diff --git a/backend/static/assets/AIAlertAnalyzer-DcLlw3nl.js b/backend/static/assets/AIAlertAnalyzer-Bok0txQu.js similarity index 98% rename from backend/static/assets/AIAlertAnalyzer-DcLlw3nl.js rename to backend/static/assets/AIAlertAnalyzer-Bok0txQu.js index 45b37e2..e575a34 100644 --- a/backend/static/assets/AIAlertAnalyzer-DcLlw3nl.js +++ b/backend/static/assets/AIAlertAnalyzer-Bok0txQu.js @@ -1,4 +1,4 @@ -import{j as s,r as l}from"./vendor-codemirror-C7mXSpXt.js";import{C as b,b as v,c as w,a as C}from"./card-B-RtdR4H.js";import{B as y}from"./badge-B0F5ZNtn.js";import{q as z,B as A,D as O,a as U,b as B,c as J,d as E}from"./index-LZWfu62c.js";import{a as L}from"./alert-C4MMKcUL.js";import{a as G}from"./ai-BMSiZ3PN.js";import{ay as R,av as g,L as $,ab as D,aa as F,y as f,F as H,r as S,z as P,w as K,aF as q,l as _,h as X,b as Q,a as W}from"./vendor-icons-Aso0-eeY.js";function Y(e){const c=(e.metric||"").toLowerCase(),t=e.source||"目标主机",a=e.severity==="critical";return c.includes("cpu")?{rootCause:`检测到 ${t} 上 CPU 使用率达到 ${e.currentValue},持续超过阈值 ${e.threshold}。可能原因:1) 某进程存在死循环或高计算负载;2) GC 频繁触发(Java/Go 应用);3) 业务流量突增导致处理能力不足。`,impact:a?"CPU 持续高负载将导致服务响应延迟显著增加,严重时可能触发雪崩效应,影响全部依赖该节点的业务。":"CPU 使用率偏高,可能导致部分请求处理变慢,建议及时排查避免进一步恶化。",recommendations:[`登录 ${t} 执行 top/htop 定位高 CPU 进程`,"检查是否有异常定时任务或批处理任务在运行","考虑临时扩容或将部分流量调度到其他节点","优化应用代码,排查是否存在低效算法或资源泄漏"],autoFixScript:`#!/bin/bash +import{j as s,r as l}from"./vendor-codemirror-B1SGo4xl.js";import{C as b,b as v,c as w,a as C}from"./card-BHSBTtub.js";import{B as y}from"./badge-B00SZHvE.js";import{q as z,B as A,D as O,a as U,b as B,c as J,d as E}from"./index-Bp-M7P_8.js";import{a as L}from"./alert-CRDraqCb.js";import{a as G}from"./ai-ACl4D1kQ.js";import{ay as R,av as g,L as $,ab as D,aa as F,y as f,F as H,r as S,z as P,w as K,aF as q,l as _,h as X,b as Q,a as W}from"./vendor-icons-BWk-DH7F.js";function Y(e){const c=(e.metric||"").toLowerCase(),t=e.source||"目标主机",a=e.severity==="critical";return c.includes("cpu")?{rootCause:`检测到 ${t} 上 CPU 使用率达到 ${e.currentValue},持续超过阈值 ${e.threshold}。可能原因:1) 某进程存在死循环或高计算负载;2) GC 频繁触发(Java/Go 应用);3) 业务流量突增导致处理能力不足。`,impact:a?"CPU 持续高负载将导致服务响应延迟显著增加,严重时可能触发雪崩效应,影响全部依赖该节点的业务。":"CPU 使用率偏高,可能导致部分请求处理变慢,建议及时排查避免进一步恶化。",recommendations:[`登录 ${t} 执行 top/htop 定位高 CPU 进程`,"检查是否有异常定时任务或批处理任务在运行","考虑临时扩容或将部分流量调度到其他节点","优化应用代码,排查是否存在低效算法或资源泄漏"],autoFixScript:`#!/bin/bash # CPU 高负载诊断脚本 - ${t} echo "===== CPU TOP 10 进程 =====" ps aux --sort=-%cpu | head -11 diff --git a/backend/static/assets/AIOpsAssistant-annAjw3b.js b/backend/static/assets/AIOpsAssistant-DHiQGhOG.js similarity index 97% rename from backend/static/assets/AIOpsAssistant-annAjw3b.js rename to backend/static/assets/AIOpsAssistant-DHiQGhOG.js index 8701881..47af3dd 100644 --- a/backend/static/assets/AIOpsAssistant-annAjw3b.js +++ b/backend/static/assets/AIOpsAssistant-DHiQGhOG.js @@ -1,4 +1,4 @@ -import{r as x,j as s,b as _s}from"./vendor-codemirror-C7mXSpXt.js";import{C as D,b as T,c as Z,a as q}from"./card-B-RtdR4H.js";import{a7 as ks,_ as Es,W as H,m as ds,B as N,q as Ls,D as Rs,a as Ms,b as Ps,c as Ds,d as Ts,e as qs,t as w}from"./index-LZWfu62c.js";import{I as C}from"./input-BdDauX3U.js";import{B as k}from"./badge-B0F5ZNtn.js";import{L as y}from"./label-u-lNUbKh.js";import{S as ss,a as ts,b as es,c as as,d as ns}from"./select-4xU_9B3_.js";import{S as Us}from"./switch-C4PJnJ9I.js";import{d as U}from"./dashboard-7Sl2aero.js";import{a as Bs}from"./alert-C4MMKcUL.js";import{a as Fs}from"./agent-g0Vk8FYK.js";import{a as $}from"./ai-BMSiZ3PN.js";import{av as zs,C as Hs,p as os,l as ms,A as xs,F as hs,aa as Vs,L as E,r as Ks,b3 as cs,aK as Gs,aj as Ws,U as Qs,b4 as Js,at as Xs,aR as Ys}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function Zs(e,n=[]){let i=[];function r(a,d){const m=x.createContext(d);m.displayName=a+"Context";const l=i.length;i=[...i,d];const g=h=>{const{scope:u,children:c,...p}=h,A=u?.[e]?.[l]||m,j=x.useMemo(()=>p,Object.values(p));return s.jsx(A.Provider,{value:j,children:c})};g.displayName=a+"Provider";function I(h,u){const c=u?.[e]?.[l]||m,p=x.useContext(c);if(p)return p;if(d!==void 0)return d;throw new Error(`\`${h}\` must be used within \`${a}\``)}return[g,I]}const o=()=>{const a=i.map(d=>x.createContext(d));return function(m){const l=m?.[e]||a;return x.useMemo(()=>({[`__scope${e}`]:{...m,[e]:l}}),[m,l])}};return o.scopeName=e,[r,st(o,...n)]}function st(...e){const n=e[0];if(e.length===1)return n;const i=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const d=r.reduce((m,{useScope:l,scopeName:g})=>{const h=l(a)[`__scope${g}`];return{...m,...h}},{});return x.useMemo(()=>({[`__scope${n.scopeName}`]:d}),[d])}};return i.scopeName=n.scopeName,i}var tt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=tt.reduce((e,n)=>{const i=ks(`Primitive.${n}`),r=x.forwardRef((o,a)=>{const{asChild:d,...m}=o,l=d?i:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(l,{...m,ref:a})});return r.displayName=`Primitive.${n}`,{...e,[n]:r}},{}),B={exports:{}},F={};var rs;function et(){if(rs)return F;rs=1;var e=_s();function n(h,u){return h===u&&(h!==0||1/h===1/u)||h!==h&&u!==u}var i=typeof Object.is=="function"?Object.is:n,r=e.useState,o=e.useEffect,a=e.useLayoutEffect,d=e.useDebugValue;function m(h,u){var c=u(),p=r({inst:{value:c,getSnapshot:u}}),A=p[0].inst,j=p[1];return a(function(){A.value=c,A.getSnapshot=u,l(A)&&j({inst:A})},[h,c,u]),o(function(){return l(A)&&j({inst:A}),h(function(){l(A)&&j({inst:A})})},[h]),d(c),c}function l(h){var u=h.getSnapshot;h=h.value;try{var c=u();return!i(h,c)}catch{return!0}}function g(h,u){return u()}var I=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:m;return F.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:I,F}var is;function at(){return is||(is=1,B.exports=et()),B.exports}var nt=at();function ot(){return nt.useSyncExternalStore(ct,()=>!0,()=>!1)}function ct(){return()=>{}}var K="Avatar",[rt]=Zs(K),[it,us]=rt(K),As=x.forwardRef((e,n)=>{const{__scopeAvatar:i,...r}=e,[o,a]=x.useState("idle");return s.jsx(it,{scope:i,imageLoadingStatus:o,onImageLoadingStatusChange:a,children:s.jsx(V.span,{...r,ref:n})})});As.displayName=K;var fs="AvatarImage",pt=x.forwardRef((e,n)=>{const{__scopeAvatar:i,src:r,onLoadingStatusChange:o=()=>{},...a}=e,d=us(fs,i),m=lt(r,a),l=Es(g=>{o(g),d.onImageLoadingStatusChange(g)});return H(()=>{m!=="idle"&&l(m)},[m,l]),m==="loaded"?s.jsx(V.img,{...a,ref:n,src:r}):null});pt.displayName=fs;var gs="AvatarFallback",vs=x.forwardRef((e,n)=>{const{__scopeAvatar:i,delayMs:r,...o}=e,a=us(gs,i),[d,m]=x.useState(r===void 0);return x.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>m(!0),r);return()=>window.clearTimeout(l)}},[r]),d&&a.imageLoadingStatus!=="loaded"?s.jsx(V.span,{...o,ref:n}):null});vs.displayName=gs;function ps(e,n){return e?n?(e.src!==n&&(e.src=n),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function lt(e,{referrerPolicy:n,crossOrigin:i}){const r=ot(),o=x.useRef(null),a=r?(o.current||(o.current=new window.Image),o.current):null,[d,m]=x.useState(()=>ps(a,e));return H(()=>{m(ps(a,e))},[a,e]),H(()=>{const l=h=>()=>{m(h)};if(!a)return;const g=l("loaded"),I=l("error");return a.addEventListener("load",g),a.addEventListener("error",I),n&&(a.referrerPolicy=n),typeof i=="string"&&(a.crossOrigin=i),()=>{a.removeEventListener("load",g),a.removeEventListener("error",I)}},[a,i,n]),d}var dt=As,mt=vs;function xt({className:e,...n}){return s.jsx(dt,{"code-path":"src/components/ui/avatar.tsx:11:5","data-slot":"avatar",className:ds("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...n})}function ht({className:e,...n}){return s.jsx(mt,{"code-path":"src/components/ui/avatar.tsx:40:5","data-slot":"avatar-fallback",className:ds("bg-muted flex size-full items-center justify-center rounded-full",e),...n})}const z=[{id:"openai",name:"OpenAI",defaultEndpoint:"https://api.openai.com/v1",models:["gpt-4o-mini","gpt-4o","gpt-4-turbo"]},{id:"deepseek",name:"DeepSeek",defaultEndpoint:"https://api.deepseek.com/v1",models:["deepseek-chat","deepseek-reasoner"]},{id:"qwen",name:"通义千问 (DashScope)",defaultEndpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1",models:["qwen-plus","qwen-turbo","qwen-max"]},{id:"moonshot",name:"Moonshot 月之暗面",defaultEndpoint:"https://api.moonshot.cn/v1",models:["moonshot-v1-8k","moonshot-v1-32k"]},{id:"ollama",name:"Ollama 本地",defaultEndpoint:"http://localhost:11434/v1",models:["qwen2.5:7b","llama3.2","deepseek-r1:7b"]},{id:"custom",name:"自定义 (OpenAI 兼容)",defaultEndpoint:"",models:[]}],ut={provider:"openai",model:"gpt-4o-mini",api_key:"",endpoint:"https://api.openai.com/v1",temperature:.7,max_tokens:2e3,system_prompt:"",enabled:!1};async function At(){const n=(await Bs.getAlerts({page:1,page_size:20}))?.list||[];if(!n.length)return"(当前无告警事件)";const i=n.slice(0,15).map((o,a)=>`${a+1}. [${o.severity||"未知"}|${o.status||"-"}] ${o.rule_name||"告警"} → 目标:${o.target||"-"} 值:${o.value??"-"} 时间:${(o.started_at||"").slice(0,16)}`),r=n.filter(o=>o.status==="firing").length;return`共 ${n.length} 条告警(firing ${r} 条),前 ${Math.min(15,n.length)} 条: +import{r as x,j as s,b as _s}from"./vendor-codemirror-B1SGo4xl.js";import{C as D,b as T,c as Z,a as q}from"./card-BHSBTtub.js";import{a7 as ks,_ as Es,W as H,m as ds,B as N,q as Ls,D as Rs,a as Ms,b as Ps,c as Ds,d as Ts,e as qs,t as w}from"./index-Bp-M7P_8.js";import{I as C}from"./input-Bnlm--la.js";import{B as k}from"./badge-B00SZHvE.js";import{L as y}from"./label-NkONM5Mp.js";import{S as ss,a as ts,b as es,c as as,d as ns}from"./select-DbhcBWnH.js";import{S as Us}from"./switch-CEwFnSNV.js";import{d as U}from"./dashboard-50x02M_T.js";import{a as Bs}from"./alert-CRDraqCb.js";import{a as Fs}from"./agent-BZUl25f5.js";import{a as $}from"./ai-ACl4D1kQ.js";import{av as zs,C as Hs,p as os,l as ms,A as xs,F as hs,aa as Vs,L as E,r as Ks,b3 as cs,aU as Gs,aj as Ws,U as Qs,b4 as Js,at as Xs,aO as Ys}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";function Zs(e,n=[]){let i=[];function r(a,d){const m=x.createContext(d);m.displayName=a+"Context";const l=i.length;i=[...i,d];const g=h=>{const{scope:u,children:c,...p}=h,A=u?.[e]?.[l]||m,j=x.useMemo(()=>p,Object.values(p));return s.jsx(A.Provider,{value:j,children:c})};g.displayName=a+"Provider";function I(h,u){const c=u?.[e]?.[l]||m,p=x.useContext(c);if(p)return p;if(d!==void 0)return d;throw new Error(`\`${h}\` must be used within \`${a}\``)}return[g,I]}const o=()=>{const a=i.map(d=>x.createContext(d));return function(m){const l=m?.[e]||a;return x.useMemo(()=>({[`__scope${e}`]:{...m,[e]:l}}),[m,l])}};return o.scopeName=e,[r,st(o,...n)]}function st(...e){const n=e[0];if(e.length===1)return n;const i=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const d=r.reduce((m,{useScope:l,scopeName:g})=>{const h=l(a)[`__scope${g}`];return{...m,...h}},{});return x.useMemo(()=>({[`__scope${n.scopeName}`]:d}),[d])}};return i.scopeName=n.scopeName,i}var tt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],V=tt.reduce((e,n)=>{const i=ks(`Primitive.${n}`),r=x.forwardRef((o,a)=>{const{asChild:d,...m}=o,l=d?i:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(l,{...m,ref:a})});return r.displayName=`Primitive.${n}`,{...e,[n]:r}},{}),B={exports:{}},F={};var rs;function et(){if(rs)return F;rs=1;var e=_s();function n(h,u){return h===u&&(h!==0||1/h===1/u)||h!==h&&u!==u}var i=typeof Object.is=="function"?Object.is:n,r=e.useState,o=e.useEffect,a=e.useLayoutEffect,d=e.useDebugValue;function m(h,u){var c=u(),p=r({inst:{value:c,getSnapshot:u}}),A=p[0].inst,j=p[1];return a(function(){A.value=c,A.getSnapshot=u,l(A)&&j({inst:A})},[h,c,u]),o(function(){return l(A)&&j({inst:A}),h(function(){l(A)&&j({inst:A})})},[h]),d(c),c}function l(h){var u=h.getSnapshot;h=h.value;try{var c=u();return!i(h,c)}catch{return!0}}function g(h,u){return u()}var I=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:m;return F.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:I,F}var is;function at(){return is||(is=1,B.exports=et()),B.exports}var nt=at();function ot(){return nt.useSyncExternalStore(ct,()=>!0,()=>!1)}function ct(){return()=>{}}var K="Avatar",[rt]=Zs(K),[it,us]=rt(K),As=x.forwardRef((e,n)=>{const{__scopeAvatar:i,...r}=e,[o,a]=x.useState("idle");return s.jsx(it,{scope:i,imageLoadingStatus:o,onImageLoadingStatusChange:a,children:s.jsx(V.span,{...r,ref:n})})});As.displayName=K;var fs="AvatarImage",pt=x.forwardRef((e,n)=>{const{__scopeAvatar:i,src:r,onLoadingStatusChange:o=()=>{},...a}=e,d=us(fs,i),m=lt(r,a),l=Es(g=>{o(g),d.onImageLoadingStatusChange(g)});return H(()=>{m!=="idle"&&l(m)},[m,l]),m==="loaded"?s.jsx(V.img,{...a,ref:n,src:r}):null});pt.displayName=fs;var gs="AvatarFallback",vs=x.forwardRef((e,n)=>{const{__scopeAvatar:i,delayMs:r,...o}=e,a=us(gs,i),[d,m]=x.useState(r===void 0);return x.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>m(!0),r);return()=>window.clearTimeout(l)}},[r]),d&&a.imageLoadingStatus!=="loaded"?s.jsx(V.span,{...o,ref:n}):null});vs.displayName=gs;function ps(e,n){return e?n?(e.src!==n&&(e.src=n),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function lt(e,{referrerPolicy:n,crossOrigin:i}){const r=ot(),o=x.useRef(null),a=r?(o.current||(o.current=new window.Image),o.current):null,[d,m]=x.useState(()=>ps(a,e));return H(()=>{m(ps(a,e))},[a,e]),H(()=>{const l=h=>()=>{m(h)};if(!a)return;const g=l("loaded"),I=l("error");return a.addEventListener("load",g),a.addEventListener("error",I),n&&(a.referrerPolicy=n),typeof i=="string"&&(a.crossOrigin=i),()=>{a.removeEventListener("load",g),a.removeEventListener("error",I)}},[a,i,n]),d}var dt=As,mt=vs;function xt({className:e,...n}){return s.jsx(dt,{"code-path":"src/components/ui/avatar.tsx:11:5","data-slot":"avatar",className:ds("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...n})}function ht({className:e,...n}){return s.jsx(mt,{"code-path":"src/components/ui/avatar.tsx:40:5","data-slot":"avatar-fallback",className:ds("bg-muted flex size-full items-center justify-center rounded-full",e),...n})}const z=[{id:"openai",name:"OpenAI",defaultEndpoint:"https://api.openai.com/v1",models:["gpt-4o-mini","gpt-4o","gpt-4-turbo"]},{id:"deepseek",name:"DeepSeek",defaultEndpoint:"https://api.deepseek.com/v1",models:["deepseek-chat","deepseek-reasoner"]},{id:"qwen",name:"通义千问 (DashScope)",defaultEndpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1",models:["qwen-plus","qwen-turbo","qwen-max"]},{id:"moonshot",name:"Moonshot 月之暗面",defaultEndpoint:"https://api.moonshot.cn/v1",models:["moonshot-v1-8k","moonshot-v1-32k"]},{id:"ollama",name:"Ollama 本地",defaultEndpoint:"http://localhost:11434/v1",models:["qwen2.5:7b","llama3.2","deepseek-r1:7b"]},{id:"custom",name:"自定义 (OpenAI 兼容)",defaultEndpoint:"",models:[]}],ut={provider:"openai",model:"gpt-4o-mini",api_key:"",endpoint:"https://api.openai.com/v1",temperature:.7,max_tokens:2e3,system_prompt:"",enabled:!1};async function At(){const n=(await Bs.getAlerts({page:1,page_size:20}))?.list||[];if(!n.length)return"(当前无告警事件)";const i=n.slice(0,15).map((o,a)=>`${a+1}. [${o.severity||"未知"}|${o.status||"-"}] ${o.rule_name||"告警"} → 目标:${o.target||"-"} 值:${o.value??"-"} 时间:${(o.started_at||"").slice(0,16)}`),r=n.filter(o=>o.status==="firing").length;return`共 ${n.length} 条告警(firing ${r} 条),前 ${Math.min(15,n.length)} 条: ${i.join(` `)}`}async function ls(){const e=await Fs.getLatest(),n=Array.isArray(e)?e:e?.list||[];if(!n.length)return"(当前无 Agent 上报数据,可能未部署监控 Agent)";const i=n.slice(0,20).map((a,d)=>{const m=a.cpu_usage??"-",l=a.mem_usage??"-";return`${d+1}. ${a.hostname||"-"} | CPU:${m}% | 内存:${l}% (${a.mem_used??"-"}/${a.mem_total??"-"}GB) | 核数:${a.cpu_cores??"-"} | 上报:${(a.report_time||"").slice(0,16)}`}),r=n.filter(a=>(a.cpu_usage??0)>=80||(a.mem_usage??0)>=80),o=r.length?` ⚠️ 高负载主机 ${r.length} 台:${r.map(a=>`${a.hostname}(CPU${a.cpu_usage}%/MEM${a.mem_usage}%)`).join("、")}`:"";return`Agent 监控的 ${n.length} 台主机实时指标: diff --git a/backend/static/assets/AIPredictiveAnalytics-PqRHnPeG.js b/backend/static/assets/AIPredictiveAnalytics-C6QOvNE6.js similarity index 97% rename from backend/static/assets/AIPredictiveAnalytics-PqRHnPeG.js rename to backend/static/assets/AIPredictiveAnalytics-C6QOvNE6.js index ecdfe9e..ee4fef8 100644 --- a/backend/static/assets/AIPredictiveAnalytics-PqRHnPeG.js +++ b/backend/static/assets/AIPredictiveAnalytics-C6QOvNE6.js @@ -1 +1 @@ -import{j as e,r as g}from"./vendor-codemirror-C7mXSpXt.js";import{C as F,b as B,c as K,a as z}from"./card-B-RtdR4H.js";import{S as Z}from"./stat-strip-BPzU38xY.js";import{B as q}from"./index-LZWfu62c.js";import{B as G}from"./badge-B0F5ZNtn.js";import{T as J,a as Q,b as D,c as $}from"./tabs-kmtfM2I-.js";import{S as ee,a as se,b as te,c as ae,d as M}from"./select-4xU_9B3_.js";import{d as ce}from"./dashboard-7Sl2aero.js";import{s as ie}from"./server-BUAZv7ZV.js";import{a as H}from"./alert-C4MMKcUL.js";import{H as X,L as _,D as ne,a4 as Y,av as re,aw as oe,A as le,ax as de,u as pe,l as L,aa as W,ay as me,g as xe,az as he,N as ye,s as ve,aA as Ae}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function ue({forecasts:c,loading:i}){return e.jsxs(F,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:14:5",className:"bg-slate-800 border-slate-700",children:[e.jsx(B,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:15:7",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:16:9",className:"flex items-center justify-between",children:[e.jsxs(K,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:17:11",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(X,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:18:13",className:"h-5 w-5 text-amber-400"}),"容量规划预警"]}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:21:11",className:"text-xs text-slate-500",children:"基于日均增长率推算阈值触及时间"})]})}),e.jsx(z,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:24:7",children:i?e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:26:11",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:27:13",className:"h-5 w-5 animate-spin mr-2"})," 加载容量数据..."]}):c.length===0?e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:30:11",className:"text-center py-12 text-slate-500",children:"暂无容量数据"}):e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:32:11",className:"space-y-4",children:c.map((a,p)=>e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:34:15",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:35:17",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:36:19",className:"flex items-center gap-2",children:[e.jsx(ne,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:37:21",className:"h-5 w-5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:38:21",className:"font-medium text-slate-200",children:a.resource})]}),e.jsx(G,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:40:19",variant:"outline",className:a.daysUntilThreshold<=7?"border-red-500/30 text-red-400 bg-red-500/10":a.daysUntilThreshold<=14?"border-amber-500/30 text-amber-400 bg-amber-500/10":"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:a.daysUntilThreshold<=7?"紧急":a.daysUntilThreshold<=14?"警告":"正常"})]}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:58:17",className:"mb-4",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:59:19",className:"flex items-center justify-between text-sm mb-1",children:[e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:60:21",className:"text-slate-400",children:"7天使用率预测"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:61:21",className:"text-slate-400",children:a.daysUntilThreshold>=999?"增长平缓,暂无触顶风险":e.jsxs(e.Fragment,{children:["预计"," ",e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:67:27",className:"text-amber-400 font-medium",children:[a.daysUntilThreshold,"天"]})," ","后达到阈值"]})})]}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:73:19",className:"h-3 bg-slate-700 rounded-full overflow-hidden",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:74:21",className:"flex h-full",children:[e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:75:23",className:"bg-blue-500",style:{width:`${a.currentUsage}%`}}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:76:23",className:"bg-gradient-to-r from-blue-500/50 to-amber-500",style:{width:`${Math.max(0,a.predictedUsage-a.currentUsage)}%`}})]})}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:84:19",className:"flex items-center justify-between text-xs mt-1",children:[e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:85:21",className:"text-slate-500",children:["当前 ",a.currentUsage,"%"]}),e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:86:21",className:"text-amber-400",children:["预测 ",a.predictedUsage,"%"]}),e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:87:21",className:"text-red-400",children:["阈值 ",a.threshold,"%"]})]})]}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:91:17",className:"p-3 bg-slate-900 rounded-lg border border-slate-700",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:92:19",className:"flex items-start gap-2",children:[e.jsx(Y,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:93:21",className:"h-4 w-4 text-emerald-400 mt-0.5"}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:94:21",children:[e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:95:23",className:"text-sm text-slate-400",children:"AI建议:"}),e.jsx("p",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:96:23",className:"text-sm text-slate-300 mt-1",children:a.recommendation})]})]})})]},p))})})]})}const T=[{key:"cpu",label:"CPU使用率",exprKey:"cpu_usage",threshold:85},{key:"memory",label:"内存使用率",exprKey:"memory_usage",threshold:85},{key:"disk",label:"磁盘使用率",exprKey:"disk_usage",threshold:90}],be={"1h":"1小时后","24h":"24小时后","7d":"7天后","30d":"30天后"},je={"1h":1,"24h":24,"7d":168,"30d":720};function R(c){const i=c.length;if(i<2)return{slope:0,r2:0};const a=c.map((r,h)=>h),p=a.reduce((r,h)=>r+h,0)/i,y=c.reduce((r,h)=>r+h,0)/i;let b=0,N=0,I=0,C=0;for(let r=0;ra.name===i).sort((a,p)=>new Date(a.timestamp).getTime()-new Date(p.timestamp).getTime()).map(a=>Number(a.value)||0)}function Pe(c){const i=c.match(/[><=]\s*([\d.]+)/);return i?parseFloat(i[1]):null}function ge(c,i){const a=i<=7?"urgent":i<=14?"warning":"normal";return{urgent:{cpu:"CPU增长趋势明显,建议尽快扩容计算资源或优化高负载进程",memory:"内存增长趋势明显,建议增加内存或排查内存泄漏",disk:"磁盘空间即将耗尽,建议立即扩容或清理历史数据与日志"},warning:{cpu:"CPU使用率呈上升趋势,建议持续监控并准备扩容计划",memory:"内存使用率呈上升趋势,建议优化应用内存使用",disk:"磁盘使用率持续增长,建议规划数据归档和清理策略"},normal:{cpu:"CPU使用正常,建议持续监控",memory:"内存使用正常,建议持续监控",disk:"磁盘空间充足,建议持续监控"}}[a]?.[c]||"建议持续监控资源使用趋势"}function O(c){return{cpu:"检查高负载进程,优化CPU密集型任务,考虑横向扩容",memory:"排查内存泄漏,优化进程内存配置,考虑增加节点",disk:"清理历史数据和日志,实施数据归档策略,扩容磁盘",service:"检查服务健康状态与依赖组件,查看服务日志",pod:"检查Pod重启原因,查看容器日志,排查OOM或健康检查失败"}[c]||"建议检查相关服务状态并持续监控"}function Ne(c){const{rawMetrics:i,serverStats:a,alertEvents:p,alertRules:y,selectedTimeRange:b}=c,N=je[b]||24,I=be[b]||"24小时后",C=T.map(t=>{const n=U(i,t.key),{slope:m,r2:x}=R(n),o=t.key==="cpu"?a.avg_cpu:t.key==="memory"?a.avg_memory:a.avg_disk,l=n.length>0?n[n.length-1]:o||0;let A=l+m*N;A=Math.max(0,Math.min(100,A));const s=m>.05?"up":m<-.05?"down":"stable",d=Math.round(60+x*35);return{name:t.label,current:Math.round(l),predicted:Math.round(A),unit:"%",trend:s,confidence:d,timeRange:I}}),j=T.map(t=>{const n=U(i,t.key),{slope:m}=R(n),x=t.key==="cpu"?a.avg_cpu:t.key==="memory"?a.avg_memory:a.avg_disk,o=Math.round(n.length>0?n[n.length-1]:x||0),l=m*24,A=Math.round(Math.min(100,o+l*7)),s=t.threshold;let d=999;return l>.01&&(d=Math.round((s-o)/l),d=d<1?1:d),{resource:{cpu:"服务器CPU算力",memory:"服务器内存",disk:"存储磁盘空间"}[t.key]||t.label,metricKey:t.key,currentUsage:o,predictedUsage:A,threshold:s,daysUntilThreshold:d,recommendation:ge(t.key,d)}}).filter(t=>t.currentUsage>0),f=[];for(const t of y){if(!t.enabled)continue;const n=Pe(t.expression||""),m=(t.expression||"").toLowerCase(),x=T.find(o=>m.includes(o.exprKey));if(x&&n){const o=U(i,x.key),{slope:l}=R(o),A=x.key==="cpu"?a.avg_cpu:x.key==="memory"?a.avg_memory:a.avg_disk,s=o.length>0?o[o.length-1]:A||0,d=n>0?s/n:0;let u=Math.round(d*55);l>.05&&(u+=15);const S=p.filter(v=>v.rule_id===t.id||v.rule_name===t.name).length;u+=Math.min(20,S*3),u=Math.max(5,Math.min(90,u));let P="未来24小时";if(l>.01&&n>s){const v=(n-s)/l;v<4?P="未来4小时":v<12?P="未来12小时":v<24?P="未来24小时":P=`未来${Math.ceil(v/24)}天`}f.push({metric:t.name,predictedAnomaly:t.description||`${t.name}可能触发`,probability:u,timeframe:P,suggestedAction:O(x.key)})}else{const o=p.filter(l=>l.rule_id===t.id||l.rule_name===t.name).length;if(o>0){const l=m.includes("service")?"service":m.includes("pod")?"pod":"service";f.push({metric:t.name,predictedAnomaly:t.description||`${t.name}可能再次发生`,probability:Math.min(60,20+o*5),timeframe:"未来24小时",suggestedAction:O(l)})}}}const w=f.sort((t,n)=>n.probability-t.probability).filter((t,n,m)=>m.findIndex(x=>x.metric===t.metric)===n),r=T.length>0?T.reduce((t,n)=>t+R(U(i,n.key)).r2,0)/T.length:0,h=Math.round(78+r*17),k=w.filter(t=>t.probability>=50).length,E=j.filter(t=>t.daysUntilThreshold<=14).length;return{predictions:C,capacityForecasts:j,dedupedAnomalies:w,accuracy:h,predictedAlertCount:k,capacityWarningCount:E}}function V(c){switch(c){case"up":return"text-red-400";case"down":return"text-emerald-400";default:return"text-slate-400"}}function De(){const[c,i]=g.useState("24h"),[a,p]=g.useState(!1),[y,b]=g.useState(!0),[N,I]=g.useState([]),[C,j]=g.useState({}),[f,w]=g.useState([]),[r,h]=g.useState([]);g.useEffect(()=>{k()},[]);const k=async()=>{b(!0);try{const[s,d,u,S]=await Promise.all([ce.getMetrics(72),ie.getServerStats(),H.getAlerts({page:1,page_size:100}),H.getRules()]);I(Array.isArray(s)?s:[]),j(d||{});const P=u?.list||u||[];w(Array.isArray(P)?P:[]);const v=S?.list||S||[];h(Array.isArray(v)?v:[])}catch{}finally{b(!1)}},E=async()=>{p(!0),await k(),p(!1)},{predictions:t,capacityForecasts:n,dedupedAnomalies:m,accuracy:x,predictedAlertCount:o,capacityWarningCount:l}=Ne({rawMetrics:N,serverStats:C,alertEvents:f,alertRules:r,selectedTimeRange:c}),A=s=>{switch(s){case"up":return e.jsx(W,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:99:16",className:"h-4 w-4 text-red-400"});case"down":return e.jsx(Ae,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:101:16",className:"h-4 w-4 text-emerald-400"});default:return e.jsx(ve,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:103:16",className:"h-4 w-4 text-slate-400"})}};return e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:108:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:110:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:111:9",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:112:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-indigo-500 to-purple-500 flex items-center justify-center",children:e.jsx(re,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:113:13",className:"h-5 w-5 text-white"})}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:115:11",children:[e.jsx("h1",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:116:13",className:"text-2xl font-bold text-slate-100",children:"AI 预测分析"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:117:13",className:"text-sm text-slate-500",children:"基于实时指标时序数据的线性回归预测与容量规划"})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:120:9",className:"flex items-center gap-2",children:[e.jsxs(ee,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:121:11",value:c,onValueChange:i,children:[e.jsxs(se,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:122:13",className:"w-32 bg-slate-800 border-slate-700 text-slate-100",children:[e.jsx(oe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:123:15",className:"h-4 w-4 mr-2"}),e.jsx(te,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:124:15"})]}),e.jsxs(ae,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:126:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:127:15",value:"1h",children:"1小时"}),e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:128:15",value:"24h",children:"24小时"}),e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:129:15",value:"7d",children:"7天"}),e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:130:15",value:"30d",children:"30天"})]})]}),e.jsx(q,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:133:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:E,children:a||y?e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:134:39",className:"h-4 w-4 animate-spin"}):e.jsx(le,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:134:86",className:"h-4 w-4"})})]})]}),e.jsx(Z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:140:7",items:[{label:"置信度",value:`${x}%`,color:"emerald"},{label:"高风险",value:o,color:"amber"},{label:"容量预警",value:l,color:"red"},{label:"指标",value:t.length,color:"purple"}]}),e.jsxs(J,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:149:7",defaultValue:"metrics",className:"space-y-4",children:[e.jsxs(Q,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:150:9",className:"bg-slate-800 border border-slate-700",children:[e.jsxs(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:151:11",value:"metrics",className:"data-[state=active]:bg-slate-700",children:[e.jsx(de,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:152:13",className:"h-4 w-4 mr-2"}),"指标预测"]}),e.jsxs(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:155:11",value:"capacity",className:"data-[state=active]:bg-slate-700",children:[e.jsx(pe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:156:13",className:"h-4 w-4 mr-2"}),"容量规划"]}),e.jsxs(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:159:11",value:"anomaly",className:"data-[state=active]:bg-slate-700",children:[e.jsx(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:160:13",className:"h-4 w-4 mr-2"}),"异常预测"]})]}),e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:165:9",value:"metrics",className:"space-y-4",children:e.jsxs(F,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:166:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(B,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:167:13",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:168:15",className:"flex items-center justify-between",children:[e.jsxs(K,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:169:17",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(W,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:170:19",className:"h-5 w-5 text-blue-400"}),"关键指标预测"]}),e.jsxs(G,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:173:17",variant:"outline",className:"border-purple-500/30 text-purple-400 bg-purple-500/10",children:[e.jsx(me,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:174:19",className:"h-3 w-3 mr-1"}),"线性回归预测"]})]})}),e.jsx(z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:179:13",children:y?e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:181:17",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:182:19",className:"h-5 w-5 animate-spin mr-2"})," 加载指标数据..."]}):t.length===0?e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:185:17",className:"text-center py-12 text-slate-500",children:"暂无指标数据"}):e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:187:17",className:"grid grid-cols-2 gap-4",children:t.map((s,d)=>e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:189:21",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:190:23",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:191:25",className:"flex items-center gap-2",children:[s.name.includes("CPU")&&e.jsx(xe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:192:63",className:"h-4 w-4 text-blue-400"}),s.name.includes("内存")&&e.jsx(he,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:193:62",className:"h-4 w-4 text-emerald-400"}),s.name.includes("磁盘")&&e.jsx(X,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:194:62",className:"h-4 w-4 text-amber-400"}),s.name.includes("网络")&&e.jsx(ye,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:195:62",className:"h-4 w-4 text-purple-400"}),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:196:27",className:"font-medium text-slate-200",children:s.name})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:198:25",className:"flex items-center gap-1",children:[A(s.trend),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:200:27",className:`text-sm ${V(s.trend)}`,children:s.trend==="up"?"上升":s.trend==="down"?"下降":"平稳"})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:206:23",className:"grid grid-cols-2 gap-4 mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:207:25",children:[e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:208:27",className:"text-xs text-slate-500 mb-1",children:"当前值"}),e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:209:27",className:"text-lg font-bold text-slate-100",children:[s.current,s.unit]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:214:25",children:[e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:215:27",className:"text-xs text-slate-500 mb-1",children:["预测值 (",s.timeRange,")"]}),e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:216:27",className:`text-lg font-bold ${V(s.trend)}`,children:[s.predicted,s.unit]})]})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:223:23",className:"flex items-center justify-between",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:224:25",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:225:27",className:"text-xs text-slate-400",children:"置信度"}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:226:27",className:"w-16 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:227:29",className:"h-full bg-gradient-to-r from-blue-500 to-purple-500",style:{width:`${s.confidence}%`}})}),e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:232:27",className:"text-xs text-purple-400",children:[s.confidence,"%"]})]})})]},d))})})]})}),e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:243:9",value:"capacity",className:"space-y-4",children:e.jsx(ue,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:244:11",forecasts:n,loading:y})}),e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:247:9",value:"anomaly",className:"space-y-4",children:e.jsxs(F,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:248:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(B,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:249:13",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:250:15",className:"flex items-center justify-between",children:[e.jsxs(K,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:251:17",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:252:19",className:"h-5 w-5 text-red-400"}),"异常事件预测"]}),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:255:17",className:"text-xs text-slate-500",children:"基于告警规则阈值与实时趋势概率推算"})]})}),e.jsx(z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:258:13",children:y?e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:260:17",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:261:19",className:"h-5 w-5 animate-spin mr-2"})," 加载异常预测..."]}):m.length===0?e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:264:17",className:"text-center py-12 text-slate-500",children:"暂无异常预测数据"}):e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:266:17",className:"space-y-3",children:m.map((s,d)=>e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:268:21",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:269:23",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:270:25",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:271:27",className:`w-10 h-10 rounded-lg flex items-center justify-center ${s.probability>=70?"bg-red-500/20":s.probability>=50?"bg-amber-500/20":"bg-blue-500/20"}`,children:e.jsx(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:280:29",className:`h-5 w-5 ${s.probability>=70?"text-red-400":s.probability>=50?"text-amber-400":"text-blue-400"}`})}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:290:27",children:[e.jsx("h4",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:291:29",className:"font-medium text-slate-200",children:s.metric}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:292:29",className:"text-sm text-slate-400 mt-1",children:s.predictedAnomaly}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:293:29",className:"flex items-center gap-4 mt-2",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:294:31",className:"text-xs text-slate-500",children:s.timeframe}),e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:295:31",className:"text-xs text-slate-500",children:["概率:"," ",e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:297:33",className:s.probability>=70?"text-red-400":"text-amber-400",children:[s.probability,"%"]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:304:25",className:"w-16 h-16 relative shrink-0",children:[e.jsxs("svg",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:305:27",className:"w-full h-full transform -rotate-90",children:[e.jsx("circle",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:306:29",cx:"32",cy:"32",r:"28",stroke:"currentColor",strokeWidth:"4",fill:"transparent",className:"text-slate-700"}),e.jsx("circle",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:315:29",cx:"32",cy:"32",r:"28",stroke:"currentColor",strokeWidth:"4",fill:"transparent",strokeDasharray:`${s.probability*1.76} 176`,className:s.probability>=70?"text-red-400":s.probability>=50?"text-amber-400":"text-blue-400"})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:332:27",className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:333:29",className:"text-sm font-bold text-slate-200",children:[s.probability,"%"]})})]})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:337:23",className:"mt-3 p-3 bg-slate-900 rounded-lg border border-slate-700",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:338:25",className:"flex items-start gap-2",children:[e.jsx(Y,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:339:27",className:"h-4 w-4 text-emerald-400 mt-0.5"}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:340:27",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:341:29",className:"text-sm text-slate-400",children:"建议操作:"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:342:29",className:"text-sm text-slate-300 mt-1",children:s.suggestedAction})]})]})})]},d))})})]})})]})]})}export{De as AIPredictiveAnalytics}; +import{j as e,r as g}from"./vendor-codemirror-B1SGo4xl.js";import{C as F,b as B,c as K,a as z}from"./card-BHSBTtub.js";import{S as Z}from"./stat-strip-CSMyyoYr.js";import{B as q}from"./index-Bp-M7P_8.js";import{B as G}from"./badge-B00SZHvE.js";import{T as J,a as Q,b as D,c as $}from"./tabs-DbNlmoQJ.js";import{S as ee,a as se,b as te,c as ae,d as M}from"./select-DbhcBWnH.js";import{d as ce}from"./dashboard-50x02M_T.js";import{s as ie}from"./server-B7EY-8NK.js";import{a as H}from"./alert-CRDraqCb.js";import{H as X,L as _,D as ne,a4 as Y,av as re,aw as oe,A as le,ax as de,u as pe,l as L,aa as W,ay as me,g as xe,az as he,N as ye,s as ve,aA as Ae}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";function ue({forecasts:c,loading:i}){return e.jsxs(F,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:14:5",className:"bg-slate-800 border-slate-700",children:[e.jsx(B,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:15:7",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:16:9",className:"flex items-center justify-between",children:[e.jsxs(K,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:17:11",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(X,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:18:13",className:"h-5 w-5 text-amber-400"}),"容量规划预警"]}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:21:11",className:"text-xs text-slate-500",children:"基于日均增长率推算阈值触及时间"})]})}),e.jsx(z,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:24:7",children:i?e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:26:11",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:27:13",className:"h-5 w-5 animate-spin mr-2"})," 加载容量数据..."]}):c.length===0?e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:30:11",className:"text-center py-12 text-slate-500",children:"暂无容量数据"}):e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:32:11",className:"space-y-4",children:c.map((a,p)=>e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:34:15",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:35:17",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:36:19",className:"flex items-center gap-2",children:[e.jsx(ne,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:37:21",className:"h-5 w-5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:38:21",className:"font-medium text-slate-200",children:a.resource})]}),e.jsx(G,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:40:19",variant:"outline",className:a.daysUntilThreshold<=7?"border-red-500/30 text-red-400 bg-red-500/10":a.daysUntilThreshold<=14?"border-amber-500/30 text-amber-400 bg-amber-500/10":"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:a.daysUntilThreshold<=7?"紧急":a.daysUntilThreshold<=14?"警告":"正常"})]}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:58:17",className:"mb-4",children:[e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:59:19",className:"flex items-center justify-between text-sm mb-1",children:[e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:60:21",className:"text-slate-400",children:"7天使用率预测"}),e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:61:21",className:"text-slate-400",children:a.daysUntilThreshold>=999?"增长平缓,暂无触顶风险":e.jsxs(e.Fragment,{children:["预计"," ",e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:67:27",className:"text-amber-400 font-medium",children:[a.daysUntilThreshold,"天"]})," ","后达到阈值"]})})]}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:73:19",className:"h-3 bg-slate-700 rounded-full overflow-hidden",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:74:21",className:"flex h-full",children:[e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:75:23",className:"bg-blue-500",style:{width:`${a.currentUsage}%`}}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:76:23",className:"bg-gradient-to-r from-blue-500/50 to-amber-500",style:{width:`${Math.max(0,a.predictedUsage-a.currentUsage)}%`}})]})}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:84:19",className:"flex items-center justify-between text-xs mt-1",children:[e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:85:21",className:"text-slate-500",children:["当前 ",a.currentUsage,"%"]}),e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:86:21",className:"text-amber-400",children:["预测 ",a.predictedUsage,"%"]}),e.jsxs("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:87:21",className:"text-red-400",children:["阈值 ",a.threshold,"%"]})]})]}),e.jsx("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:91:17",className:"p-3 bg-slate-900 rounded-lg border border-slate-700",children:e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:92:19",className:"flex items-start gap-2",children:[e.jsx(Y,{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:93:21",className:"h-4 w-4 text-emerald-400 mt-0.5"}),e.jsxs("div",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:94:21",children:[e.jsx("span",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:95:23",className:"text-sm text-slate-400",children:"AI建议:"}),e.jsx("p",{"code-path":"src/components/aiops/PredictiveCapacityTab.tsx:96:23",className:"text-sm text-slate-300 mt-1",children:a.recommendation})]})]})})]},p))})})]})}const T=[{key:"cpu",label:"CPU使用率",exprKey:"cpu_usage",threshold:85},{key:"memory",label:"内存使用率",exprKey:"memory_usage",threshold:85},{key:"disk",label:"磁盘使用率",exprKey:"disk_usage",threshold:90}],be={"1h":"1小时后","24h":"24小时后","7d":"7天后","30d":"30天后"},je={"1h":1,"24h":24,"7d":168,"30d":720};function R(c){const i=c.length;if(i<2)return{slope:0,r2:0};const a=c.map((r,h)=>h),p=a.reduce((r,h)=>r+h,0)/i,y=c.reduce((r,h)=>r+h,0)/i;let b=0,N=0,I=0,C=0;for(let r=0;ra.name===i).sort((a,p)=>new Date(a.timestamp).getTime()-new Date(p.timestamp).getTime()).map(a=>Number(a.value)||0)}function Pe(c){const i=c.match(/[><=]\s*([\d.]+)/);return i?parseFloat(i[1]):null}function ge(c,i){const a=i<=7?"urgent":i<=14?"warning":"normal";return{urgent:{cpu:"CPU增长趋势明显,建议尽快扩容计算资源或优化高负载进程",memory:"内存增长趋势明显,建议增加内存或排查内存泄漏",disk:"磁盘空间即将耗尽,建议立即扩容或清理历史数据与日志"},warning:{cpu:"CPU使用率呈上升趋势,建议持续监控并准备扩容计划",memory:"内存使用率呈上升趋势,建议优化应用内存使用",disk:"磁盘使用率持续增长,建议规划数据归档和清理策略"},normal:{cpu:"CPU使用正常,建议持续监控",memory:"内存使用正常,建议持续监控",disk:"磁盘空间充足,建议持续监控"}}[a]?.[c]||"建议持续监控资源使用趋势"}function O(c){return{cpu:"检查高负载进程,优化CPU密集型任务,考虑横向扩容",memory:"排查内存泄漏,优化进程内存配置,考虑增加节点",disk:"清理历史数据和日志,实施数据归档策略,扩容磁盘",service:"检查服务健康状态与依赖组件,查看服务日志",pod:"检查Pod重启原因,查看容器日志,排查OOM或健康检查失败"}[c]||"建议检查相关服务状态并持续监控"}function Ne(c){const{rawMetrics:i,serverStats:a,alertEvents:p,alertRules:y,selectedTimeRange:b}=c,N=je[b]||24,I=be[b]||"24小时后",C=T.map(t=>{const n=U(i,t.key),{slope:m,r2:x}=R(n),o=t.key==="cpu"?a.avg_cpu:t.key==="memory"?a.avg_memory:a.avg_disk,l=n.length>0?n[n.length-1]:o||0;let A=l+m*N;A=Math.max(0,Math.min(100,A));const s=m>.05?"up":m<-.05?"down":"stable",d=Math.round(60+x*35);return{name:t.label,current:Math.round(l),predicted:Math.round(A),unit:"%",trend:s,confidence:d,timeRange:I}}),j=T.map(t=>{const n=U(i,t.key),{slope:m}=R(n),x=t.key==="cpu"?a.avg_cpu:t.key==="memory"?a.avg_memory:a.avg_disk,o=Math.round(n.length>0?n[n.length-1]:x||0),l=m*24,A=Math.round(Math.min(100,o+l*7)),s=t.threshold;let d=999;return l>.01&&(d=Math.round((s-o)/l),d=d<1?1:d),{resource:{cpu:"服务器CPU算力",memory:"服务器内存",disk:"存储磁盘空间"}[t.key]||t.label,metricKey:t.key,currentUsage:o,predictedUsage:A,threshold:s,daysUntilThreshold:d,recommendation:ge(t.key,d)}}).filter(t=>t.currentUsage>0),f=[];for(const t of y){if(!t.enabled)continue;const n=Pe(t.expression||""),m=(t.expression||"").toLowerCase(),x=T.find(o=>m.includes(o.exprKey));if(x&&n){const o=U(i,x.key),{slope:l}=R(o),A=x.key==="cpu"?a.avg_cpu:x.key==="memory"?a.avg_memory:a.avg_disk,s=o.length>0?o[o.length-1]:A||0,d=n>0?s/n:0;let u=Math.round(d*55);l>.05&&(u+=15);const S=p.filter(v=>v.rule_id===t.id||v.rule_name===t.name).length;u+=Math.min(20,S*3),u=Math.max(5,Math.min(90,u));let P="未来24小时";if(l>.01&&n>s){const v=(n-s)/l;v<4?P="未来4小时":v<12?P="未来12小时":v<24?P="未来24小时":P=`未来${Math.ceil(v/24)}天`}f.push({metric:t.name,predictedAnomaly:t.description||`${t.name}可能触发`,probability:u,timeframe:P,suggestedAction:O(x.key)})}else{const o=p.filter(l=>l.rule_id===t.id||l.rule_name===t.name).length;if(o>0){const l=m.includes("service")?"service":m.includes("pod")?"pod":"service";f.push({metric:t.name,predictedAnomaly:t.description||`${t.name}可能再次发生`,probability:Math.min(60,20+o*5),timeframe:"未来24小时",suggestedAction:O(l)})}}}const w=f.sort((t,n)=>n.probability-t.probability).filter((t,n,m)=>m.findIndex(x=>x.metric===t.metric)===n),r=T.length>0?T.reduce((t,n)=>t+R(U(i,n.key)).r2,0)/T.length:0,h=Math.round(78+r*17),k=w.filter(t=>t.probability>=50).length,E=j.filter(t=>t.daysUntilThreshold<=14).length;return{predictions:C,capacityForecasts:j,dedupedAnomalies:w,accuracy:h,predictedAlertCount:k,capacityWarningCount:E}}function V(c){switch(c){case"up":return"text-red-400";case"down":return"text-emerald-400";default:return"text-slate-400"}}function De(){const[c,i]=g.useState("24h"),[a,p]=g.useState(!1),[y,b]=g.useState(!0),[N,I]=g.useState([]),[C,j]=g.useState({}),[f,w]=g.useState([]),[r,h]=g.useState([]);g.useEffect(()=>{k()},[]);const k=async()=>{b(!0);try{const[s,d,u,S]=await Promise.all([ce.getMetrics(72),ie.getServerStats(),H.getAlerts({page:1,page_size:100}),H.getRules()]);I(Array.isArray(s)?s:[]),j(d||{});const P=u?.list||u||[];w(Array.isArray(P)?P:[]);const v=S?.list||S||[];h(Array.isArray(v)?v:[])}catch{}finally{b(!1)}},E=async()=>{p(!0),await k(),p(!1)},{predictions:t,capacityForecasts:n,dedupedAnomalies:m,accuracy:x,predictedAlertCount:o,capacityWarningCount:l}=Ne({rawMetrics:N,serverStats:C,alertEvents:f,alertRules:r,selectedTimeRange:c}),A=s=>{switch(s){case"up":return e.jsx(W,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:99:16",className:"h-4 w-4 text-red-400"});case"down":return e.jsx(Ae,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:101:16",className:"h-4 w-4 text-emerald-400"});default:return e.jsx(ve,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:103:16",className:"h-4 w-4 text-slate-400"})}};return e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:108:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:110:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:111:9",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:112:11",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-indigo-500 to-purple-500 flex items-center justify-center",children:e.jsx(re,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:113:13",className:"h-5 w-5 text-white"})}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:115:11",children:[e.jsx("h1",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:116:13",className:"text-2xl font-bold text-slate-100",children:"AI 预测分析"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:117:13",className:"text-sm text-slate-500",children:"基于实时指标时序数据的线性回归预测与容量规划"})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:120:9",className:"flex items-center gap-2",children:[e.jsxs(ee,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:121:11",value:c,onValueChange:i,children:[e.jsxs(se,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:122:13",className:"w-32 bg-slate-800 border-slate-700 text-slate-100",children:[e.jsx(oe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:123:15",className:"h-4 w-4 mr-2"}),e.jsx(te,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:124:15"})]}),e.jsxs(ae,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:126:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:127:15",value:"1h",children:"1小时"}),e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:128:15",value:"24h",children:"24小时"}),e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:129:15",value:"7d",children:"7天"}),e.jsx(M,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:130:15",value:"30d",children:"30天"})]})]}),e.jsx(q,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:133:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:E,children:a||y?e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:134:39",className:"h-4 w-4 animate-spin"}):e.jsx(le,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:134:86",className:"h-4 w-4"})})]})]}),e.jsx(Z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:140:7",items:[{label:"置信度",value:`${x}%`,color:"emerald"},{label:"高风险",value:o,color:"amber"},{label:"容量预警",value:l,color:"red"},{label:"指标",value:t.length,color:"purple"}]}),e.jsxs(J,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:149:7",defaultValue:"metrics",className:"space-y-4",children:[e.jsxs(Q,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:150:9",className:"bg-slate-800 border border-slate-700",children:[e.jsxs(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:151:11",value:"metrics",className:"data-[state=active]:bg-slate-700",children:[e.jsx(de,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:152:13",className:"h-4 w-4 mr-2"}),"指标预测"]}),e.jsxs(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:155:11",value:"capacity",className:"data-[state=active]:bg-slate-700",children:[e.jsx(pe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:156:13",className:"h-4 w-4 mr-2"}),"容量规划"]}),e.jsxs(D,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:159:11",value:"anomaly",className:"data-[state=active]:bg-slate-700",children:[e.jsx(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:160:13",className:"h-4 w-4 mr-2"}),"异常预测"]})]}),e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:165:9",value:"metrics",className:"space-y-4",children:e.jsxs(F,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:166:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(B,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:167:13",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:168:15",className:"flex items-center justify-between",children:[e.jsxs(K,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:169:17",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(W,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:170:19",className:"h-5 w-5 text-blue-400"}),"关键指标预测"]}),e.jsxs(G,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:173:17",variant:"outline",className:"border-purple-500/30 text-purple-400 bg-purple-500/10",children:[e.jsx(me,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:174:19",className:"h-3 w-3 mr-1"}),"线性回归预测"]})]})}),e.jsx(z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:179:13",children:y?e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:181:17",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:182:19",className:"h-5 w-5 animate-spin mr-2"})," 加载指标数据..."]}):t.length===0?e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:185:17",className:"text-center py-12 text-slate-500",children:"暂无指标数据"}):e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:187:17",className:"grid grid-cols-2 gap-4",children:t.map((s,d)=>e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:189:21",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:190:23",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:191:25",className:"flex items-center gap-2",children:[s.name.includes("CPU")&&e.jsx(xe,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:192:63",className:"h-4 w-4 text-blue-400"}),s.name.includes("内存")&&e.jsx(he,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:193:62",className:"h-4 w-4 text-emerald-400"}),s.name.includes("磁盘")&&e.jsx(X,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:194:62",className:"h-4 w-4 text-amber-400"}),s.name.includes("网络")&&e.jsx(ye,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:195:62",className:"h-4 w-4 text-purple-400"}),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:196:27",className:"font-medium text-slate-200",children:s.name})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:198:25",className:"flex items-center gap-1",children:[A(s.trend),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:200:27",className:`text-sm ${V(s.trend)}`,children:s.trend==="up"?"上升":s.trend==="down"?"下降":"平稳"})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:206:23",className:"grid grid-cols-2 gap-4 mb-3",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:207:25",children:[e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:208:27",className:"text-xs text-slate-500 mb-1",children:"当前值"}),e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:209:27",className:"text-lg font-bold text-slate-100",children:[s.current,s.unit]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:214:25",children:[e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:215:27",className:"text-xs text-slate-500 mb-1",children:["预测值 (",s.timeRange,")"]}),e.jsxs("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:216:27",className:`text-lg font-bold ${V(s.trend)}`,children:[s.predicted,s.unit]})]})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:223:23",className:"flex items-center justify-between",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:224:25",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:225:27",className:"text-xs text-slate-400",children:"置信度"}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:226:27",className:"w-16 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:227:29",className:"h-full bg-gradient-to-r from-blue-500 to-purple-500",style:{width:`${s.confidence}%`}})}),e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:232:27",className:"text-xs text-purple-400",children:[s.confidence,"%"]})]})})]},d))})})]})}),e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:243:9",value:"capacity",className:"space-y-4",children:e.jsx(ue,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:244:11",forecasts:n,loading:y})}),e.jsx($,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:247:9",value:"anomaly",className:"space-y-4",children:e.jsxs(F,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:248:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(B,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:249:13",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:250:15",className:"flex items-center justify-between",children:[e.jsxs(K,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:251:17",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:252:19",className:"h-5 w-5 text-red-400"}),"异常事件预测"]}),e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:255:17",className:"text-xs text-slate-500",children:"基于告警规则阈值与实时趋势概率推算"})]})}),e.jsx(z,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:258:13",children:y?e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:260:17",className:"flex items-center justify-center py-12 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:261:19",className:"h-5 w-5 animate-spin mr-2"})," 加载异常预测..."]}):m.length===0?e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:264:17",className:"text-center py-12 text-slate-500",children:"暂无异常预测数据"}):e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:266:17",className:"space-y-3",children:m.map((s,d)=>e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:268:21",className:"p-4 rounded-lg border border-slate-700 bg-slate-800/50",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:269:23",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:270:25",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:271:27",className:`w-10 h-10 rounded-lg flex items-center justify-center ${s.probability>=70?"bg-red-500/20":s.probability>=50?"bg-amber-500/20":"bg-blue-500/20"}`,children:e.jsx(L,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:280:29",className:`h-5 w-5 ${s.probability>=70?"text-red-400":s.probability>=50?"text-amber-400":"text-blue-400"}`})}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:290:27",children:[e.jsx("h4",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:291:29",className:"font-medium text-slate-200",children:s.metric}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:292:29",className:"text-sm text-slate-400 mt-1",children:s.predictedAnomaly}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:293:29",className:"flex items-center gap-4 mt-2",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:294:31",className:"text-xs text-slate-500",children:s.timeframe}),e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:295:31",className:"text-xs text-slate-500",children:["概率:"," ",e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:297:33",className:s.probability>=70?"text-red-400":"text-amber-400",children:[s.probability,"%"]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:304:25",className:"w-16 h-16 relative shrink-0",children:[e.jsxs("svg",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:305:27",className:"w-full h-full transform -rotate-90",children:[e.jsx("circle",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:306:29",cx:"32",cy:"32",r:"28",stroke:"currentColor",strokeWidth:"4",fill:"transparent",className:"text-slate-700"}),e.jsx("circle",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:315:29",cx:"32",cy:"32",r:"28",stroke:"currentColor",strokeWidth:"4",fill:"transparent",strokeDasharray:`${s.probability*1.76} 176`,className:s.probability>=70?"text-red-400":s.probability>=50?"text-amber-400":"text-blue-400"})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:332:27",className:"absolute inset-0 flex items-center justify-center",children:e.jsxs("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:333:29",className:"text-sm font-bold text-slate-200",children:[s.probability,"%"]})})]})]}),e.jsx("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:337:23",className:"mt-3 p-3 bg-slate-900 rounded-lg border border-slate-700",children:e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:338:25",className:"flex items-start gap-2",children:[e.jsx(Y,{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:339:27",className:"h-4 w-4 text-emerald-400 mt-0.5"}),e.jsxs("div",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:340:27",children:[e.jsx("span",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:341:29",className:"text-sm text-slate-400",children:"建议操作:"}),e.jsx("p",{"code-path":"src/components/aiops/AIPredictiveAnalytics.tsx:342:29",className:"text-sm text-slate-300 mt-1",children:s.suggestedAction})]})]})})]},d))})})]})})]})]})}export{De as AIPredictiveAnalytics}; diff --git a/backend/static/assets/AlertCenter-VCEUxoOH.js b/backend/static/assets/AlertCenter-C6q8Rqrx.js similarity index 98% rename from backend/static/assets/AlertCenter-VCEUxoOH.js rename to backend/static/assets/AlertCenter-C6q8Rqrx.js index 883d9af..97cc04a 100644 --- a/backend/static/assets/AlertCenter-VCEUxoOH.js +++ b/backend/static/assets/AlertCenter-C6q8Rqrx.js @@ -1 +1 @@ -import{j as e,r as a}from"./vendor-codemirror-C7mXSpXt.js";import{G as ct,D as Q,a as J,b as V,c as U,d as Y,e as ie,B as m,t as d,f as Oe}from"./index-LZWfu62c.js";import{I as _}from"./input-BdDauX3U.js";import{B as A}from"./badge-B0F5ZNtn.js";import{C as W,a as K,b as Te,c as _e}from"./card-B-RtdR4H.js";import{S as at}from"./stat-strip-BPzU38xY.js";import{S as ne,a as se,b as oe,c as ce,d as T}from"./select-4xU_9B3_.js";import{T as lt,a as it,b as F,c as B}from"./tabs-kmtfM2I-.js";import{S as Le}from"./switch-C4PJnJ9I.js";import{a as R}from"./alert-C4MMKcUL.js";import{a as E}from"./alert-center-dJk4LGZM.js";import{u as ze,q as ae,b as Ge,a as mt}from"./unwrap-BmWy-KM2.js";import{u as $}from"./useMutation-Bp3lz5hm.js";import{a as Ce}from"./agent-g0Vk8FYK.js";import{I as dt,l as Me,ab as pt,aX as le,y as $e,U as xt,a4 as ht,w as Ie,f as ut,R as te,P as re,b as gt,aY as jt,aw as Ct,aE as ft,T as vt,S as At,x as Nt,ar as yt}from"./vendor-icons-Aso0-eeY.js";import{L as j}from"./label-u-lNUbKh.js";import{A as wt}from"./AlertRuleDialog-BsJX7bok.js";import{T as bt}from"./textarea-BdtIagjy.js";import"./index-CYARH0Cq.js";function St(t){return{id:String(t.id),title:t.rule_name||t.title||`告警 #${t.id}`,description:t.message||t.description||"",severity:t.severity||"info",status:t.status||"firing",source:t.target||t.source||"",service:t.service||"",metric:t.metric||"",value:t.value||0,threshold:t.threshold||0,startedAt:t.started_at||t.startedAt||t.created_at||new Date().toISOString(),resolvedAt:t.resolved_at||t.resolvedAt,labels:typeof t.labels=="string"?(()=>{try{return JSON.parse(t.labels||"{}")}catch{return{}}})():t.labels||{},annotations:typeof t.annotations=="string"?(()=>{try{return JSON.parse(t.annotations||"{}")}catch{return{}}})():t.annotations||{}}}function fe(t){switch(t){case"critical":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:14",variant:"destructive",className:"gap-1",children:[e.jsx(pt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:61",className:"w-3 h-3"}),"严重"]});case"warning":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:14",variant:"default",className:"bg-orange-500 gap-1",children:[e.jsx(Me,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:71",className:"w-3 h-3"}),"警告"]});case"info":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:14",variant:"default",className:"bg-blue-500 gap-1",children:[e.jsx(dt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:69",className:"w-3 h-3"}),"信息"]});default:return e.jsx(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:112:14",variant:"secondary",children:"未知"})}}function Dt(t){switch(t){case"firing":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:120:14",variant:"destructive",className:"gap-1 animate-pulse",children:[e.jsx(ht,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:120:75",className:"w-3 h-3"}),"触发中"]});case"acknowledged":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:14",variant:"default",className:"bg-yellow-500 gap-1",children:[e.jsx(xt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:71",className:"w-3 h-3"}),"已确认"]});case"resolved":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:14",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx($e,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:70",className:"w-3 h-3"}),"已解决"]});case"suppressed":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:126:14",variant:"secondary",className:"gap-1",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:126:59",className:"w-3 h-3"}),"已静默"]});default:return e.jsx(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:128:14",variant:"secondary",children:"未知"})}}function kt(t){return{dingtalk:"钉钉",wechat:"企业微信",feishu:"飞书",email:"邮件",sms:"短信",webhook:"Webhook"}[t]||t}function Tt(t){return{firing:t.filter(s=>s.status==="firing").length,critical:t.filter(s=>s.severity==="critical"&&s.status==="firing").length,warning:t.filter(s=>s.severity==="warning"&&s.status==="firing").length,resolved:t.filter(s=>s.status==="resolved").length}}function _t(){return ze({queryKey:ae.agentAlertRules(),queryFn:async()=>{const t=await Ce.listRules();return Ge(t).map(n=>({id:n.id,name:String(n.name||""),description:`${n.metric} ${n.operator} ${n.threshold}%`,enabled:!!n.enabled,severity:"warning",type:String(n.metric||""),hostname:String(n.hostname||"全部主机"),threshold:Number(n.threshold||0)}))},staleTime:3e4})}function Rt(t={}){return ze({queryKey:ae.alerts(t),queryFn:async()=>{const s=await E.getAlerts({page:t.page,page_size:t.page_size,severity:t.severity!=="all"?t.severity:void 0,status:t.status!=="all"?t.status:void 0}),u=Ge(s).map(g=>St(g));return{list:u,total:mt(s),stats:Tt(u)}},staleTime:15e3,refetchInterval:3e4})}function Et(){const t=ct(),s=()=>t.invalidateQueries({queryKey:ae.alertRules()}),n=()=>t.invalidateQueries({queryKey:ae.agentAlertRules()}),u=()=>t.invalidateQueries({queryKey:["alerts"]}),g=$({mutationFn:o=>R.toggleRule(o),onSuccess:s}),h=$({mutationFn:o=>R.deleteRule(o),onSuccess:s}),l=$({mutationFn:({id:o,enabled:p})=>Ce.updateRule(o,{enabled:p}),onSuccess:n}),C=$({mutationFn:o=>Ce.deleteRule(o),onSuccess:n}),b=$({mutationFn:o=>E.acknowledge(o),onSuccess:u}),v=$({mutationFn:o=>E.resolve(o),onSuccess:u}),f=$({mutationFn:o=>E.quickSetup(o),onSuccess:n});return{toggleRuleMutation:g,deleteRuleMutation:h,toggleAgentRuleMutation:l,deleteAgentRuleMutation:C,ackMutation:b,resolveMutation:v,quickSetupMutation:f,invalidateRules:s,invalidateAgentRules:n,invalidateAlerts:u}}function Ot({alert:t,open:s,onOpenChange:n,onAcknowledge:u}){return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:22:5",open:s,onOpenChange:n,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:23:7",className:"max-w-3xl",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:24:9",children:[e.jsxs(U,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:25:11",className:"flex items-center gap-2",children:[t?.title,t&&fe(t.severity)]}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:29:11",className:"sr-only",children:"查看告警详情"})]}),t&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:32:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:33:13",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:34:15",className:"text-muted-foreground",children:"描述"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:35:15",className:"mt-1",children:t.description})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:37:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:38:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:39:17",className:"text-muted-foreground",children:"来源"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:40:17",className:"font-medium",children:t.source})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:42:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:43:17",className:"text-muted-foreground",children:"服务"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:44:17",className:"font-medium",children:t.service})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:46:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:47:17",className:"text-muted-foreground",children:"指标"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:48:17",className:"font-medium",children:t.metric})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:50:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:51:17",className:"text-muted-foreground",children:"当前值 / 阈值"}),e.jsxs("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:52:17",className:"font-medium",children:[t.value," / ",t.threshold]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:54:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:55:17",className:"text-muted-foreground",children:"开始时间"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:56:17",className:"font-medium",children:t.startedAt})]}),t.resolvedAt&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:59:17",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:60:19",className:"text-muted-foreground",children:"解决时间"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:61:19",className:"font-medium",children:t.resolvedAt})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:65:13",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:66:15",className:"text-muted-foreground",children:"标签"}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:67:15",className:"flex flex-wrap gap-2 mt-1",children:Object.entries(t.labels).map(([g,h])=>e.jsxs(A,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:69:19",variant:"outline",children:[g,"=",h]},g))})]}),t.runbookUrl&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:74:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:75:17",className:"text-muted-foreground",children:"处理手册"}),e.jsx("a",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:76:17",href:t.runbookUrl,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline block mt-1",children:"查看处理手册 →"})]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:83:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:84:11",variant:"outline",onClick:()=>n(!1),children:"关闭"}),t?.status==="firing"&&e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:86:13",onClick:()=>{u(t.id),n(!1)},children:[e.jsx(Ie,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:87:15",className:"w-4 h-4 mr-2"}),"确认告警"]})]})]})})}function Lt({alert:t,open:s,onOpenChange:n,onSilence:u}){return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:109:5",open:s,onOpenChange:n,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:110:7",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:111:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:112:11",children:"静默告警"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:113:11",children:"选择静默持续时间"})]}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:115:9",className:"space-y-2",children:["1h","4h","8h","24h","7d"].map(g=>e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:117:13",variant:"outline",className:"w-full justify-between",onClick:()=>t&&u(t.id,g),children:[e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:123:15",children:["静默 ",g]}),e.jsx(ut,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:124:15",className:"w-4 h-4"})]},g))})]})})}const Re=[{value:"feishu",label:"飞书",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/..."},{value:"dingtalk",label:"钉钉",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=..."},{value:"wechat",label:"企业微信",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=..."},{value:"webhook",label:"自定义Webhook",placeholder:"https://your-webhook-url..."}];function zt({open:t,onOpenChange:s,editingContact:n,onSaved:u}){const[g,h]=a.useState("feishu"),[l,C]=a.useState({name:"",phone:"",email:"",webhook_url:""}),[b,v]=a.useState(!1);a.useEffect(()=>{t&&(n?(h(n.channel_type||"feishu"),C({name:n.name||"",phone:n.phone||"",email:n.email||"",webhook_url:n.webhook_url||""})):(h("feishu"),C({name:"",phone:"",email:"",webhook_url:""})))},[t,n]);const f=async()=>{if(!(!l.name.trim()||!l.webhook_url.trim())){v(!0);try{const p={name:l.name.trim(),phone:l.phone.trim()||void 0,email:l.email.trim()||void 0,channel_type:g,webhook_url:l.webhook_url.trim()};n?(await R.updateContact(n.id,p),d.success("联系人已更新")):(await R.createContact(p),d.success("联系人已添加")),s(!1),u()}catch{d.error("保存失败")}finally{v(!1)}}},o=Re.find(p=>p.value===g);return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:85:5",open:t,onOpenChange:s,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:86:7",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:87:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:88:11",children:n?"编辑报警联系人":"添加报警联系人"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:89:11",children:"选择通知渠道并填入 Webhook 地址"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:91:9",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:92:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:93:13",children:"姓名 *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:94:13",value:l.name,onChange:p=>C({...l,name:p.target.value}),placeholder:"如:张三"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:100:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:101:13",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:102:15",children:"手机号"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:103:15",value:l.phone,onChange:p=>C({...l,phone:p.target.value}),placeholder:"13800138000"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:109:13",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:110:15",children:"邮箱"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:111:15",value:l.email,onChange:p=>C({...l,email:p.target.value}),placeholder:"zhangsan@example.com"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:118:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:119:13",children:"渠道类型 *"}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:120:13",value:g,onValueChange:h,children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:121:15",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:122:17",placeholder:"选择渠道类型"})}),e.jsx(ce,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:124:15",children:Re.map(p=>e.jsx(T,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:126:19",value:p.value,children:p.label},p.value))})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:131:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:132:13",children:"Webhook URL *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:133:13",value:l.webhook_url,onChange:p=>C({...l,webhook_url:p.target.value}),placeholder:o?.placeholder||"https://...",className:"font-mono text-xs"})]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:141:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:142:11",variant:"outline",onClick:()=>s(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:143:11",onClick:f,disabled:!l.name.trim()||!l.webhook_url.trim()||b,children:b?"保存中...":n?"保存修改":"添加联系人"})]})]})})}function Gt({open:t,onOpenChange:s,editingGroup:n,contacts:u,onSaved:g}){const[h,l]=a.useState({group_name:"",notes:"",contact_ids:[]}),[C,b]=a.useState(!1);a.useEffect(()=>{if(t)if(n){let o=[];try{o=JSON.parse(n.contact_ids||"[]")}catch{}l({group_name:n.group_name||"",notes:n.notes||"",contact_ids:o})}else l({group_name:"",notes:"",contact_ids:[]})},[t,n]);const v=o=>{l(p=>({...p,contact_ids:p.contact_ids.includes(o)?p.contact_ids.filter(O=>O!==o):[...p.contact_ids,o]}))},f=async()=>{if(h.group_name.trim()){b(!0);try{const o={group_name:h.group_name.trim(),notes:h.notes.trim()||void 0,contact_ids:h.contact_ids};n?(await R.updateContactGroup(n.id,o),d.success("联系组已更新")):(await R.createContactGroup(o),d.success("联系组已添加")),s(!1),g()}catch{d.error("保存失败")}finally{b(!1)}}};return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:84:5",open:t,onOpenChange:s,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:85:7",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:86:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:87:11",children:n?"编辑报警联系组":"添加报警联系组"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:88:11",children:"配置报警联系组,选择组内成员"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:90:9",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:91:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:92:13",children:"组名称 *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:93:13",value:h.group_name,onChange:o=>l({...h,group_name:o.target.value}),placeholder:"如:运维值班组"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:99:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:100:13",children:"备注"}),e.jsx(bt,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:101:13",value:h.notes,onChange:o=>l({...h,notes:o.target.value}),placeholder:"如:周一至周五 9:00-21:00",rows:2})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:108:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:109:13",children:"选择联系人"}),u.length===0?e.jsx("p",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:111:15",className:"text-xs text-muted-foreground",children:"暂无联系人,请先在「报警联系人」标签页添加"}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:113:15",className:"flex flex-wrap gap-1.5 max-h-[180px] overflow-y-auto border rounded-md p-2",children:u.map(o=>e.jsxs(A,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:115:19",variant:h.contact_ids.includes(o.id)?"default":"outline",className:"cursor-pointer text-xs",onClick:()=>v(o.id),children:[o.name,h.contact_ids.includes(o.id)&&" ✓"]},o.id))}),h.contact_ids.length>0&&e.jsxs("p",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:128:15",className:"text-xs text-muted-foreground",children:["已选择 ",h.contact_ids.length," 位联系人"]})]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:132:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:133:11",variant:"outline",onClick:()=>s(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:134:11",onClick:f,disabled:!h.group_name.trim()||C,children:C?"保存中...":n?"保存修改":"添加联系组"})]})]})})}const Mt={onetime:"一次性",daily:"每天循环",weekly:"每周循环"},$t=["周日","周一","周二","周三","周四","周五","周六"];function ee(t){const s=t.getTimezoneOffset();return new Date(t.getTime()-s*6e4).toISOString().slice(0,16)}function Ee(t,s){return new Date(t.getTime()+s*36e5)}function It({open:t,onOpenChange:s,editingSilence:n,onSaved:u}){const[g,h]=a.useState(!1),[l,C]=a.useState(""),[b,v]=a.useState(""),[f,o]=a.useState("onetime"),[p,O]=a.useState(""),[L,c]=a.useState(""),[N,k]=a.useState([]);a.useEffect(()=>{if(n){C(n.name||""),v(n.description||""),o(n.silence_type||"onetime");const x=n.start_time?new Date(n.start_time):new Date,y=n.end_time?new Date(n.end_time):Ee(new Date,1);O(ee(x)),c(ee(y));let G=[];if(n.weekday_list)G=n.weekday_list;else if(n.weekdays)try{G=JSON.parse(n.weekdays)}catch{}k(G)}else{C(""),v(""),o("onetime");const x=new Date;O(ee(x)),c(ee(Ee(x,2))),k([])}},[n,t]);const S=x=>{k(y=>y.includes(x)?y.filter(G=>G!==x):[...y,x])},z=async()=>{if(!l.trim()){d.error("请填写规则名称");return}if(!L){d.error("请设置结束时间");return}if(f==="weekly"&&N.length===0){d.error("每周静默需要选择至少一个星期");return}const x={name:l.trim(),description:b.trim(),silence_type:f,start_time:p,end_time:L,weekdays:f==="weekly"?N:[]};h(!0);try{n?(await E.updateSilence(n.id,x),d.success("静默规则已更新")):(await E.createSilence(x),d.success("静默规则已创建")),s(!1),u()}catch{d.error("保存失败")}finally{h(!1)}};return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:141:5",open:t,onOpenChange:s,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:142:7",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:143:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:144:11",className:"text-[var(--dg-text-primary)]",children:n?"编辑静默规则":"创建静默规则"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:147:11",className:"text-[var(--dg-text-secondary)]",children:"静默期间匹配的告警将不会触发通知"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:151:9",className:"space-y-4 max-h-[60vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:153:11",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:154:13",className:"text-[var(--dg-text-primary)]",children:"规则名称 *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:155:13",value:l,onChange:x=>C(x.target.value),placeholder:"如:维护窗口静默",className:"bg-[var(--dg-bg-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:164:11",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:165:13",className:"text-[var(--dg-text-primary)]",children:"描述"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:166:13",value:b,onChange:x=>v(x.target.value),placeholder:"可选备注",className:"bg-[var(--dg-bg-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:175:11",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:176:13",className:"text-[var(--dg-text-primary)]",children:"静默类型"}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:177:13",value:f,onValueChange:o,children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:178:15",className:"bg-[var(--dg-bg-primary)]",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:179:17"})}),e.jsx(ce,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:181:15",children:Object.entries(Mt).map(([x,y])=>e.jsx(T,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:183:19",value:x,children:y},x))})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:190:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:191:13",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:192:15",className:"text-[var(--dg-text-primary)]",children:f==="onetime"?"开始时间":"每日开始"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:195:15",type:"datetime-local",value:p,onChange:x=>O(x.target.value),className:"bg-[var(--dg-bg-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:202:13",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:203:15",className:"text-[var(--dg-text-primary)]",children:f==="onetime"?"结束时间":"每日结束"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:206:15",type:"datetime-local",value:L,onChange:x=>c(x.target.value),className:"bg-[var(--dg-bg-primary)]"})]})]}),f==="weekly"&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:217:13",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:218:15",className:"text-[var(--dg-text-primary)]",children:"生效星期"}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:219:15",className:"flex flex-wrap gap-2",children:$t.map((x,y)=>e.jsx("button",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:221:19",type:"button",onClick:()=>S(y),className:`px-3 py-1.5 rounded-md text-xs transition-colors ${N.includes(y)?"bg-primary text-primary-foreground":"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] text-[var(--dg-text-secondary)]"}`,children:x},y))})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:239:11",className:"text-xs text-muted-foreground bg-muted/50 rounded-md p-2",children:[f==="onetime"&&"在指定时间窗口内,所有匹配条件的告警将被静默。窗口结束后自动恢复正常。",f==="daily"&&"每天在指定时段内静默告警,适合非工作时间免打扰。",f==="weekly"&&"仅在选定星期的指定时段内静默,适合周末维护窗口。"]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:245:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:246:11",variant:"outline",onClick:()=>s(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:247:11",onClick:z,disabled:g,children:g?"保存中…":"保存"})]})]})})}const qt={onetime:"一次性",daily:"每天",weekly:"每周"},Ft=["日","一","二","三","四","五","六"];function P(t){if(!t)return"—";const s=typeof t=="string"?new Date(t):t;return isNaN(s.getTime())?"—":s.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}const Bt=()=>{const t=Oe(),[s,n]=a.useState([]),[u,g]=a.useState(!1),[h,l]=a.useState(!1),[C,b]=a.useState(null),v=a.useCallback(async()=>{g(!0);try{const c=await E.getSilences(),N=c?.list||c?.data?.list||[];n(N)}catch{d.error("获取静默规则失败")}finally{g(!1)}},[]);a.useEffect(()=>{v()},[v]);const f=()=>{b(null),l(!0)},o=c=>{b(c),l(!0)},p=async c=>{if(await t({title:"删除静默规则",description:`确定删除「${c.name}」?删除后该规则匹配的告警将恢复通知。`,confirmText:"删除",variant:"destructive"}))try{await E.deleteSilence(c.id),d.success("已删除"),v()}catch{d.error("删除失败")}},O=async c=>{try{await E.toggleSilence(c.id),d.success(c.status===1?"已禁用":"已启用"),v()}catch{d.error("操作失败")}},L=c=>{if(c.is_active!==void 0)return c.is_active;if(c.status!==1)return!1;const N=new Date,k=new Date(c.start_time),S=new Date(c.end_time);return N>=k&&N<=S};return e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:102:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:104:7",className:"flex justify-between items-center",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:105:9",className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:106:11",className:"w-4 h-4"}),e.jsxs("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:107:11",children:["共 ",s.length," 条规则"]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:109:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:110:11",variant:"outline",size:"sm",onClick:v,disabled:u,children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:111:13",className:"w-3.5 h-3.5 mr-1"}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:114:11",size:"sm",onClick:f,children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:115:13",className:"w-3.5 h-3.5 mr-1"}),"添加静默规则"]})]})]}),u&&s.length===0?e.jsx("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:123:9",className:"text-center py-12 text-muted-foreground",children:e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:124:11",className:"text-sm",children:"加载中..."})}):s.length===0?e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:127:9",className:"text-center py-12 text-muted-foreground border border-dashed rounded-lg",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:128:11",className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:129:11",className:"text-sm",children:"暂无静默规则"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:130:11",className:"text-xs mt-1",children:"点击「添加静默规则」创建维护窗口或免打扰时段"})]}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:133:9",className:"grid grid-cols-1 gap-3",children:s.map(c=>{const N=L(c),k=c.status===1,S=c.silence_type||"onetime",z=c.weekday_list||(()=>{try{return JSON.parse(c.weekdays||"[]")}catch{return[]}})();return e.jsx(W,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:142:15",className:N?"border-primary/50":"",children:e.jsx(K,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:143:17",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:144:19",className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:146:21",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:147:23",className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:148:25",className:"font-medium text-sm",children:c.name}),e.jsxs(A,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:150:25",variant:"outline",className:"text-xs",children:[S==="onetime"&&e.jsx(gt,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:151:51",className:"w-3 h-3 mr-1"}),S==="daily"&&e.jsx(jt,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:152:49",className:"w-3 h-3 mr-1"}),S==="weekly"&&e.jsx(Ct,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:153:50",className:"w-3 h-3 mr-1"}),qt[S]||S]}),N&&e.jsx(A,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:158:27",className:"bg-green-500 text-xs",children:"生效中"}),!k&&e.jsx(A,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:161:27",variant:"secondary",className:"text-xs",children:"已禁用"})]}),c.description&&e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:166:25",className:"text-xs text-muted-foreground mb-1.5",children:c.description}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:170:23",className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:171:25",children:S==="onetime"?`${P(c.start_time)} — ${P(c.end_time)}`:`每日 ${P(c.start_time)} — ${P(c.end_time)}`}),S==="weekly"&&z.length>0&&e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:178:27",className:"flex items-center gap-1",children:z.sort((x,y)=>x-y).map(x=>e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:180:31",className:"inline-flex items-center justify-center w-5 h-5 rounded-full bg-primary/10 text-primary text-[10px]",children:Ft[x]},x))})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:189:23",className:"text-[10px] text-muted-foreground/60 mt-1",children:["创建于 ",P(c.created_at)]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:195:21",className:"flex items-center gap-2 shrink-0",children:[e.jsx(Le,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:196:23",checked:k,onCheckedChange:()=>O(c)}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:200:23",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>o(c),children:[e.jsx(ft,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:201:25",className:"w-3 h-3 mr-1"}),"编辑"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:203:23",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400",onClick:()=>p(c),children:[e.jsx(vt,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:204:25",className:"w-3 h-3 mr-1"}),"删除"]})]})]})})},c.id)})}),e.jsx(It,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:216:7",open:h,onOpenChange:l,editingSilence:C,onSaved:v})]})},ir=()=>{const t=Oe(),[s,n]=a.useState(""),[u,g]=a.useState("all"),[h,l]=a.useState("all"),[C,b]=a.useState("alerts"),[v,f]=a.useState(null),[o,p]=a.useState(!1),[O,L]=a.useState(!1),[c,N]=a.useState(!1),[k,S]=a.useState(null),[z,x]=a.useState([]),[y,G]=a.useState([]),[qe,me]=a.useState(!1),[Fe,ve]=a.useState(null),[Be,de]=a.useState(!1),[Pe,Ae]=a.useState(null),[M,H]=a.useState(1),[pe]=a.useState(10),We=a.useMemo(()=>({page:M,page_size:pe,severity:u,status:h}),[M,pe,u,h]),{data:xe,isLoading:Ke,refetch:Ne}=Rt(We),{data:ye=[],refetch:we}=_t(),{ackMutation:Qe,resolveMutation:Je,quickSetupMutation:he,toggleAgentRuleMutation:Ve,deleteAgentRuleMutation:Ue}=Et(),ue=xe?.list??[],ge=xe?.total??0,q=xe?.stats??{firing:0,critical:0,warning:0,resolved:0},I=Math.max(1,Math.ceil(ge/pe));a.useEffect(()=>{C==="contacts"&&X(),C==="groups"&&(X(),Z())},[C]);const X=async()=>{try{const r=await R.getContacts();x(r?.data?.list||r?.list||[])}catch{}},Z=async()=>{try{const r=await R.getContactGroups();G(r?.data?.list||r?.list||[])}catch{}},be=async r=>{try{await Qe.mutateAsync(r),d.success("告警已确认")}catch{d.error("操作失败")}},Ye=async r=>{try{await Je.mutateAsync(r),d.success("告警已解决")}catch{d.error("操作失败")}},He=async(r,i)=>{try{const D=ue.find(ot=>ot.id===r),w=new Date,je=i.match(/^(\d+)([hd])$/),ke=je?parseInt(je[1]):1,nt=(je?.[2]||"h")==="d"?ke*24:ke,st=new Date(w.getTime()+nt*36e5);await E.createSilence({name:`静默: ${D?.title||r} (${i})`,description:`从告警列表快速静默 — ${D?.source||""}`,silence_type:"onetime",start_time:w.toISOString(),end_time:st.toISOString()}),d.success(`告警已静默 ${i}`),L(!1),Ne()}catch{d.error("操作失败")}},Xe=async(r,i)=>{try{await Ve.mutateAsync({id:Number(r),enabled:i}),d.success("规则状态已更新")}catch{d.error("更新失败")}},Ze=()=>{S(null),N(!0)},et=r=>{S(r),N(!0)},Se=()=>{N(!1),S(null)},tt=async()=>{if(await t({title:"一键报警",description:"为 Agent 在线主机创建 CPU(>80%)/内存(>80%)/磁盘(>90%)/TIME_WAIT(>15000)/CLOSE_WAIT(>200)/进程检测 6 条告警规则。",confirmText:"确认创建"}))try{const i=await he.mutateAsync("ecs");d.success(typeof i=="string"?i:i?.message||"默认告警规则创建成功")}catch{d.error("创建失败,请检查 Agent 主机是否在线")}},rt=async r=>{if(await t({title:"删除规则",description:`确定删除规则「${r.name}」?`,confirmText:"删除",variant:"destructive"}))try{await Ue.mutateAsync(Number(r.id)),d.success("已删除")}catch{d.error("删除失败")}},De=(r,i)=>{r==="severity"?g(i):l(i),H(1)};return e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:179:5",className:"space-y-3",children:[e.jsx(at,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:181:7",items:[{label:"触发中",value:q.firing,color:q.firing>0?"red":"muted"},{label:"严重",value:q.critical,color:"red"},{label:"警告",value:q.warning,color:"amber"},{label:"已解决",value:q.resolved,color:"emerald"}]}),e.jsxs(lt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:190:7",value:C,onValueChange:b,children:[e.jsxs(it,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:191:9",className:"grid w-full grid-cols-5 lg:w-[600px] h-9",children:[e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:192:11",value:"alerts",className:"text-xs",children:"告警列表"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:193:11",value:"rules",className:"text-xs",children:"告警规则"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:194:11",value:"silences",className:"text-xs",children:"静默规则"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:195:11",value:"contacts",className:"text-xs",children:"报警联系人"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:196:11",value:"groups",className:"text-xs",children:"报警联系组"})]}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:200:9",value:"alerts",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:201:11",className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:202:13",className:"flex items-center gap-2 flex-1 min-w-[280px]",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:203:15",className:"relative flex-1",children:[e.jsx(At,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:204:17",className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:205:17",placeholder:"搜索告警...",value:s,onChange:r=>n(r.target.value),className:"pl-8 h-8 text-xs"})]}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:212:15",value:u,onValueChange:r=>De("severity",r),children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:213:17",className:"w-[100px] h-8 text-xs",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:214:19",placeholder:"级别"})}),e.jsxs(ce,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:216:17",children:[e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:217:19",value:"all",children:"全部级别"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:218:19",value:"critical",children:"严重"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:219:19",value:"warning",children:"警告"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:220:19",value:"info",children:"信息"})]})]}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:223:15",value:h,onValueChange:r=>De("status",r),children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:224:17",className:"w-[100px] h-8 text-xs",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:225:19",placeholder:"状态"})}),e.jsxs(ce,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:227:17",children:[e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:228:19",value:"all",children:"全部状态"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:229:19",value:"firing",children:"触发中"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:230:19",value:"acknowledged",children:"已确认"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:231:19",value:"resolved",children:"已解决"})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:235:13",className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:236:15",children:["共 ",ge," 条"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:237:15",variant:"outline",size:"sm",onClick:()=>Ne(),className:"h-7 text-xs px-2",children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:238:17",className:"w-3 h-3 mr-1"}),"刷新"]})]})]}),e.jsx(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:244:11",children:e.jsxs(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:245:13",className:"p-0",children:[e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:246:15",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:247:17",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:248:19",className:"bg-muted/50",children:e.jsxs("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:249:21",children:[e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:250:23",className:"px-3 py-2 text-left text-xs font-medium",children:"告警信息"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:251:23",className:"px-3 py-2 text-left text-xs font-medium w-16",children:"级别"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:252:23",className:"px-3 py-2 text-left text-xs font-medium w-16",children:"状态"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:253:23",className:"px-3 py-2 text-left text-xs font-medium w-24",children:"来源"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:254:23",className:"px-3 py-2 text-left text-xs font-medium w-20",children:"持续"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:255:23",className:"px-3 py-2 text-left text-xs font-medium w-28",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:258:19",className:"divide-y",children:Ke?e.jsx("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:260:23",children:e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:260:27",colSpan:6,className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"加载中..."})}):ue.length===0?e.jsx("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:262:23",children:e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:262:27",colSpan:6,className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"暂无告警"})}):ue.filter(r=>{if(!s)return!0;const i=s.toLowerCase();return r.title.toLowerCase().includes(i)||r.description.toLowerCase().includes(i)||r.source.toLowerCase().includes(i)}).map(r=>e.jsxs("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:272:25",className:"hover:bg-muted/50",children:[e.jsxs("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:273:27",className:"px-3 py-2",children:[e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:274:29",className:"font-medium text-xs",children:r.title}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:275:29",className:"text-xs text-muted-foreground line-clamp-1",children:r.description}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:276:29",className:"flex gap-1 mt-0.5",children:Object.entries(r.labels).slice(0,2).map(([i,D])=>e.jsxs(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:278:33",variant:"outline",className:"text-[10px] px-1 py-0",children:[i,"=",D]},i))})]}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:282:27",className:"px-3 py-2",children:fe(r.severity)}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:283:27",className:"px-3 py-2",children:Dt(r.status)}),e.jsxs("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:284:27",className:"px-3 py-2 text-xs",children:[e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:285:29",children:r.source}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:286:29",className:"text-muted-foreground text-[10px]",children:r.service})]}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:288:27",className:"px-3 py-2 text-xs text-muted-foreground",children:r.status==="resolved"&&r.resolvedAt?`${Math.floor((new Date(r.resolvedAt).getTime()-new Date(r.startedAt).getTime())/6e4)}分`:`${Math.floor((Date.now()-new Date(r.startedAt).getTime())/6e4)}分`}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:293:27",className:"px-3 py-2",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:294:29",className:"flex items-center gap-0.5",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:295:31",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{f(r),p(!0)},children:e.jsx(Nt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:297:33",className:"w-3.5 h-3.5"})}),r.status==="firing"&&e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:300:33",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>be(r.id),children:e.jsx(Ie,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:302:35",className:"w-3.5 h-3.5 text-blue-600"})}),(r.status==="firing"||r.status==="acknowledged")&&e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:306:33",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>Ye(r.id),children:e.jsx($e,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:308:35",className:"w-3.5 h-3.5 text-green-600"})}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:311:31",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{f(r),L(!0)},children:e.jsx(le,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:313:33",className:"w-3.5 h-3.5 text-orange-600"})})]})})]},r.id))})]})}),I>1&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:325:17",className:"flex items-center justify-between px-3 py-2 border-t text-xs",children:[e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:326:19",className:"text-muted-foreground",children:["第 ",M,"/",I," 页,共 ",ge," 条"]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:327:19",className:"flex items-center gap-1",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:328:21",variant:"outline",size:"sm",className:"h-7 text-xs px-2",disabled:M<=1,onClick:()=>H(r=>r-1),children:"上一页"}),Array.from({length:Math.min(I,5)},(r,i)=>{const w=Math.max(1,Math.min(M-2,I-4))+i;return w>I?null:e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:337:25",variant:w===M?"default":"outline",size:"sm",className:"h-7 min-w-[28px] text-xs px-1",onClick:()=>H(w),children:w},w)}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:344:21",variant:"outline",size:"sm",className:"h-7 text-xs px-2",disabled:M>=I,onClick:()=>H(r=>r+1),children:"下一页"})]})]})]})})]}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:356:9",value:"rules",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:357:11",className:"flex justify-between items-center",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:358:13",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:359:15",onClick:Ze,children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:360:17",className:"w-4 h-4 mr-1"}),"添加规则"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:362:15",variant:"secondary",onClick:tt,disabled:he.isPending,children:[e.jsx(yt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:363:17",className:"w-4 h-4 mr-1"}),he.isPending?"创建中…":"一键报警"]})]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:367:13",variant:"outline",onClick:()=>we(),children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:368:15",className:"w-4 h-4 mr-2"}),"刷新"]})]}),ye.length===0?e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:373:13",className:"text-center py-12 text-muted-foreground",children:[e.jsx(Me,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:374:15",className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:375:15",className:"text-sm",children:"暂无告警规则"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:376:15",className:"text-xs mt-1",children:"点击「添加规则」或「一键报警」快速创建"})]}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:379:11",className:"grid grid-cols-1 gap-4",children:ye.map(r=>e.jsx(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:381:15",children:e.jsx(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:382:17",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:383:19",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:384:21",className:"flex-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:385:23",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:386:25",className:"font-medium",children:r.name}),fe(r.severity),e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:388:25",variant:r.enabled?"default":"secondary",children:r.enabled?"已启用":"已禁用"})]}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:392:23",className:"text-sm text-muted-foreground mb-2",children:r.description}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:393:23",className:"flex items-center gap-4 text-xs text-muted-foreground",children:[r.expression&&e.jsx("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:395:27",className:"font-mono bg-muted px-2 py-1 rounded",children:r.expression}),r.duration?e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:397:42",children:["持续 ",r.duration,"秒"]}):null]}),(()=>{let i=[];try{const D=r.notify_channels;D&&(i=Array.isArray(D)?D:JSON.parse(D))}catch{}return i.length?e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:407:27",className:"flex gap-1 mt-2",children:i.map(D=>e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:409:31",variant:"outline",className:"text-xs",children:D},D))}):null})()]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:415:21",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:416:23",variant:"ghost",size:"sm",onClick:()=>et(r),children:"编辑"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:417:23",variant:"ghost",size:"sm",className:"text-red-400",onClick:()=>rt(r),children:"删除"}),e.jsx(Le,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:418:23",checked:r.enabled,onCheckedChange:i=>Xe(String(r.id),i)})]})]})})},r.id))})]}),e.jsx(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:432:9",value:"silences",children:e.jsx(Bt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:433:11"})}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:437:9",value:"contacts",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:438:13",className:"flex justify-between items-center",children:[e.jsx("h3",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:439:15",className:"text-sm font-medium",children:"报警联系人"}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:440:15",size:"sm",onClick:()=>{ve(null),me(!0)},children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:441:17",className:"w-4 h-4 mr-1"}),"添加联系人"]})]}),z.length===0?e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:446:15",className:"text-center py-8 text-muted-foreground border border-dashed rounded-lg text-xs",children:"暂无报警联系人,点击「添加联系人」创建"}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:450:15",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:z.map(r=>e.jsxs(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:452:19",className:"hover:border-primary/50 transition-colors",children:[e.jsx(Te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:453:21",className:"pb-2",children:e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:454:23",className:"flex items-start justify-between",children:e.jsx(_e,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:455:25",className:"text-sm",children:r.name})})}),e.jsxs(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:458:21",className:"pt-0 space-y-1 text-xs text-muted-foreground",children:[r.phone&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:459:35",children:["📱 ",r.phone]}),r.email&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:460:35",children:["📧 ",r.email]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:461:23",className:"flex gap-1 flex-wrap",children:[r.channel_type&&e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:463:27",variant:"outline",className:"text-[10px]",children:kt(r.channel_type)}),r.webhook_url&&e.jsx("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:468:27",className:"text-[10px] text-muted-foreground truncate max-w-[200px]",title:r.webhook_url,children:r.webhook_url})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:473:23",className:"flex gap-1.5 pt-1.5",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:474:25",variant:"outline",size:"sm",className:"h-7 text-xs flex-1",onClick:()=>{ve(r),me(!0)},children:"编辑"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:478:25",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:async()=>{if(await t({title:"删除联系人",description:`确定删除「${r.name}」?`,confirmText:"删除",variant:"destructive"}))try{await R.deleteContact(r.id),d.success("已删除"),X()}catch{d.error("删除失败")}},children:"删除"})]})]})]},r.id))})]}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:496:9",value:"groups",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:497:11",className:"flex justify-between items-center",children:[e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:498:13",variant:"outline",onClick:Z,children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:499:15",className:"w-4 h-4 mr-2"}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:502:13",onClick:()=>{Ae(null),de(!0)},children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:503:15",className:"w-4 h-4 mr-2"}),"添加联系组"]})]}),y.length===0?e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:508:13",className:"text-center py-16 text-muted-foreground border border-dashed rounded-lg",children:"暂无报警联系组,点击「添加联系组」创建"}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:512:13",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:y.map(r=>{let i=[];try{i=JSON.parse(r.contact_ids||"[]")}catch{}const D=z.filter(w=>i.includes(w.id)).map(w=>w.name);return e.jsxs(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:520:19",className:"hover:border-primary/50 transition-colors",children:[e.jsx(Te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:521:21",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:522:23",className:"flex items-start justify-between",children:[e.jsx(_e,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:523:25",className:"text-base",children:r.group_name}),e.jsxs(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:524:25",variant:"secondary",children:[i.length," 人"]})]})}),e.jsxs(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:527:21",className:"pt-0 space-y-2",children:[r.notes&&e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:528:35",className:"text-sm text-muted-foreground",children:r.notes}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:529:23",className:"flex flex-wrap gap-1",children:D.map(w=>e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:531:27",variant:"outline",className:"text-xs",children:w},w))}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:534:23",className:"flex gap-2 pt-2",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:535:25",variant:"outline",size:"sm",className:"flex-1",onClick:()=>{Ae(r),de(!0)},children:"编辑"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:539:25",variant:"outline",size:"sm",onClick:async()=>{if(await t({title:"删除联系组",description:`确定删除联系组「${r.group_name}」?`,confirmText:"删除",variant:"destructive"}))try{await R.deleteContactGroup(r.id),d.success("已删除"),Z()}catch{d.error("删除失败")}},children:"删除"})]})]})]},r.id)})})]})]}),e.jsx(Ot,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:558:7",alert:v,open:o,onOpenChange:p,onAcknowledge:be}),e.jsx(Lt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:564:7",alert:v,open:O,onOpenChange:L,onSilence:He}),e.jsx(wt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:570:7",open:c,onOpenChange:Se,editingRule:k,notifyChannels:[],onSaved:()=>{Se(),we()}}),e.jsx(zt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:577:7",open:qe,onOpenChange:me,editingContact:Fe,onSaved:X}),e.jsx(Gt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:583:7",open:Be,onOpenChange:de,editingGroup:Pe,contacts:z,onSaved:()=>{Z()}})]})};export{ir as default}; +import{j as e,r as a}from"./vendor-codemirror-B1SGo4xl.js";import{G as ct,D as Q,a as J,b as V,c as U,d as Y,e as ie,B as m,t as d,f as Oe}from"./index-Bp-M7P_8.js";import{I as _}from"./input-Bnlm--la.js";import{B as A}from"./badge-B00SZHvE.js";import{C as W,a as K,b as Te,c as _e}from"./card-BHSBTtub.js";import{S as at}from"./stat-strip-CSMyyoYr.js";import{S as ne,a as se,b as oe,c as ce,d as T}from"./select-DbhcBWnH.js";import{T as lt,a as it,b as F,c as B}from"./tabs-DbNlmoQJ.js";import{S as Le}from"./switch-CEwFnSNV.js";import{a as R}from"./alert-CRDraqCb.js";import{a as E}from"./alert-center-C9EzZkDY.js";import{u as ze,q as ae,b as Ge,a as mt}from"./unwrap-D6sbt6TG.js";import{u as $}from"./useMutation-DTWI9Q1n.js";import{a as Ce}from"./agent-BZUl25f5.js";import{I as dt,l as Me,ab as pt,aX as le,y as $e,U as xt,a4 as ht,w as Ie,f as ut,R as te,P as re,b as gt,aY as jt,aw as Ct,aE as ft,T as vt,S as At,x as Nt,ar as yt}from"./vendor-icons-BWk-DH7F.js";import{L as j}from"./label-NkONM5Mp.js";import{A as wt}from"./AlertRuleDialog-B0UIHsEi.js";import{T as bt}from"./textarea-BvOVhaCD.js";import"./index-5FEebgvX.js";function St(t){return{id:String(t.id),title:t.rule_name||t.title||`告警 #${t.id}`,description:t.message||t.description||"",severity:t.severity||"info",status:t.status||"firing",source:t.target||t.source||"",service:t.service||"",metric:t.metric||"",value:t.value||0,threshold:t.threshold||0,startedAt:t.started_at||t.startedAt||t.created_at||new Date().toISOString(),resolvedAt:t.resolved_at||t.resolvedAt,labels:typeof t.labels=="string"?(()=>{try{return JSON.parse(t.labels||"{}")}catch{return{}}})():t.labels||{},annotations:typeof t.annotations=="string"?(()=>{try{return JSON.parse(t.annotations||"{}")}catch{return{}}})():t.annotations||{}}}function fe(t){switch(t){case"critical":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:14",variant:"destructive",className:"gap-1",children:[e.jsx(pt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:106:61",className:"w-3 h-3"}),"严重"]});case"warning":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:14",variant:"default",className:"bg-orange-500 gap-1",children:[e.jsx(Me,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:108:71",className:"w-3 h-3"}),"警告"]});case"info":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:14",variant:"default",className:"bg-blue-500 gap-1",children:[e.jsx(dt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:110:69",className:"w-3 h-3"}),"信息"]});default:return e.jsx(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:112:14",variant:"secondary",children:"未知"})}}function Dt(t){switch(t){case"firing":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:120:14",variant:"destructive",className:"gap-1 animate-pulse",children:[e.jsx(ht,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:120:75",className:"w-3 h-3"}),"触发中"]});case"acknowledged":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:14",variant:"default",className:"bg-yellow-500 gap-1",children:[e.jsx(xt,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:122:71",className:"w-3 h-3"}),"已确认"]});case"resolved":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:14",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx($e,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:124:70",className:"w-3 h-3"}),"已解决"]});case"suppressed":return e.jsxs(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:126:14",variant:"secondary",className:"gap-1",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:126:59",className:"w-3 h-3"}),"已静默"]});default:return e.jsx(A,{"code-path":"src/components/monitor/alert-center/alert-center-helpers.tsx:128:14",variant:"secondary",children:"未知"})}}function kt(t){return{dingtalk:"钉钉",wechat:"企业微信",feishu:"飞书",email:"邮件",sms:"短信",webhook:"Webhook"}[t]||t}function Tt(t){return{firing:t.filter(s=>s.status==="firing").length,critical:t.filter(s=>s.severity==="critical"&&s.status==="firing").length,warning:t.filter(s=>s.severity==="warning"&&s.status==="firing").length,resolved:t.filter(s=>s.status==="resolved").length}}function _t(){return ze({queryKey:ae.agentAlertRules(),queryFn:async()=>{const t=await Ce.listRules();return Ge(t).map(n=>({id:n.id,name:String(n.name||""),description:`${n.metric} ${n.operator} ${n.threshold}%`,enabled:!!n.enabled,severity:"warning",type:String(n.metric||""),hostname:String(n.hostname||"全部主机"),threshold:Number(n.threshold||0)}))},staleTime:3e4})}function Rt(t={}){return ze({queryKey:ae.alerts(t),queryFn:async()=>{const s=await E.getAlerts({page:t.page,page_size:t.page_size,severity:t.severity!=="all"?t.severity:void 0,status:t.status!=="all"?t.status:void 0}),u=Ge(s).map(g=>St(g));return{list:u,total:mt(s),stats:Tt(u)}},staleTime:15e3,refetchInterval:3e4})}function Et(){const t=ct(),s=()=>t.invalidateQueries({queryKey:ae.alertRules()}),n=()=>t.invalidateQueries({queryKey:ae.agentAlertRules()}),u=()=>t.invalidateQueries({queryKey:["alerts"]}),g=$({mutationFn:o=>R.toggleRule(o),onSuccess:s}),h=$({mutationFn:o=>R.deleteRule(o),onSuccess:s}),l=$({mutationFn:({id:o,enabled:p})=>Ce.updateRule(o,{enabled:p}),onSuccess:n}),C=$({mutationFn:o=>Ce.deleteRule(o),onSuccess:n}),b=$({mutationFn:o=>E.acknowledge(o),onSuccess:u}),v=$({mutationFn:o=>E.resolve(o),onSuccess:u}),f=$({mutationFn:o=>E.quickSetup(o),onSuccess:n});return{toggleRuleMutation:g,deleteRuleMutation:h,toggleAgentRuleMutation:l,deleteAgentRuleMutation:C,ackMutation:b,resolveMutation:v,quickSetupMutation:f,invalidateRules:s,invalidateAgentRules:n,invalidateAlerts:u}}function Ot({alert:t,open:s,onOpenChange:n,onAcknowledge:u}){return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:22:5",open:s,onOpenChange:n,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:23:7",className:"max-w-3xl",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:24:9",children:[e.jsxs(U,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:25:11",className:"flex items-center gap-2",children:[t?.title,t&&fe(t.severity)]}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:29:11",className:"sr-only",children:"查看告警详情"})]}),t&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:32:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:33:13",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:34:15",className:"text-muted-foreground",children:"描述"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:35:15",className:"mt-1",children:t.description})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:37:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:38:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:39:17",className:"text-muted-foreground",children:"来源"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:40:17",className:"font-medium",children:t.source})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:42:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:43:17",className:"text-muted-foreground",children:"服务"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:44:17",className:"font-medium",children:t.service})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:46:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:47:17",className:"text-muted-foreground",children:"指标"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:48:17",className:"font-medium",children:t.metric})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:50:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:51:17",className:"text-muted-foreground",children:"当前值 / 阈值"}),e.jsxs("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:52:17",className:"font-medium",children:[t.value," / ",t.threshold]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:54:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:55:17",className:"text-muted-foreground",children:"开始时间"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:56:17",className:"font-medium",children:t.startedAt})]}),t.resolvedAt&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:59:17",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:60:19",className:"text-muted-foreground",children:"解决时间"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:61:19",className:"font-medium",children:t.resolvedAt})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:65:13",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:66:15",className:"text-muted-foreground",children:"标签"}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:67:15",className:"flex flex-wrap gap-2 mt-1",children:Object.entries(t.labels).map(([g,h])=>e.jsxs(A,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:69:19",variant:"outline",children:[g,"=",h]},g))})]}),t.runbookUrl&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:74:15",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:75:17",className:"text-muted-foreground",children:"处理手册"}),e.jsx("a",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:76:17",href:t.runbookUrl,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline block mt-1",children:"查看处理手册 →"})]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:83:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:84:11",variant:"outline",onClick:()=>n(!1),children:"关闭"}),t?.status==="firing"&&e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:86:13",onClick:()=>{u(t.id),n(!1)},children:[e.jsx(Ie,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:87:15",className:"w-4 h-4 mr-2"}),"确认告警"]})]})]})})}function Lt({alert:t,open:s,onOpenChange:n,onSilence:u}){return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:109:5",open:s,onOpenChange:n,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:110:7",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:111:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:112:11",children:"静默告警"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:113:11",children:"选择静默持续时间"})]}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:115:9",className:"space-y-2",children:["1h","4h","8h","24h","7d"].map(g=>e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:117:13",variant:"outline",className:"w-full justify-between",onClick:()=>t&&u(t.id,g),children:[e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:123:15",children:["静默 ",g]}),e.jsx(ut,{"code-path":"src/components/monitor/alert-center/AlertCenterDetail.tsx:124:15",className:"w-4 h-4"})]},g))})]})})}const Re=[{value:"feishu",label:"飞书",placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/..."},{value:"dingtalk",label:"钉钉",placeholder:"https://oapi.dingtalk.com/robot/send?access_token=..."},{value:"wechat",label:"企业微信",placeholder:"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=..."},{value:"webhook",label:"自定义Webhook",placeholder:"https://your-webhook-url..."}];function zt({open:t,onOpenChange:s,editingContact:n,onSaved:u}){const[g,h]=a.useState("feishu"),[l,C]=a.useState({name:"",phone:"",email:"",webhook_url:""}),[b,v]=a.useState(!1);a.useEffect(()=>{t&&(n?(h(n.channel_type||"feishu"),C({name:n.name||"",phone:n.phone||"",email:n.email||"",webhook_url:n.webhook_url||""})):(h("feishu"),C({name:"",phone:"",email:"",webhook_url:""})))},[t,n]);const f=async()=>{if(!(!l.name.trim()||!l.webhook_url.trim())){v(!0);try{const p={name:l.name.trim(),phone:l.phone.trim()||void 0,email:l.email.trim()||void 0,channel_type:g,webhook_url:l.webhook_url.trim()};n?(await R.updateContact(n.id,p),d.success("联系人已更新")):(await R.createContact(p),d.success("联系人已添加")),s(!1),u()}catch{d.error("保存失败")}finally{v(!1)}}},o=Re.find(p=>p.value===g);return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:85:5",open:t,onOpenChange:s,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:86:7",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:87:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:88:11",children:n?"编辑报警联系人":"添加报警联系人"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:89:11",children:"选择通知渠道并填入 Webhook 地址"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:91:9",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:92:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:93:13",children:"姓名 *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:94:13",value:l.name,onChange:p=>C({...l,name:p.target.value}),placeholder:"如:张三"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:100:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:101:13",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:102:15",children:"手机号"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:103:15",value:l.phone,onChange:p=>C({...l,phone:p.target.value}),placeholder:"13800138000"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:109:13",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:110:15",children:"邮箱"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:111:15",value:l.email,onChange:p=>C({...l,email:p.target.value}),placeholder:"zhangsan@example.com"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:118:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:119:13",children:"渠道类型 *"}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:120:13",value:g,onValueChange:h,children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:121:15",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:122:17",placeholder:"选择渠道类型"})}),e.jsx(ce,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:124:15",children:Re.map(p=>e.jsx(T,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:126:19",value:p.value,children:p.label},p.value))})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:131:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:132:13",children:"Webhook URL *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:133:13",value:l.webhook_url,onChange:p=>C({...l,webhook_url:p.target.value}),placeholder:o?.placeholder||"https://...",className:"font-mono text-xs"})]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:141:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:142:11",variant:"outline",onClick:()=>s(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactDialog.tsx:143:11",onClick:f,disabled:!l.name.trim()||!l.webhook_url.trim()||b,children:b?"保存中...":n?"保存修改":"添加联系人"})]})]})})}function Gt({open:t,onOpenChange:s,editingGroup:n,contacts:u,onSaved:g}){const[h,l]=a.useState({group_name:"",notes:"",contact_ids:[]}),[C,b]=a.useState(!1);a.useEffect(()=>{if(t)if(n){let o=[];try{o=JSON.parse(n.contact_ids||"[]")}catch{}l({group_name:n.group_name||"",notes:n.notes||"",contact_ids:o})}else l({group_name:"",notes:"",contact_ids:[]})},[t,n]);const v=o=>{l(p=>({...p,contact_ids:p.contact_ids.includes(o)?p.contact_ids.filter(O=>O!==o):[...p.contact_ids,o]}))},f=async()=>{if(h.group_name.trim()){b(!0);try{const o={group_name:h.group_name.trim(),notes:h.notes.trim()||void 0,contact_ids:h.contact_ids};n?(await R.updateContactGroup(n.id,o),d.success("联系组已更新")):(await R.createContactGroup(o),d.success("联系组已添加")),s(!1),g()}catch{d.error("保存失败")}finally{b(!1)}}};return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:84:5",open:t,onOpenChange:s,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:85:7",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:86:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:87:11",children:n?"编辑报警联系组":"添加报警联系组"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:88:11",children:"配置报警联系组,选择组内成员"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:90:9",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:91:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:92:13",children:"组名称 *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:93:13",value:h.group_name,onChange:o=>l({...h,group_name:o.target.value}),placeholder:"如:运维值班组"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:99:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:100:13",children:"备注"}),e.jsx(bt,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:101:13",value:h.notes,onChange:o=>l({...h,notes:o.target.value}),placeholder:"如:周一至周五 9:00-21:00",rows:2})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:108:11",className:"space-y-2",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:109:13",children:"选择联系人"}),u.length===0?e.jsx("p",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:111:15",className:"text-xs text-muted-foreground",children:"暂无联系人,请先在「报警联系人」标签页添加"}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:113:15",className:"flex flex-wrap gap-1.5 max-h-[180px] overflow-y-auto border rounded-md p-2",children:u.map(o=>e.jsxs(A,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:115:19",variant:h.contact_ids.includes(o.id)?"default":"outline",className:"cursor-pointer text-xs",onClick:()=>v(o.id),children:[o.name,h.contact_ids.includes(o.id)&&" ✓"]},o.id))}),h.contact_ids.length>0&&e.jsxs("p",{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:128:15",className:"text-xs text-muted-foreground",children:["已选择 ",h.contact_ids.length," 位联系人"]})]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:132:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:133:11",variant:"outline",onClick:()=>s(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/ContactGroupDialog.tsx:134:11",onClick:f,disabled:!h.group_name.trim()||C,children:C?"保存中...":n?"保存修改":"添加联系组"})]})]})})}const Mt={onetime:"一次性",daily:"每天循环",weekly:"每周循环"},$t=["周日","周一","周二","周三","周四","周五","周六"];function ee(t){const s=t.getTimezoneOffset();return new Date(t.getTime()-s*6e4).toISOString().slice(0,16)}function Ee(t,s){return new Date(t.getTime()+s*36e5)}function It({open:t,onOpenChange:s,editingSilence:n,onSaved:u}){const[g,h]=a.useState(!1),[l,C]=a.useState(""),[b,v]=a.useState(""),[f,o]=a.useState("onetime"),[p,O]=a.useState(""),[L,c]=a.useState(""),[N,k]=a.useState([]);a.useEffect(()=>{if(n){C(n.name||""),v(n.description||""),o(n.silence_type||"onetime");const x=n.start_time?new Date(n.start_time):new Date,y=n.end_time?new Date(n.end_time):Ee(new Date,1);O(ee(x)),c(ee(y));let G=[];if(n.weekday_list)G=n.weekday_list;else if(n.weekdays)try{G=JSON.parse(n.weekdays)}catch{}k(G)}else{C(""),v(""),o("onetime");const x=new Date;O(ee(x)),c(ee(Ee(x,2))),k([])}},[n,t]);const S=x=>{k(y=>y.includes(x)?y.filter(G=>G!==x):[...y,x])},z=async()=>{if(!l.trim()){d.error("请填写规则名称");return}if(!L){d.error("请设置结束时间");return}if(f==="weekly"&&N.length===0){d.error("每周静默需要选择至少一个星期");return}const x={name:l.trim(),description:b.trim(),silence_type:f,start_time:p,end_time:L,weekdays:f==="weekly"?N:[]};h(!0);try{n?(await E.updateSilence(n.id,x),d.success("静默规则已更新")):(await E.createSilence(x),d.success("静默规则已创建")),s(!1),u()}catch{d.error("保存失败")}finally{h(!1)}};return e.jsx(Q,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:141:5",open:t,onOpenChange:s,children:e.jsxs(J,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:142:7",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg",children:[e.jsxs(V,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:143:9",children:[e.jsx(U,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:144:11",className:"text-[var(--dg-text-primary)]",children:n?"编辑静默规则":"创建静默规则"}),e.jsx(Y,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:147:11",className:"text-[var(--dg-text-secondary)]",children:"静默期间匹配的告警将不会触发通知"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:151:9",className:"space-y-4 max-h-[60vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:153:11",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:154:13",className:"text-[var(--dg-text-primary)]",children:"规则名称 *"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:155:13",value:l,onChange:x=>C(x.target.value),placeholder:"如:维护窗口静默",className:"bg-[var(--dg-bg-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:164:11",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:165:13",className:"text-[var(--dg-text-primary)]",children:"描述"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:166:13",value:b,onChange:x=>v(x.target.value),placeholder:"可选备注",className:"bg-[var(--dg-bg-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:175:11",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:176:13",className:"text-[var(--dg-text-primary)]",children:"静默类型"}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:177:13",value:f,onValueChange:o,children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:178:15",className:"bg-[var(--dg-bg-primary)]",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:179:17"})}),e.jsx(ce,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:181:15",children:Object.entries(Mt).map(([x,y])=>e.jsx(T,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:183:19",value:x,children:y},x))})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:190:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:191:13",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:192:15",className:"text-[var(--dg-text-primary)]",children:f==="onetime"?"开始时间":"每日开始"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:195:15",type:"datetime-local",value:p,onChange:x=>O(x.target.value),className:"bg-[var(--dg-bg-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:202:13",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:203:15",className:"text-[var(--dg-text-primary)]",children:f==="onetime"?"结束时间":"每日结束"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:206:15",type:"datetime-local",value:L,onChange:x=>c(x.target.value),className:"bg-[var(--dg-bg-primary)]"})]})]}),f==="weekly"&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:217:13",className:"space-y-1.5",children:[e.jsx(j,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:218:15",className:"text-[var(--dg-text-primary)]",children:"生效星期"}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:219:15",className:"flex flex-wrap gap-2",children:$t.map((x,y)=>e.jsx("button",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:221:19",type:"button",onClick:()=>S(y),className:`px-3 py-1.5 rounded-md text-xs transition-colors ${N.includes(y)?"bg-primary text-primary-foreground":"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] text-[var(--dg-text-secondary)]"}`,children:x},y))})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:239:11",className:"text-xs text-muted-foreground bg-muted/50 rounded-md p-2",children:[f==="onetime"&&"在指定时间窗口内,所有匹配条件的告警将被静默。窗口结束后自动恢复正常。",f==="daily"&&"每天在指定时段内静默告警,适合非工作时间免打扰。",f==="weekly"&&"仅在选定星期的指定时段内静默,适合周末维护窗口。"]})]}),e.jsxs(ie,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:245:9",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:246:11",variant:"outline",onClick:()=>s(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/SilenceDialog.tsx:247:11",onClick:z,disabled:g,children:g?"保存中…":"保存"})]})]})})}const qt={onetime:"一次性",daily:"每天",weekly:"每周"},Ft=["日","一","二","三","四","五","六"];function P(t){if(!t)return"—";const s=typeof t=="string"?new Date(t):t;return isNaN(s.getTime())?"—":s.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}const Bt=()=>{const t=Oe(),[s,n]=a.useState([]),[u,g]=a.useState(!1),[h,l]=a.useState(!1),[C,b]=a.useState(null),v=a.useCallback(async()=>{g(!0);try{const c=await E.getSilences(),N=c?.list||c?.data?.list||[];n(N)}catch{d.error("获取静默规则失败")}finally{g(!1)}},[]);a.useEffect(()=>{v()},[v]);const f=()=>{b(null),l(!0)},o=c=>{b(c),l(!0)},p=async c=>{if(await t({title:"删除静默规则",description:`确定删除「${c.name}」?删除后该规则匹配的告警将恢复通知。`,confirmText:"删除",variant:"destructive"}))try{await E.deleteSilence(c.id),d.success("已删除"),v()}catch{d.error("删除失败")}},O=async c=>{try{await E.toggleSilence(c.id),d.success(c.status===1?"已禁用":"已启用"),v()}catch{d.error("操作失败")}},L=c=>{if(c.is_active!==void 0)return c.is_active;if(c.status!==1)return!1;const N=new Date,k=new Date(c.start_time),S=new Date(c.end_time);return N>=k&&N<=S};return e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:102:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:104:7",className:"flex justify-between items-center",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:105:9",className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:106:11",className:"w-4 h-4"}),e.jsxs("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:107:11",children:["共 ",s.length," 条规则"]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:109:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:110:11",variant:"outline",size:"sm",onClick:v,disabled:u,children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:111:13",className:"w-3.5 h-3.5 mr-1"}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:114:11",size:"sm",onClick:f,children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:115:13",className:"w-3.5 h-3.5 mr-1"}),"添加静默规则"]})]})]}),u&&s.length===0?e.jsx("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:123:9",className:"text-center py-12 text-muted-foreground",children:e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:124:11",className:"text-sm",children:"加载中..."})}):s.length===0?e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:127:9",className:"text-center py-12 text-muted-foreground border border-dashed rounded-lg",children:[e.jsx(le,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:128:11",className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:129:11",className:"text-sm",children:"暂无静默规则"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:130:11",className:"text-xs mt-1",children:"点击「添加静默规则」创建维护窗口或免打扰时段"})]}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:133:9",className:"grid grid-cols-1 gap-3",children:s.map(c=>{const N=L(c),k=c.status===1,S=c.silence_type||"onetime",z=c.weekday_list||(()=>{try{return JSON.parse(c.weekdays||"[]")}catch{return[]}})();return e.jsx(W,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:142:15",className:N?"border-primary/50":"",children:e.jsx(K,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:143:17",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:144:19",className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:146:21",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:147:23",className:"flex items-center gap-2 mb-1.5 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:148:25",className:"font-medium text-sm",children:c.name}),e.jsxs(A,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:150:25",variant:"outline",className:"text-xs",children:[S==="onetime"&&e.jsx(gt,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:151:51",className:"w-3 h-3 mr-1"}),S==="daily"&&e.jsx(jt,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:152:49",className:"w-3 h-3 mr-1"}),S==="weekly"&&e.jsx(Ct,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:153:50",className:"w-3 h-3 mr-1"}),qt[S]||S]}),N&&e.jsx(A,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:158:27",className:"bg-green-500 text-xs",children:"生效中"}),!k&&e.jsx(A,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:161:27",variant:"secondary",className:"text-xs",children:"已禁用"})]}),c.description&&e.jsx("p",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:166:25",className:"text-xs text-muted-foreground mb-1.5",children:c.description}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:170:23",className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:171:25",children:S==="onetime"?`${P(c.start_time)} — ${P(c.end_time)}`:`每日 ${P(c.start_time)} — ${P(c.end_time)}`}),S==="weekly"&&z.length>0&&e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:178:27",className:"flex items-center gap-1",children:z.sort((x,y)=>x-y).map(x=>e.jsx("span",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:180:31",className:"inline-flex items-center justify-center w-5 h-5 rounded-full bg-primary/10 text-primary text-[10px]",children:Ft[x]},x))})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:189:23",className:"text-[10px] text-muted-foreground/60 mt-1",children:["创建于 ",P(c.created_at)]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:195:21",className:"flex items-center gap-2 shrink-0",children:[e.jsx(Le,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:196:23",checked:k,onCheckedChange:()=>O(c)}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:200:23",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>o(c),children:[e.jsx(ft,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:201:25",className:"w-3 h-3 mr-1"}),"编辑"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:203:23",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400",onClick:()=>p(c),children:[e.jsx(vt,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:204:25",className:"w-3 h-3 mr-1"}),"删除"]})]})]})})},c.id)})}),e.jsx(It,{"code-path":"src/components/monitor/alert-center/SilenceRuleTab.tsx:216:7",open:h,onOpenChange:l,editingSilence:C,onSaved:v})]})},ir=()=>{const t=Oe(),[s,n]=a.useState(""),[u,g]=a.useState("all"),[h,l]=a.useState("all"),[C,b]=a.useState("alerts"),[v,f]=a.useState(null),[o,p]=a.useState(!1),[O,L]=a.useState(!1),[c,N]=a.useState(!1),[k,S]=a.useState(null),[z,x]=a.useState([]),[y,G]=a.useState([]),[qe,me]=a.useState(!1),[Fe,ve]=a.useState(null),[Be,de]=a.useState(!1),[Pe,Ae]=a.useState(null),[M,H]=a.useState(1),[pe]=a.useState(10),We=a.useMemo(()=>({page:M,page_size:pe,severity:u,status:h}),[M,pe,u,h]),{data:xe,isLoading:Ke,refetch:Ne}=Rt(We),{data:ye=[],refetch:we}=_t(),{ackMutation:Qe,resolveMutation:Je,quickSetupMutation:he,toggleAgentRuleMutation:Ve,deleteAgentRuleMutation:Ue}=Et(),ue=xe?.list??[],ge=xe?.total??0,q=xe?.stats??{firing:0,critical:0,warning:0,resolved:0},I=Math.max(1,Math.ceil(ge/pe));a.useEffect(()=>{C==="contacts"&&X(),C==="groups"&&(X(),Z())},[C]);const X=async()=>{try{const r=await R.getContacts();x(r?.data?.list||r?.list||[])}catch{}},Z=async()=>{try{const r=await R.getContactGroups();G(r?.data?.list||r?.list||[])}catch{}},be=async r=>{try{await Qe.mutateAsync(r),d.success("告警已确认")}catch{d.error("操作失败")}},Ye=async r=>{try{await Je.mutateAsync(r),d.success("告警已解决")}catch{d.error("操作失败")}},He=async(r,i)=>{try{const D=ue.find(ot=>ot.id===r),w=new Date,je=i.match(/^(\d+)([hd])$/),ke=je?parseInt(je[1]):1,nt=(je?.[2]||"h")==="d"?ke*24:ke,st=new Date(w.getTime()+nt*36e5);await E.createSilence({name:`静默: ${D?.title||r} (${i})`,description:`从告警列表快速静默 — ${D?.source||""}`,silence_type:"onetime",start_time:w.toISOString(),end_time:st.toISOString()}),d.success(`告警已静默 ${i}`),L(!1),Ne()}catch{d.error("操作失败")}},Xe=async(r,i)=>{try{await Ve.mutateAsync({id:Number(r),enabled:i}),d.success("规则状态已更新")}catch{d.error("更新失败")}},Ze=()=>{S(null),N(!0)},et=r=>{S(r),N(!0)},Se=()=>{N(!1),S(null)},tt=async()=>{if(await t({title:"一键报警",description:"为 Agent 在线主机创建 CPU(>80%)/内存(>80%)/磁盘(>90%)/TIME_WAIT(>15000)/CLOSE_WAIT(>200)/进程检测 6 条告警规则。",confirmText:"确认创建"}))try{const i=await he.mutateAsync("ecs");d.success(typeof i=="string"?i:i?.message||"默认告警规则创建成功")}catch{d.error("创建失败,请检查 Agent 主机是否在线")}},rt=async r=>{if(await t({title:"删除规则",description:`确定删除规则「${r.name}」?`,confirmText:"删除",variant:"destructive"}))try{await Ue.mutateAsync(Number(r.id)),d.success("已删除")}catch{d.error("删除失败")}},De=(r,i)=>{r==="severity"?g(i):l(i),H(1)};return e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:179:5",className:"space-y-3",children:[e.jsx(at,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:181:7",items:[{label:"触发中",value:q.firing,color:q.firing>0?"red":"muted"},{label:"严重",value:q.critical,color:"red"},{label:"警告",value:q.warning,color:"amber"},{label:"已解决",value:q.resolved,color:"emerald"}]}),e.jsxs(lt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:190:7",value:C,onValueChange:b,children:[e.jsxs(it,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:191:9",className:"grid w-full grid-cols-5 lg:w-[600px] h-9",children:[e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:192:11",value:"alerts",className:"text-xs",children:"告警列表"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:193:11",value:"rules",className:"text-xs",children:"告警规则"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:194:11",value:"silences",className:"text-xs",children:"静默规则"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:195:11",value:"contacts",className:"text-xs",children:"报警联系人"}),e.jsx(F,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:196:11",value:"groups",className:"text-xs",children:"报警联系组"})]}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:200:9",value:"alerts",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:201:11",className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:202:13",className:"flex items-center gap-2 flex-1 min-w-[280px]",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:203:15",className:"relative flex-1",children:[e.jsx(At,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:204:17",className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground"}),e.jsx(_,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:205:17",placeholder:"搜索告警...",value:s,onChange:r=>n(r.target.value),className:"pl-8 h-8 text-xs"})]}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:212:15",value:u,onValueChange:r=>De("severity",r),children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:213:17",className:"w-[100px] h-8 text-xs",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:214:19",placeholder:"级别"})}),e.jsxs(ce,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:216:17",children:[e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:217:19",value:"all",children:"全部级别"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:218:19",value:"critical",children:"严重"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:219:19",value:"warning",children:"警告"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:220:19",value:"info",children:"信息"})]})]}),e.jsxs(ne,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:223:15",value:h,onValueChange:r=>De("status",r),children:[e.jsx(se,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:224:17",className:"w-[100px] h-8 text-xs",children:e.jsx(oe,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:225:19",placeholder:"状态"})}),e.jsxs(ce,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:227:17",children:[e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:228:19",value:"all",children:"全部状态"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:229:19",value:"firing",children:"触发中"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:230:19",value:"acknowledged",children:"已确认"}),e.jsx(T,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:231:19",value:"resolved",children:"已解决"})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:235:13",className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:236:15",children:["共 ",ge," 条"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:237:15",variant:"outline",size:"sm",onClick:()=>Ne(),className:"h-7 text-xs px-2",children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:238:17",className:"w-3 h-3 mr-1"}),"刷新"]})]})]}),e.jsx(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:244:11",children:e.jsxs(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:245:13",className:"p-0",children:[e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:246:15",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:247:17",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:248:19",className:"bg-muted/50",children:e.jsxs("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:249:21",children:[e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:250:23",className:"px-3 py-2 text-left text-xs font-medium",children:"告警信息"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:251:23",className:"px-3 py-2 text-left text-xs font-medium w-16",children:"级别"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:252:23",className:"px-3 py-2 text-left text-xs font-medium w-16",children:"状态"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:253:23",className:"px-3 py-2 text-left text-xs font-medium w-24",children:"来源"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:254:23",className:"px-3 py-2 text-left text-xs font-medium w-20",children:"持续"}),e.jsx("th",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:255:23",className:"px-3 py-2 text-left text-xs font-medium w-28",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:258:19",className:"divide-y",children:Ke?e.jsx("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:260:23",children:e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:260:27",colSpan:6,className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"加载中..."})}):ue.length===0?e.jsx("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:262:23",children:e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:262:27",colSpan:6,className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"暂无告警"})}):ue.filter(r=>{if(!s)return!0;const i=s.toLowerCase();return r.title.toLowerCase().includes(i)||r.description.toLowerCase().includes(i)||r.source.toLowerCase().includes(i)}).map(r=>e.jsxs("tr",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:272:25",className:"hover:bg-muted/50",children:[e.jsxs("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:273:27",className:"px-3 py-2",children:[e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:274:29",className:"font-medium text-xs",children:r.title}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:275:29",className:"text-xs text-muted-foreground line-clamp-1",children:r.description}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:276:29",className:"flex gap-1 mt-0.5",children:Object.entries(r.labels).slice(0,2).map(([i,D])=>e.jsxs(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:278:33",variant:"outline",className:"text-[10px] px-1 py-0",children:[i,"=",D]},i))})]}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:282:27",className:"px-3 py-2",children:fe(r.severity)}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:283:27",className:"px-3 py-2",children:Dt(r.status)}),e.jsxs("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:284:27",className:"px-3 py-2 text-xs",children:[e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:285:29",children:r.source}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:286:29",className:"text-muted-foreground text-[10px]",children:r.service})]}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:288:27",className:"px-3 py-2 text-xs text-muted-foreground",children:r.status==="resolved"&&r.resolvedAt?`${Math.floor((new Date(r.resolvedAt).getTime()-new Date(r.startedAt).getTime())/6e4)}分`:`${Math.floor((Date.now()-new Date(r.startedAt).getTime())/6e4)}分`}),e.jsx("td",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:293:27",className:"px-3 py-2",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:294:29",className:"flex items-center gap-0.5",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:295:31",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{f(r),p(!0)},children:e.jsx(Nt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:297:33",className:"w-3.5 h-3.5"})}),r.status==="firing"&&e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:300:33",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>be(r.id),children:e.jsx(Ie,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:302:35",className:"w-3.5 h-3.5 text-blue-600"})}),(r.status==="firing"||r.status==="acknowledged")&&e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:306:33",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>Ye(r.id),children:e.jsx($e,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:308:35",className:"w-3.5 h-3.5 text-green-600"})}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:311:31",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{f(r),L(!0)},children:e.jsx(le,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:313:33",className:"w-3.5 h-3.5 text-orange-600"})})]})})]},r.id))})]})}),I>1&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:325:17",className:"flex items-center justify-between px-3 py-2 border-t text-xs",children:[e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:326:19",className:"text-muted-foreground",children:["第 ",M,"/",I," 页,共 ",ge," 条"]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:327:19",className:"flex items-center gap-1",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:328:21",variant:"outline",size:"sm",className:"h-7 text-xs px-2",disabled:M<=1,onClick:()=>H(r=>r-1),children:"上一页"}),Array.from({length:Math.min(I,5)},(r,i)=>{const w=Math.max(1,Math.min(M-2,I-4))+i;return w>I?null:e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:337:25",variant:w===M?"default":"outline",size:"sm",className:"h-7 min-w-[28px] text-xs px-1",onClick:()=>H(w),children:w},w)}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:344:21",variant:"outline",size:"sm",className:"h-7 text-xs px-2",disabled:M>=I,onClick:()=>H(r=>r+1),children:"下一页"})]})]})]})})]}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:356:9",value:"rules",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:357:11",className:"flex justify-between items-center",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:358:13",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:359:15",onClick:Ze,children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:360:17",className:"w-4 h-4 mr-1"}),"添加规则"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:362:15",variant:"secondary",onClick:tt,disabled:he.isPending,children:[e.jsx(yt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:363:17",className:"w-4 h-4 mr-1"}),he.isPending?"创建中…":"一键报警"]})]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:367:13",variant:"outline",onClick:()=>we(),children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:368:15",className:"w-4 h-4 mr-2"}),"刷新"]})]}),ye.length===0?e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:373:13",className:"text-center py-12 text-muted-foreground",children:[e.jsx(Me,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:374:15",className:"w-10 h-10 mx-auto mb-2 opacity-50"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:375:15",className:"text-sm",children:"暂无告警规则"}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:376:15",className:"text-xs mt-1",children:"点击「添加规则」或「一键报警」快速创建"})]}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:379:11",className:"grid grid-cols-1 gap-4",children:ye.map(r=>e.jsx(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:381:15",children:e.jsx(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:382:17",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:383:19",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:384:21",className:"flex-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:385:23",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:386:25",className:"font-medium",children:r.name}),fe(r.severity),e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:388:25",variant:r.enabled?"default":"secondary",children:r.enabled?"已启用":"已禁用"})]}),e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:392:23",className:"text-sm text-muted-foreground mb-2",children:r.description}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:393:23",className:"flex items-center gap-4 text-xs text-muted-foreground",children:[r.expression&&e.jsx("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:395:27",className:"font-mono bg-muted px-2 py-1 rounded",children:r.expression}),r.duration?e.jsxs("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:397:42",children:["持续 ",r.duration,"秒"]}):null]}),(()=>{let i=[];try{const D=r.notify_channels;D&&(i=Array.isArray(D)?D:JSON.parse(D))}catch{}return i.length?e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:407:27",className:"flex gap-1 mt-2",children:i.map(D=>e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:409:31",variant:"outline",className:"text-xs",children:D},D))}):null})()]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:415:21",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:416:23",variant:"ghost",size:"sm",onClick:()=>et(r),children:"编辑"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:417:23",variant:"ghost",size:"sm",className:"text-red-400",onClick:()=>rt(r),children:"删除"}),e.jsx(Le,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:418:23",checked:r.enabled,onCheckedChange:i=>Xe(String(r.id),i)})]})]})})},r.id))})]}),e.jsx(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:432:9",value:"silences",children:e.jsx(Bt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:433:11"})}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:437:9",value:"contacts",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:438:13",className:"flex justify-between items-center",children:[e.jsx("h3",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:439:15",className:"text-sm font-medium",children:"报警联系人"}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:440:15",size:"sm",onClick:()=>{ve(null),me(!0)},children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:441:17",className:"w-4 h-4 mr-1"}),"添加联系人"]})]}),z.length===0?e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:446:15",className:"text-center py-8 text-muted-foreground border border-dashed rounded-lg text-xs",children:"暂无报警联系人,点击「添加联系人」创建"}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:450:15",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:z.map(r=>e.jsxs(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:452:19",className:"hover:border-primary/50 transition-colors",children:[e.jsx(Te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:453:21",className:"pb-2",children:e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:454:23",className:"flex items-start justify-between",children:e.jsx(_e,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:455:25",className:"text-sm",children:r.name})})}),e.jsxs(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:458:21",className:"pt-0 space-y-1 text-xs text-muted-foreground",children:[r.phone&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:459:35",children:["📱 ",r.phone]}),r.email&&e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:460:35",children:["📧 ",r.email]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:461:23",className:"flex gap-1 flex-wrap",children:[r.channel_type&&e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:463:27",variant:"outline",className:"text-[10px]",children:kt(r.channel_type)}),r.webhook_url&&e.jsx("span",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:468:27",className:"text-[10px] text-muted-foreground truncate max-w-[200px]",title:r.webhook_url,children:r.webhook_url})]}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:473:23",className:"flex gap-1.5 pt-1.5",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:474:25",variant:"outline",size:"sm",className:"h-7 text-xs flex-1",onClick:()=>{ve(r),me(!0)},children:"编辑"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:478:25",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:async()=>{if(await t({title:"删除联系人",description:`确定删除「${r.name}」?`,confirmText:"删除",variant:"destructive"}))try{await R.deleteContact(r.id),d.success("已删除"),X()}catch{d.error("删除失败")}},children:"删除"})]})]})]},r.id))})]}),e.jsxs(B,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:496:9",value:"groups",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:497:11",className:"flex justify-between items-center",children:[e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:498:13",variant:"outline",onClick:Z,children:[e.jsx(te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:499:15",className:"w-4 h-4 mr-2"}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:502:13",onClick:()=>{Ae(null),de(!0)},children:[e.jsx(re,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:503:15",className:"w-4 h-4 mr-2"}),"添加联系组"]})]}),y.length===0?e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:508:13",className:"text-center py-16 text-muted-foreground border border-dashed rounded-lg",children:"暂无报警联系组,点击「添加联系组」创建"}):e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:512:13",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:y.map(r=>{let i=[];try{i=JSON.parse(r.contact_ids||"[]")}catch{}const D=z.filter(w=>i.includes(w.id)).map(w=>w.name);return e.jsxs(W,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:520:19",className:"hover:border-primary/50 transition-colors",children:[e.jsx(Te,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:521:21",children:e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:522:23",className:"flex items-start justify-between",children:[e.jsx(_e,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:523:25",className:"text-base",children:r.group_name}),e.jsxs(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:524:25",variant:"secondary",children:[i.length," 人"]})]})}),e.jsxs(K,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:527:21",className:"pt-0 space-y-2",children:[r.notes&&e.jsx("p",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:528:35",className:"text-sm text-muted-foreground",children:r.notes}),e.jsx("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:529:23",className:"flex flex-wrap gap-1",children:D.map(w=>e.jsx(A,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:531:27",variant:"outline",className:"text-xs",children:w},w))}),e.jsxs("div",{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:534:23",className:"flex gap-2 pt-2",children:[e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:535:25",variant:"outline",size:"sm",className:"flex-1",onClick:()=>{Ae(r),de(!0)},children:"编辑"}),e.jsx(m,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:539:25",variant:"outline",size:"sm",onClick:async()=>{if(await t({title:"删除联系组",description:`确定删除联系组「${r.group_name}」?`,confirmText:"删除",variant:"destructive"}))try{await R.deleteContactGroup(r.id),d.success("已删除"),Z()}catch{d.error("删除失败")}},children:"删除"})]})]})]},r.id)})})]})]}),e.jsx(Ot,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:558:7",alert:v,open:o,onOpenChange:p,onAcknowledge:be}),e.jsx(Lt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:564:7",alert:v,open:O,onOpenChange:L,onSilence:He}),e.jsx(wt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:570:7",open:c,onOpenChange:Se,editingRule:k,notifyChannels:[],onSaved:()=>{Se(),we()}}),e.jsx(zt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:577:7",open:qe,onOpenChange:me,editingContact:Fe,onSaved:X}),e.jsx(Gt,{"code-path":"src/components/monitor/alert-center/AlertCenter.tsx:583:7",open:Be,onOpenChange:de,editingGroup:Pe,contacts:z,onSaved:()=>{Z()}})]})};export{ir as default}; diff --git a/backend/static/assets/AlertManager-C0AXwvA2.js b/backend/static/assets/AlertManager-sFIXPw82.js similarity index 97% rename from backend/static/assets/AlertManager-C0AXwvA2.js rename to backend/static/assets/AlertManager-sFIXPw82.js index 698db02..898dc1a 100644 --- a/backend/static/assets/AlertManager-C0AXwvA2.js +++ b/backend/static/assets/AlertManager-sFIXPw82.js @@ -1 +1 @@ -import{r as l,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as w,a as M,b as ee,c as te,d as se}from"./card-B-RtdR4H.js";import{f as _,B as A,t as E,D as oe,a as ae,b as ne,c as re,d as ce,e as le}from"./index-LZWfu62c.js";import{T as ie,a as me,b as H,c as I}from"./tabs-kmtfM2I-.js";import{a as g}from"./alert-C4MMKcUL.js";import{I as Y}from"./input-BdDauX3U.js";import{B as f}from"./badge-B0F5ZNtn.js";import{T as $,a as Q,b as R,c as i,d as X,e as c}from"./table-BPFYQwjr.js";import{S as de,L as O,y as J,t as V,l as z,T as B,p as q,P as U,b as xe}from"./vendor-icons-Aso0-eeY.js";import{S as P}from"./switch-C4PJnJ9I.js";import{C as G}from"./checkbox-DL3onEGv.js";import{r as pe,g as he,C as K,A as ge}from"./AlertRuleDialog-BsJX7bok.js";import{L as D}from"./label-u-lNUbKh.js";import{T as be}from"./textarea-BdtIagjy.js";import{R as Ae,A as je,C as ue,X as Ne,Y as ve,T as fe,a as W}from"./AreaChart-Czgv4pNk.js";import"./index-CYARH0Cq.js";function Te({alerts:m,loading:T,onReload:d}){_();const[p,u]=l.useState(""),[o,h]=l.useState("all"),[b,C]=l.useState("all"),j=m.filter(t=>{const r=(t.rule&&t.rule.name||t.message||"").toLowerCase().includes(p.toLowerCase())||(t.target||"").toLowerCase().includes(p.toLowerCase()),N=o==="all"||t.severity===o,v=b==="all"||t.status===b;return r&&N&&v}),y=t=>{switch(t){case"critical":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:45:11",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[e.jsx(z,{"code-path":"src/components/monitor/AlertEventsTab.tsx:46:13",className:"h-3 w-3 mr-1"}),"严重"]});case"warning":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:52:11",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:[e.jsx(z,{"code-path":"src/components/monitor/AlertEventsTab.tsx:53:13",className:"h-3 w-3 mr-1"}),"警告"]});case"info":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:59:11",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:[e.jsx(V,{"code-path":"src/components/monitor/AlertEventsTab.tsx:60:13",className:"h-3 w-3 mr-1"}),"提示"]});default:return null}},a=t=>{switch(t){case"firing":return e.jsx(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:73:11",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10 animate-pulse",children:"触发中"});case"resolved":return e.jsx(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:79:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"已恢复"});default:return null}},x=async t=>{try{await g.acknowledge(t),d()}catch(r){console.error("Failed to acknowledge alert:",r)}};return e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:98:5",className:"mt-4 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:100:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:101:9",className:"relative w-64",children:[e.jsx(de,{"code-path":"src/components/monitor/AlertEventsTab.tsx:102:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(Y,{"code-path":"src/components/monitor/AlertEventsTab.tsx:103:11",placeholder:"搜索告警名称或目标...",value:p,onChange:t=>u(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs("select",{"code-path":"src/components/monitor/AlertEventsTab.tsx:110:9",value:o,onChange:t=>h(t.target.value),className:"h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:115:11",value:"all",children:"全部级别"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:116:11",value:"critical",children:"严重"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:117:11",value:"warning",children:"警告"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:118:11",value:"info",children:"提示"})]}),e.jsxs("select",{"code-path":"src/components/monitor/AlertEventsTab.tsx:120:9",value:b,onChange:t=>C(t.target.value),className:"h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:125:11",value:"all",children:"全部状态"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:126:11",value:"firing",children:"触发中"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:127:11",value:"resolved",children:"已恢复"})]})]}),e.jsx(w,{"code-path":"src/components/monitor/AlertEventsTab.tsx:132:7",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertEventsTab.tsx:133:9",className:"p-0",children:e.jsx("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:134:11",className:"border-t border-slate-800",children:e.jsxs($,{"code-path":"src/components/monitor/AlertEventsTab.tsx:135:13",children:[e.jsx(Q,{"code-path":"src/components/monitor/AlertEventsTab.tsx:136:15",children:e.jsxs(R,{"code-path":"src/components/monitor/AlertEventsTab.tsx:137:17",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:138:19",className:"text-slate-400",children:"级别"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:139:19",className:"text-slate-400",children:"告警名称"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:140:19",className:"text-slate-400",children:"状态"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:141:19",className:"text-slate-400",children:"目标"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:142:19",className:"text-slate-400",children:"当前值"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:143:19",className:"text-slate-400",children:"阈值"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:144:19",className:"text-slate-400",children:"开始时间"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:145:19",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(X,{"code-path":"src/components/monitor/AlertEventsTab.tsx:148:15",children:T?e.jsx(R,{"code-path":"src/components/monitor/AlertEventsTab.tsx:150:19",className:"border-slate-800",children:e.jsxs(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:151:21",colSpan:8,className:"text-center text-slate-500 py-8",children:[e.jsx(O,{"code-path":"src/components/monitor/AlertEventsTab.tsx:152:23",className:"h-5 w-5 animate-spin inline mr-2"}),"加载中..."]})}):j.map(t=>e.jsxs(R,{"code-path":"src/components/monitor/AlertEventsTab.tsx:157:19",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:158:21",children:y(t.severity)}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:159:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:160:23",className:"text-sm font-medium text-slate-200",children:t.rule&&t.rule.name||t.message})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:164:21",children:a(t.status)}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:165:21",className:"max-w-[160px]",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:166:23",className:"text-sm text-slate-300 block truncate",title:t.target,children:t.target})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:168:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:169:23",className:"text-sm text-slate-300",children:typeof t.value=="number"?t.value.toFixed(1):t.value})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:171:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:172:23",className:"text-sm text-slate-500",children:t.threshold})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:174:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:175:23",className:"text-sm text-slate-400",children:t.created_at?new Date(t.created_at).toLocaleString():"--"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:179:21",className:"text-right",children:e.jsx("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:180:23",className:"flex items-center justify-end gap-1",children:t.status==="firing"&&e.jsxs(A,{"code-path":"src/components/monitor/AlertEventsTab.tsx:182:27",variant:"ghost",size:"sm",className:"h-8 text-slate-400 hover:text-emerald-400",onClick:()=>x(t.id),children:[e.jsx(J,{"code-path":"src/components/monitor/AlertEventsTab.tsx:188:29",className:"h-4 w-4 mr-1"}),"确认"]})})})]},t.id))})]})})})})]})}const Ce=9;function ye({rules:m,notifyChannels:T,onReload:d,onEditRule:p}){const u=_(),[o,h]=l.useState([]),b=()=>{m.length>0&&o.length===m.length?h([]):h(m.map(t=>t.id))},C=t=>{h(r=>r.includes(t)?r.filter(N=>N!==t):[...r,t])},j=async t=>{if(await u({title:"删除告警规则",description:"确定删除此告警规则?",confirmText:"删除",variant:"destructive"}))try{await g.deleteRule(t),E.success("告警规则已删除"),d()}catch(N){console.error("Failed to delete rule:",N),E.error("删除失败")}},y=async()=>{if(!(o.length===0||!await u({title:"批量删除告警规则",description:`确定删除选中的 ${o.length} 条告警规则吗?此操作不可撤销。`,confirmText:"批量删除",variant:"destructive"})))try{await g.batchDeleteRules(o),E.success(`已删除 ${o.length} 条告警规则`),h([]),d()}catch(r){console.error("Failed to batch delete rules:",r),E.error("批量删除失败")}},a=async t=>{try{await g.toggleRule(t),d()}catch(r){console.error("Failed to toggle rule:",r)}},x=m.length>0&&o.length===m.length;return e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:104:5",className:"mt-4",children:[o.length>0&&e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:107:9",className:"flex items-center gap-2 mb-3",children:[e.jsxs("span",{"code-path":"src/components/monitor/AlertRulesTab.tsx:108:11",className:"text-sm text-slate-400",children:["已选择 ",o.length," 项"]}),e.jsxs(A,{"code-path":"src/components/monitor/AlertRulesTab.tsx:109:11",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:y,children:[e.jsx(B,{"code-path":"src/components/monitor/AlertRulesTab.tsx:115:13",className:"h-4 w-4 mr-2"}),"批量删除"]})]}),e.jsx(w,{"code-path":"src/components/monitor/AlertRulesTab.tsx:121:7",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertRulesTab.tsx:122:9",className:"p-0",children:e.jsx("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:123:11",className:"border-t border-slate-800",children:e.jsxs($,{"code-path":"src/components/monitor/AlertRulesTab.tsx:124:13",children:[e.jsx(Q,{"code-path":"src/components/monitor/AlertRulesTab.tsx:125:15",children:e.jsxs(R,{"code-path":"src/components/monitor/AlertRulesTab.tsx:126:17",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:127:19",className:"w-12",children:e.jsx(G,{"code-path":"src/components/monitor/AlertRulesTab.tsx:128:21",checked:x,onCheckedChange:b,className:"border-slate-600"})}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:134:19",className:"text-slate-400",children:"规则名称"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:135:19",className:"text-slate-400",children:"数据源"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:136:19",className:"text-slate-400",children:"触发条件"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:137:19",className:"text-slate-400",children:"级别"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:138:19",className:"text-slate-400",children:"持续时间"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:139:19",className:"text-slate-400",children:"通知渠道"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:140:19",className:"text-slate-400",children:"状态"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:141:19",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(X,{"code-path":"src/components/monitor/AlertRulesTab.tsx:144:15",children:m.length===0?e.jsx(R,{"code-path":"src/components/monitor/AlertRulesTab.tsx:146:19",className:"border-slate-800",children:e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:147:21",colSpan:Ce,className:"text-center text-slate-500 py-12",children:"暂无告警规则"})}):m.map(t=>e.jsxs(R,{"code-path":"src/components/monitor/AlertRulesTab.tsx:153:21",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:154:23",children:e.jsx(G,{"code-path":"src/components/monitor/AlertRulesTab.tsx:155:25",checked:o.includes(t.id),onCheckedChange:()=>C(t.id),className:"border-slate-600"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:161:23",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:162:25",children:[e.jsx("span",{"code-path":"src/components/monitor/AlertRulesTab.tsx:163:27",className:"text-sm font-medium text-slate-200",children:t.name}),t.description&&e.jsx("p",{"code-path":"src/components/monitor/AlertRulesTab.tsx:165:29",className:"text-xs text-slate-500",children:t.description})]})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:169:23",children:e.jsx("code",{"code-path":"src/components/monitor/AlertRulesTab.tsx:170:25",className:"text-xs text-slate-300 bg-slate-800 px-2 py-0.5 rounded",children:t.source||"--"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:174:23",className:"max-w-[180px]",children:e.jsx("code",{"code-path":"src/components/monitor/AlertRulesTab.tsx:175:25",className:"text-xs text-blue-300 block truncate",title:t.expression,children:t.expression||"--"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:179:23",children:t.severity==="critical"?e.jsx(f,{"code-path":"src/components/monitor/AlertRulesTab.tsx:181:27",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"严重"}):t.severity==="warning"?e.jsx(f,{"code-path":"src/components/monitor/AlertRulesTab.tsx:185:27",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:"警告"}):e.jsx(f,{"code-path":"src/components/monitor/AlertRulesTab.tsx:189:27",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:"提示"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:194:23",children:e.jsxs("span",{"code-path":"src/components/monitor/AlertRulesTab.tsx:195:25",className:"text-sm text-slate-300",children:[(t.duration||0)/60,"分钟"]})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:197:23",children:pe(t,T)}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:200:23",children:e.jsx(P,{"code-path":"src/components/monitor/AlertRulesTab.tsx:201:25",checked:!!t.enabled,className:"data-[state=checked]:bg-blue-600",onCheckedChange:()=>a(t.id)})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:207:23",className:"text-right",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:208:25",className:"flex items-center justify-end gap-1",children:[e.jsx(A,{"code-path":"src/components/monitor/AlertRulesTab.tsx:209:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>p(t),children:e.jsx(q,{"code-path":"src/components/monitor/AlertRulesTab.tsx:215:29",className:"h-4 w-4"})}),e.jsx(A,{"code-path":"src/components/monitor/AlertRulesTab.tsx:217:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>j(t.id),children:e.jsx(B,{"code-path":"src/components/monitor/AlertRulesTab.tsx:223:29",className:"h-4 w-4"})})]})})]},t.id))})]})})})})]})}const L={name:"",type:"dingtalk",config:"",enabled:!0};function we({open:m,onOpenChange:T,notifyChannels:d,onChannelsChanged:p}){const u=_(),[o,h]=l.useState(null),[b,C]=l.useState(!1),[j,y]=l.useState(null),[a,x]=l.useState({...L});l.useEffect(()=>{m&&(h(null),x({...L}))},[m]);const t=s=>{h(s),x({name:s.name||"",type:s.type||"dingtalk",config:s.config||"",enabled:s.enabled!==!1})},r=()=>{h(null),x({...L})},N=async()=>{if(a.name.trim()){C(!0);try{const s={name:a.name.trim(),type:a.type,config:a.config.trim()};o?await g.updateNotifyChannel(o.id,{...s,enabled:a.enabled}):await g.createNotifyChannel(s),r(),p()}catch(s){console.error("Failed to save notify channel:",s)}finally{C(!1)}}},v=async s=>{if(await u({title:"删除通知渠道",description:"确定删除此通知渠道?",confirmText:"删除",variant:"destructive"}))try{await g.deleteNotifyChannel(s),o&&o.id===s&&r(),p()}catch(n){console.error("Failed to delete notify channel:",n)}},k=async s=>{try{await g.updateNotifyChannel(s.id,{enabled:!s.enabled}),p()}catch(n){console.error("Failed to toggle notify channel:",n)}},S=async s=>{y(s);try{await g.testNotifyChannel(s),p()}catch(n){console.error("Failed to test notify channel:",n)}finally{y(null)}};return e.jsx(oe,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:119:5",open:m,onOpenChange:T,children:e.jsxs(ae,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:120:7",className:"bg-slate-900 border-slate-700 text-slate-100 max-w-2xl",children:[e.jsxs(ne,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:121:9",children:[e.jsx(re,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:122:11",className:"text-slate-100",children:"通知渠道配置"}),e.jsx(ce,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:123:11",className:"text-slate-500",children:"管理告警通知渠道(钉钉/企业微信/邮件/短信/Webhook),配置后可在告警规则中引用"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:128:9",className:"grid grid-cols-1 lg:grid-cols-2 gap-4 max-h-[65vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:130:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:131:13",className:"flex items-center justify-between",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:132:15",className:"text-slate-300 text-sm",children:"已配置渠道"}),e.jsxs(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:133:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 hover:bg-slate-800 text-xs",onClick:r,children:[e.jsx(U,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:139:17",className:"h-3 w-3 mr-1"}),"新建"]})]}),d.length===0?e.jsx("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:144:15",className:"text-center py-8 text-sm text-slate-600 border border-dashed border-slate-800 rounded-lg",children:"暂无通知渠道,请在右侧添加"}):e.jsx("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:148:15",className:"space-y-2",children:d.map(s=>e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:150:19",className:`p-3 rounded-lg border cursor-pointer transition-colors ${o&&o.id===s.id?"border-blue-500/50 bg-blue-500/5":"border-slate-800 bg-slate-800/30 hover:border-slate-700"}`,onClick:()=>t(s),children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:159:21",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:160:23",className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:161:25",className:"text-sm text-slate-200 truncate",children:s.name}),e.jsx(f,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:162:25",variant:"outline",className:"border-slate-600 text-slate-400 text-[10px] py-0",children:he(s.type)})]}),e.jsx(P,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:166:23",checked:s.enabled!==!1,onCheckedChange:()=>k(s),onClick:n=>n.stopPropagation(),className:"data-[state=checked]:bg-emerald-600 scale-90"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:173:21",className:"flex items-center justify-between mt-2",children:[s.test_status==="success"?e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:175:25",className:"text-[11px] text-emerald-400",children:"测试通过"}):e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:177:25",className:"text-[11px] text-slate-600",children:"未测试"}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:179:23",className:"flex items-center gap-1",onClick:n=>n.stopPropagation(),children:[e.jsx(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:180:25",size:"sm",variant:"ghost",className:"h-6 px-2 text-slate-400 hover:text-slate-200 hover:bg-slate-700 text-xs",disabled:j===s.id,onClick:()=>S(s.id),children:j===s.id?e.jsx(O,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:187:55",className:"h-3 w-3 animate-spin"}):"测试"}),e.jsx(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:189:25",size:"sm",variant:"ghost",className:"h-6 px-2 text-red-400/70 hover:text-red-400 hover:bg-red-500/10 text-xs",onClick:()=>v(s.id),children:e.jsx(B,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:195:27",className:"h-3 w-3"})})]})]})]},s.id))})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:206:11",className:"space-y-4",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:207:13",className:"text-slate-300 text-sm",children:o?"编辑渠道":"新建渠道"}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:210:13",className:"space-y-1.5",children:[e.jsxs(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:211:15",className:"text-slate-400 text-xs",children:["渠道名称 ",e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:211:62",className:"text-red-400",children:"*"})]}),e.jsx(Y,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:212:15",value:a.name,onChange:s=>x({...a,name:s.target.value}),placeholder:"如:运维告警群",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600 h-9"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:219:13",className:"space-y-1.5",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:220:15",className:"text-slate-400 text-xs",children:"渠道类型"}),e.jsx("select",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:221:15",value:a.type,onChange:s=>x({...a,type:s.target.value}),className:"w-full h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:K.map(({key:s,label:n})=>e.jsx("option",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:227:19",value:s,children:n},s))})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:231:13",className:"space-y-1.5",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:232:15",className:"text-slate-400 text-xs",children:"配置(JSON)"}),e.jsx(be,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:233:15",value:a.config,onChange:s=>x({...a,config:s.target.value}),placeholder:K.find(s=>s.key===a.type)?.placeholder||"",rows:5,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600 font-mono text-xs resize-none"})]}),o&&e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:242:15",className:"flex items-center gap-2",children:[e.jsx(P,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:243:17",checked:a.enabled,onCheckedChange:s=>x({...a,enabled:s}),className:"data-[state=checked]:bg-emerald-600"}),e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:248:17",className:"text-slate-400 text-xs",children:"启用此渠道"})]})]})]}),e.jsxs(le,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:254:9",children:[e.jsx(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:255:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:bg-slate-800",onClick:()=>T(!1),children:"关闭"}),e.jsxs(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:262:11",className:"bg-blue-600 hover:bg-blue-700 text-white",disabled:!a.name.trim()||b,onClick:N,children:[b&&e.jsx(O,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:267:31",className:"h-4 w-4 mr-2 animate-spin"}),o?"保存修改":"添加渠道"]})]})]})})}function Ke(){const[m,T]=l.useState("events"),[d,p]=l.useState([]),[u,o]=l.useState([]),[h,b]=l.useState(!0),[C,j]=l.useState(!1),[y,a]=l.useState(null),[x,t]=l.useState(!1),[r,N]=l.useState([]),v=async()=>{try{b(!0);const[n,F,Z]=await Promise.all([g.getAlerts(),g.getRules(),g.getNotifyChannels()]);p(n?.list||[]),o(F?.list||(Array.isArray(F)?F:[])),N(Z?.list||[])}catch(n){console.error("Failed to load alert data:",n)}finally{b(!1)}};l.useEffect(()=>{v()},[]);const k=()=>{a(null),j(!0)},S=n=>{a(n),j(!0)},s=[{time:"00:00",critical:2,warning:5,info:8},{time:"04:00",critical:1,warning:3,info:6},{time:"08:00",critical:3,warning:7,info:12},{time:"12:00",critical:5,warning:10,info:15},{time:"16:00",critical:4,warning:8,info:10},{time:"20:00",critical:3,warning:6,info:9},{time:"24:00",critical:2,warning:4,info:7}];return e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:75:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:77:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:78:9",children:[e.jsx("h1",{"code-path":"src/components/monitor/AlertManager.tsx:79:11",className:"text-2xl font-bold text-slate-100",children:"监控告警"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:80:11",className:"text-sm text-slate-500 mt-1",children:"告警规则管理与告警事件处理"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:82:9",className:"flex items-center gap-2",children:[e.jsxs(A,{"code-path":"src/components/monitor/AlertManager.tsx:83:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>t(!0),children:[e.jsx(q,{"code-path":"src/components/monitor/AlertManager.tsx:88:13",className:"h-4 w-4 mr-2"}),"通知配置"]}),e.jsxs(A,{"code-path":"src/components/monitor/AlertManager.tsx:91:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:k,children:[e.jsx(U,{"code-path":"src/components/monitor/AlertManager.tsx:92:13",className:"h-4 w-4 mr-2"}),"新建规则"]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:99:7",className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:100:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:101:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:102:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:103:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:104:17",className:"text-sm text-slate-500",children:"告警规则"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:105:17",className:"text-2xl font-bold text-slate-100",children:u.length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:107:15",className:"p-3 rounded-lg bg-blue-500/10 text-blue-400",children:e.jsx(V,{"code-path":"src/components/monitor/AlertManager.tsx:108:17",className:"h-5 w-5"})})]})})}),e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:113:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:114:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:115:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:116:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:117:17",className:"text-sm text-slate-500",children:"触发中"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:118:17",className:"text-2xl font-bold text-red-400",children:d.filter(n=>n.status==="firing").length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:122:15",className:"p-3 rounded-lg bg-red-500/10 text-red-400",children:e.jsx(z,{"code-path":"src/components/monitor/AlertManager.tsx:123:17",className:"h-5 w-5"})})]})})}),e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:128:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:129:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:130:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:131:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:132:17",className:"text-sm text-slate-500",children:"今日告警"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:133:17",className:"text-2xl font-bold text-amber-400",children:d.length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:135:15",className:"p-3 rounded-lg bg-amber-500/10 text-amber-400",children:e.jsx(xe,{"code-path":"src/components/monitor/AlertManager.tsx:136:17",className:"h-5 w-5"})})]})})}),e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:141:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:142:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:143:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:144:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:145:17",className:"text-sm text-slate-500",children:"已恢复"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:146:17",className:"text-2xl font-bold text-emerald-400",children:d.filter(n=>n.status==="resolved").length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:150:15",className:"p-3 rounded-lg bg-emerald-500/10 text-emerald-400",children:e.jsx(J,{"code-path":"src/components/monitor/AlertManager.tsx:151:17",className:"h-5 w-5"})})]})})})]}),e.jsxs(w,{"code-path":"src/components/monitor/AlertManager.tsx:159:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ee,{"code-path":"src/components/monitor/AlertManager.tsx:160:9",className:"pb-2",children:[e.jsx(te,{"code-path":"src/components/monitor/AlertManager.tsx:161:11",className:"text-slate-100",children:"告警趋势"}),e.jsx(se,{"code-path":"src/components/monitor/AlertManager.tsx:162:11",className:"text-slate-500",children:"过去24小时告警统计"})]}),e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:164:9",children:e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:165:11",className:"h-[200px]",children:e.jsx(Ae,{"code-path":"src/components/monitor/AlertManager.tsx:166:13",width:"100%",height:"100%",children:e.jsxs(je,{"code-path":"src/components/monitor/AlertManager.tsx:167:15",data:s,children:[e.jsxs("defs",{"code-path":"src/components/monitor/AlertManager.tsx:168:17",children:[e.jsxs("linearGradient",{"code-path":"src/components/monitor/AlertManager.tsx:169:19",id:"colorCritical",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:170:21",offset:"5%",stopColor:"#ef4444",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:171:21",offset:"95%",stopColor:"#ef4444",stopOpacity:0})]}),e.jsxs("linearGradient",{"code-path":"src/components/monitor/AlertManager.tsx:173:19",id:"colorWarning",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:174:21",offset:"5%",stopColor:"#f59e0b",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:175:21",offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),e.jsx(ue,{"code-path":"src/components/monitor/AlertManager.tsx:178:17",strokeDasharray:"3 3",stroke:"#1e293b"}),e.jsx(Ne,{"code-path":"src/components/monitor/AlertManager.tsx:179:17",dataKey:"time",stroke:"#475569",fontSize:12}),e.jsx(ve,{"code-path":"src/components/monitor/AlertManager.tsx:180:17",stroke:"#475569",fontSize:12}),e.jsx(fe,{"code-path":"src/components/monitor/AlertManager.tsx:181:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"6px",color:"#f8fafc"}}),e.jsx(W,{"code-path":"src/components/monitor/AlertManager.tsx:189:17",type:"monotone",dataKey:"critical",stroke:"#ef4444",fillOpacity:1,fill:"url(#colorCritical)",name:"严重"}),e.jsx(W,{"code-path":"src/components/monitor/AlertManager.tsx:197:17",type:"monotone",dataKey:"warning",stroke:"#f59e0b",fillOpacity:1,fill:"url(#colorWarning)",name:"警告"})]})})})})]}),e.jsxs(ie,{"code-path":"src/components/monitor/AlertManager.tsx:212:7",value:m,onValueChange:T,className:"w-full",children:[e.jsxs(me,{"code-path":"src/components/monitor/AlertManager.tsx:213:9",className:"bg-slate-800 border border-slate-700",children:[e.jsx(H,{"code-path":"src/components/monitor/AlertManager.tsx:214:11",value:"events",className:"data-[state=active]:bg-slate-700",children:"告警事件"}),e.jsx(H,{"code-path":"src/components/monitor/AlertManager.tsx:217:11",value:"rules",className:"data-[state=active]:bg-slate-700",children:"告警规则"})]}),e.jsx(I,{"code-path":"src/components/monitor/AlertManager.tsx:223:9",value:"events",children:e.jsx(Te,{"code-path":"src/components/monitor/AlertManager.tsx:224:11",alerts:d,loading:h,onReload:v})}),e.jsx(I,{"code-path":"src/components/monitor/AlertManager.tsx:227:9",value:"rules",children:e.jsx(ye,{"code-path":"src/components/monitor/AlertManager.tsx:228:11",rules:u,notifyChannels:r,onReload:v,onEditRule:S})})]}),e.jsx(ge,{"code-path":"src/components/monitor/AlertManager.tsx:239:7",open:C,onOpenChange:j,editingRule:y,notifyChannels:r,onSaved:v}),e.jsx(we,{"code-path":"src/components/monitor/AlertManager.tsx:246:7",open:x,onOpenChange:t,notifyChannels:r,onChannelsChanged:v})]})}export{Ke as AlertManager}; +import{r as l,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as w,a as M,b as ee,c as te,d as se}from"./card-BHSBTtub.js";import{f as _,B as A,t as E,D as oe,a as ae,b as ne,c as re,d as ce,e as le}from"./index-Bp-M7P_8.js";import{T as ie,a as me,b as H,c as I}from"./tabs-DbNlmoQJ.js";import{a as g}from"./alert-CRDraqCb.js";import{I as Y}from"./input-Bnlm--la.js";import{B as f}from"./badge-B00SZHvE.js";import{T as $,a as Q,b as R,c as i,d as X,e as c}from"./table-u8V9iTZf.js";import{S as de,L as O,y as J,t as V,l as z,T as B,p as q,P as U,b as xe}from"./vendor-icons-BWk-DH7F.js";import{S as P}from"./switch-CEwFnSNV.js";import{C as G}from"./checkbox-Bsb-ZRm9.js";import{r as pe,g as he,C as K,A as ge}from"./AlertRuleDialog-B0UIHsEi.js";import{L as D}from"./label-NkONM5Mp.js";import{T as be}from"./textarea-BvOVhaCD.js";import{R as Ae,A as je,C as ue,X as Ne,Y as ve,T as fe,a as W}from"./AreaChart-B_pR5s1C.js";import"./index-5FEebgvX.js";function Te({alerts:m,loading:T,onReload:d}){_();const[p,u]=l.useState(""),[o,h]=l.useState("all"),[b,C]=l.useState("all"),j=m.filter(t=>{const r=(t.rule&&t.rule.name||t.message||"").toLowerCase().includes(p.toLowerCase())||(t.target||"").toLowerCase().includes(p.toLowerCase()),N=o==="all"||t.severity===o,v=b==="all"||t.status===b;return r&&N&&v}),y=t=>{switch(t){case"critical":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:45:11",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[e.jsx(z,{"code-path":"src/components/monitor/AlertEventsTab.tsx:46:13",className:"h-3 w-3 mr-1"}),"严重"]});case"warning":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:52:11",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:[e.jsx(z,{"code-path":"src/components/monitor/AlertEventsTab.tsx:53:13",className:"h-3 w-3 mr-1"}),"警告"]});case"info":return e.jsxs(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:59:11",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:[e.jsx(V,{"code-path":"src/components/monitor/AlertEventsTab.tsx:60:13",className:"h-3 w-3 mr-1"}),"提示"]});default:return null}},a=t=>{switch(t){case"firing":return e.jsx(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:73:11",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10 animate-pulse",children:"触发中"});case"resolved":return e.jsx(f,{"code-path":"src/components/monitor/AlertEventsTab.tsx:79:11",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"已恢复"});default:return null}},x=async t=>{try{await g.acknowledge(t),d()}catch(r){console.error("Failed to acknowledge alert:",r)}};return e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:98:5",className:"mt-4 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:100:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:101:9",className:"relative w-64",children:[e.jsx(de,{"code-path":"src/components/monitor/AlertEventsTab.tsx:102:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(Y,{"code-path":"src/components/monitor/AlertEventsTab.tsx:103:11",placeholder:"搜索告警名称或目标...",value:p,onChange:t=>u(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs("select",{"code-path":"src/components/monitor/AlertEventsTab.tsx:110:9",value:o,onChange:t=>h(t.target.value),className:"h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:115:11",value:"all",children:"全部级别"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:116:11",value:"critical",children:"严重"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:117:11",value:"warning",children:"警告"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:118:11",value:"info",children:"提示"})]}),e.jsxs("select",{"code-path":"src/components/monitor/AlertEventsTab.tsx:120:9",value:b,onChange:t=>C(t.target.value),className:"h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:[e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:125:11",value:"all",children:"全部状态"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:126:11",value:"firing",children:"触发中"}),e.jsx("option",{"code-path":"src/components/monitor/AlertEventsTab.tsx:127:11",value:"resolved",children:"已恢复"})]})]}),e.jsx(w,{"code-path":"src/components/monitor/AlertEventsTab.tsx:132:7",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertEventsTab.tsx:133:9",className:"p-0",children:e.jsx("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:134:11",className:"border-t border-slate-800",children:e.jsxs($,{"code-path":"src/components/monitor/AlertEventsTab.tsx:135:13",children:[e.jsx(Q,{"code-path":"src/components/monitor/AlertEventsTab.tsx:136:15",children:e.jsxs(R,{"code-path":"src/components/monitor/AlertEventsTab.tsx:137:17",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:138:19",className:"text-slate-400",children:"级别"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:139:19",className:"text-slate-400",children:"告警名称"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:140:19",className:"text-slate-400",children:"状态"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:141:19",className:"text-slate-400",children:"目标"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:142:19",className:"text-slate-400",children:"当前值"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:143:19",className:"text-slate-400",children:"阈值"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:144:19",className:"text-slate-400",children:"开始时间"}),e.jsx(i,{"code-path":"src/components/monitor/AlertEventsTab.tsx:145:19",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(X,{"code-path":"src/components/monitor/AlertEventsTab.tsx:148:15",children:T?e.jsx(R,{"code-path":"src/components/monitor/AlertEventsTab.tsx:150:19",className:"border-slate-800",children:e.jsxs(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:151:21",colSpan:8,className:"text-center text-slate-500 py-8",children:[e.jsx(O,{"code-path":"src/components/monitor/AlertEventsTab.tsx:152:23",className:"h-5 w-5 animate-spin inline mr-2"}),"加载中..."]})}):j.map(t=>e.jsxs(R,{"code-path":"src/components/monitor/AlertEventsTab.tsx:157:19",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:158:21",children:y(t.severity)}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:159:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:160:23",className:"text-sm font-medium text-slate-200",children:t.rule&&t.rule.name||t.message})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:164:21",children:a(t.status)}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:165:21",className:"max-w-[160px]",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:166:23",className:"text-sm text-slate-300 block truncate",title:t.target,children:t.target})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:168:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:169:23",className:"text-sm text-slate-300",children:typeof t.value=="number"?t.value.toFixed(1):t.value})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:171:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:172:23",className:"text-sm text-slate-500",children:t.threshold})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:174:21",children:e.jsx("span",{"code-path":"src/components/monitor/AlertEventsTab.tsx:175:23",className:"text-sm text-slate-400",children:t.created_at?new Date(t.created_at).toLocaleString():"--"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertEventsTab.tsx:179:21",className:"text-right",children:e.jsx("div",{"code-path":"src/components/monitor/AlertEventsTab.tsx:180:23",className:"flex items-center justify-end gap-1",children:t.status==="firing"&&e.jsxs(A,{"code-path":"src/components/monitor/AlertEventsTab.tsx:182:27",variant:"ghost",size:"sm",className:"h-8 text-slate-400 hover:text-emerald-400",onClick:()=>x(t.id),children:[e.jsx(J,{"code-path":"src/components/monitor/AlertEventsTab.tsx:188:29",className:"h-4 w-4 mr-1"}),"确认"]})})})]},t.id))})]})})})})]})}const Ce=9;function ye({rules:m,notifyChannels:T,onReload:d,onEditRule:p}){const u=_(),[o,h]=l.useState([]),b=()=>{m.length>0&&o.length===m.length?h([]):h(m.map(t=>t.id))},C=t=>{h(r=>r.includes(t)?r.filter(N=>N!==t):[...r,t])},j=async t=>{if(await u({title:"删除告警规则",description:"确定删除此告警规则?",confirmText:"删除",variant:"destructive"}))try{await g.deleteRule(t),E.success("告警规则已删除"),d()}catch(N){console.error("Failed to delete rule:",N),E.error("删除失败")}},y=async()=>{if(!(o.length===0||!await u({title:"批量删除告警规则",description:`确定删除选中的 ${o.length} 条告警规则吗?此操作不可撤销。`,confirmText:"批量删除",variant:"destructive"})))try{await g.batchDeleteRules(o),E.success(`已删除 ${o.length} 条告警规则`),h([]),d()}catch(r){console.error("Failed to batch delete rules:",r),E.error("批量删除失败")}},a=async t=>{try{await g.toggleRule(t),d()}catch(r){console.error("Failed to toggle rule:",r)}},x=m.length>0&&o.length===m.length;return e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:104:5",className:"mt-4",children:[o.length>0&&e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:107:9",className:"flex items-center gap-2 mb-3",children:[e.jsxs("span",{"code-path":"src/components/monitor/AlertRulesTab.tsx:108:11",className:"text-sm text-slate-400",children:["已选择 ",o.length," 项"]}),e.jsxs(A,{"code-path":"src/components/monitor/AlertRulesTab.tsx:109:11",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:y,children:[e.jsx(B,{"code-path":"src/components/monitor/AlertRulesTab.tsx:115:13",className:"h-4 w-4 mr-2"}),"批量删除"]})]}),e.jsx(w,{"code-path":"src/components/monitor/AlertRulesTab.tsx:121:7",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertRulesTab.tsx:122:9",className:"p-0",children:e.jsx("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:123:11",className:"border-t border-slate-800",children:e.jsxs($,{"code-path":"src/components/monitor/AlertRulesTab.tsx:124:13",children:[e.jsx(Q,{"code-path":"src/components/monitor/AlertRulesTab.tsx:125:15",children:e.jsxs(R,{"code-path":"src/components/monitor/AlertRulesTab.tsx:126:17",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:127:19",className:"w-12",children:e.jsx(G,{"code-path":"src/components/monitor/AlertRulesTab.tsx:128:21",checked:x,onCheckedChange:b,className:"border-slate-600"})}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:134:19",className:"text-slate-400",children:"规则名称"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:135:19",className:"text-slate-400",children:"数据源"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:136:19",className:"text-slate-400",children:"触发条件"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:137:19",className:"text-slate-400",children:"级别"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:138:19",className:"text-slate-400",children:"持续时间"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:139:19",className:"text-slate-400",children:"通知渠道"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:140:19",className:"text-slate-400",children:"状态"}),e.jsx(i,{"code-path":"src/components/monitor/AlertRulesTab.tsx:141:19",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(X,{"code-path":"src/components/monitor/AlertRulesTab.tsx:144:15",children:m.length===0?e.jsx(R,{"code-path":"src/components/monitor/AlertRulesTab.tsx:146:19",className:"border-slate-800",children:e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:147:21",colSpan:Ce,className:"text-center text-slate-500 py-12",children:"暂无告警规则"})}):m.map(t=>e.jsxs(R,{"code-path":"src/components/monitor/AlertRulesTab.tsx:153:21",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:154:23",children:e.jsx(G,{"code-path":"src/components/monitor/AlertRulesTab.tsx:155:25",checked:o.includes(t.id),onCheckedChange:()=>C(t.id),className:"border-slate-600"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:161:23",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:162:25",children:[e.jsx("span",{"code-path":"src/components/monitor/AlertRulesTab.tsx:163:27",className:"text-sm font-medium text-slate-200",children:t.name}),t.description&&e.jsx("p",{"code-path":"src/components/monitor/AlertRulesTab.tsx:165:29",className:"text-xs text-slate-500",children:t.description})]})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:169:23",children:e.jsx("code",{"code-path":"src/components/monitor/AlertRulesTab.tsx:170:25",className:"text-xs text-slate-300 bg-slate-800 px-2 py-0.5 rounded",children:t.source||"--"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:174:23",className:"max-w-[180px]",children:e.jsx("code",{"code-path":"src/components/monitor/AlertRulesTab.tsx:175:25",className:"text-xs text-blue-300 block truncate",title:t.expression,children:t.expression||"--"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:179:23",children:t.severity==="critical"?e.jsx(f,{"code-path":"src/components/monitor/AlertRulesTab.tsx:181:27",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"严重"}):t.severity==="warning"?e.jsx(f,{"code-path":"src/components/monitor/AlertRulesTab.tsx:185:27",variant:"outline",className:"border-amber-500/30 text-amber-400 bg-amber-500/10",children:"警告"}):e.jsx(f,{"code-path":"src/components/monitor/AlertRulesTab.tsx:189:27",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:"提示"})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:194:23",children:e.jsxs("span",{"code-path":"src/components/monitor/AlertRulesTab.tsx:195:25",className:"text-sm text-slate-300",children:[(t.duration||0)/60,"分钟"]})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:197:23",children:pe(t,T)}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:200:23",children:e.jsx(P,{"code-path":"src/components/monitor/AlertRulesTab.tsx:201:25",checked:!!t.enabled,className:"data-[state=checked]:bg-blue-600",onCheckedChange:()=>a(t.id)})}),e.jsx(c,{"code-path":"src/components/monitor/AlertRulesTab.tsx:207:23",className:"text-right",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertRulesTab.tsx:208:25",className:"flex items-center justify-end gap-1",children:[e.jsx(A,{"code-path":"src/components/monitor/AlertRulesTab.tsx:209:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>p(t),children:e.jsx(q,{"code-path":"src/components/monitor/AlertRulesTab.tsx:215:29",className:"h-4 w-4"})}),e.jsx(A,{"code-path":"src/components/monitor/AlertRulesTab.tsx:217:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>j(t.id),children:e.jsx(B,{"code-path":"src/components/monitor/AlertRulesTab.tsx:223:29",className:"h-4 w-4"})})]})})]},t.id))})]})})})})]})}const L={name:"",type:"dingtalk",config:"",enabled:!0};function we({open:m,onOpenChange:T,notifyChannels:d,onChannelsChanged:p}){const u=_(),[o,h]=l.useState(null),[b,C]=l.useState(!1),[j,y]=l.useState(null),[a,x]=l.useState({...L});l.useEffect(()=>{m&&(h(null),x({...L}))},[m]);const t=s=>{h(s),x({name:s.name||"",type:s.type||"dingtalk",config:s.config||"",enabled:s.enabled!==!1})},r=()=>{h(null),x({...L})},N=async()=>{if(a.name.trim()){C(!0);try{const s={name:a.name.trim(),type:a.type,config:a.config.trim()};o?await g.updateNotifyChannel(o.id,{...s,enabled:a.enabled}):await g.createNotifyChannel(s),r(),p()}catch(s){console.error("Failed to save notify channel:",s)}finally{C(!1)}}},v=async s=>{if(await u({title:"删除通知渠道",description:"确定删除此通知渠道?",confirmText:"删除",variant:"destructive"}))try{await g.deleteNotifyChannel(s),o&&o.id===s&&r(),p()}catch(n){console.error("Failed to delete notify channel:",n)}},k=async s=>{try{await g.updateNotifyChannel(s.id,{enabled:!s.enabled}),p()}catch(n){console.error("Failed to toggle notify channel:",n)}},S=async s=>{y(s);try{await g.testNotifyChannel(s),p()}catch(n){console.error("Failed to test notify channel:",n)}finally{y(null)}};return e.jsx(oe,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:119:5",open:m,onOpenChange:T,children:e.jsxs(ae,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:120:7",className:"bg-slate-900 border-slate-700 text-slate-100 max-w-2xl",children:[e.jsxs(ne,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:121:9",children:[e.jsx(re,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:122:11",className:"text-slate-100",children:"通知渠道配置"}),e.jsx(ce,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:123:11",className:"text-slate-500",children:"管理告警通知渠道(钉钉/企业微信/邮件/短信/Webhook),配置后可在告警规则中引用"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:128:9",className:"grid grid-cols-1 lg:grid-cols-2 gap-4 max-h-[65vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:130:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:131:13",className:"flex items-center justify-between",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:132:15",className:"text-slate-300 text-sm",children:"已配置渠道"}),e.jsxs(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:133:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 hover:bg-slate-800 text-xs",onClick:r,children:[e.jsx(U,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:139:17",className:"h-3 w-3 mr-1"}),"新建"]})]}),d.length===0?e.jsx("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:144:15",className:"text-center py-8 text-sm text-slate-600 border border-dashed border-slate-800 rounded-lg",children:"暂无通知渠道,请在右侧添加"}):e.jsx("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:148:15",className:"space-y-2",children:d.map(s=>e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:150:19",className:`p-3 rounded-lg border cursor-pointer transition-colors ${o&&o.id===s.id?"border-blue-500/50 bg-blue-500/5":"border-slate-800 bg-slate-800/30 hover:border-slate-700"}`,onClick:()=>t(s),children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:159:21",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:160:23",className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:161:25",className:"text-sm text-slate-200 truncate",children:s.name}),e.jsx(f,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:162:25",variant:"outline",className:"border-slate-600 text-slate-400 text-[10px] py-0",children:he(s.type)})]}),e.jsx(P,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:166:23",checked:s.enabled!==!1,onCheckedChange:()=>k(s),onClick:n=>n.stopPropagation(),className:"data-[state=checked]:bg-emerald-600 scale-90"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:173:21",className:"flex items-center justify-between mt-2",children:[s.test_status==="success"?e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:175:25",className:"text-[11px] text-emerald-400",children:"测试通过"}):e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:177:25",className:"text-[11px] text-slate-600",children:"未测试"}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:179:23",className:"flex items-center gap-1",onClick:n=>n.stopPropagation(),children:[e.jsx(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:180:25",size:"sm",variant:"ghost",className:"h-6 px-2 text-slate-400 hover:text-slate-200 hover:bg-slate-700 text-xs",disabled:j===s.id,onClick:()=>S(s.id),children:j===s.id?e.jsx(O,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:187:55",className:"h-3 w-3 animate-spin"}):"测试"}),e.jsx(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:189:25",size:"sm",variant:"ghost",className:"h-6 px-2 text-red-400/70 hover:text-red-400 hover:bg-red-500/10 text-xs",onClick:()=>v(s.id),children:e.jsx(B,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:195:27",className:"h-3 w-3"})})]})]})]},s.id))})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:206:11",className:"space-y-4",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:207:13",className:"text-slate-300 text-sm",children:o?"编辑渠道":"新建渠道"}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:210:13",className:"space-y-1.5",children:[e.jsxs(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:211:15",className:"text-slate-400 text-xs",children:["渠道名称 ",e.jsx("span",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:211:62",className:"text-red-400",children:"*"})]}),e.jsx(Y,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:212:15",value:a.name,onChange:s=>x({...a,name:s.target.value}),placeholder:"如:运维告警群",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600 h-9"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:219:13",className:"space-y-1.5",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:220:15",className:"text-slate-400 text-xs",children:"渠道类型"}),e.jsx("select",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:221:15",value:a.type,onChange:s=>x({...a,type:s.target.value}),className:"w-full h-9 px-3 rounded-md bg-slate-800/50 border border-slate-700 text-slate-200 text-sm",children:K.map(({key:s,label:n})=>e.jsx("option",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:227:19",value:s,children:n},s))})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:231:13",className:"space-y-1.5",children:[e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:232:15",className:"text-slate-400 text-xs",children:"配置(JSON)"}),e.jsx(be,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:233:15",value:a.config,onChange:s=>x({...a,config:s.target.value}),placeholder:K.find(s=>s.key===a.type)?.placeholder||"",rows:5,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600 font-mono text-xs resize-none"})]}),o&&e.jsxs("div",{"code-path":"src/components/monitor/AlertChannelDialog.tsx:242:15",className:"flex items-center gap-2",children:[e.jsx(P,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:243:17",checked:a.enabled,onCheckedChange:s=>x({...a,enabled:s}),className:"data-[state=checked]:bg-emerald-600"}),e.jsx(D,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:248:17",className:"text-slate-400 text-xs",children:"启用此渠道"})]})]})]}),e.jsxs(le,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:254:9",children:[e.jsx(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:255:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:bg-slate-800",onClick:()=>T(!1),children:"关闭"}),e.jsxs(A,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:262:11",className:"bg-blue-600 hover:bg-blue-700 text-white",disabled:!a.name.trim()||b,onClick:N,children:[b&&e.jsx(O,{"code-path":"src/components/monitor/AlertChannelDialog.tsx:267:31",className:"h-4 w-4 mr-2 animate-spin"}),o?"保存修改":"添加渠道"]})]})]})})}function Ke(){const[m,T]=l.useState("events"),[d,p]=l.useState([]),[u,o]=l.useState([]),[h,b]=l.useState(!0),[C,j]=l.useState(!1),[y,a]=l.useState(null),[x,t]=l.useState(!1),[r,N]=l.useState([]),v=async()=>{try{b(!0);const[n,F,Z]=await Promise.all([g.getAlerts(),g.getRules(),g.getNotifyChannels()]);p(n?.list||[]),o(F?.list||(Array.isArray(F)?F:[])),N(Z?.list||[])}catch(n){console.error("Failed to load alert data:",n)}finally{b(!1)}};l.useEffect(()=>{v()},[]);const k=()=>{a(null),j(!0)},S=n=>{a(n),j(!0)},s=[{time:"00:00",critical:2,warning:5,info:8},{time:"04:00",critical:1,warning:3,info:6},{time:"08:00",critical:3,warning:7,info:12},{time:"12:00",critical:5,warning:10,info:15},{time:"16:00",critical:4,warning:8,info:10},{time:"20:00",critical:3,warning:6,info:9},{time:"24:00",critical:2,warning:4,info:7}];return e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:75:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:77:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:78:9",children:[e.jsx("h1",{"code-path":"src/components/monitor/AlertManager.tsx:79:11",className:"text-2xl font-bold text-slate-100",children:"监控告警"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:80:11",className:"text-sm text-slate-500 mt-1",children:"告警规则管理与告警事件处理"})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:82:9",className:"flex items-center gap-2",children:[e.jsxs(A,{"code-path":"src/components/monitor/AlertManager.tsx:83:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>t(!0),children:[e.jsx(q,{"code-path":"src/components/monitor/AlertManager.tsx:88:13",className:"h-4 w-4 mr-2"}),"通知配置"]}),e.jsxs(A,{"code-path":"src/components/monitor/AlertManager.tsx:91:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:k,children:[e.jsx(U,{"code-path":"src/components/monitor/AlertManager.tsx:92:13",className:"h-4 w-4 mr-2"}),"新建规则"]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:99:7",className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:100:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:101:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:102:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:103:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:104:17",className:"text-sm text-slate-500",children:"告警规则"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:105:17",className:"text-2xl font-bold text-slate-100",children:u.length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:107:15",className:"p-3 rounded-lg bg-blue-500/10 text-blue-400",children:e.jsx(V,{"code-path":"src/components/monitor/AlertManager.tsx:108:17",className:"h-5 w-5"})})]})})}),e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:113:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:114:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:115:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:116:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:117:17",className:"text-sm text-slate-500",children:"触发中"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:118:17",className:"text-2xl font-bold text-red-400",children:d.filter(n=>n.status==="firing").length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:122:15",className:"p-3 rounded-lg bg-red-500/10 text-red-400",children:e.jsx(z,{"code-path":"src/components/monitor/AlertManager.tsx:123:17",className:"h-5 w-5"})})]})})}),e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:128:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:129:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:130:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:131:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:132:17",className:"text-sm text-slate-500",children:"今日告警"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:133:17",className:"text-2xl font-bold text-amber-400",children:d.length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:135:15",className:"p-3 rounded-lg bg-amber-500/10 text-amber-400",children:e.jsx(xe,{"code-path":"src/components/monitor/AlertManager.tsx:136:17",className:"h-5 w-5"})})]})})}),e.jsx(w,{"code-path":"src/components/monitor/AlertManager.tsx:141:9",className:"bg-slate-900 border-slate-800",children:e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:142:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:143:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/AlertManager.tsx:144:15",children:[e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:145:17",className:"text-sm text-slate-500",children:"已恢复"}),e.jsx("p",{"code-path":"src/components/monitor/AlertManager.tsx:146:17",className:"text-2xl font-bold text-emerald-400",children:d.filter(n=>n.status==="resolved").length})]}),e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:150:15",className:"p-3 rounded-lg bg-emerald-500/10 text-emerald-400",children:e.jsx(J,{"code-path":"src/components/monitor/AlertManager.tsx:151:17",className:"h-5 w-5"})})]})})})]}),e.jsxs(w,{"code-path":"src/components/monitor/AlertManager.tsx:159:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(ee,{"code-path":"src/components/monitor/AlertManager.tsx:160:9",className:"pb-2",children:[e.jsx(te,{"code-path":"src/components/monitor/AlertManager.tsx:161:11",className:"text-slate-100",children:"告警趋势"}),e.jsx(se,{"code-path":"src/components/monitor/AlertManager.tsx:162:11",className:"text-slate-500",children:"过去24小时告警统计"})]}),e.jsx(M,{"code-path":"src/components/monitor/AlertManager.tsx:164:9",children:e.jsx("div",{"code-path":"src/components/monitor/AlertManager.tsx:165:11",className:"h-[200px]",children:e.jsx(Ae,{"code-path":"src/components/monitor/AlertManager.tsx:166:13",width:"100%",height:"100%",children:e.jsxs(je,{"code-path":"src/components/monitor/AlertManager.tsx:167:15",data:s,children:[e.jsxs("defs",{"code-path":"src/components/monitor/AlertManager.tsx:168:17",children:[e.jsxs("linearGradient",{"code-path":"src/components/monitor/AlertManager.tsx:169:19",id:"colorCritical",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:170:21",offset:"5%",stopColor:"#ef4444",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:171:21",offset:"95%",stopColor:"#ef4444",stopOpacity:0})]}),e.jsxs("linearGradient",{"code-path":"src/components/monitor/AlertManager.tsx:173:19",id:"colorWarning",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:174:21",offset:"5%",stopColor:"#f59e0b",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/monitor/AlertManager.tsx:175:21",offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),e.jsx(ue,{"code-path":"src/components/monitor/AlertManager.tsx:178:17",strokeDasharray:"3 3",stroke:"#1e293b"}),e.jsx(Ne,{"code-path":"src/components/monitor/AlertManager.tsx:179:17",dataKey:"time",stroke:"#475569",fontSize:12}),e.jsx(ve,{"code-path":"src/components/monitor/AlertManager.tsx:180:17",stroke:"#475569",fontSize:12}),e.jsx(fe,{"code-path":"src/components/monitor/AlertManager.tsx:181:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"6px",color:"#f8fafc"}}),e.jsx(W,{"code-path":"src/components/monitor/AlertManager.tsx:189:17",type:"monotone",dataKey:"critical",stroke:"#ef4444",fillOpacity:1,fill:"url(#colorCritical)",name:"严重"}),e.jsx(W,{"code-path":"src/components/monitor/AlertManager.tsx:197:17",type:"monotone",dataKey:"warning",stroke:"#f59e0b",fillOpacity:1,fill:"url(#colorWarning)",name:"警告"})]})})})})]}),e.jsxs(ie,{"code-path":"src/components/monitor/AlertManager.tsx:212:7",value:m,onValueChange:T,className:"w-full",children:[e.jsxs(me,{"code-path":"src/components/monitor/AlertManager.tsx:213:9",className:"bg-slate-800 border border-slate-700",children:[e.jsx(H,{"code-path":"src/components/monitor/AlertManager.tsx:214:11",value:"events",className:"data-[state=active]:bg-slate-700",children:"告警事件"}),e.jsx(H,{"code-path":"src/components/monitor/AlertManager.tsx:217:11",value:"rules",className:"data-[state=active]:bg-slate-700",children:"告警规则"})]}),e.jsx(I,{"code-path":"src/components/monitor/AlertManager.tsx:223:9",value:"events",children:e.jsx(Te,{"code-path":"src/components/monitor/AlertManager.tsx:224:11",alerts:d,loading:h,onReload:v})}),e.jsx(I,{"code-path":"src/components/monitor/AlertManager.tsx:227:9",value:"rules",children:e.jsx(ye,{"code-path":"src/components/monitor/AlertManager.tsx:228:11",rules:u,notifyChannels:r,onReload:v,onEditRule:S})})]}),e.jsx(ge,{"code-path":"src/components/monitor/AlertManager.tsx:239:7",open:C,onOpenChange:j,editingRule:y,notifyChannels:r,onSaved:v}),e.jsx(we,{"code-path":"src/components/monitor/AlertManager.tsx:246:7",open:x,onOpenChange:t,notifyChannels:r,onChannelsChanged:v})]})}export{Ke as AlertManager}; diff --git a/backend/static/assets/AlertRuleDialog-BsJX7bok.js b/backend/static/assets/AlertRuleDialog-B0UIHsEi.js similarity index 96% rename from backend/static/assets/AlertRuleDialog-BsJX7bok.js rename to backend/static/assets/AlertRuleDialog-B0UIHsEi.js index 9d01624..c9722b8 100644 --- a/backend/static/assets/AlertRuleDialog-BsJX7bok.js +++ b/backend/static/assets/AlertRuleDialog-B0UIHsEi.js @@ -1,4 +1,4 @@ -import{j as e,r as d}from"./vendor-codemirror-C7mXSpXt.js";import{D as R,a as v,b as w,c as k,d as S,e as _,B as g}from"./index-LZWfu62c.js";import{I as x}from"./input-BdDauX3U.js";import{L as n}from"./label-u-lNUbKh.js";import{T as C}from"./textarea-BdtIagjy.js";import{S as L}from"./switch-C4PJnJ9I.js";import{a as A}from"./alert-C4MMKcUL.js";import{t as E,aj as P,ak as T,al as I,L as B}from"./vendor-icons-Aso0-eeY.js";function D(o){if(!o)return[];if(Array.isArray(o))return o;if(typeof o=="string"){try{const r=JSON.parse(o);if(Array.isArray(r))return r}catch{}return o.split(",").map(r=>r.trim()).filter(Boolean)}return[]}const F=["email","sms","dingtalk","wechat","webhook"],q={dingtalk:"钉钉",wechat:"企业微信",email:"邮件",sms:"短信",webhook:"Webhook"};function H(o,r){if(!o)return null;const a=r.find(c=>String(c.id)===String(o));return a?{type:a.type||"unknown",name:a.name||a.type||"未命名",isLegacy:!1}:F.includes(o)?{type:o,name:q[o]||o,isLegacy:!0}:null}const z=[{key:"dingtalk",label:"钉钉",placeholder:`{ +import{j as e,r as d}from"./vendor-codemirror-B1SGo4xl.js";import{D as R,a as v,b as w,c as k,d as S,e as _,B as g}from"./index-Bp-M7P_8.js";import{I as x}from"./input-Bnlm--la.js";import{L as n}from"./label-NkONM5Mp.js";import{T as C}from"./textarea-BvOVhaCD.js";import{S as L}from"./switch-CEwFnSNV.js";import{a as A}from"./alert-CRDraqCb.js";import{t as E,aj as P,ak as T,al as I,L as B}from"./vendor-icons-BWk-DH7F.js";function D(o){if(!o)return[];if(Array.isArray(o))return o;if(typeof o=="string"){try{const r=JSON.parse(o);if(Array.isArray(r))return r}catch{}return o.split(",").map(r=>r.trim()).filter(Boolean)}return[]}const F=["email","sms","dingtalk","wechat","webhook"],q={dingtalk:"钉钉",wechat:"企业微信",email:"邮件",sms:"短信",webhook:"Webhook"};function H(o,r){if(!o)return null;const a=r.find(c=>String(c.id)===String(o));return a?{type:a.type||"unknown",name:a.name||a.type||"未命名",isLegacy:!1}:F.includes(o)?{type:o,name:q[o]||o,isLegacy:!0}:null}const z=[{key:"dingtalk",label:"钉钉",placeholder:`{ "webhook": "https://oapi.dingtalk.com/robot/send?access_token=***", "secret": "SECxxx" }`},{key:"wechat",label:"企业微信",placeholder:`{ diff --git a/backend/static/assets/ApprovalAppPage-BrRxxZFx.js b/backend/static/assets/ApprovalAppPage-BdqKjevQ.js similarity index 66% rename from backend/static/assets/ApprovalAppPage-BrRxxZFx.js rename to backend/static/assets/ApprovalAppPage-BdqKjevQ.js index 9b10935..9a29cca 100644 --- a/backend/static/assets/ApprovalAppPage-BrRxxZFx.js +++ b/backend/static/assets/ApprovalAppPage-BdqKjevQ.js @@ -1 +1 @@ -import{j as e}from"./vendor-codemirror-C7mXSpXt.js";import{A as t}from"./ApprovalCategoryPage-BdbU4Noo.js";import"./card-B-RtdR4H.js";import"./index-LZWfu62c.js";import"./vendor-icons-Aso0-eeY.js";import"./input-BdDauX3U.js";import"./badge-B0F5ZNtn.js";import"./label-u-lNUbKh.js";import"./table-BPFYQwjr.js";import"./select-4xU_9B3_.js";import"./index-CYARH0Cq.js";import"./approval-DmGRfKd6.js";const r=[{key:"app_name",label:"应用名称",type:"text",placeholder:"如 user-service",required:!0},{key:"git_url",label:"Git 地址",type:"text",placeholder:"如 https://github.com/org/repo.git",required:!0},{key:"branch",label:"分支",type:"text",defaultValue:"main",required:!0},{key:"language",label:"开发语言",type:"select",options:["Java","Go","Python","Node.js","C++"],required:!0},{key:"http_port",label:"HTTP 端口",type:"number",placeholder:"如 8080"},{key:"env",label:"部署环境",type:"select",options:["dev","staging","prod"],required:!0},{key:"replicas",label:"副本数",type:"number",defaultValue:2,required:!0},{key:"remark",label:"备注",type:"textarea"}];function g(){return e.jsx(t,{"code-path":"src/pages/ApprovalAppPage.tsx:17:5",category:"app",title:"应用申请",description:"申请应用部署、版本发布、流水线配置",fields:r,templateCode:"app_deploy"})}export{g as ApprovalAppPage}; +import{j as e}from"./vendor-codemirror-B1SGo4xl.js";import{A as t}from"./ApprovalCategoryPage-C5dI3MfR.js";import"./card-BHSBTtub.js";import"./index-Bp-M7P_8.js";import"./vendor-icons-BWk-DH7F.js";import"./input-Bnlm--la.js";import"./badge-B00SZHvE.js";import"./label-NkONM5Mp.js";import"./table-u8V9iTZf.js";import"./select-DbhcBWnH.js";import"./index-5FEebgvX.js";import"./approval-BivSGX8T.js";const r=[{key:"app_name",label:"应用名称",type:"text",placeholder:"如 user-service",required:!0},{key:"git_url",label:"Git 地址",type:"text",placeholder:"如 https://github.com/org/repo.git",required:!0},{key:"branch",label:"分支",type:"text",defaultValue:"main",required:!0},{key:"language",label:"开发语言",type:"select",options:["Java","Go","Python","Node.js","C++"],required:!0},{key:"http_port",label:"HTTP 端口",type:"number",placeholder:"如 8080"},{key:"env",label:"部署环境",type:"select",options:["dev","staging","prod"],required:!0},{key:"replicas",label:"副本数",type:"number",defaultValue:2,required:!0},{key:"remark",label:"备注",type:"textarea"}];function g(){return e.jsx(t,{"code-path":"src/pages/ApprovalAppPage.tsx:17:5",category:"app",title:"应用申请",description:"申请应用部署、版本发布、流水线配置",fields:r,templateCode:"app_deploy"})}export{g as ApprovalAppPage}; diff --git a/backend/static/assets/ApprovalCategoryPage-BdbU4Noo.js b/backend/static/assets/ApprovalCategoryPage-C5dI3MfR.js similarity index 97% rename from backend/static/assets/ApprovalCategoryPage-BdbU4Noo.js rename to backend/static/assets/ApprovalCategoryPage-C5dI3MfR.js index 3ed89df..ac8f995 100644 --- a/backend/static/assets/ApprovalCategoryPage-BdbU4Noo.js +++ b/backend/static/assets/ApprovalCategoryPage-C5dI3MfR.js @@ -1 +1 @@ -import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as de,a as xe}from"./card-B-RtdR4H.js";import{B as x,D as Q,a as W,b as Y,c as Z,d as ee,t as l}from"./index-LZWfu62c.js";import{I as H}from"./input-BdDauX3U.js";import{B as z}from"./badge-B0F5ZNtn.js";import{L as ne}from"./label-u-lNUbKh.js";import{T as he,a as ie,b as q,c as N,d as ve,e as f}from"./table-BPFYQwjr.js";import{S as J,a as U,b as X,c as K,d as w}from"./select-4xU_9B3_.js";import{b as h}from"./approval-DmGRfKd6.js";import{P as me,S as ye,R as ue,L as G,F as Ce,X as I,w as B,x as je,b as Pe,a as Ae,y as be,U as Ne,z as fe,f as we}from"./vendor-icons-Aso0-eeY.js";const ae=t=>{switch(t){case"approved":return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:43:29",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:[e.jsx(be,{"code-path":"src/pages/ApprovalCategoryPage.tsx:43:105",className:"h-3 w-3 mr-1"}),"已通过"]});case"rejected":return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:44:29",className:"bg-red-500/20 text-red-400 border-red-500/30",children:[e.jsx(Ae,{"code-path":"src/pages/ApprovalCategoryPage.tsx:44:93",className:"h-3 w-3 mr-1"}),"已拒绝"]});default:return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:21",className:"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[e.jsx(Pe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:91",className:"h-3 w-3 mr-1"}),"审批中"]})}};function M(t){try{return JSON.parse(t)||{}}catch{return{}}}function se(t){const p=t?.applicant_user;return p?p.real_name||p.username||`#${t.applicant}`:t?.applicant?`#${t.applicant}`:"--"}function ke(t){if(t.status!=="pending")return"--";const p=t.steps||[];if(p.length===0)return"管理员(待分配)";const d=p.find(g=>g.step===t.current_step&&g.status==="pending");return d?d.approver_user?d.approver_user.real_name||d.approver_user.username||`#${d.approver}`:"管理员":"管理员(待分配)"}function Re({category:t,title:p,description:d,fields:g,templateCode:C}){const[y,j]=c.useState([]),[k,_]=c.useState(!0),[P,S]=c.useState(""),[i,D]=c.useState(""),[s,o]=c.useState(!1),[n,A]=c.useState(!1),[$,F]=c.useState(null),[v,b]=c.useState({}),[te,L]=c.useState(null),[E,T]=c.useState(!1),m=c.useCallback(async()=>{_(!0);try{const a={page_size:"100"};t&&(a.category=t),i&&(a.status=i);const r=await h.getProcesses(a);j(r?.list??r?.data?.list??[])}catch{j([])}finally{_(!1)}},[t,i]),R=c.useCallback(async()=>{try{const a=await h.getTemplates({type:C}),r=a?.list??a?.data?.list??[];r.length>0&&F(r[0].id)}catch{}},[C]);c.useEffect(()=>{m()},[m]),c.useEffect(()=>{R()},[R]);const re=async()=>{if(!$){l.error("模板未加载");return}for(const a of g)if(a.required&&!v[a.key]){l.error(`请填写「${a.label}」`);return}A(!0);try{const a=v[g[0]?.key]||"",r=g[1]&&v[g[1].key]||"";await h.createProcess({template_id:$,title:`${p} - ${a}${r?" / "+r:""}`,form_data:JSON.stringify(v)}),l.success("申请已提交"),o(!1),b({}),m()}catch(a){l.error(a?.message||"提交失败")}finally{A(!1)}},O=()=>{const a={};g.forEach(r=>{a[r.key]=r.defaultValue?.toString()||""}),b(a),o(!0)},pe=async a=>{T(!0);try{await h.approveProcess(a),l.success("已通过"),m()}catch(r){l.error(r?.response?.data?.message||"审批失败")}finally{T(!1)}},ce=async a=>{T(!0);try{await h.rejectProcess(a,"审批拒绝"),l.success("已拒绝"),m()}catch(r){l.error(r?.response?.data?.message||"操作失败")}finally{T(!1)}},oe=async a=>{try{const r=await h.getProcesses({page_size:200}),ge=(r?.list??r?.data?.list??[]).find(le=>le.id===a.id);L(ge||a)}catch{L(a)}},V=y.filter(a=>!P||(a.title||"").toLowerCase().includes(P.toLowerCase()));return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:154:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:155:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:156:9",children:[e.jsx("h1",{"code-path":"src/pages/ApprovalCategoryPage.tsx:157:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:p}),e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:158:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:d})]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:160:9",onClick:O,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:[e.jsx(me,{"code-path":"src/pages/ApprovalCategoryPage.tsx:161:11",className:"h-4 w-4 mr-2"}),"新建申请"]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:165:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:166:9",className:"relative w-64",children:[e.jsx(ye,{"code-path":"src/pages/ApprovalCategoryPage.tsx:167:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx(H,{"code-path":"src/pages/ApprovalCategoryPage.tsx:168:11",placeholder:"搜索申请...",value:P,onChange:a=>S(a.target.value),className:"pl-9 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]}),e.jsxs(J,{"code-path":"src/pages/ApprovalCategoryPage.tsx:171:9",value:i,onValueChange:D,children:[e.jsx(U,{"code-path":"src/pages/ApprovalCategoryPage.tsx:172:11",className:"w-32 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]",children:e.jsx(X,{"code-path":"src/pages/ApprovalCategoryPage.tsx:173:13",placeholder:"全部状态"})}),e.jsxs(K,{"code-path":"src/pages/ApprovalCategoryPage.tsx:175:11",children:[e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:176:13",value:"all",children:"全部状态"}),e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:177:13",value:"pending",children:"审批中"}),e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:178:13",value:"approved",children:"已通过"}),e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:179:13",value:"rejected",children:"已拒绝"})]})]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:182:9",variant:"outline",size:"sm",className:"border-[var(--dg-border)]",onClick:m,children:[e.jsx(ue,{"code-path":"src/pages/ApprovalCategoryPage.tsx:183:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),e.jsx(de,{"code-path":"src/pages/ApprovalCategoryPage.tsx:187:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(xe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:188:9",className:"p-0",children:k?e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:190:13",className:"flex items-center justify-center py-16",children:e.jsx(G,{"code-path":"src/pages/ApprovalCategoryPage.tsx:190:69",className:"h-6 w-6 animate-spin text-[var(--dg-blue)]"})}):V.length===0?e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:192:13",className:"flex flex-col items-center justify-center py-16 text-[var(--dg-text-muted)]",children:[e.jsx(Ce,{"code-path":"src/pages/ApprovalCategoryPage.tsx:193:15",className:"h-10 w-10 mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:194:15",className:"text-sm",children:"暂无申请记录"}),e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:195:15",variant:"link",className:"mt-2",onClick:O,children:"立即申请"})]}):e.jsxs(he,{"code-path":"src/pages/ApprovalCategoryPage.tsx:198:13",children:[e.jsx(ie,{"code-path":"src/pages/ApprovalCategoryPage.tsx:199:15",children:e.jsxs(q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:200:17",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:201:19",className:"text-[var(--dg-text-secondary)]",children:"提交时间"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:202:19",className:"text-[var(--dg-text-secondary)]",children:"提交账号"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:203:19",className:"text-[var(--dg-text-secondary)]",children:"当前审核人"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:204:19",className:"text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:205:19",className:"text-[var(--dg-text-secondary)] w-28",children:"操作"})]})}),e.jsx(ve,{"code-path":"src/pages/ApprovalCategoryPage.tsx:208:15",children:V.map(a=>e.jsxs(q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:210:19",className:"border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:211:21",className:"text-[var(--dg-text-muted)] text-sm whitespace-nowrap",children:a.created_at?new Date(a.created_at).toLocaleString("zh-CN"):"--"}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:214:21",className:"text-[var(--dg-text-primary)]",children:se(a)}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:215:21",className:"text-[var(--dg-text-muted)] text-sm",children:ke(a)}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:216:21",children:ae(a.status)}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:217:21",children:e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:218:23",className:"flex items-center gap-1",children:a.status==="pending"?e.jsxs(e.Fragment,{children:[e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:221:29",variant:"ghost",size:"sm",className:"h-8 text-red-400 hover:bg-red-500/10",onClick:()=>ce(a.id),disabled:E,children:[e.jsx(I,{"code-path":"src/pages/ApprovalCategoryPage.tsx:222:31",className:"h-3.5 w-3.5 mr-1"}),"拒绝"]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:224:29",variant:"ghost",size:"sm",className:"h-8 text-emerald-400 hover:bg-emerald-500/10",onClick:()=>pe(a.id),disabled:E,children:[e.jsx(B,{"code-path":"src/pages/ApprovalCategoryPage.tsx:225:31",className:"h-3.5 w-3.5 mr-1"}),"通过"]})]}):e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:229:27",variant:"ghost",size:"sm",className:"h-8 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",onClick:()=>oe(a),children:[e.jsx(je,{"code-path":"src/pages/ApprovalCategoryPage.tsx:230:29",className:"h-3.5 w-3.5 mr-1"}),"详情"]})})})]},a.id))})]})})}),e.jsx(Q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:244:7",open:s,onOpenChange:o,children:e.jsxs(W,{"code-path":"src/pages/ApprovalCategoryPage.tsx:245:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsxs(Y,{"code-path":"src/pages/ApprovalCategoryPage.tsx:246:11",children:[e.jsxs(Z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:247:13",className:"text-[var(--dg-text-primary)]",children:["新建",p]}),e.jsx(ee,{"code-path":"src/pages/ApprovalCategoryPage.tsx:248:13",className:"text-[var(--dg-text-secondary)]",children:d})]}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:250:11",className:"space-y-4 py-2",children:g.map(a=>e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:252:15",className:"space-y-1.5",children:[e.jsxs(ne,{"code-path":"src/pages/ApprovalCategoryPage.tsx:253:17",className:"text-[var(--dg-text-primary)] text-sm",children:[a.label,a.required&&e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:253:106",className:"text-red-400 ml-0.5",children:"*"})]}),a.type==="select"?e.jsxs(J,{"code-path":"src/pages/ApprovalCategoryPage.tsx:255:19",value:v[a.key]||"",onValueChange:r=>b(u=>({...u,[a.key]:r})),children:[e.jsx(U,{"code-path":"src/pages/ApprovalCategoryPage.tsx:256:21",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]",children:e.jsx(X,{"code-path":"src/pages/ApprovalCategoryPage.tsx:256:101",placeholder:a.placeholder||`选择${a.label}`})}),e.jsx(K,{"code-path":"src/pages/ApprovalCategoryPage.tsx:257:21",children:(a.options||[]).map(r=>e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:257:73",value:r,children:r},r))})]}):a.type==="textarea"?e.jsx("textarea",{"code-path":"src/pages/ApprovalCategoryPage.tsx:260:19",value:v[a.key]||"",onChange:r=>b(u=>({...u,[a.key]:r.target.value})),placeholder:a.placeholder,rows:3,className:"w-full rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] px-3 py-2 text-sm resize-none focus:outline-none focus:border-[var(--dg-blue)]"}):e.jsx(H,{"code-path":"src/pages/ApprovalCategoryPage.tsx:264:19",type:a.type,value:v[a.key]||"",onChange:r=>b(u=>({...u,[a.key]:r.target.value})),placeholder:a.placeholder,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]},a.key))}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:270:11",className:"flex justify-end gap-3 pt-2",children:[e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:271:13",variant:"outline",className:"border-[var(--dg-border)]",onClick:()=>o(!1),children:"取消"}),e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:272:13",onClick:re,disabled:n,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:n?e.jsxs(e.Fragment,{children:[e.jsx(G,{"code-path":"src/pages/ApprovalCategoryPage.tsx:273:31",className:"h-4 w-4 mr-2 animate-spin"}),"提交中..."]}):"提交申请"})]})]})}),e.jsx(_e,{"code-path":"src/pages/ApprovalCategoryPage.tsx:280:7",item:te,onClose:()=>L(null),fields:g,onStatusChange:m})]})}function _e({item:t,onClose:p,fields:d,onStatusChange:g}){const[C,y]=c.useState(!1);if(!t)return null;const j=s=>s?new Date(s).toLocaleString("zh-CN"):"",k=t.steps||[],_=async()=>{y(!0);try{await h.approveProcess(t.id),l.success("已通过"),g(),p()}catch(s){l.error(s?.response?.data?.message||"审批失败")}finally{y(!1)}},P=async()=>{y(!0);try{await h.rejectProcess(t.id,"审批拒绝"),l.success("已拒绝"),g(),p()}catch(s){l.error(s?.response?.data?.message||"操作失败")}finally{y(!1)}},S=s=>s.status==="approved"?"通过":s.status==="rejected"?"拒绝":s.status==="pending"&&s.step===t.current_step?"待审批":s.status==="pending"?"待开始":s.status,i=s=>s.status==="approved"?"text-emerald-400":s.status==="rejected"?"text-red-400":s.step===t.current_step?"text-blue-400":"text-[var(--dg-text-muted)]",D=s=>s.approver_user?s.approver_user.real_name||s.approver_user.username||`#${s.approver}`:"管理员";return e.jsx(Q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:337:5",open:!!t,onOpenChange:s=>{s||p()},children:e.jsxs(W,{"code-path":"src/pages/ApprovalCategoryPage.tsx:338:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsxs(Y,{"code-path":"src/pages/ApprovalCategoryPage.tsx:339:9",children:[e.jsx(Z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:340:11",className:"text-[var(--dg-text-primary)]",children:"申请详情"}),e.jsx(ee,{"code-path":"src/pages/ApprovalCategoryPage.tsx:341:11",className:"text-[var(--dg-text-secondary)]",children:t.title})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:344:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:346:11",className:"flex items-center gap-3",children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:347:13",className:"text-sm text-[var(--dg-text-muted)]",children:"状态:"}),ae(t.status),t.status==="pending"&&e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:350:15",className:"text-xs text-[var(--dg-text-muted)]",children:["第 ",t.current_step,"/",t.total_steps," 步"]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:357:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsx("h4",{"code-path":"src/pages/ApprovalCategoryPage.tsx:358:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-4",children:"操作时间线"}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:359:13",className:"space-y-0",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:361:15",className:"flex gap-3",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:362:17",className:"flex flex-col items-center",children:[e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:363:19",className:"w-7 h-7 rounded-full bg-blue-500/20 flex items-center justify-center",children:e.jsx(Ne,{"code-path":"src/pages/ApprovalCategoryPage.tsx:363:105",className:"w-3.5 h-3.5 text-blue-400"})}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:364:19",className:"w-0.5 flex-1 bg-[var(--dg-border)] my-1"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:366:17",className:"flex-1 pb-4",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:367:19",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:368:21",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"提交申请"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:369:21",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:370:21",className:"text-xs text-[var(--dg-text-secondary)]",children:se(t)}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:371:21",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:372:21",className:"text-xs text-[var(--dg-text-muted)]",children:j(t.created_at)})]}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:375:19",className:"mt-1 flex flex-wrap gap-2",children:(()=>{const s=M(t.form_data||"{}");return d.slice(0,4).map(o=>{const n=s[o.key];return n?e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:382:27",className:"text-[11px] px-1.5 py-0.5 rounded bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]",children:[o.label,": ",e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:383:40",className:"text-[var(--dg-text-secondary)]",children:n})]},o.key):null})})()})]})]}),k.map((s,o)=>{const n=o===k.length-1,A=s.step_type==="execute",$=A?"执行":"审核",F=s.status==="approved"?"bg-emerald-500/20":s.status==="rejected"?"bg-red-500/20":"bg-[var(--dg-bg-tertiary)]";return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:401:19",className:"flex gap-3",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:402:21",className:"flex flex-col items-center",children:[e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:403:23",className:`w-7 h-7 rounded-full flex items-center justify-center ${F}`,children:s.status==="approved"?e.jsx(B,{"code-path":"src/pages/ApprovalCategoryPage.tsx:404:52",className:"w-3.5 h-3.5 text-emerald-400"}):s.status==="rejected"?e.jsx(I,{"code-path":"src/pages/ApprovalCategoryPage.tsx:405:55",className:"w-3.5 h-3.5 text-red-400"}):A?e.jsx(fe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:407:33",className:`w-3.5 h-3.5 ${s.step===t.current_step?"text-green-400":"text-[var(--dg-text-muted)]"}`}):e.jsx(we,{"code-path":"src/pages/ApprovalCategoryPage.tsx:408:33",className:`w-3.5 h-3.5 ${s.step===t.current_step?"text-blue-400":"text-[var(--dg-text-muted)]"}`})}),!n&&e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:410:35",className:"w-0.5 flex-1 bg-[var(--dg-border)] my-1"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:412:21",className:`flex-1 ${n?"":"pb-4"}`,children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:413:23",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:414:25",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:$}),s.approver_user&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:417:29",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:418:29",className:"text-xs text-[var(--dg-text-secondary)]",children:["指派人: ",D(s)]})]}),s.approved_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:423:29",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:424:29",className:`text-xs ${i(s)}`,children:[D(s)," · ",S(s)," · ",j(s.approved_at)]})]}),!s.approved_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:431:29",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:432:29",className:`text-xs ${i(s)}`,children:S(s)})]})]}),s.comment&&s.comment!==s.status&&s.comment!=="pending"&&e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:437:25",className:"text-xs text-[var(--dg-text-muted)] mt-1 ml-0",children:s.comment})]})]},s.id)})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:447:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsx("h4",{"code-path":"src/pages/ApprovalCategoryPage.tsx:448:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-2",children:"申请内容"}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:449:13",className:"space-y-2",children:(()=>{const s=M(t.form_data||"{}");return d.map(o=>{const n=s[o.key];return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:455:21",className:"grid grid-cols-3 gap-2 text-sm",children:[e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:456:23",className:"text-[var(--dg-text-muted)]",children:[o.label,":"]}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:457:23",className:"text-[var(--dg-text-primary)] col-span-2",children:n??"--"})]},o.key)})})()})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:466:9",className:"flex justify-end gap-3 pt-2",children:[t.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:469:15",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:P,disabled:C,children:[e.jsx(I,{"code-path":"src/pages/ApprovalCategoryPage.tsx:470:17",className:"h-4 w-4 mr-1.5"}),"拒绝"]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:472:15",className:"bg-emerald-600 hover:bg-emerald-700",onClick:_,disabled:C,children:[e.jsx(B,{"code-path":"src/pages/ApprovalCategoryPage.tsx:473:17",className:"h-4 w-4 mr-1.5"}),"通过"]})]}),e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:477:11",variant:"outline",className:"border-[var(--dg-border)]",onClick:p,children:"关闭"})]})]})})}export{Re as A}; +import{r as c,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as de,a as xe}from"./card-BHSBTtub.js";import{B as x,D as Q,a as W,b as Y,c as Z,d as ee,t as l}from"./index-Bp-M7P_8.js";import{I as H}from"./input-Bnlm--la.js";import{B as z}from"./badge-B00SZHvE.js";import{L as ne}from"./label-NkONM5Mp.js";import{T as he,a as ie,b as q,c as N,d as ve,e as f}from"./table-u8V9iTZf.js";import{S as J,a as U,b as X,c as K,d as w}from"./select-DbhcBWnH.js";import{b as h}from"./approval-BivSGX8T.js";import{P as me,S as ye,R as ue,L as G,F as Ce,X as I,w as B,x as je,b as Pe,a as Ae,y as be,U as Ne,z as fe,f as we}from"./vendor-icons-BWk-DH7F.js";const ae=t=>{switch(t){case"approved":return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:43:29",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:[e.jsx(be,{"code-path":"src/pages/ApprovalCategoryPage.tsx:43:105",className:"h-3 w-3 mr-1"}),"已通过"]});case"rejected":return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:44:29",className:"bg-red-500/20 text-red-400 border-red-500/30",children:[e.jsx(Ae,{"code-path":"src/pages/ApprovalCategoryPage.tsx:44:93",className:"h-3 w-3 mr-1"}),"已拒绝"]});default:return e.jsxs(z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:21",className:"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[e.jsx(Pe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:45:91",className:"h-3 w-3 mr-1"}),"审批中"]})}};function M(t){try{return JSON.parse(t)||{}}catch{return{}}}function se(t){const p=t?.applicant_user;return p?p.real_name||p.username||`#${t.applicant}`:t?.applicant?`#${t.applicant}`:"--"}function ke(t){if(t.status!=="pending")return"--";const p=t.steps||[];if(p.length===0)return"管理员(待分配)";const d=p.find(g=>g.step===t.current_step&&g.status==="pending");return d?d.approver_user?d.approver_user.real_name||d.approver_user.username||`#${d.approver}`:"管理员":"管理员(待分配)"}function Re({category:t,title:p,description:d,fields:g,templateCode:C}){const[y,j]=c.useState([]),[k,_]=c.useState(!0),[P,S]=c.useState(""),[i,D]=c.useState(""),[s,o]=c.useState(!1),[n,A]=c.useState(!1),[$,F]=c.useState(null),[v,b]=c.useState({}),[te,L]=c.useState(null),[E,T]=c.useState(!1),m=c.useCallback(async()=>{_(!0);try{const a={page_size:"100"};t&&(a.category=t),i&&(a.status=i);const r=await h.getProcesses(a);j(r?.list??r?.data?.list??[])}catch{j([])}finally{_(!1)}},[t,i]),R=c.useCallback(async()=>{try{const a=await h.getTemplates({type:C}),r=a?.list??a?.data?.list??[];r.length>0&&F(r[0].id)}catch{}},[C]);c.useEffect(()=>{m()},[m]),c.useEffect(()=>{R()},[R]);const re=async()=>{if(!$){l.error("模板未加载");return}for(const a of g)if(a.required&&!v[a.key]){l.error(`请填写「${a.label}」`);return}A(!0);try{const a=v[g[0]?.key]||"",r=g[1]&&v[g[1].key]||"";await h.createProcess({template_id:$,title:`${p} - ${a}${r?" / "+r:""}`,form_data:JSON.stringify(v)}),l.success("申请已提交"),o(!1),b({}),m()}catch(a){l.error(a?.message||"提交失败")}finally{A(!1)}},O=()=>{const a={};g.forEach(r=>{a[r.key]=r.defaultValue?.toString()||""}),b(a),o(!0)},pe=async a=>{T(!0);try{await h.approveProcess(a),l.success("已通过"),m()}catch(r){l.error(r?.response?.data?.message||"审批失败")}finally{T(!1)}},ce=async a=>{T(!0);try{await h.rejectProcess(a,"审批拒绝"),l.success("已拒绝"),m()}catch(r){l.error(r?.response?.data?.message||"操作失败")}finally{T(!1)}},oe=async a=>{try{const r=await h.getProcesses({page_size:200}),ge=(r?.list??r?.data?.list??[]).find(le=>le.id===a.id);L(ge||a)}catch{L(a)}},V=y.filter(a=>!P||(a.title||"").toLowerCase().includes(P.toLowerCase()));return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:154:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:155:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:156:9",children:[e.jsx("h1",{"code-path":"src/pages/ApprovalCategoryPage.tsx:157:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:p}),e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:158:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:d})]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:160:9",onClick:O,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:[e.jsx(me,{"code-path":"src/pages/ApprovalCategoryPage.tsx:161:11",className:"h-4 w-4 mr-2"}),"新建申请"]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:165:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:166:9",className:"relative w-64",children:[e.jsx(ye,{"code-path":"src/pages/ApprovalCategoryPage.tsx:167:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx(H,{"code-path":"src/pages/ApprovalCategoryPage.tsx:168:11",placeholder:"搜索申请...",value:P,onChange:a=>S(a.target.value),className:"pl-9 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]}),e.jsxs(J,{"code-path":"src/pages/ApprovalCategoryPage.tsx:171:9",value:i,onValueChange:D,children:[e.jsx(U,{"code-path":"src/pages/ApprovalCategoryPage.tsx:172:11",className:"w-32 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]",children:e.jsx(X,{"code-path":"src/pages/ApprovalCategoryPage.tsx:173:13",placeholder:"全部状态"})}),e.jsxs(K,{"code-path":"src/pages/ApprovalCategoryPage.tsx:175:11",children:[e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:176:13",value:"all",children:"全部状态"}),e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:177:13",value:"pending",children:"审批中"}),e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:178:13",value:"approved",children:"已通过"}),e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:179:13",value:"rejected",children:"已拒绝"})]})]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:182:9",variant:"outline",size:"sm",className:"border-[var(--dg-border)]",onClick:m,children:[e.jsx(ue,{"code-path":"src/pages/ApprovalCategoryPage.tsx:183:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),e.jsx(de,{"code-path":"src/pages/ApprovalCategoryPage.tsx:187:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(xe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:188:9",className:"p-0",children:k?e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:190:13",className:"flex items-center justify-center py-16",children:e.jsx(G,{"code-path":"src/pages/ApprovalCategoryPage.tsx:190:69",className:"h-6 w-6 animate-spin text-[var(--dg-blue)]"})}):V.length===0?e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:192:13",className:"flex flex-col items-center justify-center py-16 text-[var(--dg-text-muted)]",children:[e.jsx(Ce,{"code-path":"src/pages/ApprovalCategoryPage.tsx:193:15",className:"h-10 w-10 mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:194:15",className:"text-sm",children:"暂无申请记录"}),e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:195:15",variant:"link",className:"mt-2",onClick:O,children:"立即申请"})]}):e.jsxs(he,{"code-path":"src/pages/ApprovalCategoryPage.tsx:198:13",children:[e.jsx(ie,{"code-path":"src/pages/ApprovalCategoryPage.tsx:199:15",children:e.jsxs(q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:200:17",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:201:19",className:"text-[var(--dg-text-secondary)]",children:"提交时间"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:202:19",className:"text-[var(--dg-text-secondary)]",children:"提交账号"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:203:19",className:"text-[var(--dg-text-secondary)]",children:"当前审核人"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:204:19",className:"text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx(N,{"code-path":"src/pages/ApprovalCategoryPage.tsx:205:19",className:"text-[var(--dg-text-secondary)] w-28",children:"操作"})]})}),e.jsx(ve,{"code-path":"src/pages/ApprovalCategoryPage.tsx:208:15",children:V.map(a=>e.jsxs(q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:210:19",className:"border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:211:21",className:"text-[var(--dg-text-muted)] text-sm whitespace-nowrap",children:a.created_at?new Date(a.created_at).toLocaleString("zh-CN"):"--"}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:214:21",className:"text-[var(--dg-text-primary)]",children:se(a)}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:215:21",className:"text-[var(--dg-text-muted)] text-sm",children:ke(a)}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:216:21",children:ae(a.status)}),e.jsx(f,{"code-path":"src/pages/ApprovalCategoryPage.tsx:217:21",children:e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:218:23",className:"flex items-center gap-1",children:a.status==="pending"?e.jsxs(e.Fragment,{children:[e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:221:29",variant:"ghost",size:"sm",className:"h-8 text-red-400 hover:bg-red-500/10",onClick:()=>ce(a.id),disabled:E,children:[e.jsx(I,{"code-path":"src/pages/ApprovalCategoryPage.tsx:222:31",className:"h-3.5 w-3.5 mr-1"}),"拒绝"]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:224:29",variant:"ghost",size:"sm",className:"h-8 text-emerald-400 hover:bg-emerald-500/10",onClick:()=>pe(a.id),disabled:E,children:[e.jsx(B,{"code-path":"src/pages/ApprovalCategoryPage.tsx:225:31",className:"h-3.5 w-3.5 mr-1"}),"通过"]})]}):e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:229:27",variant:"ghost",size:"sm",className:"h-8 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",onClick:()=>oe(a),children:[e.jsx(je,{"code-path":"src/pages/ApprovalCategoryPage.tsx:230:29",className:"h-3.5 w-3.5 mr-1"}),"详情"]})})})]},a.id))})]})})}),e.jsx(Q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:244:7",open:s,onOpenChange:o,children:e.jsxs(W,{"code-path":"src/pages/ApprovalCategoryPage.tsx:245:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsxs(Y,{"code-path":"src/pages/ApprovalCategoryPage.tsx:246:11",children:[e.jsxs(Z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:247:13",className:"text-[var(--dg-text-primary)]",children:["新建",p]}),e.jsx(ee,{"code-path":"src/pages/ApprovalCategoryPage.tsx:248:13",className:"text-[var(--dg-text-secondary)]",children:d})]}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:250:11",className:"space-y-4 py-2",children:g.map(a=>e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:252:15",className:"space-y-1.5",children:[e.jsxs(ne,{"code-path":"src/pages/ApprovalCategoryPage.tsx:253:17",className:"text-[var(--dg-text-primary)] text-sm",children:[a.label,a.required&&e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:253:106",className:"text-red-400 ml-0.5",children:"*"})]}),a.type==="select"?e.jsxs(J,{"code-path":"src/pages/ApprovalCategoryPage.tsx:255:19",value:v[a.key]||"",onValueChange:r=>b(u=>({...u,[a.key]:r})),children:[e.jsx(U,{"code-path":"src/pages/ApprovalCategoryPage.tsx:256:21",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]",children:e.jsx(X,{"code-path":"src/pages/ApprovalCategoryPage.tsx:256:101",placeholder:a.placeholder||`选择${a.label}`})}),e.jsx(K,{"code-path":"src/pages/ApprovalCategoryPage.tsx:257:21",children:(a.options||[]).map(r=>e.jsx(w,{"code-path":"src/pages/ApprovalCategoryPage.tsx:257:73",value:r,children:r},r))})]}):a.type==="textarea"?e.jsx("textarea",{"code-path":"src/pages/ApprovalCategoryPage.tsx:260:19",value:v[a.key]||"",onChange:r=>b(u=>({...u,[a.key]:r.target.value})),placeholder:a.placeholder,rows:3,className:"w-full rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] px-3 py-2 text-sm resize-none focus:outline-none focus:border-[var(--dg-blue)]"}):e.jsx(H,{"code-path":"src/pages/ApprovalCategoryPage.tsx:264:19",type:a.type,value:v[a.key]||"",onChange:r=>b(u=>({...u,[a.key]:r.target.value})),placeholder:a.placeholder,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]},a.key))}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:270:11",className:"flex justify-end gap-3 pt-2",children:[e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:271:13",variant:"outline",className:"border-[var(--dg-border)]",onClick:()=>o(!1),children:"取消"}),e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:272:13",onClick:re,disabled:n,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/90",children:n?e.jsxs(e.Fragment,{children:[e.jsx(G,{"code-path":"src/pages/ApprovalCategoryPage.tsx:273:31",className:"h-4 w-4 mr-2 animate-spin"}),"提交中..."]}):"提交申请"})]})]})}),e.jsx(_e,{"code-path":"src/pages/ApprovalCategoryPage.tsx:280:7",item:te,onClose:()=>L(null),fields:g,onStatusChange:m})]})}function _e({item:t,onClose:p,fields:d,onStatusChange:g}){const[C,y]=c.useState(!1);if(!t)return null;const j=s=>s?new Date(s).toLocaleString("zh-CN"):"",k=t.steps||[],_=async()=>{y(!0);try{await h.approveProcess(t.id),l.success("已通过"),g(),p()}catch(s){l.error(s?.response?.data?.message||"审批失败")}finally{y(!1)}},P=async()=>{y(!0);try{await h.rejectProcess(t.id,"审批拒绝"),l.success("已拒绝"),g(),p()}catch(s){l.error(s?.response?.data?.message||"操作失败")}finally{y(!1)}},S=s=>s.status==="approved"?"通过":s.status==="rejected"?"拒绝":s.status==="pending"&&s.step===t.current_step?"待审批":s.status==="pending"?"待开始":s.status,i=s=>s.status==="approved"?"text-emerald-400":s.status==="rejected"?"text-red-400":s.step===t.current_step?"text-blue-400":"text-[var(--dg-text-muted)]",D=s=>s.approver_user?s.approver_user.real_name||s.approver_user.username||`#${s.approver}`:"管理员";return e.jsx(Q,{"code-path":"src/pages/ApprovalCategoryPage.tsx:337:5",open:!!t,onOpenChange:s=>{s||p()},children:e.jsxs(W,{"code-path":"src/pages/ApprovalCategoryPage.tsx:338:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg max-h-[85vh] overflow-y-auto",children:[e.jsxs(Y,{"code-path":"src/pages/ApprovalCategoryPage.tsx:339:9",children:[e.jsx(Z,{"code-path":"src/pages/ApprovalCategoryPage.tsx:340:11",className:"text-[var(--dg-text-primary)]",children:"申请详情"}),e.jsx(ee,{"code-path":"src/pages/ApprovalCategoryPage.tsx:341:11",className:"text-[var(--dg-text-secondary)]",children:t.title})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:344:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:346:11",className:"flex items-center gap-3",children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:347:13",className:"text-sm text-[var(--dg-text-muted)]",children:"状态:"}),ae(t.status),t.status==="pending"&&e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:350:15",className:"text-xs text-[var(--dg-text-muted)]",children:["第 ",t.current_step,"/",t.total_steps," 步"]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:357:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsx("h4",{"code-path":"src/pages/ApprovalCategoryPage.tsx:358:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-4",children:"操作时间线"}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:359:13",className:"space-y-0",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:361:15",className:"flex gap-3",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:362:17",className:"flex flex-col items-center",children:[e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:363:19",className:"w-7 h-7 rounded-full bg-blue-500/20 flex items-center justify-center",children:e.jsx(Ne,{"code-path":"src/pages/ApprovalCategoryPage.tsx:363:105",className:"w-3.5 h-3.5 text-blue-400"})}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:364:19",className:"w-0.5 flex-1 bg-[var(--dg-border)] my-1"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:366:17",className:"flex-1 pb-4",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:367:19",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:368:21",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"提交申请"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:369:21",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:370:21",className:"text-xs text-[var(--dg-text-secondary)]",children:se(t)}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:371:21",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:372:21",className:"text-xs text-[var(--dg-text-muted)]",children:j(t.created_at)})]}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:375:19",className:"mt-1 flex flex-wrap gap-2",children:(()=>{const s=M(t.form_data||"{}");return d.slice(0,4).map(o=>{const n=s[o.key];return n?e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:382:27",className:"text-[11px] px-1.5 py-0.5 rounded bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]",children:[o.label,": ",e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:383:40",className:"text-[var(--dg-text-secondary)]",children:n})]},o.key):null})})()})]})]}),k.map((s,o)=>{const n=o===k.length-1,A=s.step_type==="execute",$=A?"执行":"审核",F=s.status==="approved"?"bg-emerald-500/20":s.status==="rejected"?"bg-red-500/20":"bg-[var(--dg-bg-tertiary)]";return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:401:19",className:"flex gap-3",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:402:21",className:"flex flex-col items-center",children:[e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:403:23",className:`w-7 h-7 rounded-full flex items-center justify-center ${F}`,children:s.status==="approved"?e.jsx(B,{"code-path":"src/pages/ApprovalCategoryPage.tsx:404:52",className:"w-3.5 h-3.5 text-emerald-400"}):s.status==="rejected"?e.jsx(I,{"code-path":"src/pages/ApprovalCategoryPage.tsx:405:55",className:"w-3.5 h-3.5 text-red-400"}):A?e.jsx(fe,{"code-path":"src/pages/ApprovalCategoryPage.tsx:407:33",className:`w-3.5 h-3.5 ${s.step===t.current_step?"text-green-400":"text-[var(--dg-text-muted)]"}`}):e.jsx(we,{"code-path":"src/pages/ApprovalCategoryPage.tsx:408:33",className:`w-3.5 h-3.5 ${s.step===t.current_step?"text-blue-400":"text-[var(--dg-text-muted)]"}`})}),!n&&e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:410:35",className:"w-0.5 flex-1 bg-[var(--dg-border)] my-1"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:412:21",className:`flex-1 ${n?"":"pb-4"}`,children:[e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:413:23",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:414:25",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:$}),s.approver_user&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:417:29",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:418:29",className:"text-xs text-[var(--dg-text-secondary)]",children:["指派人: ",D(s)]})]}),s.approved_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:423:29",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:424:29",className:`text-xs ${i(s)}`,children:[D(s)," · ",S(s)," · ",j(s.approved_at)]})]}),!s.approved_at&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:431:29",className:"text-xs text-[var(--dg-text-muted)]",children:"·"}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:432:29",className:`text-xs ${i(s)}`,children:S(s)})]})]}),s.comment&&s.comment!==s.status&&s.comment!=="pending"&&e.jsx("p",{"code-path":"src/pages/ApprovalCategoryPage.tsx:437:25",className:"text-xs text-[var(--dg-text-muted)] mt-1 ml-0",children:s.comment})]})]},s.id)})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:447:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsx("h4",{"code-path":"src/pages/ApprovalCategoryPage.tsx:448:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-2",children:"申请内容"}),e.jsx("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:449:13",className:"space-y-2",children:(()=>{const s=M(t.form_data||"{}");return d.map(o=>{const n=s[o.key];return e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:455:21",className:"grid grid-cols-3 gap-2 text-sm",children:[e.jsxs("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:456:23",className:"text-[var(--dg-text-muted)]",children:[o.label,":"]}),e.jsx("span",{"code-path":"src/pages/ApprovalCategoryPage.tsx:457:23",className:"text-[var(--dg-text-primary)] col-span-2",children:n??"--"})]},o.key)})})()})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalCategoryPage.tsx:466:9",className:"flex justify-end gap-3 pt-2",children:[t.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:469:15",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:P,disabled:C,children:[e.jsx(I,{"code-path":"src/pages/ApprovalCategoryPage.tsx:470:17",className:"h-4 w-4 mr-1.5"}),"拒绝"]}),e.jsxs(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:472:15",className:"bg-emerald-600 hover:bg-emerald-700",onClick:_,disabled:C,children:[e.jsx(B,{"code-path":"src/pages/ApprovalCategoryPage.tsx:473:17",className:"h-4 w-4 mr-1.5"}),"通过"]})]}),e.jsx(x,{"code-path":"src/pages/ApprovalCategoryPage.tsx:477:11",variant:"outline",className:"border-[var(--dg-border)]",onClick:p,children:"关闭"})]})]})})}export{Re as A}; diff --git a/backend/static/assets/ApprovalFlow-BziKIUh9.js b/backend/static/assets/ApprovalFlow-BYXNIoil.js similarity index 94% rename from backend/static/assets/ApprovalFlow-BziKIUh9.js rename to backend/static/assets/ApprovalFlow-BYXNIoil.js index 5e69205..e1a5606 100644 --- a/backend/static/assets/ApprovalFlow-BziKIUh9.js +++ b/backend/static/assets/ApprovalFlow-BYXNIoil.js @@ -1 +1 @@ -import{j as e,r as v}from"./vendor-codemirror-C7mXSpXt.js";import{m as b,B as i,D as M,a as V,b as q,c as H,d as Q,e as G,t as T}from"./index-LZWfu62c.js";import{C as u,a as j,b as ye,c as Ne,d as we}from"./card-B-RtdR4H.js";import{B as C}from"./badge-B0F5ZNtn.js";import{T as pe}from"./textarea-BdtIagjy.js";import{b as k}from"./approval-DmGRfKd6.js";import{I as le}from"./input-BdDauX3U.js";import{h as fe,aQ as Te,F as _,C as D,a as F,L as $,S as De,x as Fe,af as Ce,J as oe,aE as Pe,ae as Se,b as ce,P as ke}from"./vendor-icons-Aso0-eeY.js";import{L as _e}from"./label-u-lNUbKh.js";import{S as Le,a as Oe,b as Ie,c as $e,d as Re}from"./select-4xU_9B3_.js";import"./index-CYARH0Cq.js";function ze(a){if(Array.isArray(a))return a;if(typeof a=="string")try{const r=JSON.parse(a);return Array.isArray(r)?r:[]}catch{return[]}return[]}function I(a){if(!a)return[];const r=typeof a=="string"?(()=>{try{return JSON.parse(a)}catch{return null}})():a;return r?Array.isArray(r.fields)?r.fields:[]:[]}function Ee(a,r){if(!a)return null;let s;try{s=typeof a=="string"?JSON.parse(a):a}catch{return null}if(!s||typeof s!="object")return null;const o=I(r?.form_schema),n=new Map;o.forEach(p=>n.set(p.key,p.label));const m=Object.entries(s).filter(([,p])=>p!=null&&p!=="");return m.length===0?null:e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:53:5",className:"grid grid-cols-2 gap-x-4 gap-y-3",children:m.map(([p,d])=>e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:55:9",className:"min-w-0",children:[e.jsx("p",{"code-path":"src/components/approval/helpers.tsx:56:11",className:"text-xs text-[var(--dg-text-muted)] mb-0.5",children:n.get(p)||p}),e.jsx("p",{"code-path":"src/components/approval/helpers.tsx:57:11",className:"text-sm text-[var(--dg-text-primary)] break-words",children:String(d)})]},p))})}const R=[{value:"server_apply",label:"云服务器申请",icon:fe,color:"var(--dg-cyan)"},{value:"app_deploy",label:"应用部署申请",icon:Te,color:"var(--dg-blue)"}],Y=a=>R.find(r=>r.value===a)?.label||a||"通用审批",L=a=>R.find(r=>r.value===a)?.color||"var(--dg-text-secondary)",Be=a=>R.find(r=>r.value===a)?.icon||_,A=a=>a?.template?.type||a?.type||"";function U(a){const r=ze(a.steps),s=a.current_step??0,o=r.length,n=r.filter(p=>p.status==="approved"||p.status==="completed").length,m=o>0?Math.round(n/o*100):0;return{steps:r,currentIndex:s,total:o,completed:n,percentage:m}}function X(a){const{steps:r,currentIndex:s}=U(a);return r.length===0?null:e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:99:5",className:"flex items-center gap-1 overflow-x-auto",children:r.map((o,n)=>{const m=o.status==="approved"||o.status==="completed",p=n===s,d=o.status==="rejected";return e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:105:11",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:106:13",className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs whitespace-nowrap",m&&"bg-emerald-500/10 text-emerald-400",p&&!d&&"bg-amber-500/10 text-amber-400 border border-amber-500/30",d&&"bg-red-500/10 text-red-400",!m&&!p&&!d&&"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]"),children:[m&&e.jsx(D,{"code-path":"src/components/approval/helpers.tsx:115:31",className:"h-3 w-3"}),d&&e.jsx(F,{"code-path":"src/components/approval/helpers.tsx:116:30",className:"h-3 w-3"}),p&&!d&&e.jsx($,{"code-path":"src/components/approval/helpers.tsx:117:44",className:"h-3 w-3 animate-spin"}),e.jsx("span",{"code-path":"src/components/approval/helpers.tsx:118:15",children:o.name||o.approver_name||`步骤 ${n+1}`})]}),no(c.target.value),className:"pl-9 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:108:9",className:"flex items-center gap-1 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-lg p-1",children:Je.map(c=>e.jsx("button",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:110:13",onClick:()=>m(c.value),className:b("px-3 py-1.5 rounded-md text-sm transition-colors",n===c.value?"bg-[var(--dg-bg-hover)] text-[var(--dg-text-primary)] font-medium":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:c.label},c.key))})]}),r?e.jsx(u,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:128:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:129:11",className:"p-12",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:130:13",className:"flex items-center justify-center text-[var(--dg-text-muted)]",children:[e.jsx($,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:131:15",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]})})}):a.length===0?e.jsx(u,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:137:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:138:11",className:"p-12",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:139:13",className:"text-center",children:[e.jsx(_,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:140:15",className:"h-12 w-12 mx-auto text-[var(--dg-text-muted)] mb-4"}),e.jsx("h3",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:141:15",className:"text-lg font-medium text-[var(--dg-text-secondary)] mb-2",children:"暂无审批流程"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:142:15",className:"text-sm text-[var(--dg-text-muted)]",children:"当前筛选条件下没有匹配的流程实例"})]})})}):e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:147:9",className:"grid grid-cols-1 gap-4",children:a.map(c=>{const w=Be(A(c)),{percentage:l}=U(c);return e.jsx(u,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:152:15",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] hover:border-[var(--dg-border)] transition-colors",children:e.jsxs(j,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:153:17",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:154:19",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:155:21",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:156:23",className:"w-10 h-10 rounded-lg bg-[var(--dg-bg-tertiary)] flex items-center justify-center",style:{color:L(A(c))},children:e.jsx(w,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:157:25",className:"h-5 w-5"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:159:23",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:160:25",className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:161:27",className:"font-medium text-[var(--dg-text-primary)]",children:c.title}),Me(c.status)]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:164:25",className:"flex items-center gap-3 text-xs text-[var(--dg-text-muted)]",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:165:27",className:"flex items-center gap-1",children:e.jsx(C,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:166:29",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:L(A(c))},children:Y(A(c))})}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:170:27",children:["申请人:",c.applicant_name||c.applicant||"--"]}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:171:27",children:["提交于 ",c.created_at?new Date(c.created_at).toLocaleString():"--"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:175:21",className:"flex items-center gap-2",children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:176:23",variant:"ghost",size:"sm",className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]",onClick:()=>p(c),children:[e.jsx(Fe,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:177:25",className:"h-4 w-4 mr-1"}),"详情"]}),c.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:182:27",variant:"outline",size:"sm",className:"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10",onClick:()=>d(c),children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:188:29",className:"h-4 w-4 mr-1"}),"通过"]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:191:27",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>y(c),children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:197:29",className:"h-4 w-4 mr-1"}),"拒绝"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:205:19",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:206:21",className:"flex items-center justify-between text-xs text-[var(--dg-text-muted)] mb-1.5",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:207:23",children:"审批进度"}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:208:23",children:[l,"%"]})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:210:21",className:"w-full h-1.5 bg-[var(--dg-bg-tertiary)] rounded-full overflow-hidden",children:e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:211:23",className:b("h-full rounded-full transition-all",c.status==="rejected"?"bg-red-400":"bg-[var(--dg-blue)]"),style:{width:`${l}%`}})})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:221:19",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3",children:X(c)})]})},c.id)})})]})}function ne(a){if(Array.isArray(a))return a;if(typeof a=="string")try{const r=JSON.parse(a);return Array.isArray(r)?r:[]}catch{return[]}return[]}const K=[{value:"deploy",label:"发布审批",color:"var(--dg-blue)"},{value:"server",label:"服务器操作",color:"var(--dg-cyan)"},{value:"permission",label:"权限申请",color:"var(--dg-purple)"}],qe=a=>K.find(r=>r.value===a)?.label||a||"通用审批",He=a=>K.find(r=>r.value===a)?.color||"var(--dg-text-secondary)";function Qe(a){const r=ne(a.steps);return r.length===0?e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:37:12",className:"text-[var(--dg-text-muted)] text-center py-4",children:"暂无流程节点"}):e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:40:5",className:"flex items-center gap-2 overflow-x-auto py-4",children:r.map((s,o)=>e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:42:9",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:43:11",className:b("px-4 py-2 rounded-lg border min-w-[100px] text-center",s.type==="start"&&"bg-emerald-500/10 border-emerald-500/30 text-emerald-400",s.type==="approval"&&"bg-[var(--dg-blue)]/10 border-[var(--dg-blue)]/30 text-[var(--dg-blue)]",s.type==="condition"&&"bg-amber-500/10 border-amber-500/30 text-amber-400",s.type==="end"&&"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-secondary)]"),children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:52:13",className:"text-sm font-medium",children:s.name}),s.approvers&&e.jsx("p",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:54:15",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:Array.isArray(s.approvers)?s.approvers.join(", "):s.approvers})]}),os("all"),className:b("px-3 py-1.5 rounded-md text-sm transition-colors",r==="all"?"bg-[var(--dg-bg-hover)] text-[var(--dg-text-primary)] font-medium":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:"全部类型"}),K.map(o=>e.jsxs("button",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:100:13",onClick:()=>s(o.value),className:b("px-3 py-1.5 rounded-md text-sm transition-colors flex items-center gap-1.5",r===o.value?"bg-[var(--dg-bg-hover)] text-[var(--dg-text-primary)] font-medium":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:110:15",style:{color:o.color},children:"●"}),o.label]},o.value))]})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:117:7",className:"grid grid-cols-1 gap-4",children:a.length===0?e.jsx(u,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:119:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:120:13",className:"p-8",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:121:15",className:"text-center",children:[e.jsx(oe,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:122:17",className:"h-12 w-12 mx-auto text-[var(--dg-text-muted)] mb-4"}),e.jsx("h3",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:123:17",className:"text-lg font-medium text-[var(--dg-text-secondary)] mb-2",children:"暂无流程模板"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:124:17",className:"text-sm text-[var(--dg-text-muted)]",children:"当前筛选条件下没有匹配的模板"})]})})}):a.map(o=>e.jsxs(u,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:130:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(ye,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:131:15",className:"pb-2",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:132:17",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:133:19",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:134:21",className:"w-10 h-10 rounded-lg bg-[var(--dg-blue)]/10 flex items-center justify-center",children:e.jsx(oe,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:135:23",className:"h-5 w-5 text-[var(--dg-blue)]"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:137:21",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:138:23",className:"flex items-center gap-2",children:[e.jsx(Ne,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:139:25",className:"text-base text-[var(--dg-text-primary)]",children:o.name}),o.type&&e.jsx(C,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:141:27",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:He(o.type)},children:qe(o.type)})]}),e.jsx(we,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:150:23",className:"text-[var(--dg-text-muted)]",children:o.description})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:153:19",className:"flex items-center gap-2",children:[e.jsx(C,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:154:21",variant:"outline",className:o.status===1||o.status==="active"||o.status===!0?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-[var(--dg-border)] text-[var(--dg-text-secondary)] bg-[var(--dg-bg-tertiary)]",children:o.status===1||o.status==="active"||o.status===!0?"已启用":"已停用"}),e.jsx(i,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:164:21",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]",children:e.jsx(Pe,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:165:23",className:"h-4 w-4"})})]})]})}),e.jsxs(j,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:170:15",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:171:17",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4 overflow-x-auto",children:Qe(o)}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:174:17",className:"flex items-center justify-between mt-4 text-sm text-[var(--dg-text-muted)]",children:[e.jsxs("span",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:175:19",children:["创建于 ",o.created_at?new Date(o.created_at).toLocaleDateString():"--"]}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:176:19",children:[ne(o.steps).length," 个节点"]})]})]})]},o.id))})]})}function Ye({open:a,onOpenChange:r,instance:s,templates:o,onApprove:n,onReject:m}){return s?e.jsx(M,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:41:5",open:a,onOpenChange:r,children:e.jsxs(V,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:42:7",className:"max-w-2xl bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-h-[90vh] overflow-y-auto",children:[e.jsxs(q,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:43:9",children:[e.jsx(H,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:44:11",className:"text-[var(--dg-text-primary)]",children:"审批详情"}),e.jsx(Q,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:45:11",className:"text-[var(--dg-text-muted)]",children:"查看审批流程详细信息"})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:47:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:48:11",children:[e.jsx("h3",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:49:13",className:"text-lg font-medium text-[var(--dg-text-primary)]",children:s.title}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:50:13",className:"flex items-center gap-2 mt-1",children:[e.jsx(C,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:51:15",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:L(A(s))},children:Y(A(s))}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:54:15",className:"text-xs text-[var(--dg-text-muted)]",children:["申请人:",s.applicant_name||s.applicant||"--"]}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:57:15",className:"text-xs text-[var(--dg-text-muted)]",children:["提交于 ",s.created_at?new Date(s.created_at).toLocaleString():"--"]})]})]}),s.content&&e.jsx("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:65:13",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:66:15",className:"text-sm text-[var(--dg-text-secondary)] whitespace-pre-wrap",children:s.content})}),(()=>{const p=o.find(y=>y.id===s.template_id),d=Ee(s.form_data,p);return d?e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:76:15",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:77:17",className:"text-sm font-medium text-[var(--dg-text-secondary)] mb-3",children:"申请表单"}),d]}):null})(),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:84:11",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:85:13",className:"text-sm font-medium text-[var(--dg-text-secondary)] mb-3",children:"审批进度"}),X(s)]}),s.actions&&e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:91:13",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:92:15",className:"text-sm font-medium text-[var(--dg-text-secondary)] mb-3",children:"操作记录"}),e.jsx("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:93:15",className:"space-y-2",children:s.actions.map((p,d)=>e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:95:19",className:"flex items-center gap-3 text-sm",children:[p.action==="approve"?e.jsx(D,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:97:23",className:"h-4 w-4 text-emerald-400"}):p.action==="reject"?e.jsx(F,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:99:23",className:"h-4 w-4 text-red-400"}):e.jsx(ce,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:101:23",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:103:21",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:104:23",className:"text-[var(--dg-text-secondary)]",children:p.operator_name||p.operator}),e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:107:23",className:"text-[var(--dg-text-muted)] mx-1",children:"·"}),e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:108:23",className:"text-[var(--dg-text-secondary)]",children:p.action==="approve"?"通过":p.action==="reject"?"拒绝":"提交"}),p.comment&&e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:112:25",className:"text-xs text-[var(--dg-text-muted)] mt-0.5",children:p.comment})]}),e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:115:21",className:"text-xs text-[var(--dg-text-muted)] ml-auto",children:p.created_at?new Date(p.created_at).toLocaleString():""})]},d))})]})]}),e.jsxs(G,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:124:9",children:[s.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:127:15",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>{r(!1),m(s)},children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:128:17",className:"h-4 w-4 mr-2"}),"拒绝"]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:130:15",className:"bg-emerald-500/90 hover:bg-emerald-500 text-white",onClick:()=>{r(!1),n(s)},children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:131:17",className:"h-4 w-4 mr-2"}),"通过"]})]}),e.jsx(i,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:135:11",variant:"ghost",onClick:()=>r(!1),children:"关闭"})]})]})}):null}function Ue({open:a,onOpenChange:r,templates:s,onSuccess:o}){const[n,m]=v.useState(null),[p,d]=v.useState({}),[y,c]=v.useState(!1),w=async()=>{if(!n){T.error("请先选择申请类型");return}const l=I(n.form_schema);for(const x of l)if(x.required&&!p[x.key]){T.error(`请填写${x.label}`);return}c(!0);try{await k.createProcess({template_id:n.id,title:p.app_name||n.name,form_data:JSON.stringify(p)}),T.success("申请已提交"),r(!1),m(null),d({}),o()}catch(x){T.error("提交失败",{description:x?.message})}finally{c(!1)}};return e.jsx(M,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:78:5",open:a,onOpenChange:l=>{l||(m(null),d({})),r(l)},children:e.jsxs(V,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:89:7",className:"max-w-2xl bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-h-[90vh] overflow-y-auto",children:[e.jsxs(q,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:90:9",children:[e.jsx(H,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:91:11",className:"text-[var(--dg-text-primary)]",children:"新建资源申请"}),e.jsx(Q,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:92:11",className:"text-[var(--dg-text-muted)]",children:n?"请填写申请信息":"请选择申请类型"})]}),n?e.jsxs("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:135:11",className:"py-2",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:136:13",className:"flex items-center gap-2 mb-4",children:e.jsx("button",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:137:15",type:"button",onClick:()=>{m(null),d({})},className:"text-xs text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",children:"← 返回选择类型"})}),e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:145:13",className:"grid grid-cols-2 gap-x-4 gap-y-4",children:I(n.form_schema).map(l=>{const x=l.type==="textarea";return e.jsxs("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:149:19",className:b("space-y-1.5",x&&"col-span-2"),children:[e.jsxs(_e,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:150:21",className:"text-sm font-medium text-[var(--dg-text-secondary)]",children:[l.label,l.required&&e.jsx("span",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:152:42",className:"text-red-400 ml-0.5",children:"*"})]}),l.type==="select"?e.jsxs(Le,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:155:23",value:String(p[l.key]??""),onValueChange:h=>d(g=>({...g,[l.key]:h})),children:[e.jsx(Oe,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:159:25",className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(Ie,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:160:27",placeholder:l.placeholder||`请选择${l.label}`})}),e.jsx($e,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:162:25",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:(l.options||[]).map(h=>e.jsx(Re,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:164:29",value:h,className:"text-[var(--dg-text-primary)] focus:bg-[var(--dg-bg-hover)]",children:h},h))})]}):l.type==="textarea"?e.jsx(pe,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:171:23",placeholder:l.placeholder||`请输入${l.label}`,value:p[l.key]??"",onChange:h=>d(g=>({...g,[l.key]:h.target.value})),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] min-h-[80px]"}):e.jsx(le,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:178:23",type:l.type==="number"?"number":"text",placeholder:l.placeholder||`请输入${l.label}`,value:p[l.key]??"",onChange:h=>d(g=>({...g,[l.key]:h.target.value})),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]},l.key)})})]}):e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:99:11",className:"grid grid-cols-2 gap-4 py-2",children:R.map(l=>{const x=s.find(g=>g.type===l.value&&g.enabled!==!1),h=l.icon;return e.jsxs("button",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:106:17",type:"button",disabled:!x,onClick:()=>{m(x),d({})},className:b("flex flex-col items-start gap-3 p-5 rounded-xl text-left transition-colors","bg-[var(--dg-bg-tertiary)] hover:bg-[var(--dg-bg-hover)]",!x&&"opacity-40 cursor-not-allowed hover:bg-[var(--dg-bg-tertiary)]"),children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:117:19",className:"w-10 h-10 rounded-lg flex items-center justify-center",style:{backgroundColor:`color-mix(in srgb, ${l.color} 15%, transparent)`,color:l.color},children:e.jsx(h,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:121:21",className:"h-5 w-5"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:123:19",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:124:21",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:l.label}),e.jsx("p",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:125:21",className:"text-xs text-[var(--dg-text-muted)] mt-0.5",children:x?x.description||`共 ${I(x.form_schema).length} 个字段`:"暂无可用模板"})]})]},l.value)})}),e.jsxs(G,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:196:9",children:[e.jsx(i,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:197:11",variant:"ghost",onClick:()=>r(!1),children:"取消"}),n&&e.jsxs(i,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:199:13",className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",onClick:w,disabled:y,children:[y&&e.jsx($,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:204:30",className:"h-4 w-4 mr-2 animate-spin"}),"提交申请"]})]})]})})}function Xe(){const[a,r]=v.useState("instances"),[s,o]=v.useState([]),[n,m]=v.useState([]),[p,d]=v.useState([]),[y,c]=v.useState(!0),[w,l]=v.useState(""),[x,h]=v.useState(""),[g,de]=v.useState("all"),[me,W]=v.useState(!1),[P,Z]=v.useState(null),[ve,O]=v.useState(!1),[f,xe]=v.useState("approve"),[z,ee]=v.useState(""),[ae,te]=v.useState(!1),[ie,se]=v.useState(!1),E=async()=>{try{c(!0);const[t,N,J]=await Promise.all([k.getProcesses().catch(()=>null),k.getTemplates().catch(()=>null),k.getProcesses({status:"pending"}).catch(()=>null)]);o(t?.list||[]),m(N?.list||[]),d(J?.list||[])}catch(t){console.error("加载审批数据失败:",t)}finally{c(!1)}};v.useEffect(()=>{E()},[]);const he=s.filter(t=>{const N=(t.title||"").toLowerCase().includes(w.toLowerCase())||(t.applicant_name||t.applicant||"").toLowerCase().includes(w.toLowerCase()),J=!x||t.status===x;return N&&J}),ge=n.filter(t=>g==="all"||t.type===g),re=t=>{Z(t),W(!0)},S=(t,N)=>{xe(t),Z(N),ee(""),O(!0)},be=async()=>{if(P)try{te(!0),f==="approve"?(await k.approveProcess(P.id,z),T.success("审批通过")):(await k.rejectProcess(P.id,z),T.success("已拒绝")),O(!1),E()}catch(t){T.error("操作失败",{description:t.message})}finally{te(!1)}},ue=s.filter(t=>t.status==="pending").length,je=s.filter(t=>t.status==="approved").length,Ae=s.filter(t=>t.status==="rejected").length,B=p.filter(t=>t.status==="pending").length;return e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:139:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:141:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:142:9",children:[e.jsx("h1",{"code-path":"src/components/approval/ApprovalFlow.tsx:143:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"资源申请"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:144:11",className:"text-sm text-[var(--dg-text-muted)] mt-1",children:"云服务器申请 · 应用部署申请"})]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:146:9",className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",onClick:()=>se(!0),children:[e.jsx(ke,{"code-path":"src/components/approval/ApprovalFlow.tsx:150:11",className:"h-4 w-4 mr-2"}),"新建申请"]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:156:7",className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:157:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:158:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:159:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:160:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:161:17",className:"text-sm text-[var(--dg-text-muted)]",children:"待审批"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:162:17",className:"text-2xl font-bold text-amber-400",children:ue})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:164:15",className:"p-3 rounded-lg bg-amber-500/10 text-amber-400",children:e.jsx(ce,{"code-path":"src/components/approval/ApprovalFlow.tsx:165:17",className:"h-5 w-5"})})]})})}),e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:170:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:171:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:172:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:173:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:174:17",className:"text-sm text-[var(--dg-text-muted)]",children:"已通过"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:175:17",className:"text-2xl font-bold text-emerald-400",children:je})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:177:15",className:"p-3 rounded-lg bg-emerald-500/10 text-emerald-400",children:e.jsx(D,{"code-path":"src/components/approval/ApprovalFlow.tsx:178:17",className:"h-5 w-5"})})]})})}),e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:183:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:184:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:185:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:186:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:187:17",className:"text-sm text-[var(--dg-text-muted)]",children:"已拒绝"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:188:17",className:"text-2xl font-bold text-red-400",children:Ae})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:190:15",className:"p-3 rounded-lg bg-red-500/10 text-red-400",children:e.jsx(F,{"code-path":"src/components/approval/ApprovalFlow.tsx:191:17",className:"h-5 w-5"})})]})})}),e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:196:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:197:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:198:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:199:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:200:17",className:"text-sm text-[var(--dg-text-muted)]",children:"我的待办"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:201:17",className:"text-2xl font-bold text-[var(--dg-blue)]",children:B})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:203:15",className:"p-3 rounded-lg bg-[var(--dg-blue)]/10 text-[var(--dg-blue)]",children:e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:204:17",className:"h-5 w-5"})})]})})})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:212:7",className:"flex items-center gap-1 border-b border-[var(--dg-border)]",children:[{key:"instances",label:"审批实例"},{key:"flows",label:"流程模板"},{key:"my-approvals",label:"我的审批"}].map(t=>e.jsxs("button",{"code-path":"src/components/approval/ApprovalFlow.tsx:218:11",onClick:()=>r(t.key),className:b("px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",a===t.key?"border-[var(--dg-blue)] text-[var(--dg-blue)]":"border-transparent text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:[t.label,t.key==="my-approvals"&&B>0&&e.jsx(C,{"code-path":"src/components/approval/ApprovalFlow.tsx:230:15",className:"ml-2 bg-red-500/20 text-red-400 border-0 text-xs",children:B})]},t.key))}),a==="instances"&&e.jsx(Ve,{"code-path":"src/components/approval/ApprovalFlow.tsx:238:9",processes:s,filteredInstances:he,loading:y,searchQuery:w,setSearchQuery:l,statusFilter:x,setStatusFilter:h,onView:re,onApprove:t=>S("approve",t),onReject:t=>S("reject",t)}),a==="flows"&&e.jsx(Ge,{"code-path":"src/components/approval/ApprovalFlow.tsx:253:9",filteredTemplates:ge,templateTypeFilter:g,setTemplateTypeFilter:de}),a==="my-approvals"&&e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:261:9",className:"grid grid-cols-1 gap-4",children:p.length===0?e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:263:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:264:15",className:"p-12",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:265:17",className:"text-center",children:[e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:266:19",className:"h-12 w-12 mx-auto text-[var(--dg-text-muted)] mb-4"}),e.jsx("h3",{"code-path":"src/components/approval/ApprovalFlow.tsx:267:19",className:"text-lg font-medium text-[var(--dg-text-secondary)] mb-2",children:"暂无待办"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:268:19",className:"text-sm text-[var(--dg-text-muted)]",children:"没有等待你处理的审批"})]})})}):p.map(t=>{const{percentage:N}=U(t);return e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:276:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:277:19",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:278:21",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:279:23",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:280:25",className:"w-10 h-10 rounded-lg bg-[var(--dg-bg-tertiary)] flex items-center justify-center",style:{color:L(A(t))},children:e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:281:27",className:"h-5 w-5"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:283:25",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:284:27",className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{"code-path":"src/components/approval/ApprovalFlow.tsx:285:29",className:"font-medium text-[var(--dg-text-primary)]",children:t.title}),e.jsx(C,{"code-path":"src/components/approval/ApprovalFlow.tsx:286:29",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:L(A(t))},children:Y(A(t))})]}),e.jsxs("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:290:27",className:"text-xs text-[var(--dg-text-muted)]",children:["申请人:",t.applicant_name||t.applicant||"--"]}),e.jsxs("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:293:27",className:"text-xs text-[var(--dg-text-muted)]",children:["提交于 ",t.created_at?new Date(t.created_at).toLocaleString():"--"]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:298:23",className:"flex items-center gap-2",children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:299:25",variant:"ghost",size:"sm",onClick:()=>re(t),children:[e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:300:27",className:"h-4 w-4 mr-1"}),"详情"]}),t.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:305:29",variant:"outline",size:"sm",className:"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10",onClick:()=>S("approve",t),children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalFlow.tsx:306:31",className:"h-4 w-4 mr-1"}),"通过"]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:308:29",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>S("reject",t),children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalFlow.tsx:309:31",className:"h-4 w-4 mr-1"}),"拒绝"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:315:21",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:316:23",className:"flex items-center justify-between text-xs text-[var(--dg-text-muted)] mb-1.5",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalFlow.tsx:317:25",children:"审批进度"}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalFlow.tsx:318:25",children:[N,"%"]})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:320:23",className:"w-full h-1.5 bg-[var(--dg-bg-tertiary)] rounded-full overflow-hidden",children:e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:321:25",className:b("h-full rounded-full",t.status==="rejected"?"bg-red-400":"bg-[var(--dg-blue)]"),style:{width:`${N}%`}})})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:324:21",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3",children:X(t)})]})},t.id)})}),e.jsx(Ye,{"code-path":"src/components/approval/ApprovalFlow.tsx:336:7",open:me,onOpenChange:W,instance:P,templates:n,onApprove:t=>S("approve",t),onReject:t=>S("reject",t)}),e.jsx(M,{"code-path":"src/components/approval/ApprovalFlow.tsx:346:7",open:ve,onOpenChange:O,children:e.jsxs(V,{"code-path":"src/components/approval/ApprovalFlow.tsx:347:9",className:"max-w-md bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(q,{"code-path":"src/components/approval/ApprovalFlow.tsx:348:11",children:[e.jsx(H,{"code-path":"src/components/approval/ApprovalFlow.tsx:349:13",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:f==="approve"?e.jsxs(e.Fragment,{children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalFlow.tsx:352:19",className:"h-5 w-5 text-emerald-400"}),"确认通过审批"]}):e.jsxs(e.Fragment,{children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalFlow.tsx:357:19",className:"h-5 w-5 text-red-400"}),"确认拒绝审批"]})}),e.jsx(Q,{"code-path":"src/components/approval/ApprovalFlow.tsx:362:13",className:"text-[var(--dg-text-muted)]",children:f==="approve"?"请填写审批意见后确认通过":"请填写拒绝原因后确认拒绝"})]}),P&&e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:367:13",className:"py-2",children:[e.jsxs("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:368:15",className:"text-sm text-[var(--dg-text-secondary)] mb-2",children:["审批标题:",e.jsx("span",{"code-path":"src/components/approval/ApprovalFlow.tsx:369:22",className:"text-[var(--dg-text-primary)]",children:P.title})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:371:15",className:"space-y-2",children:[e.jsx("label",{"code-path":"src/components/approval/ApprovalFlow.tsx:372:17",className:"text-sm font-medium text-[var(--dg-text-secondary)]",children:f==="approve"?"审批意见":"拒绝原因"}),e.jsx(pe,{"code-path":"src/components/approval/ApprovalFlow.tsx:375:17",placeholder:f==="approve"?"请填写审批意见(可选)":"请填写拒绝原因",value:z,onChange:t=>ee(t.target.value),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] min-h-[80px]"})]})]}),e.jsxs(G,{"code-path":"src/components/approval/ApprovalFlow.tsx:384:11",children:[e.jsx(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:385:13",variant:"outline",onClick:()=>O(!1),className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"取消"}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:388:13",onClick:be,disabled:ae,className:f==="approve"?"bg-emerald-500/90 hover:bg-emerald-500 text-white":"bg-red-500 hover:bg-red-600 text-white",children:[ae&&e.jsx($,{"code-path":"src/components/approval/ApprovalFlow.tsx:393:36",className:"h-4 w-4 mr-2 animate-spin"}),f==="approve"?"确认通过":"确认拒绝"]})]})]})}),e.jsx(Ue,{"code-path":"src/components/approval/ApprovalFlow.tsx:401:7",open:ie,onOpenChange:se,templates:n,onSuccess:E})]})}const ca=Xe;export{Xe as ApprovalFlow,ca as ApprovalFlowManager}; +import{j as e,r as v}from"./vendor-codemirror-B1SGo4xl.js";import{m as b,B as i,D as M,a as V,b as q,c as H,d as G,e as Q,t as T}from"./index-Bp-M7P_8.js";import{C as u,a as j,b as Ne,c as ye,d as we}from"./card-BHSBTtub.js";import{B as C}from"./badge-B00SZHvE.js";import{T as pe}from"./textarea-BvOVhaCD.js";import{b as k}from"./approval-BivSGX8T.js";import{I as le}from"./input-Bnlm--la.js";import{h as fe,aN as Te,F as _,C as D,a as F,L as $,S as De,x as Fe,af as Ce,J as oe,aE as Pe,ae as Se,b as ce,P as ke}from"./vendor-icons-BWk-DH7F.js";import{L as _e}from"./label-NkONM5Mp.js";import{S as Le,a as Oe,b as Ie,c as $e,d as Re}from"./select-DbhcBWnH.js";import"./index-5FEebgvX.js";function ze(a){if(Array.isArray(a))return a;if(typeof a=="string")try{const r=JSON.parse(a);return Array.isArray(r)?r:[]}catch{return[]}return[]}function I(a){if(!a)return[];const r=typeof a=="string"?(()=>{try{return JSON.parse(a)}catch{return null}})():a;return r?Array.isArray(r.fields)?r.fields:[]:[]}function Ee(a,r){if(!a)return null;let s;try{s=typeof a=="string"?JSON.parse(a):a}catch{return null}if(!s||typeof s!="object")return null;const o=I(r?.form_schema),n=new Map;o.forEach(p=>n.set(p.key,p.label));const m=Object.entries(s).filter(([,p])=>p!=null&&p!=="");return m.length===0?null:e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:53:5",className:"grid grid-cols-2 gap-x-4 gap-y-3",children:m.map(([p,d])=>e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:55:9",className:"min-w-0",children:[e.jsx("p",{"code-path":"src/components/approval/helpers.tsx:56:11",className:"text-xs text-[var(--dg-text-muted)] mb-0.5",children:n.get(p)||p}),e.jsx("p",{"code-path":"src/components/approval/helpers.tsx:57:11",className:"text-sm text-[var(--dg-text-primary)] break-words",children:String(d)})]},p))})}const R=[{value:"server_apply",label:"云服务器申请",icon:fe,color:"var(--dg-cyan)"},{value:"app_deploy",label:"应用部署申请",icon:Te,color:"var(--dg-blue)"}],Y=a=>R.find(r=>r.value===a)?.label||a||"通用审批",L=a=>R.find(r=>r.value===a)?.color||"var(--dg-text-secondary)",Be=a=>R.find(r=>r.value===a)?.icon||_,A=a=>a?.template?.type||a?.type||"";function U(a){const r=ze(a.steps),s=a.current_step??0,o=r.length,n=r.filter(p=>p.status==="approved"||p.status==="completed").length,m=o>0?Math.round(n/o*100):0;return{steps:r,currentIndex:s,total:o,completed:n,percentage:m}}function X(a){const{steps:r,currentIndex:s}=U(a);return r.length===0?null:e.jsx("div",{"code-path":"src/components/approval/helpers.tsx:99:5",className:"flex items-center gap-1 overflow-x-auto",children:r.map((o,n)=>{const m=o.status==="approved"||o.status==="completed",p=n===s,d=o.status==="rejected";return e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:105:11",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/helpers.tsx:106:13",className:b("flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs whitespace-nowrap",m&&"bg-emerald-500/10 text-emerald-400",p&&!d&&"bg-amber-500/10 text-amber-400 border border-amber-500/30",d&&"bg-red-500/10 text-red-400",!m&&!p&&!d&&"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]"),children:[m&&e.jsx(D,{"code-path":"src/components/approval/helpers.tsx:115:31",className:"h-3 w-3"}),d&&e.jsx(F,{"code-path":"src/components/approval/helpers.tsx:116:30",className:"h-3 w-3"}),p&&!d&&e.jsx($,{"code-path":"src/components/approval/helpers.tsx:117:44",className:"h-3 w-3 animate-spin"}),e.jsx("span",{"code-path":"src/components/approval/helpers.tsx:118:15",children:o.name||o.approver_name||`步骤 ${n+1}`})]}),no(c.target.value),className:"pl-9 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:108:9",className:"flex items-center gap-1 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-lg p-1",children:Je.map(c=>e.jsx("button",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:110:13",onClick:()=>m(c.value),className:b("px-3 py-1.5 rounded-md text-sm transition-colors",n===c.value?"bg-[var(--dg-bg-hover)] text-[var(--dg-text-primary)] font-medium":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:c.label},c.key))})]}),r?e.jsx(u,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:128:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:129:11",className:"p-12",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:130:13",className:"flex items-center justify-center text-[var(--dg-text-muted)]",children:[e.jsx($,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:131:15",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]})})}):a.length===0?e.jsx(u,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:137:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:138:11",className:"p-12",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:139:13",className:"text-center",children:[e.jsx(_,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:140:15",className:"h-12 w-12 mx-auto text-[var(--dg-text-muted)] mb-4"}),e.jsx("h3",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:141:15",className:"text-lg font-medium text-[var(--dg-text-secondary)] mb-2",children:"暂无审批流程"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:142:15",className:"text-sm text-[var(--dg-text-muted)]",children:"当前筛选条件下没有匹配的流程实例"})]})})}):e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:147:9",className:"grid grid-cols-1 gap-4",children:a.map(c=>{const w=Be(A(c)),{percentage:l}=U(c);return e.jsx(u,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:152:15",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] hover:border-[var(--dg-border)] transition-colors",children:e.jsxs(j,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:153:17",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:154:19",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:155:21",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:156:23",className:"w-10 h-10 rounded-lg bg-[var(--dg-bg-tertiary)] flex items-center justify-center",style:{color:L(A(c))},children:e.jsx(w,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:157:25",className:"h-5 w-5"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:159:23",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:160:25",className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:161:27",className:"font-medium text-[var(--dg-text-primary)]",children:c.title}),Me(c.status)]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:164:25",className:"flex items-center gap-3 text-xs text-[var(--dg-text-muted)]",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:165:27",className:"flex items-center gap-1",children:e.jsx(C,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:166:29",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:L(A(c))},children:Y(A(c))})}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:170:27",children:["申请人:",c.applicant_name||c.applicant||"--"]}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:171:27",children:["提交于 ",c.created_at?new Date(c.created_at).toLocaleString():"--"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:175:21",className:"flex items-center gap-2",children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:176:23",variant:"ghost",size:"sm",className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]",onClick:()=>p(c),children:[e.jsx(Fe,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:177:25",className:"h-4 w-4 mr-1"}),"详情"]}),c.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:182:27",variant:"outline",size:"sm",className:"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10",onClick:()=>d(c),children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:188:29",className:"h-4 w-4 mr-1"}),"通过"]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:191:27",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>N(c),children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalProcessTab.tsx:197:29",className:"h-4 w-4 mr-1"}),"拒绝"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:205:19",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:206:21",className:"flex items-center justify-between text-xs text-[var(--dg-text-muted)] mb-1.5",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:207:23",children:"审批进度"}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:208:23",children:[l,"%"]})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:210:21",className:"w-full h-1.5 bg-[var(--dg-bg-tertiary)] rounded-full overflow-hidden",children:e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:211:23",className:b("h-full rounded-full transition-all",c.status==="rejected"?"bg-red-400":"bg-[var(--dg-blue)]"),style:{width:`${l}%`}})})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalProcessTab.tsx:221:19",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3",children:X(c)})]})},c.id)})})]})}function ne(a){if(Array.isArray(a))return a;if(typeof a=="string")try{const r=JSON.parse(a);return Array.isArray(r)?r:[]}catch{return[]}return[]}const K=[{value:"deploy",label:"发布审批",color:"var(--dg-blue)"},{value:"server",label:"服务器操作",color:"var(--dg-cyan)"},{value:"permission",label:"权限申请",color:"var(--dg-purple)"}],qe=a=>K.find(r=>r.value===a)?.label||a||"通用审批",He=a=>K.find(r=>r.value===a)?.color||"var(--dg-text-secondary)";function Ge(a){const r=ne(a.steps);return r.length===0?e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:37:12",className:"text-[var(--dg-text-muted)] text-center py-4",children:"暂无流程节点"}):e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:40:5",className:"flex items-center gap-2 overflow-x-auto py-4",children:r.map((s,o)=>e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:42:9",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:43:11",className:b("px-4 py-2 rounded-lg border min-w-[100px] text-center",s.type==="start"&&"bg-emerald-500/10 border-emerald-500/30 text-emerald-400",s.type==="approval"&&"bg-[var(--dg-blue)]/10 border-[var(--dg-blue)]/30 text-[var(--dg-blue)]",s.type==="condition"&&"bg-amber-500/10 border-amber-500/30 text-amber-400",s.type==="end"&&"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-secondary)]"),children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:52:13",className:"text-sm font-medium",children:s.name}),s.approvers&&e.jsx("p",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:54:15",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:Array.isArray(s.approvers)?s.approvers.join(", "):s.approvers})]}),os("all"),className:b("px-3 py-1.5 rounded-md text-sm transition-colors",r==="all"?"bg-[var(--dg-bg-hover)] text-[var(--dg-text-primary)] font-medium":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:"全部类型"}),K.map(o=>e.jsxs("button",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:100:13",onClick:()=>s(o.value),className:b("px-3 py-1.5 rounded-md text-sm transition-colors flex items-center gap-1.5",r===o.value?"bg-[var(--dg-bg-hover)] text-[var(--dg-text-primary)] font-medium":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:110:15",style:{color:o.color},children:"●"}),o.label]},o.value))]})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:117:7",className:"grid grid-cols-1 gap-4",children:a.length===0?e.jsx(u,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:119:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:120:13",className:"p-8",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:121:15",className:"text-center",children:[e.jsx(oe,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:122:17",className:"h-12 w-12 mx-auto text-[var(--dg-text-muted)] mb-4"}),e.jsx("h3",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:123:17",className:"text-lg font-medium text-[var(--dg-text-secondary)] mb-2",children:"暂无流程模板"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:124:17",className:"text-sm text-[var(--dg-text-muted)]",children:"当前筛选条件下没有匹配的模板"})]})})}):a.map(o=>e.jsxs(u,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:130:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(Ne,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:131:15",className:"pb-2",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:132:17",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:133:19",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:134:21",className:"w-10 h-10 rounded-lg bg-[var(--dg-blue)]/10 flex items-center justify-center",children:e.jsx(oe,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:135:23",className:"h-5 w-5 text-[var(--dg-blue)]"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:137:21",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:138:23",className:"flex items-center gap-2",children:[e.jsx(ye,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:139:25",className:"text-base text-[var(--dg-text-primary)]",children:o.name}),o.type&&e.jsx(C,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:141:27",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:He(o.type)},children:qe(o.type)})]}),e.jsx(we,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:150:23",className:"text-[var(--dg-text-muted)]",children:o.description})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:153:19",className:"flex items-center gap-2",children:[e.jsx(C,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:154:21",variant:"outline",className:o.status===1||o.status==="active"||o.status===!0?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-[var(--dg-border)] text-[var(--dg-text-secondary)] bg-[var(--dg-bg-tertiary)]",children:o.status===1||o.status==="active"||o.status===!0?"已启用":"已停用"}),e.jsx(i,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:164:21",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]",children:e.jsx(Pe,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:165:23",className:"h-4 w-4"})})]})]})}),e.jsxs(j,{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:170:15",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:171:17",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4 overflow-x-auto",children:Ge(o)}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:174:17",className:"flex items-center justify-between mt-4 text-sm text-[var(--dg-text-muted)]",children:[e.jsxs("span",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:175:19",children:["创建于 ",o.created_at?new Date(o.created_at).toLocaleDateString():"--"]}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalTemplateTab.tsx:176:19",children:[ne(o.steps).length," 个节点"]})]})]})]},o.id))})]})}function Ye({open:a,onOpenChange:r,instance:s,templates:o,onApprove:n,onReject:m}){return s?e.jsx(M,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:41:5",open:a,onOpenChange:r,children:e.jsxs(V,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:42:7",className:"max-w-2xl bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-h-[90vh] overflow-y-auto",children:[e.jsxs(q,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:43:9",children:[e.jsx(H,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:44:11",className:"text-[var(--dg-text-primary)]",children:"审批详情"}),e.jsx(G,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:45:11",className:"text-[var(--dg-text-muted)]",children:"查看审批流程详细信息"})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:47:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:48:11",children:[e.jsx("h3",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:49:13",className:"text-lg font-medium text-[var(--dg-text-primary)]",children:s.title}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:50:13",className:"flex items-center gap-2 mt-1",children:[e.jsx(C,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:51:15",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:L(A(s))},children:Y(A(s))}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:54:15",className:"text-xs text-[var(--dg-text-muted)]",children:["申请人:",s.applicant_name||s.applicant||"--"]}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:57:15",className:"text-xs text-[var(--dg-text-muted)]",children:["提交于 ",s.created_at?new Date(s.created_at).toLocaleString():"--"]})]})]}),s.content&&e.jsx("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:65:13",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:66:15",className:"text-sm text-[var(--dg-text-secondary)] whitespace-pre-wrap",children:s.content})}),(()=>{const p=o.find(N=>N.id===s.template_id),d=Ee(s.form_data,p);return d?e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:76:15",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:77:17",className:"text-sm font-medium text-[var(--dg-text-secondary)] mb-3",children:"申请表单"}),d]}):null})(),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:84:11",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:85:13",className:"text-sm font-medium text-[var(--dg-text-secondary)] mb-3",children:"审批进度"}),X(s)]}),s.actions&&e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:91:13",className:"bg-[var(--dg-bg-primary)] rounded-lg p-4",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:92:15",className:"text-sm font-medium text-[var(--dg-text-secondary)] mb-3",children:"操作记录"}),e.jsx("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:93:15",className:"space-y-2",children:s.actions.map((p,d)=>e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:95:19",className:"flex items-center gap-3 text-sm",children:[p.action==="approve"?e.jsx(D,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:97:23",className:"h-4 w-4 text-emerald-400"}):p.action==="reject"?e.jsx(F,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:99:23",className:"h-4 w-4 text-red-400"}):e.jsx(ce,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:101:23",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:103:21",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:104:23",className:"text-[var(--dg-text-secondary)]",children:p.operator_name||p.operator}),e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:107:23",className:"text-[var(--dg-text-muted)] mx-1",children:"·"}),e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:108:23",className:"text-[var(--dg-text-secondary)]",children:p.action==="approve"?"通过":p.action==="reject"?"拒绝":"提交"}),p.comment&&e.jsx("p",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:112:25",className:"text-xs text-[var(--dg-text-muted)] mt-0.5",children:p.comment})]}),e.jsx("span",{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:115:21",className:"text-xs text-[var(--dg-text-muted)] ml-auto",children:p.created_at?new Date(p.created_at).toLocaleString():""})]},d))})]})]}),e.jsxs(Q,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:124:9",children:[s.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:127:15",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>{r(!1),m(s)},children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:128:17",className:"h-4 w-4 mr-2"}),"拒绝"]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:130:15",className:"bg-emerald-500/90 hover:bg-emerald-500 text-white",onClick:()=>{r(!1),n(s)},children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:131:17",className:"h-4 w-4 mr-2"}),"通过"]})]}),e.jsx(i,{"code-path":"src/components/approval/ApprovalDetailDialog.tsx:135:11",variant:"ghost",onClick:()=>r(!1),children:"关闭"})]})]})}):null}function Ue({open:a,onOpenChange:r,templates:s,onSuccess:o}){const[n,m]=v.useState(null),[p,d]=v.useState({}),[N,c]=v.useState(!1),w=async()=>{if(!n){T.error("请先选择申请类型");return}const l=I(n.form_schema);for(const x of l)if(x.required&&!p[x.key]){T.error(`请填写${x.label}`);return}c(!0);try{await k.createProcess({template_id:n.id,title:p.app_name||n.name,form_data:JSON.stringify(p)}),T.success("申请已提交"),r(!1),m(null),d({}),o()}catch(x){T.error("提交失败",{description:x?.message})}finally{c(!1)}};return e.jsx(M,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:78:5",open:a,onOpenChange:l=>{l||(m(null),d({})),r(l)},children:e.jsxs(V,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:89:7",className:"max-w-2xl bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-h-[90vh] overflow-y-auto",children:[e.jsxs(q,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:90:9",children:[e.jsx(H,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:91:11",className:"text-[var(--dg-text-primary)]",children:"新建资源申请"}),e.jsx(G,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:92:11",className:"text-[var(--dg-text-muted)]",children:n?"请填写申请信息":"请选择申请类型"})]}),n?e.jsxs("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:135:11",className:"py-2",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:136:13",className:"flex items-center gap-2 mb-4",children:e.jsx("button",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:137:15",type:"button",onClick:()=>{m(null),d({})},className:"text-xs text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",children:"← 返回选择类型"})}),e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:145:13",className:"grid grid-cols-2 gap-x-4 gap-y-4",children:I(n.form_schema).map(l=>{const x=l.type==="textarea";return e.jsxs("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:149:19",className:b("space-y-1.5",x&&"col-span-2"),children:[e.jsxs(_e,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:150:21",className:"text-sm font-medium text-[var(--dg-text-secondary)]",children:[l.label,l.required&&e.jsx("span",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:152:42",className:"text-red-400 ml-0.5",children:"*"})]}),l.type==="select"?e.jsxs(Le,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:155:23",value:String(p[l.key]??""),onValueChange:h=>d(g=>({...g,[l.key]:h})),children:[e.jsx(Oe,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:159:25",className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(Ie,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:160:27",placeholder:l.placeholder||`请选择${l.label}`})}),e.jsx($e,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:162:25",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:(l.options||[]).map(h=>e.jsx(Re,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:164:29",value:h,className:"text-[var(--dg-text-primary)] focus:bg-[var(--dg-bg-hover)]",children:h},h))})]}):l.type==="textarea"?e.jsx(pe,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:171:23",placeholder:l.placeholder||`请输入${l.label}`,value:p[l.key]??"",onChange:h=>d(g=>({...g,[l.key]:h.target.value})),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] min-h-[80px]"}):e.jsx(le,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:178:23",type:l.type==="number"?"number":"text",placeholder:l.placeholder||`请输入${l.label}`,value:p[l.key]??"",onChange:h=>d(g=>({...g,[l.key]:h.target.value})),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]},l.key)})})]}):e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:99:11",className:"grid grid-cols-2 gap-4 py-2",children:R.map(l=>{const x=s.find(g=>g.type===l.value&&g.enabled!==!1),h=l.icon;return e.jsxs("button",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:106:17",type:"button",disabled:!x,onClick:()=>{m(x),d({})},className:b("flex flex-col items-start gap-3 p-5 rounded-xl text-left transition-colors","bg-[var(--dg-bg-tertiary)] hover:bg-[var(--dg-bg-hover)]",!x&&"opacity-40 cursor-not-allowed hover:bg-[var(--dg-bg-tertiary)]"),children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:117:19",className:"w-10 h-10 rounded-lg flex items-center justify-center",style:{backgroundColor:`color-mix(in srgb, ${l.color} 15%, transparent)`,color:l.color},children:e.jsx(h,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:121:21",className:"h-5 w-5"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:123:19",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:124:21",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:l.label}),e.jsx("p",{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:125:21",className:"text-xs text-[var(--dg-text-muted)] mt-0.5",children:x?x.description||`共 ${I(x.form_schema).length} 个字段`:"暂无可用模板"})]})]},l.value)})}),e.jsxs(Q,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:196:9",children:[e.jsx(i,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:197:11",variant:"ghost",onClick:()=>r(!1),children:"取消"}),n&&e.jsxs(i,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:199:13",className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",onClick:w,disabled:N,children:[N&&e.jsx($,{"code-path":"src/components/approval/ApprovalCreateDialog.tsx:204:30",className:"h-4 w-4 mr-2 animate-spin"}),"提交申请"]})]})]})})}function Xe(){const[a,r]=v.useState("instances"),[s,o]=v.useState([]),[n,m]=v.useState([]),[p,d]=v.useState([]),[N,c]=v.useState(!0),[w,l]=v.useState(""),[x,h]=v.useState(""),[g,de]=v.useState("all"),[me,W]=v.useState(!1),[P,Z]=v.useState(null),[ve,O]=v.useState(!1),[f,xe]=v.useState("approve"),[z,ee]=v.useState(""),[ae,te]=v.useState(!1),[ie,se]=v.useState(!1),E=async()=>{try{c(!0);const[t,y,J]=await Promise.all([k.getProcesses().catch(()=>null),k.getTemplates().catch(()=>null),k.getProcesses({status:"pending"}).catch(()=>null)]);o(t?.list||[]),m(y?.list||[]),d(J?.list||[])}catch(t){console.error("加载审批数据失败:",t)}finally{c(!1)}};v.useEffect(()=>{E()},[]);const he=s.filter(t=>{const y=(t.title||"").toLowerCase().includes(w.toLowerCase())||(t.applicant_name||t.applicant||"").toLowerCase().includes(w.toLowerCase()),J=!x||t.status===x;return y&&J}),ge=n.filter(t=>g==="all"||t.type===g),re=t=>{Z(t),W(!0)},S=(t,y)=>{xe(t),Z(y),ee(""),O(!0)},be=async()=>{if(P)try{te(!0),f==="approve"?(await k.approveProcess(P.id,z),T.success("审批通过")):(await k.rejectProcess(P.id,z),T.success("已拒绝")),O(!1),E()}catch(t){T.error("操作失败",{description:t.message})}finally{te(!1)}},ue=s.filter(t=>t.status==="pending").length,je=s.filter(t=>t.status==="approved").length,Ae=s.filter(t=>t.status==="rejected").length,B=p.filter(t=>t.status==="pending").length;return e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:139:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:141:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:142:9",children:[e.jsx("h1",{"code-path":"src/components/approval/ApprovalFlow.tsx:143:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"资源申请"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:144:11",className:"text-sm text-[var(--dg-text-muted)] mt-1",children:"云服务器申请 · 应用部署申请"})]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:146:9",className:"bg-[var(--dg-blue)] hover:opacity-90 text-white",onClick:()=>se(!0),children:[e.jsx(ke,{"code-path":"src/components/approval/ApprovalFlow.tsx:150:11",className:"h-4 w-4 mr-2"}),"新建申请"]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:156:7",className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:157:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:158:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:159:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:160:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:161:17",className:"text-sm text-[var(--dg-text-muted)]",children:"待审批"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:162:17",className:"text-2xl font-bold text-amber-400",children:ue})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:164:15",className:"p-3 rounded-lg bg-amber-500/10 text-amber-400",children:e.jsx(ce,{"code-path":"src/components/approval/ApprovalFlow.tsx:165:17",className:"h-5 w-5"})})]})})}),e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:170:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:171:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:172:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:173:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:174:17",className:"text-sm text-[var(--dg-text-muted)]",children:"已通过"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:175:17",className:"text-2xl font-bold text-emerald-400",children:je})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:177:15",className:"p-3 rounded-lg bg-emerald-500/10 text-emerald-400",children:e.jsx(D,{"code-path":"src/components/approval/ApprovalFlow.tsx:178:17",className:"h-5 w-5"})})]})})}),e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:183:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:184:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:185:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:186:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:187:17",className:"text-sm text-[var(--dg-text-muted)]",children:"已拒绝"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:188:17",className:"text-2xl font-bold text-red-400",children:Ae})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:190:15",className:"p-3 rounded-lg bg-red-500/10 text-red-400",children:e.jsx(F,{"code-path":"src/components/approval/ApprovalFlow.tsx:191:17",className:"h-5 w-5"})})]})})}),e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:196:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:197:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:198:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:199:15",children:[e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:200:17",className:"text-sm text-[var(--dg-text-muted)]",children:"我的待办"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:201:17",className:"text-2xl font-bold text-[var(--dg-blue)]",children:B})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:203:15",className:"p-3 rounded-lg bg-[var(--dg-blue)]/10 text-[var(--dg-blue)]",children:e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:204:17",className:"h-5 w-5"})})]})})})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:212:7",className:"flex items-center gap-1 border-b border-[var(--dg-border)]",children:[{key:"instances",label:"审批实例"},{key:"flows",label:"流程模板"},{key:"my-approvals",label:"我的审批"}].map(t=>e.jsxs("button",{"code-path":"src/components/approval/ApprovalFlow.tsx:218:11",onClick:()=>r(t.key),className:b("px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",a===t.key?"border-[var(--dg-blue)] text-[var(--dg-blue)]":"border-transparent text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"),children:[t.label,t.key==="my-approvals"&&B>0&&e.jsx(C,{"code-path":"src/components/approval/ApprovalFlow.tsx:230:15",className:"ml-2 bg-red-500/20 text-red-400 border-0 text-xs",children:B})]},t.key))}),a==="instances"&&e.jsx(Ve,{"code-path":"src/components/approval/ApprovalFlow.tsx:238:9",processes:s,filteredInstances:he,loading:N,searchQuery:w,setSearchQuery:l,statusFilter:x,setStatusFilter:h,onView:re,onApprove:t=>S("approve",t),onReject:t=>S("reject",t)}),a==="flows"&&e.jsx(Qe,{"code-path":"src/components/approval/ApprovalFlow.tsx:253:9",filteredTemplates:ge,templateTypeFilter:g,setTemplateTypeFilter:de}),a==="my-approvals"&&e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:261:9",className:"grid grid-cols-1 gap-4",children:p.length===0?e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:263:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:264:15",className:"p-12",children:e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:265:17",className:"text-center",children:[e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:266:19",className:"h-12 w-12 mx-auto text-[var(--dg-text-muted)] mb-4"}),e.jsx("h3",{"code-path":"src/components/approval/ApprovalFlow.tsx:267:19",className:"text-lg font-medium text-[var(--dg-text-secondary)] mb-2",children:"暂无待办"}),e.jsx("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:268:19",className:"text-sm text-[var(--dg-text-muted)]",children:"没有等待你处理的审批"})]})})}):p.map(t=>{const{percentage:y}=U(t);return e.jsx(u,{"code-path":"src/components/approval/ApprovalFlow.tsx:276:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(j,{"code-path":"src/components/approval/ApprovalFlow.tsx:277:19",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:278:21",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:279:23",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:280:25",className:"w-10 h-10 rounded-lg bg-[var(--dg-bg-tertiary)] flex items-center justify-center",style:{color:L(A(t))},children:e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:281:27",className:"h-5 w-5"})}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:283:25",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:284:27",className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{"code-path":"src/components/approval/ApprovalFlow.tsx:285:29",className:"font-medium text-[var(--dg-text-primary)]",children:t.title}),e.jsx(C,{"code-path":"src/components/approval/ApprovalFlow.tsx:286:29",variant:"outline",className:"text-xs border-[var(--dg-border)]",style:{color:L(A(t))},children:Y(A(t))})]}),e.jsxs("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:290:27",className:"text-xs text-[var(--dg-text-muted)]",children:["申请人:",t.applicant_name||t.applicant||"--"]}),e.jsxs("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:293:27",className:"text-xs text-[var(--dg-text-muted)]",children:["提交于 ",t.created_at?new Date(t.created_at).toLocaleString():"--"]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:298:23",className:"flex items-center gap-2",children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:299:25",variant:"ghost",size:"sm",onClick:()=>re(t),children:[e.jsx(_,{"code-path":"src/components/approval/ApprovalFlow.tsx:300:27",className:"h-4 w-4 mr-1"}),"详情"]}),t.status==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:305:29",variant:"outline",size:"sm",className:"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10",onClick:()=>S("approve",t),children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalFlow.tsx:306:31",className:"h-4 w-4 mr-1"}),"通过"]}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:308:29",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>S("reject",t),children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalFlow.tsx:309:31",className:"h-4 w-4 mr-1"}),"拒绝"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:315:21",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:316:23",className:"flex items-center justify-between text-xs text-[var(--dg-text-muted)] mb-1.5",children:[e.jsx("span",{"code-path":"src/components/approval/ApprovalFlow.tsx:317:25",children:"审批进度"}),e.jsxs("span",{"code-path":"src/components/approval/ApprovalFlow.tsx:318:25",children:[y,"%"]})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:320:23",className:"w-full h-1.5 bg-[var(--dg-bg-tertiary)] rounded-full overflow-hidden",children:e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:321:25",className:b("h-full rounded-full",t.status==="rejected"?"bg-red-400":"bg-[var(--dg-blue)]"),style:{width:`${y}%`}})})]}),e.jsx("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:324:21",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3",children:X(t)})]})},t.id)})}),e.jsx(Ye,{"code-path":"src/components/approval/ApprovalFlow.tsx:336:7",open:me,onOpenChange:W,instance:P,templates:n,onApprove:t=>S("approve",t),onReject:t=>S("reject",t)}),e.jsx(M,{"code-path":"src/components/approval/ApprovalFlow.tsx:346:7",open:ve,onOpenChange:O,children:e.jsxs(V,{"code-path":"src/components/approval/ApprovalFlow.tsx:347:9",className:"max-w-md bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(q,{"code-path":"src/components/approval/ApprovalFlow.tsx:348:11",children:[e.jsx(H,{"code-path":"src/components/approval/ApprovalFlow.tsx:349:13",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:f==="approve"?e.jsxs(e.Fragment,{children:[e.jsx(D,{"code-path":"src/components/approval/ApprovalFlow.tsx:352:19",className:"h-5 w-5 text-emerald-400"}),"确认通过审批"]}):e.jsxs(e.Fragment,{children:[e.jsx(F,{"code-path":"src/components/approval/ApprovalFlow.tsx:357:19",className:"h-5 w-5 text-red-400"}),"确认拒绝审批"]})}),e.jsx(G,{"code-path":"src/components/approval/ApprovalFlow.tsx:362:13",className:"text-[var(--dg-text-muted)]",children:f==="approve"?"请填写审批意见后确认通过":"请填写拒绝原因后确认拒绝"})]}),P&&e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:367:13",className:"py-2",children:[e.jsxs("p",{"code-path":"src/components/approval/ApprovalFlow.tsx:368:15",className:"text-sm text-[var(--dg-text-secondary)] mb-2",children:["审批标题:",e.jsx("span",{"code-path":"src/components/approval/ApprovalFlow.tsx:369:22",className:"text-[var(--dg-text-primary)]",children:P.title})]}),e.jsxs("div",{"code-path":"src/components/approval/ApprovalFlow.tsx:371:15",className:"space-y-2",children:[e.jsx("label",{"code-path":"src/components/approval/ApprovalFlow.tsx:372:17",className:"text-sm font-medium text-[var(--dg-text-secondary)]",children:f==="approve"?"审批意见":"拒绝原因"}),e.jsx(pe,{"code-path":"src/components/approval/ApprovalFlow.tsx:375:17",placeholder:f==="approve"?"请填写审批意见(可选)":"请填写拒绝原因",value:z,onChange:t=>ee(t.target.value),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] min-h-[80px]"})]})]}),e.jsxs(Q,{"code-path":"src/components/approval/ApprovalFlow.tsx:384:11",children:[e.jsx(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:385:13",variant:"outline",onClick:()=>O(!1),className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"取消"}),e.jsxs(i,{"code-path":"src/components/approval/ApprovalFlow.tsx:388:13",onClick:be,disabled:ae,className:f==="approve"?"bg-emerald-500/90 hover:bg-emerald-500 text-white":"bg-red-500 hover:bg-red-600 text-white",children:[ae&&e.jsx($,{"code-path":"src/components/approval/ApprovalFlow.tsx:393:36",className:"h-4 w-4 mr-2 animate-spin"}),f==="approve"?"确认通过":"确认拒绝"]})]})]})}),e.jsx(Ue,{"code-path":"src/components/approval/ApprovalFlow.tsx:401:7",open:ie,onOpenChange:se,templates:n,onSuccess:E})]})}const ca=Xe;export{Xe as ApprovalFlow,ca as ApprovalFlowManager}; diff --git a/backend/static/assets/ApprovalPermissionPage-Bv3kKyby.js b/backend/static/assets/ApprovalPermissionPage-bmqKSj6I.js similarity index 63% rename from backend/static/assets/ApprovalPermissionPage-Bv3kKyby.js rename to backend/static/assets/ApprovalPermissionPage-bmqKSj6I.js index 4939350..497c675 100644 --- a/backend/static/assets/ApprovalPermissionPage-Bv3kKyby.js +++ b/backend/static/assets/ApprovalPermissionPage-bmqKSj6I.js @@ -1 +1 @@ -import{j as e}from"./vendor-codemirror-C7mXSpXt.js";import{A as r}from"./ApprovalCategoryPage-BdbU4Noo.js";import"./card-B-RtdR4H.js";import"./index-LZWfu62c.js";import"./vendor-icons-Aso0-eeY.js";import"./input-BdDauX3U.js";import"./badge-B0F5ZNtn.js";import"./label-u-lNUbKh.js";import"./table-BPFYQwjr.js";import"./select-4xU_9B3_.js";import"./index-CYARH0Cq.js";import"./approval-DmGRfKd6.js";const t=[{key:"perm_type",label:"权限类型",type:"select",options:["堡垒机权限","生产VPN权限","日志查询权限","数据库查询权限","服务器SSH权限","K8s集群权限"],required:!0},{key:"account",label:"申请账号",type:"text",placeholder:"如 logan.li",required:!0},{key:"reason",label:"申请理由",type:"textarea",placeholder:"说明为什么需要该权限",required:!0},{key:"duration",label:"权限时长",type:"select",options:["临时(24小时)","短期(7天)","中期(30天)","长期(90天)","永久"],required:!0}];function P(){return e.jsx(r,{"code-path":"src/pages/ApprovalPermissionPage.tsx:17:5",category:"permission",title:"权限审批",description:"申请堡垒机、VPN、日志查询、数据库查询等运维权限",fields:t,templateCode:"permission_request"})}export{P as ApprovalPermissionPage}; +import{j as e}from"./vendor-codemirror-B1SGo4xl.js";import{A as r}from"./ApprovalCategoryPage-C5dI3MfR.js";import"./card-BHSBTtub.js";import"./index-Bp-M7P_8.js";import"./vendor-icons-BWk-DH7F.js";import"./input-Bnlm--la.js";import"./badge-B00SZHvE.js";import"./label-NkONM5Mp.js";import"./table-u8V9iTZf.js";import"./select-DbhcBWnH.js";import"./index-5FEebgvX.js";import"./approval-BivSGX8T.js";const t=[{key:"perm_type",label:"权限类型",type:"select",options:["堡垒机权限","生产VPN权限","日志查询权限","数据库查询权限","服务器SSH权限","K8s集群权限"],required:!0},{key:"account",label:"申请账号",type:"text",placeholder:"如 logan.li",required:!0},{key:"reason",label:"申请理由",type:"textarea",placeholder:"说明为什么需要该权限",required:!0},{key:"duration",label:"权限时长",type:"select",options:["临时(24小时)","短期(7天)","中期(30天)","长期(90天)","永久"],required:!0}];function P(){return e.jsx(r,{"code-path":"src/pages/ApprovalPermissionPage.tsx:17:5",category:"permission",title:"权限审批",description:"申请堡垒机、VPN、日志查询、数据库查询等运维权限",fields:t,templateCode:"permission_request"})}export{P as ApprovalPermissionPage}; diff --git a/backend/static/assets/ApprovalResourcePage-CnDxsH56.js b/backend/static/assets/ApprovalResourcePage-UEMsJGgE.js similarity index 65% rename from backend/static/assets/ApprovalResourcePage-CnDxsH56.js rename to backend/static/assets/ApprovalResourcePage-UEMsJGgE.js index b4932b1..a7e4c90 100644 --- a/backend/static/assets/ApprovalResourcePage-CnDxsH56.js +++ b/backend/static/assets/ApprovalResourcePage-UEMsJGgE.js @@ -1 +1 @@ -import{j as e}from"./vendor-codemirror-C7mXSpXt.js";import{A as r}from"./ApprovalCategoryPage-BdbU4Noo.js";import"./card-B-RtdR4H.js";import"./index-LZWfu62c.js";import"./vendor-icons-Aso0-eeY.js";import"./input-BdDauX3U.js";import"./badge-B0F5ZNtn.js";import"./label-u-lNUbKh.js";import"./table-BPFYQwjr.js";import"./select-4xU_9B3_.js";import"./index-CYARH0Cq.js";import"./approval-DmGRfKd6.js";const t=[{key:"provider",label:"云厂商",type:"select",options:["阿里云","腾讯云","华为云","AWS"],required:!0},{key:"region",label:"地域",type:"text",placeholder:"如 cn-hangzhou",required:!0},{key:"spec",label:"规格",type:"select",options:["2C4G","4C8G","8C16G","16C32G","32C64G"],required:!0},{key:"disk",label:"系统盘(GB)",type:"number",defaultValue:40,required:!0},{key:"count",label:"数量(台)",type:"number",defaultValue:1,required:!0},{key:"duration",label:"时长",type:"select",options:["1个月","3个月","6个月","1年"],required:!0},{key:"purpose",label:"用途说明",type:"textarea",required:!0}];function b(){return e.jsx(r,{"code-path":"src/pages/ApprovalResourcePage.tsx:16:5",category:"resource",title:"资源申请",description:"申请云服务器、存储、网络等基础设施资源",fields:t,templateCode:"server_apply"})}export{b as ApprovalResourcePage}; +import{j as e}from"./vendor-codemirror-B1SGo4xl.js";import{A as r}from"./ApprovalCategoryPage-C5dI3MfR.js";import"./card-BHSBTtub.js";import"./index-Bp-M7P_8.js";import"./vendor-icons-BWk-DH7F.js";import"./input-Bnlm--la.js";import"./badge-B00SZHvE.js";import"./label-NkONM5Mp.js";import"./table-u8V9iTZf.js";import"./select-DbhcBWnH.js";import"./index-5FEebgvX.js";import"./approval-BivSGX8T.js";const t=[{key:"provider",label:"云厂商",type:"select",options:["阿里云","腾讯云","华为云","AWS"],required:!0},{key:"region",label:"地域",type:"text",placeholder:"如 cn-hangzhou",required:!0},{key:"spec",label:"规格",type:"select",options:["2C4G","4C8G","8C16G","16C32G","32C64G"],required:!0},{key:"disk",label:"系统盘(GB)",type:"number",defaultValue:40,required:!0},{key:"count",label:"数量(台)",type:"number",defaultValue:1,required:!0},{key:"duration",label:"时长",type:"select",options:["1个月","3个月","6个月","1年"],required:!0},{key:"purpose",label:"用途说明",type:"textarea",required:!0}];function b(){return e.jsx(r,{"code-path":"src/pages/ApprovalResourcePage.tsx:16:5",category:"resource",title:"资源申请",description:"申请云服务器、存储、网络等基础设施资源",fields:t,templateCode:"server_apply"})}export{b as ApprovalResourcePage}; diff --git a/backend/static/assets/ApprovalWorkflowPage-Feqoq_m6.js b/backend/static/assets/ApprovalWorkflowPage-_9oj7366.js similarity index 98% rename from backend/static/assets/ApprovalWorkflowPage-Feqoq_m6.js rename to backend/static/assets/ApprovalWorkflowPage-_9oj7366.js index 0ef1fe6..4476d1b 100644 --- a/backend/static/assets/ApprovalWorkflowPage-Feqoq_m6.js +++ b/backend/static/assets/ApprovalWorkflowPage-_9oj7366.js @@ -1 +1 @@ -import{r as p,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as M,a as Q}from"./card-B-RtdR4H.js";import{f as V,u as X,t as C,B as $}from"./index-LZWfu62c.js";import{a as S}from"./approval-DmGRfKd6.js";import{L as D,P as R,J as H,K as z,O as Z,Q as Y,z as J,c as ee,T as F,X as G,j as q,V as se,W as ae,Y as te,y as re}from"./vendor-icons-Aso0-eeY.js";const oe={resource:"资源申请",app:"应用申请",permission:"权限审批"},L={submit:"提交阶段",audit:"审核阶段",execute:"执行阶段"},B={submit:"bg-blue-500/15 text-blue-400 border-blue-500/30",audit:"bg-purple-500/15 text-purple-400 border-purple-500/30",execute:"bg-green-500/15 text-green-400 border-green-500/30"},pe={submit:se,audit:q,execute:J},le=[{value:"submit",label:"提交阶段",desc:"工单提交人"},{value:"audit",label:"审核阶段",desc:"审核人员审批"},{value:"execute",label:"执行阶段",desc:"执行人员操作"}];function ce({users:i,selectedIds:g,label:v,onToggle:b,onToggleAll:y,onClear:A,getUserName:_}){const[m,j]=p.useState(!1),k=p.useRef(null),[P,l]=p.useState({top:0,left:0,width:0}),h=()=>{if(k.current){const c=k.current.getBoundingClientRect();l({top:c.bottom+4,left:c.left,width:c.width})}};return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:113:5",className:"relative",children:[e.jsxs("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:114:7",ref:k,type:"button",onClick:()=>{m||h(),j(!m)},className:`w-full flex items-center justify-between px-3 py-2 rounded-lg text-sm transition-colors ${g.length===0?"bg-[var(--dg-bg-tertiary)] border border-red-500/40 text-[var(--dg-text-muted)]":"bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)]"}`,children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:124:9",className:"truncate",children:g.length===0?`${v} * 请选择`:`${v} (${g.length}人)`}),e.jsx(Y,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:127:9",className:`w-4 h-4 text-[var(--dg-text-muted)] transition-transform ${m?"rotate-180":""}`})]}),g.length>1&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:131:9",className:"flex flex-wrap gap-1 mt-1.5",children:g.map(c=>e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:133:13",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] bg-blue-500/15 text-blue-400",children:[_(c),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:135:15",onClick:()=>b(c),className:"hover:text-red-400",children:e.jsx(G,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:135:84",className:"w-3 h-3"})})]},c))}),m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:143:11",className:"fixed inset-0 z-40",onClick:()=>j(!1)}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:144:11",className:"fixed z-50 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded-lg shadow-xl max-h-52 overflow-y-auto",style:{top:P.top,left:P.left,width:P.width},children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:146:13",className:"flex items-center justify-between px-3 py-2 border-b border-[var(--dg-border)]",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:147:15",onClick:y,className:"text-[11px] text-blue-400 hover:text-blue-300",children:g.length===i.length&&i.length>0?"取消全选":"全选"}),g.length>0&&e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:151:17",onClick:A,className:"text-[11px] text-red-400 hover:text-red-300",children:"清空"})]}),i.map(c=>{const u=g.includes(c.id);return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:157:17",onClick:()=>b(c.id),className:"flex items-center gap-2.5 px-3 py-2 cursor-pointer hover:bg-[var(--dg-bg-hover)] transition-colors",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:159:19",className:`w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 ${u?"bg-blue-500 border-blue-500":"border-[var(--dg-border)]"}`,children:u&&e.jsx(re,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:162:33",className:"w-3 h-3 text-white"})}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:164:19",className:`text-sm flex-1 ${u?"text-[var(--dg-text-primary)]":"text-[var(--dg-text-secondary)]"}`,children:c.display_name||c.username}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:167:19",className:"text-[10px] text-[var(--dg-text-muted)] px-1.5 py-0.5 rounded bg-[var(--dg-bg-tertiary)]",children:c.role})]},c.id)})]})]})]})}function de({workflow:i,users:g,onClose:v,onSaved:b}){const y=!!i,[A,_]=p.useState(i?.name||""),[m,j]=p.useState(i?.description||""),[k,P]=p.useState(i?.category||"resource"),[l,h]=p.useState([]),[c,u]=p.useState(!1),[E,W]=p.useState("");p.useEffect(()=>{i?.steps?.length?h(i.steps.map(s=>({name:s.name,step_type:s.step_type==="serial"||s.step_type==="parallel"?"audit":s.step_type,approver_ids:T(s.approver_ids)}))):h([{name:"提交申请",step_type:"submit",approver_ids:[]},{name:"审核",step_type:"audit",approver_ids:[]}])},[i]);const T=s=>{if(!s)return[];try{const t=JSON.parse(s);return Array.isArray(t)?t:[]}catch{return[]}},U=s=>{const t={submit:"提交",audit:"审核",execute:"执行"},r=l.filter(f=>f.step_type===s).length,x=r>0?` ${r+1}`:"";h([...l,{name:`${t[s]}${x}`,step_type:s,approver_ids:[]}])},a=s=>h(l.filter((t,r)=>r!==s)),d=(s,t)=>{const r=s+t;if(r<0||r>=l.length)return;const x=[...l];[x[s],x[r]]=[x[r],x[s]],h(x)},o=(s,t)=>{h(l.map((r,x)=>x===s?{...r,...t}:r))},n=(s,t)=>{const r=l[s],x=r.approver_ids.includes(t);o(s,{approver_ids:x?r.approver_ids.filter(f=>f!==t):[...r.approver_ids,t]})},w=s=>{const t=g.filter(r=>r.is_active!==!1);return s==="audit"?t:s==="execute"?t.filter(r=>["super_admin","k8s_admin","release_admin","resource_admin"].includes(r.role)):t},N=s=>{const t=l[s],r=w(t.step_type),x=t.approver_ids.length===r.length&&r.length>0;o(s,{approver_ids:x?[]:r.map(f=>f.id)})},I=async()=>{if(!A.trim()){W("请输入流程名称");return}if(l.length===0){W("请至少添加一个步骤");return}for(let s=0;s({step_number:r+1,name:t.name,step_type:t.step_type,approver_ids:t.approver_ids.length>0?JSON.stringify(t.approver_ids):null,is_required:!0,timeout_hours:24,auto_approve_on_timeout:!1}))};y&&i?await S.update(i.id,s):await S.create(s),b()}catch(s){const t=s?.response?.data?.detail||"保存失败";W(t)}finally{u(!1)}},K=s=>{const t=g.find(r=>r.id===s);return t?t.display_name||t.username:`#${s}`},O="w-full px-3 py-2 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-lg text-sm focus:border-blue-400 focus:outline-none transition-colors text-[var(--dg-text-primary)]";return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:315:5",className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:316:7",className:"absolute inset-0 bg-black/50",onClick:v}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:317:7",className:"relative bg-[var(--dg-bg-secondary)] rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] overflow-y-auto m-4",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:318:9",className:"flex items-center justify-between px-5 py-4 border-b border-[var(--dg-border)]",children:[e.jsx("h2",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:319:11",className:"text-base font-semibold text-[var(--dg-text-primary)]",children:y?"编辑审批流程":"新建审批流程"}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:322:11",onClick:v,className:"p-1.5 rounded-lg hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)] transition-colors",children:e.jsx(G,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:323:13",className:"w-4 h-4"})})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:327:9",className:"px-5 pb-5 space-y-4 pt-4",children:[E&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:328:21",className:"px-3 py-2 text-sm text-red-400 bg-red-500/10 rounded-lg",children:E}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:330:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:331:13",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:332:15",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:"流程名称 *"}),e.jsx("input",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:333:15",className:O,value:A,onChange:s=>_(s.target.value),placeholder:"输入流程名称"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:335:13",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:336:15",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:"所属分类"}),e.jsxs("select",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:337:15",className:O,value:k,onChange:s=>P(s.target.value),children:[e.jsx("option",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:338:17",value:"resource",children:"资源申请"}),e.jsx("option",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:339:17",value:"app",children:"应用申请"}),e.jsx("option",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:340:17",value:"permission",children:"权限审批"})]})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:345:11",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:346:13",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:"描述"}),e.jsx("input",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:347:13",className:O,value:m,onChange:s=>j(s.target.value),placeholder:"可选"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:351:11",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:352:13",className:"flex items-center justify-between mb-2",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:353:15",className:"text-xs font-medium text-[var(--dg-text-secondary)]",children:"流程步骤"}),e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:354:15",className:"flex items-center gap-1",children:le.map(s=>e.jsxs("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:356:19",onClick:()=>U(s.value),className:"flex items-center gap-1 px-2 py-1 text-[11px] font-medium bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 rounded transition-colors",children:[e.jsx(R,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:358:21",className:"w-3 h-3"}),s.label]},s.value))})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:364:13",className:"space-y-2",children:[l.map((s,t)=>{const r=B[s.step_type],x=pe[s.step_type]||q;return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:369:19",className:"p-3 bg-[var(--dg-bg-primary)] rounded-lg border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:370:21",className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:371:23",className:`w-7 h-7 rounded-md flex items-center justify-center flex-shrink-0 ${r.split(" ")[0]}`,children:e.jsx(x,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:372:25",className:`w-3.5 h-3.5 ${r.split(" ")[1]}`})}),e.jsx("input",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:374:23",className:"flex-1 px-2 py-1 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded text-sm focus:border-blue-400 focus:outline-none text-[var(--dg-text-primary)]",value:s.name,onChange:f=>o(t,{name:f.target.value}),placeholder:"步骤名称"}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:379:23",className:`text-[10px] px-1.5 py-0.5 rounded ${r}`,children:L[s.step_type]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:382:23",className:"flex items-center gap-0.5 ml-1",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:383:25",onClick:()=>d(t,-1),disabled:t===0,className:"p-1 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] disabled:opacity-20 transition-colors",children:e.jsx(ae,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:385:27",className:"w-3.5 h-3.5"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:387:25",onClick:()=>d(t,1),disabled:t===l.length-1,className:"p-1 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] disabled:opacity-20 transition-colors",children:e.jsx(te,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:389:27",className:"w-3.5 h-3.5"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:391:25",onClick:()=>a(t),className:"p-1 rounded hover:bg-red-500/10 text-[var(--dg-text-muted)] hover:text-red-400 transition-colors",children:e.jsx(F,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:393:27",className:"w-3.5 h-3.5"})})]})]}),s.step_type!=="submit"&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:399:23",className:"pl-9 mt-2",children:e.jsx(ce,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:400:25",users:w(s.step_type),selectedIds:s.approver_ids,label:s.step_type==="audit"?"审核人":"执行人",onToggle:f=>n(t,f),onToggleAll:()=>N(t),onClear:()=>o(t,{approver_ids:[]}),getUserName:K})})]},t)}),l.length===0&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:416:17",className:"text-center py-4 text-sm text-[var(--dg-text-muted)]",children:"请点击上方按钮添加流程步骤"})]})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:424:9",className:"flex items-center justify-end gap-3 px-5 py-4 border-t border-[var(--dg-border)]",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:425:11",onClick:v,className:"px-4 py-2 text-sm text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-hover)] rounded-lg transition-colors",children:"取消"}),e.jsxs($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:428:11",onClick:I,disabled:c,children:[c&&e.jsx(D,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:429:28",className:"w-4 h-4 animate-spin mr-1"}),y?"保存":"创建"]})]})]})]})}function ve(){const i=V(),[g,v]=p.useState([]),[b,y]=p.useState([]),[A,_]=p.useState(!0),[m,j]=p.useState(null),[k,P]=p.useState(null),[l,h]=p.useState(void 0),c=p.useCallback(async()=>{try{_(!0),j(null);const a=await S.list(),o=(Array.isArray(a?.list)?a.list:Array.isArray(a)?a:[]).map(n=>({...n,steps:n.steps||[]}));v(o)}catch{j("获取审批流程失败")}finally{_(!1)}},[]),u=p.useCallback(async()=>{try{const a=await X.getUsers(),o=(Array.isArray(a?.list)?a.list:Array.isArray(a)?a:[]).map(n=>({...n,role:n.role||(Array.isArray(n.roles)&&n.roles.length>0?n.roles[0].code:"")}));y(o)}catch{}},[]);p.useEffect(()=>{c(),u()},[c,u]);const E=p.useCallback(async a=>{try{await S.update(a.id,{is_active:!a.is_active}),v(d=>d.map(o=>o.id===a.id?{...o,is_active:!o.is_active}:o)),C.success(a.is_active?"已停用":"已启用")}catch{C.error("操作失败")}},[]),W=p.useCallback(async(a,d)=>{if(await i({title:"删除审批流程",description:`确定删除审批流程「${d}」?删除后不可恢复。`,confirmText:"删除",variant:"destructive"}))try{await S.delete(a),v(n=>n.filter(w=>w.id!==a)),C.success("已删除")}catch{C.error("删除失败")}},[i]),T=p.useCallback(async a=>{try{await S.setDefault(a),v(d=>d.map(o=>({...o,is_default:o.id===a}))),C.success("已设为默认")}catch{C.error("操作失败")}},[]),U=p.useCallback(a=>{const d=b.find(o=>o.id===a);return d?d.display_name||d.username:`#${a}`},[b]);return A?e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:525:7",className:"flex items-center justify-center h-64",children:e.jsx(D,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:526:9",className:"w-8 h-8 animate-spin text-blue-400"})}):m?e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:533:7",className:"flex flex-col items-center justify-center h-64 text-[var(--dg-text-muted)]",children:[e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:534:9",className:"text-sm",children:m}),e.jsx($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:535:9",variant:"outline",onClick:c,className:"mt-3",children:"重试"})]}):e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:541:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:543:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:544:9",children:[e.jsx("h1",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:545:11",className:"text-2xl font-semibold text-[var(--dg-text-primary)]",children:"审批流程配置"}),e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:546:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"为资源申请、应用申请、权限审批配置多级审批流程"})]}),e.jsxs($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:550:9",onClick:()=>h(null),children:[e.jsx(R,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:551:11",className:"w-4 h-4 mr-1.5"}),"新建流程"]})]}),g.length===0?e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:556:9",className:"dg-card p-12 text-center",children:[e.jsx(H,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:557:11",className:"w-12 h-12 mx-auto mb-3 opacity-50 text-[var(--dg-text-muted)]"}),e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:558:11",className:"text-sm text-[var(--dg-text-muted)] mb-4",children:"暂无审批流程"}),e.jsx($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:559:11",variant:"outline",onClick:()=>h(null),children:"创建第一个流程"})]}):e.jsx(e.Fragment,{children:e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:564:11",className:"space-y-4",children:g.map(a=>{const d=k===a.id;return e.jsx(M,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:568:17",className:`dg-card overflow-hidden ${a.is_active?"":"opacity-50"}`,children:e.jsxs(Q,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:569:19",className:"p-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:570:21",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:571:23",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:572:25",className:"flex items-center gap-3 mb-2 flex-wrap",children:[e.jsx("h3",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:573:27",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:a.name}),a.is_default&&e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:574:45",className:"text-[10px] px-1.5 py-0.5 rounded bg-yellow-400/15 text-yellow-400 flex items-center gap-1",children:[e.jsx(z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:574:154",className:"w-3 h-3"}),"默认"]}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:575:27",className:`text-[10px] px-1.5 py-0.5 rounded ${a.is_active?"bg-green-500/15 text-green-400":"bg-red-500/15 text-red-400"}`,children:a.is_active?"启用":"停用"}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:578:27",className:"text-[10px] px-1.5 py-0.5 rounded bg-blue-500/15 text-blue-400",children:oe[a.category]||a.category})]}),a.description&&e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:582:44",className:"text-sm text-[var(--dg-text-secondary)] mb-1",children:a.description}),e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:583:25",className:"flex items-center gap-1.5 mt-2 flex-wrap",children:a.steps?.map((o,n)=>e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:585:29",className:"flex items-center gap-1",children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:586:31",className:`text-[10px] px-1.5 py-0.5 rounded ${B[o.step_type]||"bg-gray-500/15 text-gray-400 border-gray-500/30"}`,children:L[o.step_type]||o.step_type}),n<(a.steps?.length||0)-1&&e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:590:33",className:"text-[var(--dg-text-muted)] text-[10px]",children:"→"})]},n))})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:597:23",className:"flex items-center gap-1 flex-shrink-0 ml-4",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:598:25",onClick:()=>P(d?null:a.id),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] transition-colors",children:d?e.jsx(Z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:600:41",className:"w-4 h-4"}):e.jsx(Y,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:600:77",className:"w-4 h-4"})}),!a.is_default&&e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:603:27",onClick:()=>T(a.id),className:"p-1.5 rounded hover:bg-yellow-500/10 text-[var(--dg-text-muted)] hover:text-yellow-400 transition-colors",title:"设为默认",children:e.jsx(z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:605:29",className:"w-4 h-4"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:608:25",onClick:()=>E(a),className:`p-1.5 rounded transition-colors ${a.is_active?"hover:bg-red-500/10 text-green-400 hover:text-red-400":"hover:bg-green-500/10 text-red-400 hover:text-green-400"}`,title:a.is_active?"停用":"启用",children:e.jsx(J,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:611:27",className:`w-4 h-4 ${a.is_active?"":"rotate-180"}`})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:613:25",onClick:()=>h(a),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] hover:text-blue-400 transition-colors",title:"编辑",children:e.jsx(ee,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:615:27",className:"w-4 h-4"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:617:25",onClick:()=>W(a.id,a.name),className:"p-1.5 rounded hover:bg-red-500/10 text-[var(--dg-text-muted)] hover:text-red-400 transition-colors",title:"删除",children:e.jsx(F,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:619:27",className:"w-4 h-4"})})]})]}),d&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:625:23",className:"mt-4 pt-4 border-t border-[var(--dg-border)] space-y-3",children:a.steps?.map((o,n)=>{const w=(()=>{try{const N=JSON.parse(o.approver_ids||"[]");return Array.isArray(N)?N:[]}catch{return[]}})();return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:629:29",className:"flex items-start gap-3 p-3 bg-[var(--dg-bg-primary)] rounded-lg",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:630:31",className:"w-6 h-6 rounded-full bg-[var(--dg-bg-tertiary)] flex items-center justify-center text-xs font-medium text-[var(--dg-text-secondary)] flex-shrink-0 mt-0.5",children:o.step_number}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:633:31",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:634:33",className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:635:35",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.name}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:636:35",className:`text-[10px] px-1.5 py-0.5 rounded ${B[o.step_type]||"bg-gray-500/15 text-gray-400 border-gray-500/30"}`,children:L[o.step_type]||o.step_type})]}),w.length>0&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:641:35",className:"flex flex-wrap gap-1",children:w.map(N=>e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:643:39",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] bg-blue-500/15 text-blue-400",children:U(N)},N))}),w.length===0&&o.step_type!=="submit"&&e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:650:35",className:"text-[11px] text-red-400",children:"未关联审批人"})]})]},n)})})]})},a.id)})})}),l!==void 0&&e.jsx(de,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:667:9",workflow:l,users:b,onClose:()=>h(void 0),onSaved:()=>{h(void 0),c()}})]})}export{ve as default}; +import{r as p,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as M,a as Q}from"./card-BHSBTtub.js";import{f as V,u as X,t as C,B as $}from"./index-Bp-M7P_8.js";import{a as S}from"./approval-BivSGX8T.js";import{L as D,P as R,J as H,K as z,O as Z,Q as Y,z as J,c as ee,T as F,X as G,j as q,V as se,W as ae,Y as te,y as re}from"./vendor-icons-BWk-DH7F.js";const oe={resource:"资源申请",app:"应用申请",permission:"权限审批"},L={submit:"提交阶段",audit:"审核阶段",execute:"执行阶段"},B={submit:"bg-blue-500/15 text-blue-400 border-blue-500/30",audit:"bg-purple-500/15 text-purple-400 border-purple-500/30",execute:"bg-green-500/15 text-green-400 border-green-500/30"},pe={submit:se,audit:q,execute:J},le=[{value:"submit",label:"提交阶段",desc:"工单提交人"},{value:"audit",label:"审核阶段",desc:"审核人员审批"},{value:"execute",label:"执行阶段",desc:"执行人员操作"}];function ce({users:i,selectedIds:g,label:v,onToggle:b,onToggleAll:y,onClear:A,getUserName:_}){const[m,j]=p.useState(!1),k=p.useRef(null),[P,l]=p.useState({top:0,left:0,width:0}),h=()=>{if(k.current){const c=k.current.getBoundingClientRect();l({top:c.bottom+4,left:c.left,width:c.width})}};return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:113:5",className:"relative",children:[e.jsxs("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:114:7",ref:k,type:"button",onClick:()=>{m||h(),j(!m)},className:`w-full flex items-center justify-between px-3 py-2 rounded-lg text-sm transition-colors ${g.length===0?"bg-[var(--dg-bg-tertiary)] border border-red-500/40 text-[var(--dg-text-muted)]":"bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)]"}`,children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:124:9",className:"truncate",children:g.length===0?`${v} * 请选择`:`${v} (${g.length}人)`}),e.jsx(Y,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:127:9",className:`w-4 h-4 text-[var(--dg-text-muted)] transition-transform ${m?"rotate-180":""}`})]}),g.length>1&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:131:9",className:"flex flex-wrap gap-1 mt-1.5",children:g.map(c=>e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:133:13",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] bg-blue-500/15 text-blue-400",children:[_(c),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:135:15",onClick:()=>b(c),className:"hover:text-red-400",children:e.jsx(G,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:135:84",className:"w-3 h-3"})})]},c))}),m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:143:11",className:"fixed inset-0 z-40",onClick:()=>j(!1)}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:144:11",className:"fixed z-50 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded-lg shadow-xl max-h-52 overflow-y-auto",style:{top:P.top,left:P.left,width:P.width},children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:146:13",className:"flex items-center justify-between px-3 py-2 border-b border-[var(--dg-border)]",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:147:15",onClick:y,className:"text-[11px] text-blue-400 hover:text-blue-300",children:g.length===i.length&&i.length>0?"取消全选":"全选"}),g.length>0&&e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:151:17",onClick:A,className:"text-[11px] text-red-400 hover:text-red-300",children:"清空"})]}),i.map(c=>{const u=g.includes(c.id);return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:157:17",onClick:()=>b(c.id),className:"flex items-center gap-2.5 px-3 py-2 cursor-pointer hover:bg-[var(--dg-bg-hover)] transition-colors",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:159:19",className:`w-4 h-4 rounded border flex items-center justify-center flex-shrink-0 ${u?"bg-blue-500 border-blue-500":"border-[var(--dg-border)]"}`,children:u&&e.jsx(re,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:162:33",className:"w-3 h-3 text-white"})}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:164:19",className:`text-sm flex-1 ${u?"text-[var(--dg-text-primary)]":"text-[var(--dg-text-secondary)]"}`,children:c.display_name||c.username}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:167:19",className:"text-[10px] text-[var(--dg-text-muted)] px-1.5 py-0.5 rounded bg-[var(--dg-bg-tertiary)]",children:c.role})]},c.id)})]})]})]})}function de({workflow:i,users:g,onClose:v,onSaved:b}){const y=!!i,[A,_]=p.useState(i?.name||""),[m,j]=p.useState(i?.description||""),[k,P]=p.useState(i?.category||"resource"),[l,h]=p.useState([]),[c,u]=p.useState(!1),[E,W]=p.useState("");p.useEffect(()=>{i?.steps?.length?h(i.steps.map(s=>({name:s.name,step_type:s.step_type==="serial"||s.step_type==="parallel"?"audit":s.step_type,approver_ids:T(s.approver_ids)}))):h([{name:"提交申请",step_type:"submit",approver_ids:[]},{name:"审核",step_type:"audit",approver_ids:[]}])},[i]);const T=s=>{if(!s)return[];try{const t=JSON.parse(s);return Array.isArray(t)?t:[]}catch{return[]}},U=s=>{const t={submit:"提交",audit:"审核",execute:"执行"},r=l.filter(f=>f.step_type===s).length,x=r>0?` ${r+1}`:"";h([...l,{name:`${t[s]}${x}`,step_type:s,approver_ids:[]}])},a=s=>h(l.filter((t,r)=>r!==s)),d=(s,t)=>{const r=s+t;if(r<0||r>=l.length)return;const x=[...l];[x[s],x[r]]=[x[r],x[s]],h(x)},o=(s,t)=>{h(l.map((r,x)=>x===s?{...r,...t}:r))},n=(s,t)=>{const r=l[s],x=r.approver_ids.includes(t);o(s,{approver_ids:x?r.approver_ids.filter(f=>f!==t):[...r.approver_ids,t]})},w=s=>{const t=g.filter(r=>r.is_active!==!1);return s==="audit"?t:s==="execute"?t.filter(r=>["super_admin","k8s_admin","release_admin","resource_admin"].includes(r.role)):t},N=s=>{const t=l[s],r=w(t.step_type),x=t.approver_ids.length===r.length&&r.length>0;o(s,{approver_ids:x?[]:r.map(f=>f.id)})},I=async()=>{if(!A.trim()){W("请输入流程名称");return}if(l.length===0){W("请至少添加一个步骤");return}for(let s=0;s({step_number:r+1,name:t.name,step_type:t.step_type,approver_ids:t.approver_ids.length>0?JSON.stringify(t.approver_ids):null,is_required:!0,timeout_hours:24,auto_approve_on_timeout:!1}))};y&&i?await S.update(i.id,s):await S.create(s),b()}catch(s){const t=s?.response?.data?.detail||"保存失败";W(t)}finally{u(!1)}},K=s=>{const t=g.find(r=>r.id===s);return t?t.display_name||t.username:`#${s}`},O="w-full px-3 py-2 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-lg text-sm focus:border-blue-400 focus:outline-none transition-colors text-[var(--dg-text-primary)]";return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:315:5",className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:316:7",className:"absolute inset-0 bg-black/50",onClick:v}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:317:7",className:"relative bg-[var(--dg-bg-secondary)] rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] overflow-y-auto m-4",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:318:9",className:"flex items-center justify-between px-5 py-4 border-b border-[var(--dg-border)]",children:[e.jsx("h2",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:319:11",className:"text-base font-semibold text-[var(--dg-text-primary)]",children:y?"编辑审批流程":"新建审批流程"}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:322:11",onClick:v,className:"p-1.5 rounded-lg hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)] transition-colors",children:e.jsx(G,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:323:13",className:"w-4 h-4"})})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:327:9",className:"px-5 pb-5 space-y-4 pt-4",children:[E&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:328:21",className:"px-3 py-2 text-sm text-red-400 bg-red-500/10 rounded-lg",children:E}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:330:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:331:13",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:332:15",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:"流程名称 *"}),e.jsx("input",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:333:15",className:O,value:A,onChange:s=>_(s.target.value),placeholder:"输入流程名称"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:335:13",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:336:15",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:"所属分类"}),e.jsxs("select",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:337:15",className:O,value:k,onChange:s=>P(s.target.value),children:[e.jsx("option",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:338:17",value:"resource",children:"资源申请"}),e.jsx("option",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:339:17",value:"app",children:"应用申请"}),e.jsx("option",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:340:17",value:"permission",children:"权限审批"})]})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:345:11",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:346:13",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:"描述"}),e.jsx("input",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:347:13",className:O,value:m,onChange:s=>j(s.target.value),placeholder:"可选"})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:351:11",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:352:13",className:"flex items-center justify-between mb-2",children:[e.jsx("label",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:353:15",className:"text-xs font-medium text-[var(--dg-text-secondary)]",children:"流程步骤"}),e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:354:15",className:"flex items-center gap-1",children:le.map(s=>e.jsxs("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:356:19",onClick:()=>U(s.value),className:"flex items-center gap-1 px-2 py-1 text-[11px] font-medium bg-blue-500/10 text-blue-400 hover:bg-blue-500/20 rounded transition-colors",children:[e.jsx(R,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:358:21",className:"w-3 h-3"}),s.label]},s.value))})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:364:13",className:"space-y-2",children:[l.map((s,t)=>{const r=B[s.step_type],x=pe[s.step_type]||q;return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:369:19",className:"p-3 bg-[var(--dg-bg-primary)] rounded-lg border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:370:21",className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:371:23",className:`w-7 h-7 rounded-md flex items-center justify-center flex-shrink-0 ${r.split(" ")[0]}`,children:e.jsx(x,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:372:25",className:`w-3.5 h-3.5 ${r.split(" ")[1]}`})}),e.jsx("input",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:374:23",className:"flex-1 px-2 py-1 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded text-sm focus:border-blue-400 focus:outline-none text-[var(--dg-text-primary)]",value:s.name,onChange:f=>o(t,{name:f.target.value}),placeholder:"步骤名称"}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:379:23",className:`text-[10px] px-1.5 py-0.5 rounded ${r}`,children:L[s.step_type]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:382:23",className:"flex items-center gap-0.5 ml-1",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:383:25",onClick:()=>d(t,-1),disabled:t===0,className:"p-1 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] disabled:opacity-20 transition-colors",children:e.jsx(ae,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:385:27",className:"w-3.5 h-3.5"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:387:25",onClick:()=>d(t,1),disabled:t===l.length-1,className:"p-1 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] disabled:opacity-20 transition-colors",children:e.jsx(te,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:389:27",className:"w-3.5 h-3.5"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:391:25",onClick:()=>a(t),className:"p-1 rounded hover:bg-red-500/10 text-[var(--dg-text-muted)] hover:text-red-400 transition-colors",children:e.jsx(F,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:393:27",className:"w-3.5 h-3.5"})})]})]}),s.step_type!=="submit"&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:399:23",className:"pl-9 mt-2",children:e.jsx(ce,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:400:25",users:w(s.step_type),selectedIds:s.approver_ids,label:s.step_type==="audit"?"审核人":"执行人",onToggle:f=>n(t,f),onToggleAll:()=>N(t),onClear:()=>o(t,{approver_ids:[]}),getUserName:K})})]},t)}),l.length===0&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:416:17",className:"text-center py-4 text-sm text-[var(--dg-text-muted)]",children:"请点击上方按钮添加流程步骤"})]})]})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:424:9",className:"flex items-center justify-end gap-3 px-5 py-4 border-t border-[var(--dg-border)]",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:425:11",onClick:v,className:"px-4 py-2 text-sm text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-hover)] rounded-lg transition-colors",children:"取消"}),e.jsxs($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:428:11",onClick:I,disabled:c,children:[c&&e.jsx(D,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:429:28",className:"w-4 h-4 animate-spin mr-1"}),y?"保存":"创建"]})]})]})]})}function ve(){const i=V(),[g,v]=p.useState([]),[b,y]=p.useState([]),[A,_]=p.useState(!0),[m,j]=p.useState(null),[k,P]=p.useState(null),[l,h]=p.useState(void 0),c=p.useCallback(async()=>{try{_(!0),j(null);const a=await S.list(),o=(Array.isArray(a?.list)?a.list:Array.isArray(a)?a:[]).map(n=>({...n,steps:n.steps||[]}));v(o)}catch{j("获取审批流程失败")}finally{_(!1)}},[]),u=p.useCallback(async()=>{try{const a=await X.getUsers(),o=(Array.isArray(a?.list)?a.list:Array.isArray(a)?a:[]).map(n=>({...n,role:n.role||(Array.isArray(n.roles)&&n.roles.length>0?n.roles[0].code:"")}));y(o)}catch{}},[]);p.useEffect(()=>{c(),u()},[c,u]);const E=p.useCallback(async a=>{try{await S.update(a.id,{is_active:!a.is_active}),v(d=>d.map(o=>o.id===a.id?{...o,is_active:!o.is_active}:o)),C.success(a.is_active?"已停用":"已启用")}catch{C.error("操作失败")}},[]),W=p.useCallback(async(a,d)=>{if(await i({title:"删除审批流程",description:`确定删除审批流程「${d}」?删除后不可恢复。`,confirmText:"删除",variant:"destructive"}))try{await S.delete(a),v(n=>n.filter(w=>w.id!==a)),C.success("已删除")}catch{C.error("删除失败")}},[i]),T=p.useCallback(async a=>{try{await S.setDefault(a),v(d=>d.map(o=>({...o,is_default:o.id===a}))),C.success("已设为默认")}catch{C.error("操作失败")}},[]),U=p.useCallback(a=>{const d=b.find(o=>o.id===a);return d?d.display_name||d.username:`#${a}`},[b]);return A?e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:525:7",className:"flex items-center justify-center h-64",children:e.jsx(D,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:526:9",className:"w-8 h-8 animate-spin text-blue-400"})}):m?e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:533:7",className:"flex flex-col items-center justify-center h-64 text-[var(--dg-text-muted)]",children:[e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:534:9",className:"text-sm",children:m}),e.jsx($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:535:9",variant:"outline",onClick:c,className:"mt-3",children:"重试"})]}):e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:541:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:543:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:544:9",children:[e.jsx("h1",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:545:11",className:"text-2xl font-semibold text-[var(--dg-text-primary)]",children:"审批流程配置"}),e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:546:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"为资源申请、应用申请、权限审批配置多级审批流程"})]}),e.jsxs($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:550:9",onClick:()=>h(null),children:[e.jsx(R,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:551:11",className:"w-4 h-4 mr-1.5"}),"新建流程"]})]}),g.length===0?e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:556:9",className:"dg-card p-12 text-center",children:[e.jsx(H,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:557:11",className:"w-12 h-12 mx-auto mb-3 opacity-50 text-[var(--dg-text-muted)]"}),e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:558:11",className:"text-sm text-[var(--dg-text-muted)] mb-4",children:"暂无审批流程"}),e.jsx($,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:559:11",variant:"outline",onClick:()=>h(null),children:"创建第一个流程"})]}):e.jsx(e.Fragment,{children:e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:564:11",className:"space-y-4",children:g.map(a=>{const d=k===a.id;return e.jsx(M,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:568:17",className:`dg-card overflow-hidden ${a.is_active?"":"opacity-50"}`,children:e.jsxs(Q,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:569:19",className:"p-5",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:570:21",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:571:23",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:572:25",className:"flex items-center gap-3 mb-2 flex-wrap",children:[e.jsx("h3",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:573:27",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:a.name}),a.is_default&&e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:574:45",className:"text-[10px] px-1.5 py-0.5 rounded bg-yellow-400/15 text-yellow-400 flex items-center gap-1",children:[e.jsx(z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:574:154",className:"w-3 h-3"}),"默认"]}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:575:27",className:`text-[10px] px-1.5 py-0.5 rounded ${a.is_active?"bg-green-500/15 text-green-400":"bg-red-500/15 text-red-400"}`,children:a.is_active?"启用":"停用"}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:578:27",className:"text-[10px] px-1.5 py-0.5 rounded bg-blue-500/15 text-blue-400",children:oe[a.category]||a.category})]}),a.description&&e.jsx("p",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:582:44",className:"text-sm text-[var(--dg-text-secondary)] mb-1",children:a.description}),e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:583:25",className:"flex items-center gap-1.5 mt-2 flex-wrap",children:a.steps?.map((o,n)=>e.jsxs("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:585:29",className:"flex items-center gap-1",children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:586:31",className:`text-[10px] px-1.5 py-0.5 rounded ${B[o.step_type]||"bg-gray-500/15 text-gray-400 border-gray-500/30"}`,children:L[o.step_type]||o.step_type}),n<(a.steps?.length||0)-1&&e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:590:33",className:"text-[var(--dg-text-muted)] text-[10px]",children:"→"})]},n))})]}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:597:23",className:"flex items-center gap-1 flex-shrink-0 ml-4",children:[e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:598:25",onClick:()=>P(d?null:a.id),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] transition-colors",children:d?e.jsx(Z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:600:41",className:"w-4 h-4"}):e.jsx(Y,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:600:77",className:"w-4 h-4"})}),!a.is_default&&e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:603:27",onClick:()=>T(a.id),className:"p-1.5 rounded hover:bg-yellow-500/10 text-[var(--dg-text-muted)] hover:text-yellow-400 transition-colors",title:"设为默认",children:e.jsx(z,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:605:29",className:"w-4 h-4"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:608:25",onClick:()=>E(a),className:`p-1.5 rounded transition-colors ${a.is_active?"hover:bg-red-500/10 text-green-400 hover:text-red-400":"hover:bg-green-500/10 text-red-400 hover:text-green-400"}`,title:a.is_active?"停用":"启用",children:e.jsx(J,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:611:27",className:`w-4 h-4 ${a.is_active?"":"rotate-180"}`})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:613:25",onClick:()=>h(a),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-muted)] hover:text-blue-400 transition-colors",title:"编辑",children:e.jsx(ee,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:615:27",className:"w-4 h-4"})}),e.jsx("button",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:617:25",onClick:()=>W(a.id,a.name),className:"p-1.5 rounded hover:bg-red-500/10 text-[var(--dg-text-muted)] hover:text-red-400 transition-colors",title:"删除",children:e.jsx(F,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:619:27",className:"w-4 h-4"})})]})]}),d&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:625:23",className:"mt-4 pt-4 border-t border-[var(--dg-border)] space-y-3",children:a.steps?.map((o,n)=>{const w=(()=>{try{const N=JSON.parse(o.approver_ids||"[]");return Array.isArray(N)?N:[]}catch{return[]}})();return e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:629:29",className:"flex items-start gap-3 p-3 bg-[var(--dg-bg-primary)] rounded-lg",children:[e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:630:31",className:"w-6 h-6 rounded-full bg-[var(--dg-bg-tertiary)] flex items-center justify-center text-xs font-medium text-[var(--dg-text-secondary)] flex-shrink-0 mt-0.5",children:o.step_number}),e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:633:31",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:634:33",className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:635:35",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.name}),e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:636:35",className:`text-[10px] px-1.5 py-0.5 rounded ${B[o.step_type]||"bg-gray-500/15 text-gray-400 border-gray-500/30"}`,children:L[o.step_type]||o.step_type})]}),w.length>0&&e.jsx("div",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:641:35",className:"flex flex-wrap gap-1",children:w.map(N=>e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:643:39",className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] bg-blue-500/15 text-blue-400",children:U(N)},N))}),w.length===0&&o.step_type!=="submit"&&e.jsx("span",{"code-path":"src/pages/ApprovalWorkflowPage.tsx:650:35",className:"text-[11px] text-red-400",children:"未关联审批人"})]})]},n)})})]})},a.id)})})}),l!==void 0&&e.jsx(de,{"code-path":"src/pages/ApprovalWorkflowPage.tsx:667:9",workflow:l,users:b,onClose:()=>h(void 0),onSaved:()=>{h(void 0),c()}})]})}export{ve as default}; diff --git a/backend/static/assets/AreaChart-Czgv4pNk.js b/backend/static/assets/AreaChart-B_pR5s1C.js similarity index 99% rename from backend/static/assets/AreaChart-Czgv4pNk.js rename to backend/static/assets/AreaChart-B_pR5s1C.js index f9be410..b387703 100644 --- a/backend/static/assets/AreaChart-Czgv4pNk.js +++ b/backend/static/assets/AreaChart-B_pR5s1C.js @@ -1,4 +1,4 @@ -import{au as ee}from"./index-LZWfu62c.js";import{d as ti,g as ue,r as N,a as T}from"./vendor-codemirror-C7mXSpXt.js";var Wa,vh;function Re(){if(vh)return Wa;vh=1;var e=Array.isArray;return Wa=e,Wa}var Ua,yh;function Zg(){if(yh)return Ua;yh=1;var e=typeof ti=="object"&&ti&&ti.Object===Object&&ti;return Ua=e,Ua}var Ha,mh;function ot(){if(mh)return Ha;mh=1;var e=Zg(),t=typeof self=="object"&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return Ha=r,Ha}var Ga,gh;function Gn(){if(gh)return Ga;gh=1;var e=ot(),t=e.Symbol;return Ga=t,Ga}var Ka,bh;function sw(){if(bh)return Ka;bh=1;var e=Gn(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,i=e?e.toStringTag:void 0;function a(o){var u=r.call(o,i),c=o[i];try{o[i]=void 0;var s=!0}catch{}var f=n.call(o);return s&&(u?o[i]=c:delete o[i]),f}return Ka=a,Ka}var Va,xh;function lw(){if(xh)return Va;xh=1;var e=Object.prototype,t=e.toString;function r(n){return t.call(n)}return Va=r,Va}var Xa,wh;function xt(){if(wh)return Xa;wh=1;var e=Gn(),t=sw(),r=lw(),n="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function o(u){return u==null?u===void 0?i:n:a&&a in Object(u)?t(u):r(u)}return Xa=o,Xa}var Ya,Oh;function wt(){if(Oh)return Ya;Oh=1;function e(t){return t!=null&&typeof t=="object"}return Ya=e,Ya}var Za,_h;function Nr(){if(_h)return Za;_h=1;var e=xt(),t=wt(),r="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&e(i)==r}return Za=n,Za}var Ja,Sh;function uf(){if(Sh)return Ja;Sh=1;var e=Re(),t=Nr(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var u=typeof a;return u=="number"||u=="symbol"||u=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return Ja=i,Ja}var Qa,Ah;function Ct(){if(Ah)return Qa;Ah=1;function e(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}return Qa=e,Qa}var eo,Ph;function cf(){if(Ph)return eo;Ph=1;var e=xt(),t=Ct(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(u){if(!t(u))return!1;var c=e(u);return c==n||c==i||c==r||c==a}return eo=o,eo}var to,Th;function fw(){if(Th)return to;Th=1;var e=ot(),t=e["__core-js_shared__"];return to=t,to}var ro,Eh;function hw(){if(Eh)return ro;Eh=1;var e=fw(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return ro=r,ro}var no,jh;function Jg(){if(jh)return no;jh=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return no=r,no}var io,Mh;function pw(){if(Mh)return io;Mh=1;var e=cf(),t=hw(),r=Ct(),n=Jg(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,u=Object.prototype,c=o.toString,s=u.hasOwnProperty,f=RegExp("^"+c.call(s).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!r(h)||t(h))return!1;var d=e(h)?f:a;return d.test(n(h))}return io=l,io}var ao,Ch;function dw(){if(Ch)return ao;Ch=1;function e(t,r){return t?.[r]}return ao=e,ao}var oo,$h;function Qt(){if($h)return oo;$h=1;var e=pw(),t=dw();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return oo=r,oo}var uo,Ih;function ha(){if(Ih)return uo;Ih=1;var e=Qt(),t=e(Object,"create");return uo=t,uo}var co,Rh;function vw(){if(Rh)return co;Rh=1;var e=ha();function t(){this.__data__=e?e(null):{},this.size=0}return co=t,co}var so,kh;function yw(){if(kh)return so;kh=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return so=e,so}var lo,Dh;function mw(){if(Dh)return lo;Dh=1;var e=ha(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var u=o[a];return u===t?void 0:u}return n.call(o,a)?o[a]:void 0}return lo=i,lo}var fo,Nh;function gw(){if(Nh)return fo;Nh=1;var e=ha(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return fo=n,fo}var ho,qh;function bw(){if(qh)return ho;qh=1;var e=ha(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return ho=r,ho}var po,Bh;function xw(){if(Bh)return po;Bh=1;var e=vw(),t=yw(),r=mw(),n=gw(),i=bw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u-1}return xo=t,xo}var wo,Gh;function Aw(){if(Gh)return wo;Gh=1;var e=pa();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return wo=t,wo}var Oo,Kh;function da(){if(Kh)return Oo;Kh=1;var e=ww(),t=Ow(),r=_w(),n=Sw(),i=Aw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u0?1:-1},zt=function(t){return Xt(t)&&t.indexOf("%")===t.length-1},q=function(t){return Vw(t)&&!Br(t)},Xw=function(t){return J(t)},we=function(t){return q(t)||Xt(t)},Yw=0,Kn=function(t){var r=++Yw;return"".concat(t||"").concat(r)},Je=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!q(t)&&!Xt(t))return n;var a;if(zt(t)){var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return Br(a)&&(a=n),i&&a>r&&(a=r),a},Pt=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},Zw=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function iO(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Hs(e){"@babel/helpers - typeof";return Hs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hs(e)}var wp={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},pt=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},Op=null,Vo=null,vf=function e(t){if(t===Op&&Array.isArray(Vo))return Vo;var r=[];return N.Children.forEach(t,function(n){J(n)||(Uw.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),Vo=r,Op=t,r};function Qe(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(i){return pt(i)}):n=[pt(t)],vf(e).forEach(function(i){var a=He(i,"type.displayName")||He(i,"type.name");n.indexOf(a)!==-1&&r.push(i)}),r}function Ne(e,t){var r=Qe(e,t);return r&&r[0]}var _p=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,i=r.height;return!(!q(n)||n<=0||!q(i)||i<=0)},aO=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],oO=function(t){return t&&t.type&&Xt(t.type)&&aO.indexOf(t.type)>=0},uO=function(t){return t&&Hs(t)==="object"&&"clipDot"in t},cO=function(t,r,n,i){var a,o=(a=Ko?.[i])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!V(t)&&(i&&o.includes(r)||eO.includes(r))||n&&df.includes(r)},Z=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(N.isValidElement(t)&&(i=t.props),!qr(i))return null;var a={};return Object.keys(i).forEach(function(o){var u;cO((u=i)===null||u===void 0?void 0:u[o],o,r,n)&&(a[o]=i[o])}),a},Gs=function e(t,r){if(t===r)return!0;var n=N.Children.count(t);if(n!==N.Children.count(r))return!1;if(n===0)return!0;if(n===1)return Sp(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function pO(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Vs(e){var t=e.children,r=e.width,n=e.height,i=e.viewBox,a=e.className,o=e.style,u=e.title,c=e.desc,s=hO(e,fO),f=i||{width:r,height:n,x:0,y:0},l=ee("recharts-surface",a);return T.createElement("svg",Ks({},Z(s,!0,"svg"),{className:l,width:r,height:n,style:o,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),T.createElement("title",null,u),T.createElement("desc",null,c),t)}var dO=["children","className"];function Xs(){return Xs=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function yO(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var fe=T.forwardRef(function(e,t){var r=e.children,n=e.className,i=vO(e,dO),a=ee("recharts-layer",n);return T.createElement("g",Xs({className:a},Z(i,!0),{ref:t}),r)}),dt=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;aa?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(a);++i=a?r:e(r,n,i)}return Yo=t,Yo}var Zo,Ep;function ib(){if(Ep)return Zo;Ep=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",u=RegExp("["+o+e+i+a+"]");function c(s){return u.test(s)}return Zo=c,Zo}var Jo,jp;function bO(){if(jp)return Jo;jp=1;function e(t){return t.split("")}return Jo=e,Jo}var Qo,Mp;function xO(){if(Mp)return Qo;Mp=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="["+e+"]",u="["+i+"]",c="\\ud83c[\\udffb-\\udfff]",s="(?:"+u+"|"+c+")",f="[^"+e+"]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",d="\\u200d",m=s+"?",v="["+a+"]?",p="(?:"+d+"(?:"+[f,l,h].join("|")+")"+v+m+")*",b=v+m+p,x="(?:"+[f+u+"?",u,l,h,o].join("|")+")",w=RegExp(c+"(?="+c+")|"+x+b,"g");function O(y){return y.match(w)||[]}return Qo=O,Qo}var eu,Cp;function wO(){if(Cp)return eu;Cp=1;var e=bO(),t=ib(),r=xO();function n(i){return t(i)?r(i):e(i)}return eu=n,eu}var tu,$p;function OO(){if($p)return tu;$p=1;var e=gO(),t=ib(),r=wO(),n=eb();function i(a){return function(o){o=n(o);var u=t(o)?r(o):void 0,c=u?u[0]:o.charAt(0),s=u?e(u,1).join(""):o.slice(1);return c[a]()+s}}return tu=i,tu}var ru,Ip;function _O(){if(Ip)return ru;Ip=1;var e=OO(),t=e("toUpperCase");return ru=t,ru}var SO=_O();const ma=ue(SO);function oe(e){return function(){return e}}const ab=Math.cos,gi=Math.sin,et=Math.sqrt,bi=Math.PI,ga=2*bi,Ys=Math.PI,Zs=2*Ys,Lt=1e-6,AO=Zs-Lt;function ob(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return ob;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iLt)if(!(Math.abs(l*c-s*f)>Lt)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let d=n-o,m=i-u,v=c*c+s*s,p=d*d+m*m,b=Math.sqrt(v),x=Math.sqrt(h),w=a*Math.tan((Ys-Math.acos((v+h-p)/(2*b*x)))/2),O=w/x,y=w/b;Math.abs(O-1)>Lt&&this._append`L${t+O*f},${r+O*l}`,this._append`A${a},${a},0,0,${+(l*d>f*m)},${this._x1=t+y*c},${this._y1=r+y*s}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),c=n*Math.sin(i),s=t+u,f=r+c,l=1^o,h=o?i-a:a-i;this._x1===null?this._append`M${s},${f}`:(Math.abs(this._x1-s)>Lt||Math.abs(this._y1-f)>Lt)&&this._append`L${s},${f}`,n&&(h<0&&(h=h%Zs+Zs),h>AO?this._append`A${n},${n},0,1,${l},${t-u},${r-c}A${n},${n},0,1,${l},${this._x1=s},${this._y1=f}`:h>Lt&&this._append`A${n},${n},0,${+(h>=Ys)},${l},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function yf(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new TO(t)}function mf(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ub(e){this._context=e}ub.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ba(e){return new ub(e)}function cb(e){return e[0]}function sb(e){return e[1]}function lb(e,t){var r=oe(!0),n=null,i=ba,a=null,o=yf(u);e=typeof e=="function"?e:e===void 0?cb:oe(e),t=typeof t=="function"?t:t===void 0?sb:oe(t);function u(c){var s,f=(c=mf(c)).length,l,h=!1,d;for(n==null&&(a=i(d=o())),s=0;s<=f;++s)!(s=d;--m)u.point(w[m],O[m]);u.lineEnd(),u.areaEnd()}b&&(w[h]=+e(p,h,l),O[h]=+t(p,h,l),u.point(n?+n(p,h,l):w[h],r?+r(p,h,l):O[h]))}if(x)return u=null,x+""||null}function f(){return lb().defined(i).curve(o).context(a)}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:oe(+l),n=null,s):e},s.x0=function(l){return arguments.length?(e=typeof l=="function"?l:oe(+l),s):e},s.x1=function(l){return arguments.length?(n=l==null?null:typeof l=="function"?l:oe(+l),s):n},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:oe(+l),r=null,s):t},s.y0=function(l){return arguments.length?(t=typeof l=="function"?l:oe(+l),s):t},s.y1=function(l){return arguments.length?(r=l==null?null:typeof l=="function"?l:oe(+l),s):r},s.lineX0=s.lineY0=function(){return f().x(e).y(t)},s.lineY1=function(){return f().x(e).y(r)},s.lineX1=function(){return f().x(n).y(t)},s.defined=function(l){return arguments.length?(i=typeof l=="function"?l:oe(!!l),s):i},s.curve=function(l){return arguments.length?(o=l,a!=null&&(u=o(a)),s):o},s.context=function(l){return arguments.length?(l==null?a=u=null:u=o(a=l),s):a},s}class fb{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function EO(e){return new fb(e,!0)}function jO(e){return new fb(e,!1)}const gf={draw(e,t){const r=et(t/bi);e.moveTo(r,0),e.arc(0,0,r,0,ga)}},MO={draw(e,t){const r=et(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},hb=et(1/3),CO=hb*2,$O={draw(e,t){const r=et(t/CO),n=r*hb;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},IO={draw(e,t){const r=et(t),n=-r/2;e.rect(n,n,r,r)}},RO=.8908130915292852,pb=gi(bi/10)/gi(7*bi/10),kO=gi(ga/10)*pb,DO=-ab(ga/10)*pb,NO={draw(e,t){const r=et(t*RO),n=kO*r,i=DO*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=ga*a/5,u=ab(o),c=gi(o);e.lineTo(c*r,-u*r),e.lineTo(u*n-c*i,c*n+u*i)}e.closePath()}},nu=et(3),qO={draw(e,t){const r=-et(t/(nu*3));e.moveTo(0,r*2),e.lineTo(-nu*r,-r),e.lineTo(nu*r,-r),e.closePath()}},Le=-.5,Fe=et(3)/2,Js=1/et(12),BO=(Js/2+1)*3,LO={draw(e,t){const r=et(t/BO),n=r/2,i=r*Js,a=n,o=r*Js+r,u=-a,c=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(u,c),e.lineTo(Le*n-Fe*i,Fe*n+Le*i),e.lineTo(Le*a-Fe*o,Fe*a+Le*o),e.lineTo(Le*u-Fe*c,Fe*u+Le*c),e.lineTo(Le*n+Fe*i,Le*i-Fe*n),e.lineTo(Le*a+Fe*o,Le*o-Fe*a),e.lineTo(Le*u+Fe*c,Le*c-Fe*u),e.closePath()}};function FO(e,t){let r=null,n=yf(i);e=typeof e=="function"?e:oe(e||gf),t=typeof t=="function"?t:oe(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:oe(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:oe(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function xi(){}function wi(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function db(e){this._context=e}db.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:wi(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:wi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function zO(e){return new db(e)}function vb(e){this._context=e}vb.prototype={areaStart:xi,areaEnd:xi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:wi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function WO(e){return new vb(e)}function yb(e){this._context=e}yb.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:wi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function UO(e){return new yb(e)}function mb(e){this._context=e}mb.prototype={areaStart:xi,areaEnd:xi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function HO(e){return new mb(e)}function Rp(e){return e<0?-1:1}function kp(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),u=(a*i+o*n)/(n+i);return(Rp(a)+Rp(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function Dp(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function iu(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,u=(a-n)/3;e._context.bezierCurveTo(n+u,i+u*t,a-u,o-u*r,a,o)}function Oi(e){this._context=e}Oi.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:iu(this,this._t0,Dp(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,iu(this,Dp(this,r=kp(this,e,t)),r);break;default:iu(this,this._t0,r=kp(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function gb(e){this._context=new bb(e)}(gb.prototype=Object.create(Oi.prototype)).point=function(e,t){Oi.prototype.point.call(this,t,e)};function bb(e){this._context=e}bb.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function GO(e){return new Oi(e)}function KO(e){return new gb(e)}function xb(e){this._context=e}xb.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Np(e),i=Np(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function XO(e){return new xa(e,.5)}function YO(e){return new xa(e,0)}function ZO(e){return new xa(e,1)}function vr(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,u=a.length;r=0;)r[t]=t;return r}function JO(e,t){return e[t]}function QO(e){const t=[];return t.key=e,t}function e1(){var e=oe([]),t=Qs,r=vr,n=JO;function i(a){var o=Array.from(e.apply(this,arguments),QO),u,c=o.length,s=-1,f;for(const l of a)for(u=0,++s;u0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function s1(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var wb={symbolCircle:gf,symbolCross:MO,symbolDiamond:$O,symbolSquare:IO,symbolStar:NO,symbolTriangle:qO,symbolWye:LO},l1=Math.PI/180,f1=function(t){var r="symbol".concat(ma(t));return wb[r]||gf},h1=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*l1;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},p1=function(t,r){wb["symbol".concat(ma(t))]=r},bf=function(t){var r=t.type,n=r===void 0?"circle":r,i=t.size,a=i===void 0?64:i,o=t.sizeType,u=o===void 0?"area":o,c=c1(t,i1),s=Bp(Bp({},c),{},{type:n,size:a,sizeType:u}),f=function(){var p=f1(n),b=FO().type(p).size(h1(a,u,n));return b()},l=s.className,h=s.cx,d=s.cy,m=Z(s,!0);return h===+h&&d===+d&&a===+a?T.createElement("path",el({},m,{className:ee("recharts-symbols",l),transform:"translate(".concat(h,", ").concat(d,")"),d:f()})):null};bf.registerSymbol=p1;function yr(e){"@babel/helpers - typeof";return yr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yr(e)}function tl(){return tl=Object.assign?Object.assign.bind():function(e){for(var t=1;t-1}return xo=t,xo}var wo,Gh;function Aw(){if(Gh)return wo;Gh=1;var e=pa();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return wo=t,wo}var Oo,Kh;function da(){if(Kh)return Oo;Kh=1;var e=ww(),t=Ow(),r=_w(),n=Sw(),i=Aw();function a(o){var u=-1,c=o==null?0:o.length;for(this.clear();++u0?1:-1},zt=function(t){return Xt(t)&&t.indexOf("%")===t.length-1},q=function(t){return Vw(t)&&!Br(t)},Xw=function(t){return J(t)},we=function(t){return q(t)||Xt(t)},Yw=0,Kn=function(t){var r=++Yw;return"".concat(t||"").concat(r)},Je=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!q(t)&&!Xt(t))return n;var a;if(zt(t)){var o=t.indexOf("%");a=r*parseFloat(t.slice(0,o))/100}else a=+t;return Br(a)&&(a=n),i&&a>r&&(a=r),a},Pt=function(t){if(!t)return null;var r=Object.keys(t);return r&&r.length?t[r[0]]:null},Zw=function(t){if(!Array.isArray(t))return!1;for(var r=t.length,n={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function iO(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Hs(e){"@babel/helpers - typeof";return Hs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hs(e)}var wp={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},pt=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},Op=null,Vo=null,vf=function e(t){if(t===Op&&Array.isArray(Vo))return Vo;var r=[];return N.Children.forEach(t,function(n){J(n)||(Uw.isFragment(n)?r=r.concat(e(n.props.children)):r.push(n))}),Vo=r,Op=t,r};function Qe(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(function(i){return pt(i)}):n=[pt(t)],vf(e).forEach(function(i){var a=He(i,"type.displayName")||He(i,"type.name");n.indexOf(a)!==-1&&r.push(i)}),r}function Ne(e,t){var r=Qe(e,t);return r&&r[0]}var _p=function(t){if(!t||!t.props)return!1;var r=t.props,n=r.width,i=r.height;return!(!q(n)||n<=0||!q(i)||i<=0)},aO=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],oO=function(t){return t&&t.type&&Xt(t.type)&&aO.indexOf(t.type)>=0},uO=function(t){return t&&Hs(t)==="object"&&"clipDot"in t},cO=function(t,r,n,i){var a,o=(a=Ko?.[i])!==null&&a!==void 0?a:[];return r.startsWith("data-")||!V(t)&&(i&&o.includes(r)||eO.includes(r))||n&&df.includes(r)},Z=function(t,r,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(N.isValidElement(t)&&(i=t.props),!qr(i))return null;var a={};return Object.keys(i).forEach(function(o){var u;cO((u=i)===null||u===void 0?void 0:u[o],o,r,n)&&(a[o]=i[o])}),a},Gs=function e(t,r){if(t===r)return!0;var n=N.Children.count(t);if(n!==N.Children.count(r))return!1;if(n===0)return!0;if(n===1)return Sp(Array.isArray(t)?t[0]:t,Array.isArray(r)?r[0]:r);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function pO(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function Vs(e){var t=e.children,r=e.width,n=e.height,i=e.viewBox,a=e.className,o=e.style,u=e.title,c=e.desc,s=hO(e,fO),f=i||{width:r,height:n,x:0,y:0},l=ee("recharts-surface",a);return T.createElement("svg",Ks({},Z(s,!0,"svg"),{className:l,width:r,height:n,style:o,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),T.createElement("title",null,u),T.createElement("desc",null,c),t)}var dO=["children","className"];function Xs(){return Xs=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function yO(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var fe=T.forwardRef(function(e,t){var r=e.children,n=e.className,i=vO(e,dO),a=ee("recharts-layer",n);return T.createElement("g",Xs({className:a},Z(i,!0),{ref:t}),r)}),dt=function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),a=2;aa?0:a+r),n=n>a?a:n,n<0&&(n+=a),a=r>n?0:n-r>>>0,r>>>=0;for(var o=Array(a);++i=a?r:e(r,n,i)}return Yo=t,Yo}var Zo,Ep;function ib(){if(Ep)return Zo;Ep=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",u=RegExp("["+o+e+i+a+"]");function c(s){return u.test(s)}return Zo=c,Zo}var Jo,jp;function bO(){if(jp)return Jo;jp=1;function e(t){return t.split("")}return Jo=e,Jo}var Qo,Mp;function xO(){if(Mp)return Qo;Mp=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="["+e+"]",u="["+i+"]",c="\\ud83c[\\udffb-\\udfff]",s="(?:"+u+"|"+c+")",f="[^"+e+"]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",d="\\u200d",m=s+"?",v="["+a+"]?",p="(?:"+d+"(?:"+[f,l,h].join("|")+")"+v+m+")*",b=v+m+p,x="(?:"+[f+u+"?",u,l,h,o].join("|")+")",w=RegExp(c+"(?="+c+")|"+x+b,"g");function O(y){return y.match(w)||[]}return Qo=O,Qo}var eu,Cp;function wO(){if(Cp)return eu;Cp=1;var e=bO(),t=ib(),r=xO();function n(i){return t(i)?r(i):e(i)}return eu=n,eu}var tu,$p;function OO(){if($p)return tu;$p=1;var e=gO(),t=ib(),r=wO(),n=eb();function i(a){return function(o){o=n(o);var u=t(o)?r(o):void 0,c=u?u[0]:o.charAt(0),s=u?e(u,1).join(""):o.slice(1);return c[a]()+s}}return tu=i,tu}var ru,Ip;function _O(){if(Ip)return ru;Ip=1;var e=OO(),t=e("toUpperCase");return ru=t,ru}var SO=_O();const ma=ue(SO);function oe(e){return function(){return e}}const ab=Math.cos,gi=Math.sin,et=Math.sqrt,bi=Math.PI,ga=2*bi,Ys=Math.PI,Zs=2*Ys,Lt=1e-6,AO=Zs-Lt;function ob(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return ob;const r=10**t;return function(n){this._+=n[0];for(let i=1,a=n.length;iLt)if(!(Math.abs(l*c-s*f)>Lt)||!a)this._append`L${this._x1=t},${this._y1=r}`;else{let d=n-o,m=i-u,v=c*c+s*s,p=d*d+m*m,b=Math.sqrt(v),x=Math.sqrt(h),w=a*Math.tan((Ys-Math.acos((v+h-p)/(2*b*x)))/2),O=w/x,y=w/b;Math.abs(O-1)>Lt&&this._append`L${t+O*f},${r+O*l}`,this._append`A${a},${a},0,0,${+(l*d>f*m)},${this._x1=t+y*c},${this._y1=r+y*s}`}}arc(t,r,n,i,a,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let u=n*Math.cos(i),c=n*Math.sin(i),s=t+u,f=r+c,l=1^o,h=o?i-a:a-i;this._x1===null?this._append`M${s},${f}`:(Math.abs(this._x1-s)>Lt||Math.abs(this._y1-f)>Lt)&&this._append`L${s},${f}`,n&&(h<0&&(h=h%Zs+Zs),h>AO?this._append`A${n},${n},0,1,${l},${t-u},${r-c}A${n},${n},0,1,${l},${this._x1=s},${this._y1=f}`:h>Lt&&this._append`A${n},${n},0,${+(h>=Ys)},${l},${this._x1=t+n*Math.cos(a)},${this._y1=r+n*Math.sin(a)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}}function yf(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new TO(t)}function mf(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ub(e){this._context=e}ub.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ba(e){return new ub(e)}function cb(e){return e[0]}function sb(e){return e[1]}function lb(e,t){var r=oe(!0),n=null,i=ba,a=null,o=yf(u);e=typeof e=="function"?e:e===void 0?cb:oe(e),t=typeof t=="function"?t:t===void 0?sb:oe(t);function u(c){var s,f=(c=mf(c)).length,l,h=!1,d;for(n==null&&(a=i(d=o())),s=0;s<=f;++s)!(s=d;--m)u.point(w[m],O[m]);u.lineEnd(),u.areaEnd()}b&&(w[h]=+e(p,h,l),O[h]=+t(p,h,l),u.point(n?+n(p,h,l):w[h],r?+r(p,h,l):O[h]))}if(x)return u=null,x+""||null}function f(){return lb().defined(i).curve(o).context(a)}return s.x=function(l){return arguments.length?(e=typeof l=="function"?l:oe(+l),n=null,s):e},s.x0=function(l){return arguments.length?(e=typeof l=="function"?l:oe(+l),s):e},s.x1=function(l){return arguments.length?(n=l==null?null:typeof l=="function"?l:oe(+l),s):n},s.y=function(l){return arguments.length?(t=typeof l=="function"?l:oe(+l),r=null,s):t},s.y0=function(l){return arguments.length?(t=typeof l=="function"?l:oe(+l),s):t},s.y1=function(l){return arguments.length?(r=l==null?null:typeof l=="function"?l:oe(+l),s):r},s.lineX0=s.lineY0=function(){return f().x(e).y(t)},s.lineY1=function(){return f().x(e).y(r)},s.lineX1=function(){return f().x(n).y(t)},s.defined=function(l){return arguments.length?(i=typeof l=="function"?l:oe(!!l),s):i},s.curve=function(l){return arguments.length?(o=l,a!=null&&(u=o(a)),s):o},s.context=function(l){return arguments.length?(l==null?a=u=null:u=o(a=l),s):a},s}class fb{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function EO(e){return new fb(e,!0)}function jO(e){return new fb(e,!1)}const gf={draw(e,t){const r=et(t/bi);e.moveTo(r,0),e.arc(0,0,r,0,ga)}},MO={draw(e,t){const r=et(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},hb=et(1/3),CO=hb*2,$O={draw(e,t){const r=et(t/CO),n=r*hb;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},IO={draw(e,t){const r=et(t),n=-r/2;e.rect(n,n,r,r)}},RO=.8908130915292852,pb=gi(bi/10)/gi(7*bi/10),kO=gi(ga/10)*pb,DO=-ab(ga/10)*pb,NO={draw(e,t){const r=et(t*RO),n=kO*r,i=DO*r;e.moveTo(0,-r),e.lineTo(n,i);for(let a=1;a<5;++a){const o=ga*a/5,u=ab(o),c=gi(o);e.lineTo(c*r,-u*r),e.lineTo(u*n-c*i,c*n+u*i)}e.closePath()}},nu=et(3),qO={draw(e,t){const r=-et(t/(nu*3));e.moveTo(0,r*2),e.lineTo(-nu*r,-r),e.lineTo(nu*r,-r),e.closePath()}},Le=-.5,Fe=et(3)/2,Js=1/et(12),BO=(Js/2+1)*3,LO={draw(e,t){const r=et(t/BO),n=r/2,i=r*Js,a=n,o=r*Js+r,u=-a,c=o;e.moveTo(n,i),e.lineTo(a,o),e.lineTo(u,c),e.lineTo(Le*n-Fe*i,Fe*n+Le*i),e.lineTo(Le*a-Fe*o,Fe*a+Le*o),e.lineTo(Le*u-Fe*c,Fe*u+Le*c),e.lineTo(Le*n+Fe*i,Le*i-Fe*n),e.lineTo(Le*a+Fe*o,Le*o-Fe*a),e.lineTo(Le*u+Fe*c,Le*c-Fe*u),e.closePath()}};function FO(e,t){let r=null,n=yf(i);e=typeof e=="function"?e:oe(e||gf),t=typeof t=="function"?t:oe(t===void 0?64:+t);function i(){let a;if(r||(r=a=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),a)return r=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:oe(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:oe(+a),i):t},i.context=function(a){return arguments.length?(r=a??null,i):r},i}function xi(){}function wi(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function db(e){this._context=e}db.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:wi(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:wi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function zO(e){return new db(e)}function vb(e){this._context=e}vb.prototype={areaStart:xi,areaEnd:xi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:wi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function WO(e){return new vb(e)}function yb(e){this._context=e}yb.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:wi(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function UO(e){return new yb(e)}function mb(e){this._context=e}mb.prototype={areaStart:xi,areaEnd:xi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function HO(e){return new mb(e)}function Rp(e){return e<0?-1:1}function kp(e,t,r){var n=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(n||i<0&&-0),o=(r-e._y1)/(i||n<0&&-0),u=(a*i+o*n)/(n+i);return(Rp(a)+Rp(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(u))||0}function Dp(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function iu(e,t,r){var n=e._x0,i=e._y0,a=e._x1,o=e._y1,u=(a-n)/3;e._context.bezierCurveTo(n+u,i+u*t,a-u,o-u*r,a,o)}function Oi(e){this._context=e}Oi.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:iu(this,this._t0,Dp(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,iu(this,Dp(this,r=kp(this,e,t)),r);break;default:iu(this,this._t0,r=kp(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function gb(e){this._context=new bb(e)}(gb.prototype=Object.create(Oi.prototype)).point=function(e,t){Oi.prototype.point.call(this,t,e)};function bb(e){this._context=e}bb.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,i,a){this._context.bezierCurveTo(t,e,n,r,a,i)}};function GO(e){return new Oi(e)}function KO(e){return new gb(e)}function xb(e){this._context=e}xb.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Np(e),i=Np(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function XO(e){return new xa(e,.5)}function YO(e){return new xa(e,0)}function ZO(e){return new xa(e,1)}function vr(e,t){if((o=e.length)>1)for(var r=1,n,i,a=e[t[0]],o,u=a.length;r=0;)r[t]=t;return r}function JO(e,t){return e[t]}function QO(e){const t=[];return t.key=e,t}function e1(){var e=oe([]),t=Qs,r=vr,n=JO;function i(a){var o=Array.from(e.apply(this,arguments),QO),u,c=o.length,s=-1,f;for(const l of a)for(u=0,++s;u0){for(var r,n,i=0,a=e[0].length,o;i0){for(var r=0,n=e[t[0]],i,a=n.length;r0)||!((a=(i=e[t[0]]).length)>0))){for(var r=0,n=1,i,a,o;n=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function s1(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}var wb={symbolCircle:gf,symbolCross:MO,symbolDiamond:$O,symbolSquare:IO,symbolStar:NO,symbolTriangle:qO,symbolWye:LO},l1=Math.PI/180,f1=function(t){var r="symbol".concat(ma(t));return wb[r]||gf},h1=function(t,r,n){if(r==="area")return t;switch(n){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*l1;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},p1=function(t,r){wb["symbol".concat(ma(t))]=r},bf=function(t){var r=t.type,n=r===void 0?"circle":r,i=t.size,a=i===void 0?64:i,o=t.sizeType,u=o===void 0?"area":o,c=c1(t,i1),s=Bp(Bp({},c),{},{type:n,size:a,sizeType:u}),f=function(){var p=f1(n),b=FO().type(p).size(h1(a,u,n));return b()},l=s.className,h=s.cx,d=s.cy,m=Z(s,!0);return h===+h&&d===+d&&a===+a?T.createElement("path",el({},m,{className:ee("recharts-symbols",l),transform:"translate(".concat(h,", ").concat(d,")"),d:f()})):null};bf.registerSymbol=p1;function yr(e){"@babel/helpers - typeof";return yr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yr(e)}function tl(){return tl=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var x=d.inactive?s:d.color;return T.createElement("li",tl({className:p,style:l,key:"legend-item-".concat(m)},mi(n.props,d,m)),T.createElement(Vs,{width:o,height:o,viewBox:f,style:h},n.renderIcon(d)),T.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},v?v(b,d,m):b))})}},{key:"render",value:function(){var n=this.props,i=n.payload,a=n.layout,o=n.align;if(!i||!i.length)return null;var u={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return T.createElement("ul",{className:"recharts-default-legend",style:u},this.renderItems())}}])})(N.PureComponent);fn(xf,"displayName","Legend");fn(xf,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var au,Fp;function _1(){if(Fp)return au;Fp=1;var e=da();function t(){this.__data__=new e,this.size=0}return au=t,au}var ou,zp;function S1(){if(zp)return ou;zp=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return ou=e,ou}var uu,Wp;function A1(){if(Wp)return uu;Wp=1;function e(t){return this.__data__.get(t)}return uu=e,uu}var cu,Up;function P1(){if(Up)return cu;Up=1;function e(t){return this.__data__.has(t)}return cu=e,cu}var su,Hp;function T1(){if(Hp)return su;Hp=1;var e=da(),t=lf(),r=ff(),n=200;function i(a,o){var u=this.__data__;if(u instanceof e){var c=u.__data__;if(!t||c.lengthd))return!1;var v=l.get(o),p=l.get(u);if(v&&p)return v==u&&p==o;var b=-1,x=!0,w=c&i?new e:void 0;for(l.set(o,u),l.set(u,o);++b-1&&n%1==0&&n-1&&r%1==0&&r<=e}return Cu=t,Cu}var $u,vd;function L1(){if(vd)return $u;vd=1;var e=xt(),t=Sf(),r=wt(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",u="[object Error]",c="[object Function]",s="[object Map]",f="[object Number]",l="[object Object]",h="[object RegExp]",d="[object Set]",m="[object String]",v="[object WeakMap]",p="[object ArrayBuffer]",b="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",O="[object Int8Array]",y="[object Int16Array]",g="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",P="[object Uint16Array]",M="[object Uint32Array]",A={};A[x]=A[w]=A[O]=A[y]=A[g]=A[_]=A[S]=A[P]=A[M]=!0,A[n]=A[i]=A[p]=A[a]=A[b]=A[o]=A[u]=A[c]=A[s]=A[f]=A[l]=A[h]=A[d]=A[m]=A[v]=!1;function E(j){return r(j)&&t(j.length)&&!!A[e(j)]}return $u=E,$u}var Iu,yd;function Cb(){if(yd)return Iu;yd=1;function e(t){return function(r){return t(r)}}return Iu=e,Iu}var rn={exports:{}};rn.exports;var md;function F1(){return md||(md=1,(function(e,t){var r=Zg(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a&&r.process,u=(function(){try{var c=i&&i.require&&i.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}})();e.exports=u})(rn,rn.exports)),rn.exports}var Ru,gd;function $b(){if(gd)return Ru;gd=1;var e=L1(),t=Cb(),r=F1(),n=r&&r.isTypedArray,i=n?t(n):e;return Ru=i,Ru}var ku,bd;function z1(){if(bd)return ku;bd=1;var e=N1(),t=Of(),r=Re(),n=Mb(),i=_f(),a=$b(),o=Object.prototype,u=o.hasOwnProperty;function c(s,f){var l=r(s),h=!l&&t(s),d=!l&&!h&&n(s),m=!l&&!h&&!d&&a(s),v=l||h||d||m,p=v?e(s.length,String):[],b=p.length;for(var x in s)(f||u.call(s,x))&&!(v&&(x=="length"||d&&(x=="offset"||x=="parent")||m&&(x=="buffer"||x=="byteLength"||x=="byteOffset")||i(x,b)))&&p.push(x);return p}return ku=c,ku}var Du,xd;function W1(){if(xd)return Du;xd=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return Du=t,Du}var Nu,wd;function Ib(){if(wd)return Nu;wd=1;function e(t,r){return function(n){return t(r(n))}}return Nu=e,Nu}var qu,Od;function U1(){if(Od)return qu;Od=1;var e=Ib(),t=e(Object.keys,Object);return qu=t,qu}var Bu,_d;function H1(){if(_d)return Bu;_d=1;var e=W1(),t=U1(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!e(a))return t(a);var o=[];for(var u in Object(a))n.call(a,u)&&u!="constructor"&&o.push(u);return o}return Bu=i,Bu}var Lu,Sd;function Vn(){if(Sd)return Lu;Sd=1;var e=cf(),t=Sf();function r(n){return n!=null&&t(n.length)&&!e(n)}return Lu=r,Lu}var Fu,Ad;function wa(){if(Ad)return Fu;Ad=1;var e=z1(),t=H1(),r=Vn();function n(i){return r(i)?e(i):t(i)}return Fu=n,Fu}var zu,Pd;function G1(){if(Pd)return zu;Pd=1;var e=I1(),t=D1(),r=wa();function n(i){return e(i,r,t)}return zu=n,zu}var Wu,Td;function K1(){if(Td)return Wu;Td=1;var e=G1(),t=1,r=Object.prototype,n=r.hasOwnProperty;function i(a,o,u,c,s,f){var l=u&t,h=e(a),d=h.length,m=e(o),v=m.length;if(d!=v&&!l)return!1;for(var p=d;p--;){var b=h[p];if(!(l?b in o:n.call(o,b)))return!1}var x=f.get(a),w=f.get(o);if(x&&w)return x==o&&w==a;var O=!0;f.set(a,o),f.set(o,a);for(var y=l;++p-1}return vc=t,vc}var yc,ev;function p_(){if(ev)return yc;ev=1;function e(t,r,n){for(var i=-1,a=t==null?0:t.length;++i=o){var b=s?null:i(c);if(b)return a(b);m=!1,h=n,p=new e}else p=s?[]:v;e:for(;++l=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function E_(e,t){if(e==null)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}function j_(e){return e.value}function M_(e,t){if(T.isValidElement(e))return T.cloneElement(e,t);if(typeof e=="function")return T.createElement(e,t);t.ref;var r=T_(t,b_);return T.createElement(xf,r)}var cv=1,hr=(function(e){function t(){var r;x_(this,t);for(var n=arguments.length,i=new Array(n),a=0;acv||Math.abs(i.height-this.lastBoundingBox.height)>cv)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,n&&n(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,n&&n(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?ut({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(n){var i=this.props,a=i.layout,o=i.align,u=i.verticalAlign,c=i.margin,s=i.chartWidth,f=i.chartHeight,l,h;if(!n||(n.left===void 0||n.left===null)&&(n.right===void 0||n.right===null))if(o==="center"&&a==="vertical"){var d=this.getBBoxSnapshot();l={left:((s||0)-d.width)/2}}else l=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!n||(n.top===void 0||n.top===null)&&(n.bottom===void 0||n.bottom===null))if(u==="middle"){var m=this.getBBoxSnapshot();h={top:((f||0)-m.height)/2}}else h=u==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return ut(ut({},l),h)}},{key:"render",value:function(){var n=this,i=this.props,a=i.content,o=i.width,u=i.height,c=i.wrapperStyle,s=i.payloadUniqBy,f=i.payload,l=ut(ut({position:"absolute",width:o||"auto",height:u||"auto"},this.getDefaultPosition(c)),c);return T.createElement("div",{className:"recharts-legend-wrapper",style:l,ref:function(d){n.wrapperNode=d}},M_(a,ut(ut({},this.props),{},{payload:qb(f,s,j_)})))}}],[{key:"getWithHeight",value:function(n,i){var a=ut(ut({},this.defaultProps),n.props),o=a.layout;return o==="vertical"&&q(n.props.height)?{height:n.props.height}:o==="horizontal"?{width:n.props.width||i}:null}}])})(N.PureComponent);Oa(hr,"displayName","Legend");Oa(hr,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var wc,sv;function C_(){if(sv)return wc;sv=1;var e=Gn(),t=Of(),r=Re(),n=e?e.isConcatSpreadable:void 0;function i(a){return r(a)||t(a)||!!(n&&a&&a[n])}return wc=i,wc}var Oc,lv;function Fb(){if(lv)return Oc;lv=1;var e=jb(),t=C_();function r(n,i,a,o,u){var c=-1,s=n.length;for(a||(a=t),u||(u=[]);++c0&&a(f)?i>1?r(f,i-1,a,o,u):e(u,f):o||(u[u.length]=f)}return u}return Oc=r,Oc}var _c,fv;function $_(){if(fv)return _c;fv=1;function e(t){return function(r,n,i){for(var a=-1,o=Object(r),u=i(r),c=u.length;c--;){var s=u[t?c:++a];if(n(o[s],s,o)===!1)break}return r}}return _c=e,_c}var Sc,hv;function I_(){if(hv)return Sc;hv=1;var e=$_(),t=e();return Sc=t,Sc}var Ac,pv;function zb(){if(pv)return Ac;pv=1;var e=I_(),t=wa();function r(n,i){return n&&e(n,i,t)}return Ac=r,Ac}var Pc,dv;function R_(){if(dv)return Pc;dv=1;var e=Vn();function t(r,n){return function(i,a){if(i==null)return i;if(!e(i))return r(i,a);for(var o=i.length,u=n?o:-1,c=Object(i);(n?u--:++un||u&&c&&f&&!s&&!l||a&&c&&f||!i&&f||!o)return 1;if(!a&&!u&&!l&&r=s)return f;var l=i[a];return f*(l=="desc"?-1:1)}}return r.index-n.index}return Cc=t,Cc}var $c,xv;function q_(){if(xv)return $c;xv=1;var e=hf(),t=pf(),r=$t(),n=Wb(),i=k_(),a=Cb(),o=N_(),u=Lr(),c=Re();function s(f,l,h){l.length?l=e(l,function(v){return c(v)?function(p){return t(p,v.length===1?v[0]:v)}:v}):l=[u];var d=-1;l=e(l,a(r));var m=n(f,function(v,p,b){var x=e(l,function(w){return w(v)});return{criteria:x,index:++d,value:v}});return i(m,function(v,p){return o(v,p,h)})}return $c=s,$c}var Ic,wv;function B_(){if(wv)return Ic;wv=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return Ic=e,Ic}var Rc,Ov;function L_(){if(Ov)return Rc;Ov=1;var e=B_(),t=Math.max;function r(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var o=arguments,u=-1,c=t(o.length-i,0),s=Array(c);++u0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return qc=n,qc}var Bc,Tv;function U_(){if(Tv)return Bc;Tv=1;var e=z_(),t=W_(),r=t(e);return Bc=r,Bc}var Lc,Ev;function H_(){if(Ev)return Lc;Ev=1;var e=Lr(),t=L_(),r=U_();function n(i,a){return r(t(i,a,e),i+"")}return Lc=n,Lc}var Fc,jv;function _a(){if(jv)return Fc;jv=1;var e=sf(),t=Vn(),r=_f(),n=Ct();function i(a,o,u){if(!n(u))return!1;var c=typeof o;return(c=="number"?t(u)&&r(o,u.length):c=="string"&&o in u)?e(u[o],a):!1}return Fc=i,Fc}var zc,Mv;function G_(){if(Mv)return zc;Mv=1;var e=Fb(),t=q_(),r=H_(),n=_a(),i=r(function(a,o){if(a==null)return[];var u=o.length;return u>1&&n(a,o[0],o[1])?o=[]:u>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(a,e(o,1),[])});return zc=i,zc}var K_=G_();const Tf=ue(K_);function hn(e){"@babel/helpers - typeof";return hn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hn(e)}function il(){return il=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const a=await m.getLogs(s);return{list:V(a),total:J(a)}},staleTime:2e4})}function se(s){return{id:String(s.id??""),userId:String(s.user_id??s.userId??""),username:s.username??"",module:s.module??s.resource??"",action:s.action??"",resource:s.resource??"",ip:s.ip??"",userAgent:s.user_agent??s.userAgent??"",result:s.result==="failure"?"failure":"success",message:s.message??s.detail??"",createdAt:s.createdAt??s.created_at??""}}function be(){K();const[s,a]=c.useState(""),[i,r]=c.useState(""),[d,u]=c.useState(""),N=c.useMemo(()=>({page:1,page_size:100,...i?{module:i}:{},...d?{action:d}:{}}),[i,d]),{data:g,isLoading:y,refetch:w}=ee(N),C=c.useMemo(()=>(g?.list||[]).map(t=>se(t)),[g]),[S,L]=c.useState([]),[k,_]=c.useState([]),[D,A]=c.useState(null),[I,z]=c.useState(!1),[R,re]=c.useState(null),[B,ce]=c.useState(!1),j=c.useCallback(async()=>{try{const[t,l]=await Promise.all([m.getModules(),m.getActions()]);L(t?.list??t??[]),_(l?.list??l??[])}catch{}},[]);c.useEffect(()=>{j()},[j]);const T=C.filter(t=>{const l=s.toLowerCase();return!l||t.username.toLowerCase().includes(l)||t.module.toLowerCase().includes(l)||t.action.toLowerCase().includes(l)||t.resource.toLowerCase().includes(l)}),M=t=>t==="success"?e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:111:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"成功"}):e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:115:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"失败"}),E=async()=>{try{const t={};i&&(t.module=i),d&&(t.action=d),await m.exportLogs(t)}catch{}},F=t=>{A(t)};return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:150:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:152:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:153:9",className:"relative w-64",children:[e.jsx(v,{"code-path":"src/pages/AuditOperationsTab.tsx:154:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(H,{"code-path":"src/pages/AuditOperationsTab.tsx:155:11",placeholder:"搜索操作日志...",value:s,onChange:t=>a(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs("select",{"code-path":"src/pages/AuditOperationsTab.tsx:164:9",value:i,onChange:t=>r(t.target.value),className:"h-9 px-3 text-sm rounded-md bg-slate-800/50 border border-slate-700 text-slate-300 focus:outline-none focus:border-blue-500",children:[e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:169:11",value:"",children:"全部模块"}),S.map(t=>e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:171:13",value:t.value,children:t.label},t.value))]}),e.jsxs("select",{"code-path":"src/pages/AuditOperationsTab.tsx:178:9",value:d,onChange:t=>u(t.target.value),className:"h-9 px-3 text-sm rounded-md bg-slate-800/50 border border-slate-700 text-slate-300 focus:outline-none focus:border-blue-500",children:[e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:183:11",value:"",children:"全部操作"}),k.map(t=>e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:185:13",value:t.value,children:t.label},t.value))]}),e.jsxs(x,{"code-path":"src/pages/AuditOperationsTab.tsx:191:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>w(),children:[e.jsx(W,{"code-path":"src/pages/AuditOperationsTab.tsx:196:11",className:"h-4 w-4 mr-2"}),"刷新"]}),e.jsxs(x,{"code-path":"src/pages/AuditOperationsTab.tsx:199:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:E,children:[e.jsx(Y,{"code-path":"src/pages/AuditOperationsTab.tsx:204:11",className:"h-4 w-4 mr-2"}),"导出"]})]}),e.jsx(q,{"code-path":"src/pages/AuditOperationsTab.tsx:210:7",className:"bg-slate-900 border-slate-800",children:e.jsx(P,{"code-path":"src/pages/AuditOperationsTab.tsx:211:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:212:11",className:"border-t border-slate-800",children:y?e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:214:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:215:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):T.length===0?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:218:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[e.jsx(v,{"code-path":"src/pages/AuditOperationsTab.tsx:219:17",className:"h-8 w-8 mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/pages/AuditOperationsTab.tsx:220:17",className:"text-sm",children:"暂无操作日志"})]}):e.jsxs(Q,{"code-path":"src/pages/AuditOperationsTab.tsx:223:15",children:[e.jsx(U,{"code-path":"src/pages/AuditOperationsTab.tsx:224:17",children:e.jsxs(O,{"code-path":"src/pages/AuditOperationsTab.tsx:225:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:226:21",className:"text-slate-400",children:"时间"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:227:21",className:"text-slate-400",children:"用户"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:228:21",className:"text-slate-400",children:"模块"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:229:21",className:"text-slate-400",children:"操作类型"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:230:21",className:"text-slate-400",children:"资源"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:231:21",className:"text-slate-400",children:"IP"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:232:21",className:"text-slate-400",children:"结果"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:233:21",className:"text-slate-400 text-right",children:"详情"})]})}),e.jsx(X,{"code-path":"src/pages/AuditOperationsTab.tsx:236:17",children:T.map(t=>e.jsxs(O,{"code-path":"src/pages/AuditOperationsTab.tsx:238:21",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:239:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:240:25",className:"text-sm text-slate-400",children:t.createdAt?new Date(t.createdAt).toLocaleString():"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:244:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:245:25",className:"text-sm text-slate-200",children:t.username||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:247:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:248:25",className:"text-sm text-slate-300",children:t.module||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:250:23",children:e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:251:25",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:t.action||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:255:23",children:e.jsx("code",{"code-path":"src/pages/AuditOperationsTab.tsx:256:25",className:"text-xs text-slate-400 bg-slate-800 px-2 py-0.5 rounded",children:t.resource||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:260:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:261:25",className:"text-sm text-slate-400",children:t.ip||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:263:23",children:M(t.result)}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:264:23",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:265:25",className:"flex items-center justify-end",children:e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:266:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400 hover:bg-slate-800",onClick:()=>F(t),title:"查看详情",children:e.jsx(Z,{"code-path":"src/pages/AuditOperationsTab.tsx:273:29",className:"h-4 w-4"})})})})]},t.id))})]})})})}),e.jsx(te,{"code-path":"src/pages/AuditOperationsTab.tsx:287:7",log:D,onClose:()=>A(null)}),e.jsx(ae,{"code-path":"src/pages/AuditOperationsTab.tsx:290:7",open:I,onClose:()=>z(!1),loading:B,stats:R})]})}function te({log:s,onClose:a}){return s?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:308:5",className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:309:7",className:"absolute inset-0 bg-black/60",onClick:a}),e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:310:7",className:"relative bg-slate-900 border border-slate-800 rounded-lg p-6 max-w-lg w-full mx-4 shadow-2xl",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:311:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{"code-path":"src/pages/AuditOperationsTab.tsx:312:11",className:"text-lg font-semibold text-slate-100",children:"操作日志详情"}),e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:313:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-slate-100",onClick:a,children:e.jsx(f,{"code-path":"src/pages/AuditOperationsTab.tsx:319:13",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:323:9",className:"space-y-3 text-sm",children:[e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:324:11",label:"ID",value:s.id}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:325:11",label:"时间",value:s.createdAt?new Date(s.createdAt).toLocaleString():"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:326:11",label:"用户",value:s.username||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:327:11",label:"用户ID",value:s.userId||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:328:11",label:"模块",value:s.module||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:329:11",label:"操作类型",value:s.action||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:330:11",label:"资源",value:s.resource||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:331:11",label:"IP地址",value:s.ip||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:332:11",label:"User-Agent",value:s.userAgent||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:333:11",label:"结果",value:e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:336:15",variant:"outline",className:s.result==="success"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-red-500/30 text-red-400 bg-red-500/10",children:s.result==="success"?"成功":"失败"})}),s.message&&e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:348:27",label:"详情",value:s.message,mono:!0})]}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:351:9",className:"mt-5 flex justify-end",children:e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:352:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:bg-slate-800",onClick:a,children:"关闭"})})]})]}):null}function o({label:s,value:a,mono:i}){return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:367:5",className:"flex items-start gap-4",children:[e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:368:7",className:"text-slate-500 w-20 flex-shrink-0",children:s}),e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:369:7",className:i?"text-slate-300 font-mono text-xs break-all":"text-slate-200 break-all",children:a})]})}function ae({open:s,onClose:a,loading:i,stats:r}){return s?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:394:5",className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:395:7",className:"absolute inset-0 bg-black/60",onClick:a}),e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:396:7",className:"relative bg-slate-900 border border-slate-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:397:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{"code-path":"src/pages/AuditOperationsTab.tsx:398:11",className:"text-lg font-semibold text-slate-100",children:"审计统计"}),e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:399:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-slate-100",onClick:a,children:e.jsx(f,{"code-path":"src/pages/AuditOperationsTab.tsx:405:13",className:"h-4 w-4"})})]}),i?e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:410:11",className:"flex items-center justify-center py-10",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:411:13",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):r?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:414:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:415:13",className:"grid grid-cols-2 gap-3",children:[e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:416:15",label:"总日志数",value:String(r.total_logs??"--"),color:"blue"}),e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:417:15",label:"今日日志",value:String(r.today_count??"--"),color:"emerald"}),e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:418:15",label:"成功数",value:String(r.success_count??"--"),color:"emerald"}),e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:419:15",label:"失败数",value:String(r.failure_count??"--"),color:"red"})]}),r.top_modules&&r.top_modules.length>0&&e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:423:15",children:[e.jsx("h4",{"code-path":"src/pages/AuditOperationsTab.tsx:424:17",className:"text-xs font-semibold text-slate-400 mb-2",children:"热门模块"}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:425:17",className:"space-y-1",children:r.top_modules.slice(0,5).map((d,u)=>e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:427:21",className:"flex justify-between text-xs",children:[e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:428:23",className:"text-slate-300",children:d.module}),e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:429:23",className:"text-slate-500",children:d.count})]},u))})]}),r.top_users&&r.top_users.length>0&&e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:437:15",children:[e.jsx("h4",{"code-path":"src/pages/AuditOperationsTab.tsx:438:17",className:"text-xs font-semibold text-slate-400 mb-2",children:"活跃用户"}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:439:17",className:"space-y-1",children:r.top_users.slice(0,5).map((d,u)=>e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:441:21",className:"flex justify-between text-xs",children:[e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:442:23",className:"text-slate-300",children:d.username}),e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:443:23",className:"text-slate-500",children:d.count})]},u))})]})]}):e.jsx("p",{"code-path":"src/pages/AuditOperationsTab.tsx:451:11",className:"text-slate-500 text-center py-10 text-sm",children:"暂无统计数据"}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:454:9",className:"mt-5 flex justify-end",children:e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:455:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:bg-slate-800",onClick:a,children:"关闭"})})]})]}):null}function h({label:s,value:a,color:i}){const r={blue:"border-blue-500/20 bg-blue-500/5 text-blue-400",emerald:"border-emerald-500/20 bg-emerald-500/5 text-emerald-400",red:"border-red-500/20 bg-red-500/5 text-red-400"};return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:475:5",className:`rounded-lg border p-3 ${r[i]}`,children:[e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:476:7",className:"text-xs text-slate-500",children:s}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:477:7",className:"text-xl font-bold mt-0.5",children:a})]})}export{be as AuditOperationsTab}; +import{r as c,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as q,a as P}from"./card-BHSBTtub.js";import{f as K,B as x}from"./index-Bp-M7P_8.js";import{I as H}from"./input-Bnlm--la.js";import{B as b}from"./badge-B00SZHvE.js";import{T as Q,a as U,b as O,c as p,d as X,e as n}from"./table-u8V9iTZf.js";import{a as m}from"./audit-BQ_DomYe.js";import{u as $,q as G,a as J,b as V}from"./unwrap-D6sbt6TG.js";import{S as v,R as W,v as Y,x as Z,X as f}from"./vendor-icons-BWk-DH7F.js";function ee(s={page:1,page_size:50}){return $({queryKey:G.auditLogs(s),queryFn:async()=>{const a=await m.getLogs(s);return{list:V(a),total:J(a)}},staleTime:2e4})}function se(s){return{id:String(s.id??""),userId:String(s.user_id??s.userId??""),username:s.username??"",module:s.module??s.resource??"",action:s.action??"",resource:s.resource??"",ip:s.ip??"",userAgent:s.user_agent??s.userAgent??"",result:s.result==="failure"?"failure":"success",message:s.message??s.detail??"",createdAt:s.createdAt??s.created_at??""}}function be(){K();const[s,a]=c.useState(""),[i,r]=c.useState(""),[d,u]=c.useState(""),N=c.useMemo(()=>({page:1,page_size:100,...i?{module:i}:{},...d?{action:d}:{}}),[i,d]),{data:g,isLoading:y,refetch:w}=ee(N),C=c.useMemo(()=>(g?.list||[]).map(t=>se(t)),[g]),[S,L]=c.useState([]),[k,_]=c.useState([]),[D,A]=c.useState(null),[I,z]=c.useState(!1),[R,re]=c.useState(null),[B,ce]=c.useState(!1),j=c.useCallback(async()=>{try{const[t,l]=await Promise.all([m.getModules(),m.getActions()]);L(t?.list??t??[]),_(l?.list??l??[])}catch{}},[]);c.useEffect(()=>{j()},[j]);const T=C.filter(t=>{const l=s.toLowerCase();return!l||t.username.toLowerCase().includes(l)||t.module.toLowerCase().includes(l)||t.action.toLowerCase().includes(l)||t.resource.toLowerCase().includes(l)}),M=t=>t==="success"?e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:111:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"成功"}):e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:115:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"失败"}),E=async()=>{try{const t={};i&&(t.module=i),d&&(t.action=d),await m.exportLogs(t)}catch{}},F=t=>{A(t)};return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:150:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:152:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:153:9",className:"relative w-64",children:[e.jsx(v,{"code-path":"src/pages/AuditOperationsTab.tsx:154:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(H,{"code-path":"src/pages/AuditOperationsTab.tsx:155:11",placeholder:"搜索操作日志...",value:s,onChange:t=>a(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs("select",{"code-path":"src/pages/AuditOperationsTab.tsx:164:9",value:i,onChange:t=>r(t.target.value),className:"h-9 px-3 text-sm rounded-md bg-slate-800/50 border border-slate-700 text-slate-300 focus:outline-none focus:border-blue-500",children:[e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:169:11",value:"",children:"全部模块"}),S.map(t=>e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:171:13",value:t.value,children:t.label},t.value))]}),e.jsxs("select",{"code-path":"src/pages/AuditOperationsTab.tsx:178:9",value:d,onChange:t=>u(t.target.value),className:"h-9 px-3 text-sm rounded-md bg-slate-800/50 border border-slate-700 text-slate-300 focus:outline-none focus:border-blue-500",children:[e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:183:11",value:"",children:"全部操作"}),k.map(t=>e.jsx("option",{"code-path":"src/pages/AuditOperationsTab.tsx:185:13",value:t.value,children:t.label},t.value))]}),e.jsxs(x,{"code-path":"src/pages/AuditOperationsTab.tsx:191:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>w(),children:[e.jsx(W,{"code-path":"src/pages/AuditOperationsTab.tsx:196:11",className:"h-4 w-4 mr-2"}),"刷新"]}),e.jsxs(x,{"code-path":"src/pages/AuditOperationsTab.tsx:199:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:E,children:[e.jsx(Y,{"code-path":"src/pages/AuditOperationsTab.tsx:204:11",className:"h-4 w-4 mr-2"}),"导出"]})]}),e.jsx(q,{"code-path":"src/pages/AuditOperationsTab.tsx:210:7",className:"bg-slate-900 border-slate-800",children:e.jsx(P,{"code-path":"src/pages/AuditOperationsTab.tsx:211:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:212:11",className:"border-t border-slate-800",children:y?e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:214:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:215:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):T.length===0?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:218:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[e.jsx(v,{"code-path":"src/pages/AuditOperationsTab.tsx:219:17",className:"h-8 w-8 mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/pages/AuditOperationsTab.tsx:220:17",className:"text-sm",children:"暂无操作日志"})]}):e.jsxs(Q,{"code-path":"src/pages/AuditOperationsTab.tsx:223:15",children:[e.jsx(U,{"code-path":"src/pages/AuditOperationsTab.tsx:224:17",children:e.jsxs(O,{"code-path":"src/pages/AuditOperationsTab.tsx:225:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:226:21",className:"text-slate-400",children:"时间"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:227:21",className:"text-slate-400",children:"用户"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:228:21",className:"text-slate-400",children:"模块"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:229:21",className:"text-slate-400",children:"操作类型"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:230:21",className:"text-slate-400",children:"资源"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:231:21",className:"text-slate-400",children:"IP"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:232:21",className:"text-slate-400",children:"结果"}),e.jsx(p,{"code-path":"src/pages/AuditOperationsTab.tsx:233:21",className:"text-slate-400 text-right",children:"详情"})]})}),e.jsx(X,{"code-path":"src/pages/AuditOperationsTab.tsx:236:17",children:T.map(t=>e.jsxs(O,{"code-path":"src/pages/AuditOperationsTab.tsx:238:21",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:239:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:240:25",className:"text-sm text-slate-400",children:t.createdAt?new Date(t.createdAt).toLocaleString():"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:244:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:245:25",className:"text-sm text-slate-200",children:t.username||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:247:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:248:25",className:"text-sm text-slate-300",children:t.module||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:250:23",children:e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:251:25",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10",children:t.action||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:255:23",children:e.jsx("code",{"code-path":"src/pages/AuditOperationsTab.tsx:256:25",className:"text-xs text-slate-400 bg-slate-800 px-2 py-0.5 rounded",children:t.resource||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:260:23",children:e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:261:25",className:"text-sm text-slate-400",children:t.ip||"--"})}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:263:23",children:M(t.result)}),e.jsx(n,{"code-path":"src/pages/AuditOperationsTab.tsx:264:23",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:265:25",className:"flex items-center justify-end",children:e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:266:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400 hover:bg-slate-800",onClick:()=>F(t),title:"查看详情",children:e.jsx(Z,{"code-path":"src/pages/AuditOperationsTab.tsx:273:29",className:"h-4 w-4"})})})})]},t.id))})]})})})}),e.jsx(te,{"code-path":"src/pages/AuditOperationsTab.tsx:287:7",log:D,onClose:()=>A(null)}),e.jsx(ae,{"code-path":"src/pages/AuditOperationsTab.tsx:290:7",open:I,onClose:()=>z(!1),loading:B,stats:R})]})}function te({log:s,onClose:a}){return s?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:308:5",className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:309:7",className:"absolute inset-0 bg-black/60",onClick:a}),e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:310:7",className:"relative bg-slate-900 border border-slate-800 rounded-lg p-6 max-w-lg w-full mx-4 shadow-2xl",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:311:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{"code-path":"src/pages/AuditOperationsTab.tsx:312:11",className:"text-lg font-semibold text-slate-100",children:"操作日志详情"}),e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:313:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-slate-100",onClick:a,children:e.jsx(f,{"code-path":"src/pages/AuditOperationsTab.tsx:319:13",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:323:9",className:"space-y-3 text-sm",children:[e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:324:11",label:"ID",value:s.id}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:325:11",label:"时间",value:s.createdAt?new Date(s.createdAt).toLocaleString():"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:326:11",label:"用户",value:s.username||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:327:11",label:"用户ID",value:s.userId||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:328:11",label:"模块",value:s.module||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:329:11",label:"操作类型",value:s.action||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:330:11",label:"资源",value:s.resource||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:331:11",label:"IP地址",value:s.ip||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:332:11",label:"User-Agent",value:s.userAgent||"--"}),e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:333:11",label:"结果",value:e.jsx(b,{"code-path":"src/pages/AuditOperationsTab.tsx:336:15",variant:"outline",className:s.result==="success"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-red-500/30 text-red-400 bg-red-500/10",children:s.result==="success"?"成功":"失败"})}),s.message&&e.jsx(o,{"code-path":"src/pages/AuditOperationsTab.tsx:348:27",label:"详情",value:s.message,mono:!0})]}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:351:9",className:"mt-5 flex justify-end",children:e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:352:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:bg-slate-800",onClick:a,children:"关闭"})})]})]}):null}function o({label:s,value:a,mono:i}){return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:367:5",className:"flex items-start gap-4",children:[e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:368:7",className:"text-slate-500 w-20 flex-shrink-0",children:s}),e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:369:7",className:i?"text-slate-300 font-mono text-xs break-all":"text-slate-200 break-all",children:a})]})}function ae({open:s,onClose:a,loading:i,stats:r}){return s?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:394:5",className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:395:7",className:"absolute inset-0 bg-black/60",onClick:a}),e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:396:7",className:"relative bg-slate-900 border border-slate-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-2xl",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:397:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{"code-path":"src/pages/AuditOperationsTab.tsx:398:11",className:"text-lg font-semibold text-slate-100",children:"审计统计"}),e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:399:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-slate-100",onClick:a,children:e.jsx(f,{"code-path":"src/pages/AuditOperationsTab.tsx:405:13",className:"h-4 w-4"})})]}),i?e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:410:11",className:"flex items-center justify-center py-10",children:e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:411:13",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):r?e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:414:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:415:13",className:"grid grid-cols-2 gap-3",children:[e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:416:15",label:"总日志数",value:String(r.total_logs??"--"),color:"blue"}),e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:417:15",label:"今日日志",value:String(r.today_count??"--"),color:"emerald"}),e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:418:15",label:"成功数",value:String(r.success_count??"--"),color:"emerald"}),e.jsx(h,{"code-path":"src/pages/AuditOperationsTab.tsx:419:15",label:"失败数",value:String(r.failure_count??"--"),color:"red"})]}),r.top_modules&&r.top_modules.length>0&&e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:423:15",children:[e.jsx("h4",{"code-path":"src/pages/AuditOperationsTab.tsx:424:17",className:"text-xs font-semibold text-slate-400 mb-2",children:"热门模块"}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:425:17",className:"space-y-1",children:r.top_modules.slice(0,5).map((d,u)=>e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:427:21",className:"flex justify-between text-xs",children:[e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:428:23",className:"text-slate-300",children:d.module}),e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:429:23",className:"text-slate-500",children:d.count})]},u))})]}),r.top_users&&r.top_users.length>0&&e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:437:15",children:[e.jsx("h4",{"code-path":"src/pages/AuditOperationsTab.tsx:438:17",className:"text-xs font-semibold text-slate-400 mb-2",children:"活跃用户"}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:439:17",className:"space-y-1",children:r.top_users.slice(0,5).map((d,u)=>e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:441:21",className:"flex justify-between text-xs",children:[e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:442:23",className:"text-slate-300",children:d.username}),e.jsx("span",{"code-path":"src/pages/AuditOperationsTab.tsx:443:23",className:"text-slate-500",children:d.count})]},u))})]})]}):e.jsx("p",{"code-path":"src/pages/AuditOperationsTab.tsx:451:11",className:"text-slate-500 text-center py-10 text-sm",children:"暂无统计数据"}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:454:9",className:"mt-5 flex justify-end",children:e.jsx(x,{"code-path":"src/pages/AuditOperationsTab.tsx:455:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:bg-slate-800",onClick:a,children:"关闭"})})]})]}):null}function h({label:s,value:a,color:i}){const r={blue:"border-blue-500/20 bg-blue-500/5 text-blue-400",emerald:"border-emerald-500/20 bg-emerald-500/5 text-emerald-400",red:"border-red-500/20 bg-red-500/5 text-red-400"};return e.jsxs("div",{"code-path":"src/pages/AuditOperationsTab.tsx:475:5",className:`rounded-lg border p-3 ${r[i]}`,children:[e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:476:7",className:"text-xs text-slate-500",children:s}),e.jsx("div",{"code-path":"src/pages/AuditOperationsTab.tsx:477:7",className:"text-xl font-bold mt-0.5",children:a})]})}export{be as AuditOperationsTab}; diff --git a/backend/static/assets/CapacityPage-BucLnYij.js b/backend/static/assets/CapacityPage-BQ2ghUzp.js similarity index 94% rename from backend/static/assets/CapacityPage-BucLnYij.js rename to backend/static/assets/CapacityPage-BQ2ghUzp.js index 1bf1325..e0c1fd6 100644 --- a/backend/static/assets/CapacityPage-BucLnYij.js +++ b/backend/static/assets/CapacityPage-BQ2ghUzp.js @@ -1 +1 @@ -import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as E,a as L}from"./card-B-RtdR4H.js";import{g as H,i as M,L as k,B as j}from"./index-LZWfu62c.js";import{B as D}from"./badge-B0F5ZNtn.js";import{S as P,a as N,b as f,c as v,d as x}from"./select-4xU_9B3_.js";import{T as z,a as U,b as d,c as r,d as F,e as n}from"./table-BPFYQwjr.js";import{k as p}from"./index-Z0O8nAcG.js";import{f as S,u as I,R as G,v as J,g as w,H as _}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function te(){const{clusterCode:$}=H(),h=M(),[l,u]=c.useState(!1),[b,g]=c.useState([]),[q,T]=c.useState([]),[A,R]=c.useState([]),[o,V]=c.useState("all"),[a,C]=c.useState($||"");c.useEffect(()=>{p.getClusters().then(s=>{const t=s?.list||[];if(T(t),!a&&t.length>0){const y=t[0].code||String(t[0].id);C(y),h(`/kubernetes/${y}/capacity`,{replace:!0})}}).catch(()=>{})},[]),c.useEffect(()=>{a&&p.getNamespaces(a).then(s=>{R(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const i=c.useCallback(async()=>{if(a){u(!0);try{const s=o==="all"?void 0:o,t=await p.getCapacity(a,s);g(Array.isArray(t)?t:t?.list||[])}catch{g([])}finally{u(!1)}}},[a,o]);c.useEffect(()=>{i()},[i]);const m=c.useMemo(()=>b.flatMap(s=>(s.containers||[]).map(t=>({namespace:s.namespace,deployment:s.name,replicas:s.replicas,container:t.name,cpu_req:t.cpu_request||"-",cpu_lim:t.cpu_limit||"-",mem_req:t.mem_request||"-",mem_lim:t.mem_limit||"-"}))),[b]),B=()=>p.exportAsCSV(`capacity-${a}.csv`,m);return e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:73:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:74:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:75:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:76:29",className:"h-3 w-3"}),e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:76:65",to:`/kubernetes/${a}`,className:"hover:text-slate-300",children:a})]}),e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:45",className:"text-slate-300",children:"容量分析"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:80:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/CapacityPage.tsx:81:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(I,{"code-path":"src/components/kubernetes/CapacityPage.tsx:81:86",className:"h-5 w-5 text-purple-400"}),"资源容量分析"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:82:9",className:"flex items-center gap-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:83:11",value:a,onValueChange:s=>{C(s),h(`/kubernetes/${s}/capacity`)},children:[e.jsx(N,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:13",className:"w-40 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:87"})}),e.jsx(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:85:13",className:"bg-slate-800 border-slate-700",children:q.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:86:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:89:11",value:o,onValueChange:V,children:[e.jsx(N,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:13",className:"w-32 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:87",placeholder:"所有命名空间"})}),e.jsxs(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:91:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:92:15",value:"all",className:"text-xs",children:"所有命名空间"}),A.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:93:36",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:96:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:i,disabled:l,children:[e.jsx(G,{"code-path":"src/components/kubernetes/CapacityPage.tsx:97:13",className:`h-3 w-3 mr-1 ${l?"animate-spin":""}`}),"刷新"]}),e.jsxs(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:99:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:B,children:[e.jsx(J,{"code-path":"src/components/kubernetes/CapacityPage.tsx:100:13",className:"h-3 w-3 mr-1"}),"CSV"]})]})]}),e.jsx(E,{"code-path":"src/components/kubernetes/CapacityPage.tsx:105:7",className:"bg-slate-900 border-slate-800",children:e.jsx(L,{"code-path":"src/components/kubernetes/CapacityPage.tsx:106:9",className:"p-0",children:e.jsxs(z,{"code-path":"src/components/kubernetes/CapacityPage.tsx:107:11",children:[e.jsx(U,{"code-path":"src/components/kubernetes/CapacityPage.tsx:108:13",children:e.jsxs(d,{"code-path":"src/components/kubernetes/CapacityPage.tsx:108:26",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:109:15",className:"text-slate-400",children:"Deployment"}),e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:110:15",className:"text-slate-400",children:"命名空间"}),e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:111:15",className:"text-slate-400",children:"副本"}),e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:112:15",className:"text-slate-400",children:"容器"}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:113:15",className:"text-slate-400",children:[e.jsx(w,{"code-path":"src/components/kubernetes/CapacityPage.tsx:113:53",className:"h-3 w-3 inline mr-1"}),"CPU Req"]}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:114:15",className:"text-slate-400",children:[e.jsx(w,{"code-path":"src/components/kubernetes/CapacityPage.tsx:114:53",className:"h-3 w-3 inline mr-1"}),"CPU Lim"]}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:115:15",className:"text-slate-400",children:[e.jsx(_,{"code-path":"src/components/kubernetes/CapacityPage.tsx:115:53",className:"h-3 w-3 inline mr-1"}),"Mem Req"]}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:116:15",className:"text-slate-400",children:[e.jsx(_,{"code-path":"src/components/kubernetes/CapacityPage.tsx:116:53",className:"h-3 w-3 inline mr-1"}),"Mem Lim"]})]})}),e.jsx(F,{"code-path":"src/components/kubernetes/CapacityPage.tsx:118:13",children:m.length===0?e.jsx(d,{"code-path":"src/components/kubernetes/CapacityPage.tsx:120:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:120:27",colSpan:8,className:"text-center text-slate-500 py-8",children:["暂无数据",l?e.jsx("span",{"code-path":"src/components/kubernetes/CapacityPage.tsx:120:109",className:"animate-spin inline-block ml-2",children:"⏳"}):""]})}):m.map((s,t)=>e.jsxs(d,{"code-path":"src/components/kubernetes/CapacityPage.tsx:122:17",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:123:19",className:"font-medium text-slate-200 text-sm",children:s.deployment}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:124:19",children:e.jsx(D,{"code-path":"src/components/kubernetes/CapacityPage.tsx:124:30",variant:"outline",className:"border-slate-700 text-slate-400 text-xs",children:s.namespace})}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:125:19",className:"text-sm text-slate-300",children:s.replicas}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:126:19",className:"text-sm text-slate-400",children:s.container}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:127:19",className:`text-sm ${s.cpu_req!=="-"?"text-blue-400":"text-slate-600"}`,children:s.cpu_req}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:128:19",className:`text-sm ${s.cpu_lim!=="-"?"text-cyan-400":"text-slate-600"}`,children:s.cpu_lim}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:129:19",className:`text-sm ${s.mem_req!=="-"?"text-emerald-400":"text-slate-600"}`,children:s.mem_req}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:130:19",className:`text-sm ${s.mem_lim!=="-"?"text-teal-400":"text-slate-600"}`,children:s.mem_lim})]},`${s.deployment}-${s.container}-${t}`))})]})})})]})}export{te as default}; +import{r as c,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as E,a as L}from"./card-BHSBTtub.js";import{g as H,i as M,L as k,B as j}from"./index-Bp-M7P_8.js";import{B as D}from"./badge-B00SZHvE.js";import{S as P,a as N,b as f,c as v,d as x}from"./select-DbhcBWnH.js";import{T as z,a as U,b as d,c as r,d as F,e as n}from"./table-u8V9iTZf.js";import{k as p}from"./index-BkulU9RM.js";import{f as S,u as I,R as G,v as J,g as w,H as _}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";function te(){const{clusterCode:$}=H(),h=M(),[l,u]=c.useState(!1),[b,g]=c.useState([]),[q,T]=c.useState([]),[A,R]=c.useState([]),[o,V]=c.useState("all"),[a,C]=c.useState($||"");c.useEffect(()=>{p.getClusters().then(s=>{const t=s?.list||[];if(T(t),!a&&t.length>0){const y=t[0].code||String(t[0].id);C(y),h(`/kubernetes/${y}/capacity`,{replace:!0})}}).catch(()=>{})},[]),c.useEffect(()=>{a&&p.getNamespaces(a).then(s=>{R(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const i=c.useCallback(async()=>{if(a){u(!0);try{const s=o==="all"?void 0:o,t=await p.getCapacity(a,s);g(Array.isArray(t)?t:t?.list||[])}catch{g([])}finally{u(!1)}}},[a,o]);c.useEffect(()=>{i()},[i]);const m=c.useMemo(()=>b.flatMap(s=>(s.containers||[]).map(t=>({namespace:s.namespace,deployment:s.name,replicas:s.replicas,container:t.name,cpu_req:t.cpu_request||"-",cpu_lim:t.cpu_limit||"-",mem_req:t.mem_request||"-",mem_lim:t.mem_limit||"-"}))),[b]),B=()=>p.exportAsCSV(`capacity-${a}.csv`,m);return e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:73:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:74:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:75:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:76:29",className:"h-3 w-3"}),e.jsx(k,{"code-path":"src/components/kubernetes/CapacityPage.tsx:76:65",to:`/kubernetes/${a}`,className:"hover:text-slate-300",children:a})]}),e.jsx(S,{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/CapacityPage.tsx:77:45",className:"text-slate-300",children:"容量分析"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:80:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/CapacityPage.tsx:81:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(I,{"code-path":"src/components/kubernetes/CapacityPage.tsx:81:86",className:"h-5 w-5 text-purple-400"}),"资源容量分析"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/CapacityPage.tsx:82:9",className:"flex items-center gap-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:83:11",value:a,onValueChange:s=>{C(s),h(`/kubernetes/${s}/capacity`)},children:[e.jsx(N,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:13",className:"w-40 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:84:87"})}),e.jsx(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:85:13",className:"bg-slate-800 border-slate-700",children:q.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:86:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(P,{"code-path":"src/components/kubernetes/CapacityPage.tsx:89:11",value:o,onValueChange:V,children:[e.jsx(N,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:13",className:"w-32 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(f,{"code-path":"src/components/kubernetes/CapacityPage.tsx:90:87",placeholder:"所有命名空间"})}),e.jsxs(v,{"code-path":"src/components/kubernetes/CapacityPage.tsx:91:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:92:15",value:"all",className:"text-xs",children:"所有命名空间"}),A.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/CapacityPage.tsx:93:36",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:96:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:i,disabled:l,children:[e.jsx(G,{"code-path":"src/components/kubernetes/CapacityPage.tsx:97:13",className:`h-3 w-3 mr-1 ${l?"animate-spin":""}`}),"刷新"]}),e.jsxs(j,{"code-path":"src/components/kubernetes/CapacityPage.tsx:99:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:B,children:[e.jsx(J,{"code-path":"src/components/kubernetes/CapacityPage.tsx:100:13",className:"h-3 w-3 mr-1"}),"CSV"]})]})]}),e.jsx(E,{"code-path":"src/components/kubernetes/CapacityPage.tsx:105:7",className:"bg-slate-900 border-slate-800",children:e.jsx(L,{"code-path":"src/components/kubernetes/CapacityPage.tsx:106:9",className:"p-0",children:e.jsxs(z,{"code-path":"src/components/kubernetes/CapacityPage.tsx:107:11",children:[e.jsx(U,{"code-path":"src/components/kubernetes/CapacityPage.tsx:108:13",children:e.jsxs(d,{"code-path":"src/components/kubernetes/CapacityPage.tsx:108:26",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:109:15",className:"text-slate-400",children:"Deployment"}),e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:110:15",className:"text-slate-400",children:"命名空间"}),e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:111:15",className:"text-slate-400",children:"副本"}),e.jsx(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:112:15",className:"text-slate-400",children:"容器"}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:113:15",className:"text-slate-400",children:[e.jsx(w,{"code-path":"src/components/kubernetes/CapacityPage.tsx:113:53",className:"h-3 w-3 inline mr-1"}),"CPU Req"]}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:114:15",className:"text-slate-400",children:[e.jsx(w,{"code-path":"src/components/kubernetes/CapacityPage.tsx:114:53",className:"h-3 w-3 inline mr-1"}),"CPU Lim"]}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:115:15",className:"text-slate-400",children:[e.jsx(_,{"code-path":"src/components/kubernetes/CapacityPage.tsx:115:53",className:"h-3 w-3 inline mr-1"}),"Mem Req"]}),e.jsxs(r,{"code-path":"src/components/kubernetes/CapacityPage.tsx:116:15",className:"text-slate-400",children:[e.jsx(_,{"code-path":"src/components/kubernetes/CapacityPage.tsx:116:53",className:"h-3 w-3 inline mr-1"}),"Mem Lim"]})]})}),e.jsx(F,{"code-path":"src/components/kubernetes/CapacityPage.tsx:118:13",children:m.length===0?e.jsx(d,{"code-path":"src/components/kubernetes/CapacityPage.tsx:120:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:120:27",colSpan:8,className:"text-center text-slate-500 py-8",children:["暂无数据",l?e.jsx("span",{"code-path":"src/components/kubernetes/CapacityPage.tsx:120:109",className:"animate-spin inline-block ml-2",children:"⏳"}):""]})}):m.map((s,t)=>e.jsxs(d,{"code-path":"src/components/kubernetes/CapacityPage.tsx:122:17",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:123:19",className:"font-medium text-slate-200 text-sm",children:s.deployment}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:124:19",children:e.jsx(D,{"code-path":"src/components/kubernetes/CapacityPage.tsx:124:30",variant:"outline",className:"border-slate-700 text-slate-400 text-xs",children:s.namespace})}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:125:19",className:"text-sm text-slate-300",children:s.replicas}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:126:19",className:"text-sm text-slate-400",children:s.container}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:127:19",className:`text-sm ${s.cpu_req!=="-"?"text-blue-400":"text-slate-600"}`,children:s.cpu_req}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:128:19",className:`text-sm ${s.cpu_lim!=="-"?"text-cyan-400":"text-slate-600"}`,children:s.cpu_lim}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:129:19",className:`text-sm ${s.mem_req!=="-"?"text-emerald-400":"text-slate-600"}`,children:s.mem_req}),e.jsx(n,{"code-path":"src/components/kubernetes/CapacityPage.tsx:130:19",className:`text-sm ${s.mem_lim!=="-"?"text-teal-400":"text-slate-600"}`,children:s.mem_lim})]},`${s.deployment}-${s.container}-${t}`))})]})})})]})}export{te as default}; diff --git a/backend/static/assets/CloudAccountManager-Dth1Gy-B.js b/backend/static/assets/CloudAccountManager-CTxUSSuc.js similarity index 98% rename from backend/static/assets/CloudAccountManager-Dth1Gy-B.js rename to backend/static/assets/CloudAccountManager-CTxUSSuc.js index 87639e0..78fef2a 100644 --- a/backend/static/assets/CloudAccountManager-Dth1Gy-B.js +++ b/backend/static/assets/CloudAccountManager-CTxUSSuc.js @@ -1 +1 @@ -import{j as e,r as a}from"./vendor-codemirror-C7mXSpXt.js";import{B as d,D as R,a as W,b as Q,c as V,d as $,e as G}from"./index-LZWfu62c.js";import{I as h}from"./input-BdDauX3U.js";import{L as u}from"./label-u-lNUbKh.js";import{C as N,a as y}from"./card-B-RtdR4H.js";import{B as A}from"./badge-B0F5ZNtn.js";import{c as v}from"./account-Dzyhyahe.js";import{R as _,P as F,S as X,ag as S,C as Z,a as q,d as k,T as J,i as U,L as Y}from"./vendor-icons-Aso0-eeY.js";const L={aws:{viewBox:"0 0 24 24",color:"#FF9900",path:"M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.24-.112a2.47 2.47 0 0 1-.288-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.671 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.287 2.287 0 0 1-.28.104.488.488 0 0 1-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 0 1 .224-.167c.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.21c.265 0 .538-.048.822-.144.283-.096.535-.271.742-.51.128-.152.224-.32.264-.512.04-.191.072-.423.072-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.654.295.846.191.2.47.296.838.296zm3.89.527c-.073 0-.12-.016-.152-.048-.032-.024-.064-.08-.088-.152L6.155 5.563a.715.715 0 0 1-.032-.16c0-.128.064-.2.192.2h.703c.08 0 .136.016.168.048.032.024.064.08.088.152l1.348 5.298 1.252-5.298c.024-.08.056-.128.088-.152a.355.355 0 0 1 .176-.048h.575c.08 0 .136.016.176.048.032.024.072.08.088.152l1.268 5.362 1.39-5.362c.024-.08.056-.128.088-.152a.344.344 0 0 1 .168-.048h.67c.128 0 .2.072.2.2 0 .04-.008.072-.016.112 0 0-.04.128-.088.152l-1.916 6.15c-.032.08-.064.128-.096.152a.355.355 0 0 1-.176.048h-.622c-.08 0-.136-.016-.176-.048-.032-.024-.064-.08-.088-.152l-1.26-5.186-1.252 5.178c-.024.08-.056.128-.088.152a.355.355 0 0 1-.176.048h-.623zm9.166.215c-.367 0-.734-.04-1.094-.127-.359-.088-.638-.184-.822-.296-.112-.064-.191-.136-.223-.2a.498.498 0 0 1-.032-.128v-.399c0-.167.064-.247.183-.247a.45.45 0 0 1 .144.024c.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .893-.088 1.164-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.55c-.144-.151-.423-.287-.83-.415l-1.188-.367c-.598-.192-1.044-.471-1.316-.838a1.95 1.95 0 0 1-.415-1.205c0-.351.072-.662.215-.918.144-.255.335-.479.575-.654.24-.184.51-.319.822-.415.311-.096.638-.136.982-.136.176 0 .36.008.535.032.184.024.351.056.518.088.152.04.303.08.439.127.136.048.24.096.311.144a.66.66 0 0 1 .176.144.298.298 0 0 1 .048.184v.359c0 .168-.064.256-.183.256a.83.83 0 0 1-.304-.096 3.68 3.68 0 0 0-1.548-.311c-.463 0-.83.072-1.085.231-.255.16-.39.4-.39.743 0 .351.128.59.383.758.255.168.702.335 1.331.48.583.135 1.005.311 1.268.518.263.207.39.495.39.862 0 .367-.128.662-.375.902-.247.247-.67.375-1.26.375zm2.004 1.332c-2.637 1.948-6.488 2.984-9.793 2.984-4.635 0-8.81-1.715-11.966-4.566-.255-.224-.024-.335.271-.144 3.41 1.987 7.622 3.183 11.966 3.183 2.936 0 6.158-.61 9.119-1.876.44-.207.815.287.383.615zm1.078-1.23c-.336-.431-2.223-.2-3.073-.103-.255.024-.295-.192-.064-.351 1.5-1.053 3.962-.75 4.246-.4.287.359-.08 2.824-1.484 4.004-.215.184-.423.088-.319-.151.311-.774 1.005-2.51.662-2.956v-.443z"},azure:{viewBox:"0 0 24 24",color:"#0078D4",path:"M5.483 21.3H24L14.025 4.013l-3.022 5.915 5.99 9.357H8.787l-3.304 6.015zM8.7 3.197L0 21.3h6.395l4.49-8.51L8.7 3.196z"},gcp:{viewBox:"0 0 24 24",color:"#4285F4",path:"M12.19 2.38a9.344 9.344 0 0 0-9.234 6.893c.053-.02-.055.013 0 0-3.875 2.551-3.922 8.11-.247 10.941l.006-.007-.007.03a6.717 6.717 0 0 0 4.077 1.356h5.173l.03.03h5.192c6.687.053 9.376-8.605 3.835-12.35a9.365 9.365 0 0 0-2.821-4.552l-.043.043.006-.05A9.344 9.344 0 0 0 12.19 2.38zm-.358 4.146c1.244-.04 2.518.368 3.486 1.15a5.186 5.186 0 0 1 1.862 4.078v.518c3.53-.07 3.53 5.262 0 5.193h-5.193l-.008.009v-.04H6.785a2.59 2.59 0 0 1-1.067-.23h.001a2.597 2.597 0 1 1 3.437-3.437l3.013-3.012A6.747 6.747 0 0 0 8.11 8.24c.018-.01.04-.026.054-.023a5.186 5.186 0 0 1 3.67-1.69z"},aliyun:{viewBox:"0 0 24 24",color:"#FF6A00",path:"M3.996 4.517h5.291L8.01 6.324 4.153 7.506a1.668 1.668 0 0 0-1.165 1.601v5.786a1.668 1.668 0 0 0 1.165 1.6l3.857 1.183 1.277 1.807H3.996A3.996 3.996 0 0 1 0 15.487V8.513a3.996 3.996 0 0 1 3.996-3.996m16.008 0h-5.291l1.277 1.807 3.857 1.182c.715.227 1.17.889 1.165 1.601v5.786a1.668 1.668 0 0 1-1.165 1.6l-3.857 1.183-1.277 1.807h5.291A3.996 3.996 0 0 0 24 15.487V8.513a3.996 3.996 0 0 0-3.996-3.996m-4.007 8.345H8.002v-1.804h7.995Z"},tencent:{viewBox:"220 60 620 430",color:"#006EFF",paths:[{fill:"#006EFF",d:"M685.3,188.5c-24.7-66.3-88-110.4-158.8-110.5c-84.8,0-152.2,62.8-165.3,140.8c6.5,0,13.1-2.1,21.8-2.1c8.7,0,19.6,2.1,28.3,2.1c10.9-54.2,58.7-93.2,115.3-93.2c47.8,0,89.2,28.2,108.7,69.3c0,0,2.2,2.2,2.2,0C652.6,192.8,670,188.5,685.3,188.5L685.3,188.5"},{fill:"#00C8DC",d:"M456.9,242.6c-23.9-17.3-47.9-26-76.1-26c-33.9,0-66.2,14.2-89.2,39c-48.4,49.7-47.4,129.2,2.2,177.7c21.7,19.5,43.5,30.3,69.6,32.5l50-47.7h-28.3c-28.3-2.1-45.7-10.8-56.5-21.6c-30-29.6-30.9-77.6-2.2-108.3c15.2-15.2,32.6-21.7,54.4-21.7c13.1,0,32.6,2.1,52.2,21.6c8.7,8.7,32.6,26,41.3,34.7h2.1l32.6-32.5v-2.2C493.9,273,470,253.5,456.9,242.6"},{fill:"#00A3FF",d:"M724.4,396.5c-8.7,8.7-26.1,21.7-56.5,21.7h-187c56.5-54.1,104.4-99.6,108.8-104c8.3-8.4,17-16.3,26.1-23.8c21.8-19.5,39.1-21.7,54.4-21.7c21.7,0,39.1,8.7,54.4,21.6C754.9,318.5,754.9,368.4,724.4,396.5z M761.4,255.6c-23-24.8-55.3-39-89.2-39c-30.4,0-56.5,10.9-80.5,28.2c-8.8,8.7-21.8,17.3-32.7,30.3c-8.7,8.7-195.7,190.7-195.7,190.7c10.9,2.2,23.9,2.2,34.8,2.2h237.1c17.4,0,30.5,0,43.5-2.2c30-2.2,58.3-14.4,80.5-34.7C809.2,383.5,809.2,303.4,761.4,255.6L761.4,255.6"}]},huawei:{viewBox:"0 0 24 24",color:"#FF0000",path:"M3.67 6.14S1.82 7.91 1.72 9.78v.35c.08 1.51 1.22 2.4 1.22 2.4 1.83 1.79 6.26 4.04 7.3 4.55 0 0 .06.03.1-.01l.02-.04v-.04C7.52 10.8 3.67 6.14 3.67 6.14zM9.65 18.6c-.02-.08-.1-.08-.1-.08l-7.38.26c.8 1.43 2.15 2.53 3.56 2.2.96-.25 3.16-1.78 3.88-2.3.06-.05.04-.09.04-.09zm.08-.78C6.49 15.63.21 12.28.21 12.28c-.15.46-.2.9-.21 1.3v.07c0 1.07.4 1.82.4 1.82.8 1.69 2.34 2.2 2.34 2.2.7.3 1.4.31 1.4.31.12.02 4.4 0 5.54 0 .05 0 .08-.05.08-.05v-.06c0-.03-.03-.05-.03-.05zM9.06 3.19a3.42 3.42 0 00-2.57 3.15v.41c.03.6.16 1.05.16 1.05.66 2.9 3.86 7.65 4.55 8.65.05.05.1.03.1.03a.1.1 0 00.06-.1c1.06-10.6-1.11-13.42-1.11-13.42-.32.02-1.19.23-1.19.23zm8.299 2.27s-.49-1.8-2.44-2.28c0 0-.57-.14-1.17-.22 0 0-2.18 2.81-1.12 13.43.01.07.06.08.06.08.07.03.1-.03.1-.03.72-1.03 3.9-5.76 4.55-8.64 0 0 .36-1.4.02-2.34zm-2.92 13.07s-.07 0-.09.05c0 0-.01.07.03.1.7.51 2.85 2 3.88 2.3 0 0 .16.05.43.06h.14c.69-.02 1.9-.37 3-2.26l-7.4-.25zm7.83-8.41c.14-2.06-1.94-3.97-1.94-3.98 0 0-3.85 4.66-6.67 10.8 0 0-.03.08.02.13l.04.01h.06c1.06-.53 5.46-2.77 7.28-4.54 0 0 1.15-.93 1.21-2.42zm1.52 2.14s-6.28 3.37-9.52 5.55c0 0-.05.04-.03.11 0 0 .03.06.07.06 1.16 0 5.56 0 5.67-.02 0 0 .57-.02 1.27-.29 0 0 1.56-.5 2.37-2.27 0 0 .73-1.45.17-3.14z"}};function ee({provider:t,className:p="h-5 w-5"}){const n=L[t]||L.aliyun;return e.jsx("svg",{"code-path":"src/components/icons/CloudBrandIcon.tsx:69:5",className:p,viewBox:n.viewBox,fill:"currentColor",style:{color:n.color},role:"img","aria-label":t,children:n.paths?n.paths.map((m,x)=>e.jsx("path",{"code-path":"src/components/icons/CloudBrandIcon.tsx:79:11",d:m.d,fill:m.fill||"currentColor"},x)):e.jsx("path",{"code-path":"src/components/icons/CloudBrandIcon.tsx:82:9",d:n.path})})}function ce(t){return{aws:"#FF9900",azure:"#0078D4",gcp:"#4285F4",aliyun:"#FF6A00",tencent:"#006EFF",huawei:"#FF0000"}[t]||"#64748B"}const se={aws:"AWS",aliyun:"阿里云",tencent:"腾讯云",huawei:"华为云",azure:"Azure",gcp:"GCP"};function pe(){const[t,p]=a.useState([]),[n,m]=a.useState(!0),[x,B]=a.useState(""),[M,D]=a.useState("all"),[E,i]=a.useState(!1),[b,f]=a.useState(!1),[o,w]=a.useState(null),[s,l]=a.useState({name:"",provider:"aliyun",access_key:"",secret_key:"",monthly_cost:"",status:"active"}),I=()=>{w(null),l({name:"",provider:"aliyun",access_key:"",secret_key:"",monthly_cost:"",status:"active"})},K=()=>{I(),i(!0)},P=c=>{w(c),l({name:c.name||"",provider:c.provider||"aliyun",access_key:"",secret_key:"",monthly_cost:String(c.monthly_cost??0),status:c.status||"active"}),i(!0)},H=async()=>{if(!(!s.name.trim()||!s.provider.trim()))try{f(!0);const c={name:s.name.trim(),provider:s.provider,access_key:s.access_key.trim(),secret_key:s.secret_key.trim(),monthly_cost:Number(s.monthly_cost)||0,status:s.status};o?await v.updateAccount(o.id,c):await v.createAccount(c),i(!1),g()}catch(c){console.error(o?"更新云账号失败:":"创建云账号失败:",c)}finally{f(!1)}},g=async()=>{try{m(!0);const c=await v.getAccounts();p(c?.list||[])}catch(c){console.error("加载云账号列表失败:",c),p([])}finally{m(!1)}};a.useEffect(()=>{g()},[]);const O=async c=>{try{await v.deleteAccount(c),g()}catch(r){console.error("删除云账号失败:",r)}},z=t.filter(c=>{const r=c.access_key||c.accessKey||"",j=(c.name||"").toLowerCase().includes(x.toLowerCase())||r.toLowerCase().includes(x.toLowerCase()),C=M==="all"||c.provider===M;return j&&C});return t.length,t.filter(c=>c.status==="active").length,t.filter(c=>c.status==="inactive").length,t.filter(c=>c.status==="error").length,e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:156:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:158:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:159:9",children:[e.jsx("h1",{"code-path":"src/components/cloud/CloudAccountManager.tsx:160:11",className:"text-2xl font-bold text-slate-100",children:"云账号管理"}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:161:11",className:"text-slate-400 mt-1",children:"管理多云平台的访问凭证和账号信息"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:163:9",className:"flex items-center gap-2",children:[e.jsxs(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:164:11",variant:"outline",onClick:g,className:"border-slate-700 text-slate-300",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudAccountManager.tsx:165:13",className:`h-4 w-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),e.jsxs(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:168:11",className:"bg-blue-600 hover:bg-blue-700",onClick:K,children:[e.jsx(F,{"code-path":"src/components/cloud/CloudAccountManager.tsx:169:13",className:"h-4 w-4 mr-2"}),"添加账号"]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:176:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:177:9",className:"relative flex-1 max-w-md",children:[e.jsx(X,{"code-path":"src/components/cloud/CloudAccountManager.tsx:178:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:179:11",placeholder:"搜索账号名称或AccessKey...",value:x,onChange:c=>B(c.target.value),className:"pl-10 bg-slate-800 border-slate-700 text-slate-100"})]}),e.jsxs("select",{"code-path":"src/components/cloud/CloudAccountManager.tsx:186:9",value:M,onChange:c=>D(c.target.value),className:"px-3 py-2 bg-slate-800 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:191:11",value:"all",children:"全部平台"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:192:11",value:"aws",children:"AWS"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:193:11",value:"aliyun",children:"阿里云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:194:11",value:"tencent",children:"腾讯云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:195:11",value:"huawei",children:"华为云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:196:11",value:"azure",children:"Azure"})]})]}),n?e.jsx(N,{"code-path":"src/components/cloud/CloudAccountManager.tsx:202:9",className:"bg-slate-800 border-slate-700",children:e.jsxs(y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:203:11",className:"p-12 text-center text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudAccountManager.tsx:204:13",className:"h-6 w-6 animate-spin mx-auto mb-3"}),"加载中..."]})}):z.length===0?e.jsx(N,{"code-path":"src/components/cloud/CloudAccountManager.tsx:209:9",className:"bg-slate-800 border-slate-700",children:e.jsx(y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:210:11",className:"p-12 text-center text-slate-500",children:"暂无云账号数据"})}):e.jsx("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:213:9",className:"grid grid-cols-2 gap-4",children:z.map(c=>{const r=c.access_key||c.accessKey||"",j=c.server_count??c.serverCount??0,C=c.last_sync||c.lastSync||c.created_at||"-",T=c.monthly_cost??c.monthlyCost??0;return e.jsx(N,{"code-path":"src/components/cloud/CloudAccountManager.tsx:220:15",className:"bg-slate-800 border-slate-700",children:e.jsxs(y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:221:17",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:222:19",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:223:21",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:224:23",className:"w-10 h-10 rounded-lg bg-slate-800 flex items-center justify-center",style:{borderBottom:`2px solid ${ce(c.provider)}`},children:e.jsx(ee,{"code-path":"src/components/cloud/CloudAccountManager.tsx:225:25",provider:c.provider,className:"h-6 w-6"})}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:227:23",children:[e.jsx("h3",{"code-path":"src/components/cloud/CloudAccountManager.tsx:228:25",className:"font-medium text-slate-100",children:c.name}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:229:25",className:"text-sm text-slate-400 mt-0.5",children:se[c.provider]||c.provider}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:230:25",className:"flex items-center gap-3 mt-2",children:[r&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:232:29",variant:"secondary",className:"bg-slate-700 text-slate-300",children:[e.jsx(S,{"code-path":"src/components/cloud/CloudAccountManager.tsx:233:31",className:"h-3 w-3 mr-1"}),r.slice(0,8),"..."]}),c.status==="active"&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:238:29",className:"bg-green-500/20 text-green-400 border-0",children:[e.jsx(Z,{"code-path":"src/components/cloud/CloudAccountManager.tsx:239:31",className:"h-3 w-3 mr-1"}),"正常"]}),c.status==="inactive"&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:244:29",className:"bg-slate-500/20 text-slate-400 border-0",children:[e.jsx(q,{"code-path":"src/components/cloud/CloudAccountManager.tsx:245:31",className:"h-3 w-3 mr-1"}),"已停用"]}),c.status==="error"&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:250:29",className:"bg-red-500/20 text-red-400 border-0",children:[e.jsx(S,{"code-path":"src/components/cloud/CloudAccountManager.tsx:251:31",className:"h-3 w-3 mr-1"}),"异常"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:258:21",className:"flex items-center gap-1",children:[e.jsx(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:259:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400",onClick:()=>P(c),children:e.jsx(k,{"code-path":"src/components/cloud/CloudAccountManager.tsx:265:25",className:"h-4 w-4"})}),e.jsx(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:267:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>O(c.id),children:e.jsx(J,{"code-path":"src/components/cloud/CloudAccountManager.tsx:273:25",className:"h-4 w-4"})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:277:19",className:"grid grid-cols-3 gap-4 mt-4 pt-4 border-t border-slate-700",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:278:21",children:[e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:279:23",className:"text-xs text-slate-400",children:"月费用"}),e.jsxs("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:280:23",className:"text-lg font-medium text-emerald-400",children:["¥",Number(T).toLocaleString()]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:282:21",children:[e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:283:23",className:"text-xs text-slate-400",children:"服务器数"}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:284:23",className:"text-lg font-medium text-slate-100",children:j})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:286:21",children:[e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:287:23",className:"text-xs text-slate-400",children:"最后同步"}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:288:23",className:"text-sm text-slate-300",children:C!=="-"?new Date(C).toLocaleString():"-"})]})]})]})},c.id)})}),e.jsx(R,{"code-path":"src/components/cloud/CloudAccountManager.tsx:301:7",open:E,onOpenChange:i,children:e.jsxs(W,{"code-path":"src/components/cloud/CloudAccountManager.tsx:302:9",className:"bg-slate-800 border-slate-700 text-slate-100 max-w-lg",children:[e.jsxs(Q,{"code-path":"src/components/cloud/CloudAccountManager.tsx:303:11",children:[e.jsxs(V,{"code-path":"src/components/cloud/CloudAccountManager.tsx:304:13",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(U,{"code-path":"src/components/cloud/CloudAccountManager.tsx:305:15",className:"h-5 w-5 text-blue-400"}),o?"编辑云账号":"添加云账号"]}),e.jsx($,{"code-path":"src/components/cloud/CloudAccountManager.tsx:308:13",className:"text-slate-400",children:o?"修改账号信息和访问凭证,留空则保持原凭证不变":"录入多云平台的访问凭证,用于资源同步与成本统计"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:313:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:314:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:315:15",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:316:17",className:"text-slate-300",children:["账号名称 ",e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:317:24",className:"text-red-400",children:"*"})]}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:319:17",placeholder:"阿里云生产账号",value:s.name,onChange:c=>l({...s,name:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:326:15",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:327:17",className:"text-slate-300",children:["云平台 ",e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:328:23",className:"text-red-400",children:"*"})]}),e.jsxs("select",{"code-path":"src/components/cloud/CloudAccountManager.tsx:330:17",value:s.provider,onChange:c=>l({...s,provider:c.target.value}),className:"w-full px-3 py-2 bg-slate-900 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:335:19",value:"aliyun",children:"阿里云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:336:19",value:"tencent",children:"腾讯云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:337:19",value:"aws",children:"AWS"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:338:19",value:"huawei",children:"华为云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:339:19",value:"azure",children:"Azure"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:344:13",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:345:15",className:"text-slate-300",children:["AccessKey",o&&e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:347:36",className:"text-xs text-slate-500 ml-2",children:"留空保持不变"})]}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:349:15",placeholder:"LTAI...",value:s.access_key,onChange:c=>l({...s,access_key:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500 font-mono text-sm"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:357:13",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:358:15",className:"text-slate-300",children:["SecretKey",o&&e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:360:36",className:"text-xs text-slate-500 ml-2",children:"留空保持不变"})]}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:362:15",type:"password",placeholder:"••••••••",value:s.secret_key,onChange:c=>l({...s,secret_key:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500 font-mono text-sm"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:371:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:372:15",className:"space-y-1.5",children:[e.jsx(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:373:17",className:"text-slate-300",children:"月费用 (元)"}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:374:17",type:"number",min:"0",placeholder:"0",value:s.monthly_cost,onChange:c=>l({...s,monthly_cost:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:383:15",className:"space-y-1.5",children:[e.jsx(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:384:17",className:"text-slate-300",children:"状态"}),e.jsxs("select",{"code-path":"src/components/cloud/CloudAccountManager.tsx:385:17",value:s.status,onChange:c=>l({...s,status:c.target.value}),className:"w-full px-3 py-2 bg-slate-900 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:390:19",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:391:19",value:"inactive",children:"已停用"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:392:19",value:"error",children:"异常"})]})]})]})]}),e.jsxs(G,{"code-path":"src/components/cloud/CloudAccountManager.tsx:398:11",children:[e.jsx(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:399:13",variant:"outline",onClick:()=>i(!1),className:"border-slate-700 text-slate-300 hover:bg-slate-700",children:"取消"}),e.jsxs(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:402:13",className:"bg-blue-600 hover:bg-blue-700",disabled:!s.name.trim()||b,onClick:H,children:[b?e.jsx(Y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:407:29",className:"h-4 w-4 mr-2 animate-spin"}):o?e.jsx(k,{"code-path":"src/components/cloud/CloudAccountManager.tsx:407:98",className:"h-4 w-4 mr-2"}):e.jsx(F,{"code-path":"src/components/cloud/CloudAccountManager.tsx:407:136",className:"h-4 w-4 mr-2"}),o?"保存修改":"创建账号"]})]})]})})]})}export{pe as CloudAccountManager}; +import{j as e,r as a}from"./vendor-codemirror-B1SGo4xl.js";import{B as d,D as R,a as W,b as Q,c as V,d as $,e as G}from"./index-Bp-M7P_8.js";import{I as h}from"./input-Bnlm--la.js";import{L as u}from"./label-NkONM5Mp.js";import{C as N,a as y}from"./card-BHSBTtub.js";import{B as A}from"./badge-B00SZHvE.js";import{c as v}from"./account-CeWzarwh.js";import{R as _,P as F,S as X,ag as S,C as Z,a as q,d as k,T as J,i as U,L as Y}from"./vendor-icons-BWk-DH7F.js";const L={aws:{viewBox:"0 0 24 24",color:"#FF9900",path:"M6.763 10.036c0 .296.032.535.088.71.064.176.144.368.256.576.04.063.056.127.056.183 0 .08-.048.16-.152.24l-.503.335a.383.383 0 0 1-.208.072c-.08 0-.16-.04-.24-.112a2.47 2.47 0 0 1-.288-.375 6.18 6.18 0 0 1-.248-.471c-.622.734-1.405 1.101-2.347 1.101-.671 0-1.205-.191-1.596-.574-.391-.384-.59-.894-.59-1.533 0-.678.239-1.23.726-1.644.487-.415 1.133-.623 1.955-.623.272 0 .551.024.846.064.296.04.6.104.918.176v-.583c0-.607-.127-1.03-.375-1.277-.255-.248-.686-.367-1.3-.367-.28 0-.568.031-.863.103-.295.072-.583.16-.862.272a2.287 2.287 0 0 1-.28.104.488.488 0 0 1-.127.023c-.112 0-.168-.08-.168-.247v-.391c0-.128.016-.224.056-.28a.597.597 0 0 1 .224-.167c.279-.144.614-.264 1.005-.36a4.84 4.84 0 0 1 1.246-.151c.95 0 1.644.216 2.091.647.439.43.662 1.085.662 1.963v2.586zm-3.24 1.21c.265 0 .538-.048.822-.144.283-.096.535-.271.742-.51.128-.152.224-.32.264-.512.04-.191.072-.423.072-.694v-.335a6.66 6.66 0 0 0-.735-.136 6.02 6.02 0 0 0-.75-.048c-.535 0-.926.104-1.19.32-.263.215-.39.518-.39.917 0 .375.095.654.295.846.191.2.47.296.838.296zm3.89.527c-.073 0-.12-.016-.152-.048-.032-.024-.064-.08-.088-.152L6.155 5.563a.715.715 0 0 1-.032-.16c0-.128.064-.2.192.2h.703c.08 0 .136.016.168.048.032.024.064.08.088.152l1.348 5.298 1.252-5.298c.024-.08.056-.128.088-.152a.355.355 0 0 1 .176-.048h.575c.08 0 .136.016.176.048.032.024.072.08.088.152l1.268 5.362 1.39-5.362c.024-.08.056-.128.088-.152a.344.344 0 0 1 .168-.048h.67c.128 0 .2.072.2.2 0 .04-.008.072-.016.112 0 0-.04.128-.088.152l-1.916 6.15c-.032.08-.064.128-.096.152a.355.355 0 0 1-.176.048h-.622c-.08 0-.136-.016-.176-.048-.032-.024-.064-.08-.088-.152l-1.26-5.186-1.252 5.178c-.024.08-.056.128-.088.152a.355.355 0 0 1-.176.048h-.623zm9.166.215c-.367 0-.734-.04-1.094-.127-.359-.088-.638-.184-.822-.296-.112-.064-.191-.136-.223-.2a.498.498 0 0 1-.032-.128v-.399c0-.167.064-.247.183-.247a.45.45 0 0 1 .144.024c.048.016.12.048.2.08.271.12.566.215.878.279.319.064.63.096.95.096.502 0 .893-.088 1.164-.264a.86.86 0 0 0 .415-.758.777.777 0 0 0-.215-.55c-.144-.151-.423-.287-.83-.415l-1.188-.367c-.598-.192-1.044-.471-1.316-.838a1.95 1.95 0 0 1-.415-1.205c0-.351.072-.662.215-.918.144-.255.335-.479.575-.654.24-.184.51-.319.822-.415.311-.096.638-.136.982-.136.176 0 .36.008.535.032.184.024.351.056.518.088.152.04.303.08.439.127.136.048.24.096.311.144a.66.66 0 0 1 .176.144.298.298 0 0 1 .048.184v.359c0 .168-.064.256-.183.256a.83.83 0 0 1-.304-.096 3.68 3.68 0 0 0-1.548-.311c-.463 0-.83.072-1.085.231-.255.16-.39.4-.39.743 0 .351.128.59.383.758.255.168.702.335 1.331.48.583.135 1.005.311 1.268.518.263.207.39.495.39.862 0 .367-.128.662-.375.902-.247.247-.67.375-1.26.375zm2.004 1.332c-2.637 1.948-6.488 2.984-9.793 2.984-4.635 0-8.81-1.715-11.966-4.566-.255-.224-.024-.335.271-.144 3.41 1.987 7.622 3.183 11.966 3.183 2.936 0 6.158-.61 9.119-1.876.44-.207.815.287.383.615zm1.078-1.23c-.336-.431-2.223-.2-3.073-.103-.255.024-.295-.192-.064-.351 1.5-1.053 3.962-.75 4.246-.4.287.359-.08 2.824-1.484 4.004-.215.184-.423.088-.319-.151.311-.774 1.005-2.51.662-2.956v-.443z"},azure:{viewBox:"0 0 24 24",color:"#0078D4",path:"M5.483 21.3H24L14.025 4.013l-3.022 5.915 5.99 9.357H8.787l-3.304 6.015zM8.7 3.197L0 21.3h6.395l4.49-8.51L8.7 3.196z"},gcp:{viewBox:"0 0 24 24",color:"#4285F4",path:"M12.19 2.38a9.344 9.344 0 0 0-9.234 6.893c.053-.02-.055.013 0 0-3.875 2.551-3.922 8.11-.247 10.941l.006-.007-.007.03a6.717 6.717 0 0 0 4.077 1.356h5.173l.03.03h5.192c6.687.053 9.376-8.605 3.835-12.35a9.365 9.365 0 0 0-2.821-4.552l-.043.043.006-.05A9.344 9.344 0 0 0 12.19 2.38zm-.358 4.146c1.244-.04 2.518.368 3.486 1.15a5.186 5.186 0 0 1 1.862 4.078v.518c3.53-.07 3.53 5.262 0 5.193h-5.193l-.008.009v-.04H6.785a2.59 2.59 0 0 1-1.067-.23h.001a2.597 2.597 0 1 1 3.437-3.437l3.013-3.012A6.747 6.747 0 0 0 8.11 8.24c.018-.01.04-.026.054-.023a5.186 5.186 0 0 1 3.67-1.69z"},aliyun:{viewBox:"0 0 24 24",color:"#FF6A00",path:"M3.996 4.517h5.291L8.01 6.324 4.153 7.506a1.668 1.668 0 0 0-1.165 1.601v5.786a1.668 1.668 0 0 0 1.165 1.6l3.857 1.183 1.277 1.807H3.996A3.996 3.996 0 0 1 0 15.487V8.513a3.996 3.996 0 0 1 3.996-3.996m16.008 0h-5.291l1.277 1.807 3.857 1.182c.715.227 1.17.889 1.165 1.601v5.786a1.668 1.668 0 0 1-1.165 1.6l-3.857 1.183-1.277 1.807h5.291A3.996 3.996 0 0 0 24 15.487V8.513a3.996 3.996 0 0 0-3.996-3.996m-4.007 8.345H8.002v-1.804h7.995Z"},tencent:{viewBox:"220 60 620 430",color:"#006EFF",paths:[{fill:"#006EFF",d:"M685.3,188.5c-24.7-66.3-88-110.4-158.8-110.5c-84.8,0-152.2,62.8-165.3,140.8c6.5,0,13.1-2.1,21.8-2.1c8.7,0,19.6,2.1,28.3,2.1c10.9-54.2,58.7-93.2,115.3-93.2c47.8,0,89.2,28.2,108.7,69.3c0,0,2.2,2.2,2.2,0C652.6,192.8,670,188.5,685.3,188.5L685.3,188.5"},{fill:"#00C8DC",d:"M456.9,242.6c-23.9-17.3-47.9-26-76.1-26c-33.9,0-66.2,14.2-89.2,39c-48.4,49.7-47.4,129.2,2.2,177.7c21.7,19.5,43.5,30.3,69.6,32.5l50-47.7h-28.3c-28.3-2.1-45.7-10.8-56.5-21.6c-30-29.6-30.9-77.6-2.2-108.3c15.2-15.2,32.6-21.7,54.4-21.7c13.1,0,32.6,2.1,52.2,21.6c8.7,8.7,32.6,26,41.3,34.7h2.1l32.6-32.5v-2.2C493.9,273,470,253.5,456.9,242.6"},{fill:"#00A3FF",d:"M724.4,396.5c-8.7,8.7-26.1,21.7-56.5,21.7h-187c56.5-54.1,104.4-99.6,108.8-104c8.3-8.4,17-16.3,26.1-23.8c21.8-19.5,39.1-21.7,54.4-21.7c21.7,0,39.1,8.7,54.4,21.6C754.9,318.5,754.9,368.4,724.4,396.5z M761.4,255.6c-23-24.8-55.3-39-89.2-39c-30.4,0-56.5,10.9-80.5,28.2c-8.8,8.7-21.8,17.3-32.7,30.3c-8.7,8.7-195.7,190.7-195.7,190.7c10.9,2.2,23.9,2.2,34.8,2.2h237.1c17.4,0,30.5,0,43.5-2.2c30-2.2,58.3-14.4,80.5-34.7C809.2,383.5,809.2,303.4,761.4,255.6L761.4,255.6"}]},huawei:{viewBox:"0 0 24 24",color:"#FF0000",path:"M3.67 6.14S1.82 7.91 1.72 9.78v.35c.08 1.51 1.22 2.4 1.22 2.4 1.83 1.79 6.26 4.04 7.3 4.55 0 0 .06.03.1-.01l.02-.04v-.04C7.52 10.8 3.67 6.14 3.67 6.14zM9.65 18.6c-.02-.08-.1-.08-.1-.08l-7.38.26c.8 1.43 2.15 2.53 3.56 2.2.96-.25 3.16-1.78 3.88-2.3.06-.05.04-.09.04-.09zm.08-.78C6.49 15.63.21 12.28.21 12.28c-.15.46-.2.9-.21 1.3v.07c0 1.07.4 1.82.4 1.82.8 1.69 2.34 2.2 2.34 2.2.7.3 1.4.31 1.4.31.12.02 4.4 0 5.54 0 .05 0 .08-.05.08-.05v-.06c0-.03-.03-.05-.03-.05zM9.06 3.19a3.42 3.42 0 00-2.57 3.15v.41c.03.6.16 1.05.16 1.05.66 2.9 3.86 7.65 4.55 8.65.05.05.1.03.1.03a.1.1 0 00.06-.1c1.06-10.6-1.11-13.42-1.11-13.42-.32.02-1.19.23-1.19.23zm8.299 2.27s-.49-1.8-2.44-2.28c0 0-.57-.14-1.17-.22 0 0-2.18 2.81-1.12 13.43.01.07.06.08.06.08.07.03.1-.03.1-.03.72-1.03 3.9-5.76 4.55-8.64 0 0 .36-1.4.02-2.34zm-2.92 13.07s-.07 0-.09.05c0 0-.01.07.03.1.7.51 2.85 2 3.88 2.3 0 0 .16.05.43.06h.14c.69-.02 1.9-.37 3-2.26l-7.4-.25zm7.83-8.41c.14-2.06-1.94-3.97-1.94-3.98 0 0-3.85 4.66-6.67 10.8 0 0-.03.08.02.13l.04.01h.06c1.06-.53 5.46-2.77 7.28-4.54 0 0 1.15-.93 1.21-2.42zm1.52 2.14s-6.28 3.37-9.52 5.55c0 0-.05.04-.03.11 0 0 .03.06.07.06 1.16 0 5.56 0 5.67-.02 0 0 .57-.02 1.27-.29 0 0 1.56-.5 2.37-2.27 0 0 .73-1.45.17-3.14z"}};function ee({provider:t,className:p="h-5 w-5"}){const n=L[t]||L.aliyun;return e.jsx("svg",{"code-path":"src/components/icons/CloudBrandIcon.tsx:69:5",className:p,viewBox:n.viewBox,fill:"currentColor",style:{color:n.color},role:"img","aria-label":t,children:n.paths?n.paths.map((m,x)=>e.jsx("path",{"code-path":"src/components/icons/CloudBrandIcon.tsx:79:11",d:m.d,fill:m.fill||"currentColor"},x)):e.jsx("path",{"code-path":"src/components/icons/CloudBrandIcon.tsx:82:9",d:n.path})})}function ce(t){return{aws:"#FF9900",azure:"#0078D4",gcp:"#4285F4",aliyun:"#FF6A00",tencent:"#006EFF",huawei:"#FF0000"}[t]||"#64748B"}const se={aws:"AWS",aliyun:"阿里云",tencent:"腾讯云",huawei:"华为云",azure:"Azure",gcp:"GCP"};function pe(){const[t,p]=a.useState([]),[n,m]=a.useState(!0),[x,B]=a.useState(""),[M,D]=a.useState("all"),[E,i]=a.useState(!1),[b,f]=a.useState(!1),[o,w]=a.useState(null),[s,l]=a.useState({name:"",provider:"aliyun",access_key:"",secret_key:"",monthly_cost:"",status:"active"}),I=()=>{w(null),l({name:"",provider:"aliyun",access_key:"",secret_key:"",monthly_cost:"",status:"active"})},K=()=>{I(),i(!0)},P=c=>{w(c),l({name:c.name||"",provider:c.provider||"aliyun",access_key:"",secret_key:"",monthly_cost:String(c.monthly_cost??0),status:c.status||"active"}),i(!0)},H=async()=>{if(!(!s.name.trim()||!s.provider.trim()))try{f(!0);const c={name:s.name.trim(),provider:s.provider,access_key:s.access_key.trim(),secret_key:s.secret_key.trim(),monthly_cost:Number(s.monthly_cost)||0,status:s.status};o?await v.updateAccount(o.id,c):await v.createAccount(c),i(!1),g()}catch(c){console.error(o?"更新云账号失败:":"创建云账号失败:",c)}finally{f(!1)}},g=async()=>{try{m(!0);const c=await v.getAccounts();p(c?.list||[])}catch(c){console.error("加载云账号列表失败:",c),p([])}finally{m(!1)}};a.useEffect(()=>{g()},[]);const O=async c=>{try{await v.deleteAccount(c),g()}catch(r){console.error("删除云账号失败:",r)}},z=t.filter(c=>{const r=c.access_key||c.accessKey||"",j=(c.name||"").toLowerCase().includes(x.toLowerCase())||r.toLowerCase().includes(x.toLowerCase()),C=M==="all"||c.provider===M;return j&&C});return t.length,t.filter(c=>c.status==="active").length,t.filter(c=>c.status==="inactive").length,t.filter(c=>c.status==="error").length,e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:156:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:158:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:159:9",children:[e.jsx("h1",{"code-path":"src/components/cloud/CloudAccountManager.tsx:160:11",className:"text-2xl font-bold text-slate-100",children:"云账号管理"}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:161:11",className:"text-slate-400 mt-1",children:"管理多云平台的访问凭证和账号信息"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:163:9",className:"flex items-center gap-2",children:[e.jsxs(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:164:11",variant:"outline",onClick:g,className:"border-slate-700 text-slate-300",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudAccountManager.tsx:165:13",className:`h-4 w-4 mr-2 ${n?"animate-spin":""}`}),"刷新"]}),e.jsxs(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:168:11",className:"bg-blue-600 hover:bg-blue-700",onClick:K,children:[e.jsx(F,{"code-path":"src/components/cloud/CloudAccountManager.tsx:169:13",className:"h-4 w-4 mr-2"}),"添加账号"]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:176:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:177:9",className:"relative flex-1 max-w-md",children:[e.jsx(X,{"code-path":"src/components/cloud/CloudAccountManager.tsx:178:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:179:11",placeholder:"搜索账号名称或AccessKey...",value:x,onChange:c=>B(c.target.value),className:"pl-10 bg-slate-800 border-slate-700 text-slate-100"})]}),e.jsxs("select",{"code-path":"src/components/cloud/CloudAccountManager.tsx:186:9",value:M,onChange:c=>D(c.target.value),className:"px-3 py-2 bg-slate-800 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:191:11",value:"all",children:"全部平台"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:192:11",value:"aws",children:"AWS"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:193:11",value:"aliyun",children:"阿里云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:194:11",value:"tencent",children:"腾讯云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:195:11",value:"huawei",children:"华为云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:196:11",value:"azure",children:"Azure"})]})]}),n?e.jsx(N,{"code-path":"src/components/cloud/CloudAccountManager.tsx:202:9",className:"bg-slate-800 border-slate-700",children:e.jsxs(y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:203:11",className:"p-12 text-center text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudAccountManager.tsx:204:13",className:"h-6 w-6 animate-spin mx-auto mb-3"}),"加载中..."]})}):z.length===0?e.jsx(N,{"code-path":"src/components/cloud/CloudAccountManager.tsx:209:9",className:"bg-slate-800 border-slate-700",children:e.jsx(y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:210:11",className:"p-12 text-center text-slate-500",children:"暂无云账号数据"})}):e.jsx("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:213:9",className:"grid grid-cols-2 gap-4",children:z.map(c=>{const r=c.access_key||c.accessKey||"",j=c.server_count??c.serverCount??0,C=c.last_sync||c.lastSync||c.created_at||"-",T=c.monthly_cost??c.monthlyCost??0;return e.jsx(N,{"code-path":"src/components/cloud/CloudAccountManager.tsx:220:15",className:"bg-slate-800 border-slate-700",children:e.jsxs(y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:221:17",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:222:19",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:223:21",className:"flex items-start gap-3",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:224:23",className:"w-10 h-10 rounded-lg bg-slate-800 flex items-center justify-center",style:{borderBottom:`2px solid ${ce(c.provider)}`},children:e.jsx(ee,{"code-path":"src/components/cloud/CloudAccountManager.tsx:225:25",provider:c.provider,className:"h-6 w-6"})}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:227:23",children:[e.jsx("h3",{"code-path":"src/components/cloud/CloudAccountManager.tsx:228:25",className:"font-medium text-slate-100",children:c.name}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:229:25",className:"text-sm text-slate-400 mt-0.5",children:se[c.provider]||c.provider}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:230:25",className:"flex items-center gap-3 mt-2",children:[r&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:232:29",variant:"secondary",className:"bg-slate-700 text-slate-300",children:[e.jsx(S,{"code-path":"src/components/cloud/CloudAccountManager.tsx:233:31",className:"h-3 w-3 mr-1"}),r.slice(0,8),"..."]}),c.status==="active"&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:238:29",className:"bg-green-500/20 text-green-400 border-0",children:[e.jsx(Z,{"code-path":"src/components/cloud/CloudAccountManager.tsx:239:31",className:"h-3 w-3 mr-1"}),"正常"]}),c.status==="inactive"&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:244:29",className:"bg-slate-500/20 text-slate-400 border-0",children:[e.jsx(q,{"code-path":"src/components/cloud/CloudAccountManager.tsx:245:31",className:"h-3 w-3 mr-1"}),"已停用"]}),c.status==="error"&&e.jsxs(A,{"code-path":"src/components/cloud/CloudAccountManager.tsx:250:29",className:"bg-red-500/20 text-red-400 border-0",children:[e.jsx(S,{"code-path":"src/components/cloud/CloudAccountManager.tsx:251:31",className:"h-3 w-3 mr-1"}),"异常"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:258:21",className:"flex items-center gap-1",children:[e.jsx(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:259:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400",onClick:()=>P(c),children:e.jsx(k,{"code-path":"src/components/cloud/CloudAccountManager.tsx:265:25",className:"h-4 w-4"})}),e.jsx(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:267:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>O(c.id),children:e.jsx(J,{"code-path":"src/components/cloud/CloudAccountManager.tsx:273:25",className:"h-4 w-4"})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:277:19",className:"grid grid-cols-3 gap-4 mt-4 pt-4 border-t border-slate-700",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:278:21",children:[e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:279:23",className:"text-xs text-slate-400",children:"月费用"}),e.jsxs("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:280:23",className:"text-lg font-medium text-emerald-400",children:["¥",Number(T).toLocaleString()]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:282:21",children:[e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:283:23",className:"text-xs text-slate-400",children:"服务器数"}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:284:23",className:"text-lg font-medium text-slate-100",children:j})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:286:21",children:[e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:287:23",className:"text-xs text-slate-400",children:"最后同步"}),e.jsx("p",{"code-path":"src/components/cloud/CloudAccountManager.tsx:288:23",className:"text-sm text-slate-300",children:C!=="-"?new Date(C).toLocaleString():"-"})]})]})]})},c.id)})}),e.jsx(R,{"code-path":"src/components/cloud/CloudAccountManager.tsx:301:7",open:E,onOpenChange:i,children:e.jsxs(W,{"code-path":"src/components/cloud/CloudAccountManager.tsx:302:9",className:"bg-slate-800 border-slate-700 text-slate-100 max-w-lg",children:[e.jsxs(Q,{"code-path":"src/components/cloud/CloudAccountManager.tsx:303:11",children:[e.jsxs(V,{"code-path":"src/components/cloud/CloudAccountManager.tsx:304:13",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(U,{"code-path":"src/components/cloud/CloudAccountManager.tsx:305:15",className:"h-5 w-5 text-blue-400"}),o?"编辑云账号":"添加云账号"]}),e.jsx($,{"code-path":"src/components/cloud/CloudAccountManager.tsx:308:13",className:"text-slate-400",children:o?"修改账号信息和访问凭证,留空则保持原凭证不变":"录入多云平台的访问凭证,用于资源同步与成本统计"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:313:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:314:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:315:15",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:316:17",className:"text-slate-300",children:["账号名称 ",e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:317:24",className:"text-red-400",children:"*"})]}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:319:17",placeholder:"阿里云生产账号",value:s.name,onChange:c=>l({...s,name:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:326:15",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:327:17",className:"text-slate-300",children:["云平台 ",e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:328:23",className:"text-red-400",children:"*"})]}),e.jsxs("select",{"code-path":"src/components/cloud/CloudAccountManager.tsx:330:17",value:s.provider,onChange:c=>l({...s,provider:c.target.value}),className:"w-full px-3 py-2 bg-slate-900 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:335:19",value:"aliyun",children:"阿里云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:336:19",value:"tencent",children:"腾讯云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:337:19",value:"aws",children:"AWS"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:338:19",value:"huawei",children:"华为云"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:339:19",value:"azure",children:"Azure"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:344:13",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:345:15",className:"text-slate-300",children:["AccessKey",o&&e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:347:36",className:"text-xs text-slate-500 ml-2",children:"留空保持不变"})]}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:349:15",placeholder:"LTAI...",value:s.access_key,onChange:c=>l({...s,access_key:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500 font-mono text-sm"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:357:13",className:"space-y-1.5",children:[e.jsxs(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:358:15",className:"text-slate-300",children:["SecretKey",o&&e.jsx("span",{"code-path":"src/components/cloud/CloudAccountManager.tsx:360:36",className:"text-xs text-slate-500 ml-2",children:"留空保持不变"})]}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:362:15",type:"password",placeholder:"••••••••",value:s.secret_key,onChange:c=>l({...s,secret_key:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500 font-mono text-sm"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:371:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:372:15",className:"space-y-1.5",children:[e.jsx(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:373:17",className:"text-slate-300",children:"月费用 (元)"}),e.jsx(h,{"code-path":"src/components/cloud/CloudAccountManager.tsx:374:17",type:"number",min:"0",placeholder:"0",value:s.monthly_cost,onChange:c=>l({...s,monthly_cost:c.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100 placeholder:text-slate-500"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudAccountManager.tsx:383:15",className:"space-y-1.5",children:[e.jsx(u,{"code-path":"src/components/cloud/CloudAccountManager.tsx:384:17",className:"text-slate-300",children:"状态"}),e.jsxs("select",{"code-path":"src/components/cloud/CloudAccountManager.tsx:385:17",value:s.status,onChange:c=>l({...s,status:c.target.value}),className:"w-full px-3 py-2 bg-slate-900 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:390:19",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:391:19",value:"inactive",children:"已停用"}),e.jsx("option",{"code-path":"src/components/cloud/CloudAccountManager.tsx:392:19",value:"error",children:"异常"})]})]})]})]}),e.jsxs(G,{"code-path":"src/components/cloud/CloudAccountManager.tsx:398:11",children:[e.jsx(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:399:13",variant:"outline",onClick:()=>i(!1),className:"border-slate-700 text-slate-300 hover:bg-slate-700",children:"取消"}),e.jsxs(d,{"code-path":"src/components/cloud/CloudAccountManager.tsx:402:13",className:"bg-blue-600 hover:bg-blue-700",disabled:!s.name.trim()||b,onClick:H,children:[b?e.jsx(Y,{"code-path":"src/components/cloud/CloudAccountManager.tsx:407:29",className:"h-4 w-4 mr-2 animate-spin"}):o?e.jsx(k,{"code-path":"src/components/cloud/CloudAccountManager.tsx:407:98",className:"h-4 w-4 mr-2"}):e.jsx(F,{"code-path":"src/components/cloud/CloudAccountManager.tsx:407:136",className:"h-4 w-4 mr-2"}),o?"保存修改":"创建账号"]})]})]})})]})}export{pe as CloudAccountManager}; diff --git a/backend/static/assets/CloudBilling-Dtss07cb.js b/backend/static/assets/CloudBilling-Cz5SvRnO.js similarity index 98% rename from backend/static/assets/CloudBilling-Dtss07cb.js rename to backend/static/assets/CloudBilling-Cz5SvRnO.js index 0bd996d..a38b569 100644 --- a/backend/static/assets/CloudBilling-Dtss07cb.js +++ b/backend/static/assets/CloudBilling-Cz5SvRnO.js @@ -1 +1 @@ -import{j as e,r as c}from"./vendor-codemirror-C7mXSpXt.js";import{D as X,a as Y,b as Z,c as ee,d as se,e as le,B as m,t as p,f as ve}from"./index-LZWfu62c.js";import{I as j}from"./input-BdDauX3U.js";import{L as r}from"./label-u-lNUbKh.js";import{C as H,a as T}from"./card-B-RtdR4H.js";import{B as Ne}from"./badge-B0F5ZNtn.js";import{S as oe}from"./switch-C4PJnJ9I.js";import{S as R,a as w,b as S,c as k,d as x}from"./select-4xU_9B3_.js";import{b as h}from"./billing-9Cbmzl6K.js";import{S as fe}from"./stat-strip-BPzU38xY.js";import{L as _,R as q,P as G,t as O,aB as be,d as J,T as K}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const v={aliyun:"阿里云",tencent:"腾讯云",aws:"AWS",huawei:"华为云",azure:"Azure"},V={aliyun:"bg-orange-500",tencent:"bg-blue-500",aws:"bg-amber-500",huawei:"bg-red-500",azure:"bg-sky-500"};function g(d){return`¥${d.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function De({data:d}){if(d.length===0)return e.jsx("p",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:54:12",className:"text-sm text-slate-500 py-8 text-center",children:"暂无数据"});const n=Math.max(...d.map(a=>a.cost),1),t=d.slice(-30);return e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:60:5",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:61:7",className:"flex items-end gap-0.5 h-40",children:t.map((a,o)=>{const i=Math.max(a.cost/n*100,2);return e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:65:13",className:"flex-1 group relative",style:{height:"100%"},children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:70:15",className:"absolute bottom-0 w-full rounded-t-sm bg-gradient-to-t from-blue-600/60 to-blue-400/80 group-hover:from-blue-500 group-hover:to-blue-300 transition-colors",style:{height:`${i}%`}}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:74:15",className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block whitespace-nowrap text-xs bg-slate-800 text-slate-200 px-2 py-1 rounded border border-slate-700 z-10",children:[a.date,": ",g(a.cost)]})]},o)})}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:81:7",className:"flex justify-between mt-2 text-xs text-slate-500",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:82:9",children:t[0]?.date}),e.jsx("span",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:83:9",children:t[t.length-1]?.date})]})]})}const Q={provider:"aliyun",billing_date:"",cost:"",service:"",region:"",account_name:"",description:""};function ye({open:d,onOpenChange:n,editingRecord:t,onSuccess:a}){const[o,i]=c.useState(Q),[B,C]=c.useState(!1);c.useEffect(()=>{d&&i(t?{provider:t.provider,billing_date:t.billing_date,cost:t.cost,service:t.service||"",region:t.region||"",account_name:t.account_name||"",description:t.description||""}:{...Q,billing_date:new Date().toISOString().slice(0,10)})},[d,t]);const y=async()=>{if(!o.provider||!o.billing_date||!o.cost){p.error("请填写必填字段");return}C(!0);try{const l={...o,cost:parseFloat(o.cost)};t?(await h.remove(t.id),await h.create(l)):await h.create(l),n(!1),a(),p("保存成功")}catch(l){p.error("保存失败",{description:l.message})}finally{C(!1)}};return e.jsx(X,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:90:5",open:d,onOpenChange:n,children:e.jsxs(Y,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:91:7",className:"max-w-md",children:[e.jsxs(Z,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:92:9",children:[e.jsx(ee,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:93:11",children:t?"编辑成本记录":"记录成本"}),e.jsx(se,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:94:11",children:"记录一条每日云资源成本"})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:96:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:97:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:98:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:99:15",className:"text-sm text-slate-300",children:"厂商 *"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:100:15",value:o.provider,onValueChange:l=>i({...o,provider:l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:49"})}),e.jsx(k,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:102:17",children:Object.entries(v).map(([l,f])=>e.jsx(x,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:104:21",value:l,children:f},l))})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:109:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:110:15",className:"text-sm text-slate-300",children:"日期 *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:111:15",type:"date",className:"mt-1",value:o.billing_date,onChange:l=>i({...o,billing_date:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:114:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:115:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:116:15",className:"text-sm text-slate-300",children:"费用(元) *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:117:15",type:"number",step:"0.01",className:"mt-1",placeholder:"0.00",value:o.cost,onChange:l=>i({...o,cost:l.target.value})})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:119:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:120:15",className:"text-sm text-slate-300",children:"服务"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:121:15",className:"mt-1",placeholder:"ECS, RDS...",value:o.service,onChange:l=>i({...o,service:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:124:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:125:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:126:15",className:"text-sm text-slate-300",children:"区域"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:127:15",className:"mt-1",placeholder:"cn-hangzhou",value:o.region,onChange:l=>i({...o,region:l.target.value})})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:129:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:130:15",className:"text-sm text-slate-300",children:"账号名称"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:131:15",className:"mt-1",placeholder:"主账号",value:o.account_name,onChange:l=>i({...o,account_name:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:134:11",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:135:13",className:"text-sm text-slate-300",children:"备注"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:136:13",className:"mt-1",placeholder:"可选",value:o.description,onChange:l=>i({...o,description:l.target.value})})]})]}),e.jsxs(le,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:139:9",children:[e.jsx(m,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:140:11",variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsxs(m,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:141:11",onClick:y,disabled:B,children:[B&&e.jsx(_,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:142:28",className:"h-4 w-4 mr-1 animate-spin"}),"保存"]})]})]})})}const U={name:"",provider:"",metric:"daily",threshold:"",operator:">",enabled:!0};function Re({open:d,onOpenChange:n,editingRule:t,onSuccess:a}){const[o,i]=c.useState(U),[B,C]=c.useState(!1);c.useEffect(()=>{d&&i(t?{name:t.name,provider:t.provider||"",metric:t.metric||"daily",threshold:t.threshold,operator:t.operator||">",enabled:t.enabled}:{...U})},[d,t]);const y=async()=>{if(!o.name||!o.threshold){p.error("请填写规则名称和阈值");return}C(!0);try{const l={...o,threshold:parseFloat(o.threshold)};t?await h.updateAlertRule(t.id,l):await h.createAlertRule(l),n(!1),a(),p("保存成功")}catch(l){p.error("保存失败",{description:l.message})}finally{C(!1)}};return e.jsx(X,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:81:5",open:d,onOpenChange:n,children:e.jsxs(Y,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:82:7",className:"max-w-md",children:[e.jsxs(Z,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:83:9",children:[e.jsx(ee,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:84:11",children:t?"编辑预警规则":"添加预警规则"}),e.jsx(se,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:85:11",children:"设置成本阈值,超标时自动预警"})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:87:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:88:11",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:89:13",className:"text-sm text-slate-300",children:"规则名称 *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:90:13",className:"mt-1",placeholder:"如:日成本超 500 元预警",value:o.name,onChange:l=>i({...o,name:l.target.value})})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:92:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:93:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:94:15",className:"text-sm text-slate-300",children:"厂商"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:95:15",value:o.provider||"all",onValueChange:l=>i({...o,provider:l==="all"?"":l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:96:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:96:49"})}),e.jsxs(k,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:97:17",children:[e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:98:19",value:"all",children:"全部厂商"}),Object.entries(v).map(([l,f])=>e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:100:21",value:l,children:f},l))]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:105:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:106:15",className:"text-sm text-slate-300",children:"指标"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:107:15",value:o.metric,onValueChange:l=>i({...o,metric:l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:108:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:108:49"})}),e.jsxs(k,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:109:17",children:[e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:110:19",value:"daily",children:"日成本"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:111:19",value:"monthly",children:"月累计"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:116:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:117:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:118:15",className:"text-sm text-slate-300",children:"比较"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:119:15",value:o.operator,onValueChange:l=>i({...o,operator:l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:120:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:120:49"})}),e.jsxs(k,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:121:17",children:[e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:122:19",value:">",children:"大于 >"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:123:19",value:">=",children:"大于等于 ≥"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:124:19",value:"<",children:"小于 <"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:125:19",value:"<=",children:"小于等于 ≤"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:129:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:130:15",className:"text-sm text-slate-300",children:"阈值(元) *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:131:15",type:"number",step:"0.01",className:"mt-1",placeholder:"500.00",value:o.threshold,onChange:l=>i({...o,threshold:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:134:11",className:"flex items-center gap-2",children:[e.jsx(oe,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:135:13",checked:o.enabled,onCheckedChange:l=>i({...o,enabled:l})}),e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:136:13",className:"text-sm text-slate-300",children:"启用"})]})]}),e.jsxs(le,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:139:9",children:[e.jsx(m,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:140:11",variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsxs(m,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:141:11",onClick:y,disabled:B,children:[B&&e.jsx(_,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:142:28",className:"h-4 w-4 mr-1 animate-spin"}),"保存"]})]})]})})}function Oe(){const d=ve(),[n,t]=c.useState("overview"),[a,o]=c.useState(null),[i,B]=c.useState(!0),[C,y]=c.useState([]),[l,f]=c.useState(!0),[z,te]=c.useState(""),[E,ce]=c.useState(""),[F,ne]=c.useState(""),[P,ae]=c.useState([]),[ie,I]=c.useState(!0),[de,L]=c.useState(!1),[re,M]=c.useState(null),[pe,$]=c.useState(!1),[ue,W]=c.useState(null),N=c.useCallback(async()=>{B(!0);try{const s=await h.getStats();o(s)}catch(s){p.error("加载统计失败",{description:s.message})}finally{B(!1)}},[]),b=c.useCallback(async()=>{f(!0);try{const s={};z&&(s.provider=z),E&&(s.start_date=E),F&&(s.end_date=F);const u=await h.list(s);y(u.list||[])}catch(s){p.error("加载账单失败",{description:s.message})}finally{f(!1)}},[z,E,F]),D=c.useCallback(async()=>{I(!0);try{const s=await h.listAlertRules();ae(s.list||[])}catch(s){p.error("加载预警规则失败",{description:s.message})}finally{I(!1)}},[]);c.useEffect(()=>{N()},[N]),c.useEffect(()=>{n==="records"&&b()},[n,b]),c.useEffect(()=>{n==="alerts"&&D()},[n,D]);const me=()=>{M(null),L(!0)},xe=s=>{M(s),L(!0)},he=()=>{W(null),$(!0)},ge=s=>{W(s),$(!0)},je=async s=>{if(await d({title:"删除账单记录",description:"确定删除这条成本记录?",variant:"destructive"}))try{await h.remove(s),b(),N(),p("删除成功")}catch(A){p.error("删除失败",{description:A.message})}},Be=async s=>{if(await d({title:"删除预警规则",description:"确定删除此预警规则?",variant:"destructive"}))try{await h.deleteAlertRule(s),D(),p("删除成功")}catch(A){p.error("删除失败",{description:A.message})}},Ce=async s=>{try{await h.toggleAlertRule(s),D(),N()}catch(u){p.error("操作失败",{description:u.message})}};return e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:163:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:164:7",className:"flex items-center justify-between",children:[e.jsx("h2",{"code-path":"src/components/cloud/CloudBilling.tsx:165:9",className:"text-lg font-semibold text-slate-100",children:"云账单管理"}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:166:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:167:11",variant:"outline",size:"sm",onClick:()=>{N(),n==="records"&&b(),n==="alerts"&&D()},children:[e.jsx(q,{"code-path":"src/components/cloud/CloudBilling.tsx:168:13",className:"h-4 w-4 mr-1"}),"刷新"]}),n==="records"&&e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:171:13",size:"sm",onClick:me,children:[e.jsx(G,{"code-path":"src/components/cloud/CloudBilling.tsx:172:15",className:"h-4 w-4 mr-1"}),"记录成本"]}),n==="alerts"&&e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:176:13",size:"sm",onClick:he,children:[e.jsx(G,{"code-path":"src/components/cloud/CloudBilling.tsx:177:15",className:"h-4 w-4 mr-1"}),"添加规则"]})]})]}),e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:183:7",className:"flex gap-1 border-b border-slate-800",children:[{key:"overview",label:"概览统计"},{key:"records",label:"成本记录"},{key:"alerts",label:"预警规则"}].map(s=>e.jsx("button",{"code-path":"src/components/cloud/CloudBilling.tsx:189:11",onClick:()=>t(s.key),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${n===s.key?"text-blue-400 border-blue-400":"text-slate-400 border-transparent hover:text-slate-200"}`,children:s.label},s.key))}),n==="overview"&&e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:204:9",className:"space-y-4",children:i?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:206:13",className:"flex items-center justify-center py-20 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudBilling.tsx:206:84",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]}):a?e.jsxs(e.Fragment,{children:[e.jsx(fe,{"code-path":"src/components/cloud/CloudBilling.tsx:209:15",items:[{label:"今日",value:g(a.today_cost||0),color:"blue"},{label:"本月",value:g(a.month_cost||0),color:"amber"},{label:"年度",value:g(a.year_cost||0),color:"purple"},{label:"预警",value:`${a.alerts?.length||0} 条`,color:a.alerts?.length>0?"red":"muted"}]}),a.alerts?.length>0&&e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:219:17",className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:220:19",className:"flex items-center gap-2 mb-3",children:[e.jsx(O,{"code-path":"src/components/cloud/CloudBilling.tsx:221:21",className:"h-4 w-4 text-amber-400"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:222:21",className:"text-sm font-medium text-amber-300",children:"成本预警"})]}),e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:224:19",className:"space-y-2",children:a.alerts.map((s,u)=>e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:226:23",className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:227:25",className:"flex items-center gap-2",children:[e.jsx(Ne,{"code-path":"src/components/cloud/CloudBilling.tsx:228:27",variant:"outline",className:"border-amber-500/50 text-amber-300",children:s.rule_name}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:229:27",className:"text-slate-400",children:[s.provider," · ",s.metric==="daily"?"日":"月","成本"]})]}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:233:25",className:"text-slate-300",children:["当前 ",e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:234:30",className:"text-amber-300 font-medium",children:g(s.current)})," ",s.operator," ","阈值 ",e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:236:30",className:"text-red-400 font-medium",children:g(s.threshold)})]})]},u))})]}),e.jsx(H,{"code-path":"src/components/cloud/CloudBilling.tsx:244:15",className:"bg-slate-900/50 border-slate-800",children:e.jsxs(T,{"code-path":"src/components/cloud/CloudBilling.tsx:245:17",className:"pt-4",children:[e.jsx("h3",{"code-path":"src/components/cloud/CloudBilling.tsx:246:19",className:"text-sm font-medium text-slate-200 mb-4",children:"近 30 天成本趋势"}),e.jsx(De,{"code-path":"src/components/cloud/CloudBilling.tsx:247:19",data:a.month_trend||[]})]})}),e.jsx(H,{"code-path":"src/components/cloud/CloudBilling.tsx:251:15",className:"bg-slate-900/50 border-slate-800",children:e.jsxs(T,{"code-path":"src/components/cloud/CloudBilling.tsx:252:17",className:"pt-4",children:[e.jsx("h3",{"code-path":"src/components/cloud/CloudBilling.tsx:253:19",className:"text-sm font-medium text-slate-200 mb-4",children:"本月厂商成本分布"}),(a.provider_dist||[]).length===0?e.jsx("p",{"code-path":"src/components/cloud/CloudBilling.tsx:255:21",className:"text-sm text-slate-500 py-8 text-center",children:"暂无数据"}):e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:257:21",className:"space-y-3",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:258:23",className:"flex h-8 rounded-lg overflow-hidden",children:a.provider_dist.map((s,u)=>e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:260:27",className:`${V[s.provider]||"bg-slate-600"} flex items-center justify-center text-xs text-white font-medium`,style:{width:`${s.percent}%`},title:`${v[s.provider]||s.provider}: ${g(s.cost)} (${s.percent.toFixed(1)}%)`,children:s.percent>8?v[s.provider]||s.provider:""},u))}),e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:270:23",className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:a.provider_dist.map((s,u)=>e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:272:27",className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:273:29",className:"flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:274:31",className:`w-3 h-3 rounded ${V[s.provider]||"bg-slate-600"}`}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:275:31",className:"text-slate-300",children:v[s.provider]||s.provider})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:277:29",className:"text-right",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:278:31",className:"text-slate-200 font-medium",children:g(s.cost)}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:279:31",className:"text-slate-500 ml-2",children:[s.percent.toFixed(1),"%"]})]})]},u))})]})]})})]}):null}),n==="records"&&e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:294:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:295:11",className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:296:13",children:[e.jsx(r,{"code-path":"src/components/cloud/CloudBilling.tsx:297:15",className:"text-xs text-slate-400 mb-1",children:"厂商"}),e.jsxs(R,{"code-path":"src/components/cloud/CloudBilling.tsx:298:15",value:z||"all",onValueChange:s=>te(s==="all"?"":s),children:[e.jsx(w,{"code-path":"src/components/cloud/CloudBilling.tsx:299:17",className:"w-32 h-9",children:e.jsx(S,{"code-path":"src/components/cloud/CloudBilling.tsx:299:53"})}),e.jsxs(k,{"code-path":"src/components/cloud/CloudBilling.tsx:300:17",children:[e.jsx(x,{"code-path":"src/components/cloud/CloudBilling.tsx:301:19",value:"all",children:"全部"}),Object.entries(v).map(([s,u])=>e.jsx(x,{"code-path":"src/components/cloud/CloudBilling.tsx:303:21",value:s,children:u},s))]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:308:13",children:[e.jsx(r,{"code-path":"src/components/cloud/CloudBilling.tsx:309:15",className:"text-xs text-slate-400 mb-1",children:"开始日期"}),e.jsx(j,{"code-path":"src/components/cloud/CloudBilling.tsx:310:15",type:"date",className:"w-40 h-9",value:E,onChange:s=>ce(s.target.value)})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:312:13",children:[e.jsx(r,{"code-path":"src/components/cloud/CloudBilling.tsx:313:15",className:"text-xs text-slate-400 mb-1",children:"结束日期"}),e.jsx(j,{"code-path":"src/components/cloud/CloudBilling.tsx:314:15",type:"date",className:"w-40 h-9",value:F,onChange:s=>ne(s.target.value)})]}),e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:316:13",variant:"outline",size:"sm",onClick:b,children:[e.jsx(q,{"code-path":"src/components/cloud/CloudBilling.tsx:317:15",className:"h-4 w-4 mr-1"}),"查询"]})]}),l?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:322:13",className:"flex items-center justify-center py-20 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudBilling.tsx:322:84",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]}):C.length===0?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:324:13",className:"py-20 text-center text-slate-500",children:[e.jsx(be,{"code-path":"src/components/cloud/CloudBilling.tsx:325:15",className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/cloud/CloudBilling.tsx:326:15",className:"text-sm",children:"暂无成本记录"})]}):e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:329:13",className:"overflow-x-auto rounded-lg border border-slate-800",children:e.jsxs("table",{"code-path":"src/components/cloud/CloudBilling.tsx:330:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/cloud/CloudBilling.tsx:331:17",className:"bg-slate-900/80 text-slate-400",children:e.jsxs("tr",{"code-path":"src/components/cloud/CloudBilling.tsx:332:19",children:[e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:333:21",className:"px-4 py-2.5 text-left font-medium",children:"日期"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:334:21",className:"px-4 py-2.5 text-left font-medium",children:"厂商"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:335:21",className:"px-4 py-2.5 text-left font-medium",children:"服务"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:336:21",className:"px-4 py-2.5 text-left font-medium",children:"区域"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:337:21",className:"px-4 py-2.5 text-left font-medium",children:"账号"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:338:21",className:"px-4 py-2.5 text-right font-medium",children:"费用"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:339:21",className:"px-4 py-2.5 text-left font-medium",children:"说明"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:340:21",className:"px-4 py-2.5 text-center font-medium",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/cloud/CloudBilling.tsx:343:17",children:C.map(s=>e.jsxs("tr",{"code-path":"src/components/cloud/CloudBilling.tsx:345:21",className:"border-t border-slate-800 hover:bg-slate-800/30",children:[e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:346:23",className:"px-4 py-2.5 text-slate-300",children:s.billing_date}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:347:23",className:"px-4 py-2.5",children:e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:348:25",className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:349:27",className:`w-2 h-2 rounded-full ${V[s.provider]||"bg-slate-500"}`}),v[s.provider]||s.provider]})}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:353:23",className:"px-4 py-2.5 text-slate-400",children:s.service||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:354:23",className:"px-4 py-2.5 text-slate-400",children:s.region||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:355:23",className:"px-4 py-2.5 text-slate-400",children:s.account_name||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:356:23",className:"px-4 py-2.5 text-right text-slate-200 font-medium",children:g(s.cost)}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:357:23",className:"px-4 py-2.5 text-slate-500 max-w-xs truncate",children:s.description||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:358:23",className:"px-4 py-2.5",children:e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:359:25",className:"flex items-center justify-center gap-1",children:[e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:360:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>xe(s),children:e.jsx(J,{"code-path":"src/components/cloud/CloudBilling.tsx:361:29",className:"h-3.5 w-3.5"})}),e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:363:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>je(s.id),children:e.jsx(K,{"code-path":"src/components/cloud/CloudBilling.tsx:364:29",className:"h-3.5 w-3.5"})})]})})]},s.id))})]})})]}),n==="alerts"&&e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:378:9",className:"space-y-3",children:ie?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:380:13",className:"flex items-center justify-center py-20 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudBilling.tsx:380:84",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]}):P.length===0?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:382:13",className:"py-20 text-center text-slate-500",children:[e.jsx(O,{"code-path":"src/components/cloud/CloudBilling.tsx:383:15",className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/cloud/CloudBilling.tsx:384:15",className:"text-sm",children:"暂无预警规则"})]}):e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:387:13",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:P.map(s=>e.jsx(H,{"code-path":"src/components/cloud/CloudBilling.tsx:389:17",className:"bg-slate-900/50 border-slate-800",children:e.jsxs(T,{"code-path":"src/components/cloud/CloudBilling.tsx:390:19",className:"pt-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:391:21",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:392:23",className:"flex items-center gap-2",children:[e.jsx(O,{"code-path":"src/components/cloud/CloudBilling.tsx:393:25",className:`h-4 w-4 ${s.enabled?"text-amber-400":"text-slate-600"}`}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:394:25",className:"text-sm font-medium text-slate-200",children:s.name})]}),e.jsx(oe,{"code-path":"src/components/cloud/CloudBilling.tsx:396:23",checked:s.enabled,onCheckedChange:()=>Ce(s.id)})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:398:21",className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:399:23",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:400:25",className:"text-slate-500",children:"厂商"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:401:25",className:"ml-2 text-slate-300",children:s.provider?v[s.provider]||s.provider:"全部"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:403:23",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:404:25",className:"text-slate-500",children:"指标"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:405:25",className:"ml-2 text-slate-300",children:s.metric==="daily"?"日成本":"月累计"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:407:23",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:408:25",className:"text-slate-500",children:"阈值"}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:409:25",className:"ml-2 text-amber-300 font-medium",children:[s.operator," ",g(s.threshold)]})]}),s.last_triggered&&e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:412:25",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:413:27",className:"text-slate-500",children:"最后触发"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:414:27",className:"ml-2 text-slate-400",children:new Date(s.last_triggered).toLocaleString("zh-CN")})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:418:21",className:"flex justify-end gap-1 mt-3",children:[e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:419:23",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>ge(s),children:e.jsx(J,{"code-path":"src/components/cloud/CloudBilling.tsx:420:25",className:"h-3.5 w-3.5"})}),e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:422:23",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>Be(s.id),children:e.jsx(K,{"code-path":"src/components/cloud/CloudBilling.tsx:423:25",className:"h-3.5 w-3.5"})})]})]})},s.id))})}),e.jsx(ye,{"code-path":"src/components/cloud/CloudBilling.tsx:434:7",open:de,onOpenChange:L,editingRecord:re,onSuccess:()=>{b(),N()}}),e.jsx(Re,{"code-path":"src/components/cloud/CloudBilling.tsx:440:7",open:pe,onOpenChange:$,editingRule:ue,onSuccess:()=>{D(),N()}})]})}export{Oe as CloudBilling}; +import{j as e,r as c}from"./vendor-codemirror-B1SGo4xl.js";import{D as X,a as Y,b as Z,c as ee,d as se,e as le,B as m,t as p,f as ve}from"./index-Bp-M7P_8.js";import{I as j}from"./input-Bnlm--la.js";import{L as r}from"./label-NkONM5Mp.js";import{C as H,a as T}from"./card-BHSBTtub.js";import{B as Ne}from"./badge-B00SZHvE.js";import{S as oe}from"./switch-CEwFnSNV.js";import{S as R,a as w,b as S,c as k,d as x}from"./select-DbhcBWnH.js";import{b as h}from"./billing-D8MiPwwH.js";import{S as fe}from"./stat-strip-CSMyyoYr.js";import{L as _,R as q,P as G,t as O,aB as be,d as J,T as K}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";const v={aliyun:"阿里云",tencent:"腾讯云",aws:"AWS",huawei:"华为云",azure:"Azure"},V={aliyun:"bg-orange-500",tencent:"bg-blue-500",aws:"bg-amber-500",huawei:"bg-red-500",azure:"bg-sky-500"};function g(d){return`¥${d.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})}`}function De({data:d}){if(d.length===0)return e.jsx("p",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:54:12",className:"text-sm text-slate-500 py-8 text-center",children:"暂无数据"});const n=Math.max(...d.map(a=>a.cost),1),t=d.slice(-30);return e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:60:5",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:61:7",className:"flex items-end gap-0.5 h-40",children:t.map((a,o)=>{const i=Math.max(a.cost/n*100,2);return e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:65:13",className:"flex-1 group relative",style:{height:"100%"},children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:70:15",className:"absolute bottom-0 w-full rounded-t-sm bg-gradient-to-t from-blue-600/60 to-blue-400/80 group-hover:from-blue-500 group-hover:to-blue-300 transition-colors",style:{height:`${i}%`}}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:74:15",className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block whitespace-nowrap text-xs bg-slate-800 text-slate-200 px-2 py-1 rounded border border-slate-700 z-10",children:[a.date,": ",g(a.cost)]})]},o)})}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:81:7",className:"flex justify-between mt-2 text-xs text-slate-500",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:82:9",children:t[0]?.date}),e.jsx("span",{"code-path":"src/components/cloud/CloudBillingHelpers.tsx:83:9",children:t[t.length-1]?.date})]})]})}const Q={provider:"aliyun",billing_date:"",cost:"",service:"",region:"",account_name:"",description:""};function ye({open:d,onOpenChange:n,editingRecord:t,onSuccess:a}){const[o,i]=c.useState(Q),[B,C]=c.useState(!1);c.useEffect(()=>{d&&i(t?{provider:t.provider,billing_date:t.billing_date,cost:t.cost,service:t.service||"",region:t.region||"",account_name:t.account_name||"",description:t.description||""}:{...Q,billing_date:new Date().toISOString().slice(0,10)})},[d,t]);const y=async()=>{if(!o.provider||!o.billing_date||!o.cost){p.error("请填写必填字段");return}C(!0);try{const l={...o,cost:parseFloat(o.cost)};t?(await h.remove(t.id),await h.create(l)):await h.create(l),n(!1),a(),p("保存成功")}catch(l){p.error("保存失败",{description:l.message})}finally{C(!1)}};return e.jsx(X,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:90:5",open:d,onOpenChange:n,children:e.jsxs(Y,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:91:7",className:"max-w-md",children:[e.jsxs(Z,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:92:9",children:[e.jsx(ee,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:93:11",children:t?"编辑成本记录":"记录成本"}),e.jsx(se,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:94:11",children:"记录一条每日云资源成本"})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:96:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:97:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:98:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:99:15",className:"text-sm text-slate-300",children:"厂商 *"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:100:15",value:o.provider,onValueChange:l=>i({...o,provider:l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:101:49"})}),e.jsx(k,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:102:17",children:Object.entries(v).map(([l,f])=>e.jsx(x,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:104:21",value:l,children:f},l))})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:109:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:110:15",className:"text-sm text-slate-300",children:"日期 *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:111:15",type:"date",className:"mt-1",value:o.billing_date,onChange:l=>i({...o,billing_date:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:114:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:115:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:116:15",className:"text-sm text-slate-300",children:"费用(元) *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:117:15",type:"number",step:"0.01",className:"mt-1",placeholder:"0.00",value:o.cost,onChange:l=>i({...o,cost:l.target.value})})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:119:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:120:15",className:"text-sm text-slate-300",children:"服务"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:121:15",className:"mt-1",placeholder:"ECS, RDS...",value:o.service,onChange:l=>i({...o,service:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:124:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:125:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:126:15",className:"text-sm text-slate-300",children:"区域"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:127:15",className:"mt-1",placeholder:"cn-hangzhou",value:o.region,onChange:l=>i({...o,region:l.target.value})})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:129:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:130:15",className:"text-sm text-slate-300",children:"账号名称"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:131:15",className:"mt-1",placeholder:"主账号",value:o.account_name,onChange:l=>i({...o,account_name:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRecordDialog.tsx:134:11",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:135:13",className:"text-sm text-slate-300",children:"备注"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:136:13",className:"mt-1",placeholder:"可选",value:o.description,onChange:l=>i({...o,description:l.target.value})})]})]}),e.jsxs(le,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:139:9",children:[e.jsx(m,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:140:11",variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsxs(m,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:141:11",onClick:y,disabled:B,children:[B&&e.jsx(_,{"code-path":"src/components/cloud/BillingRecordDialog.tsx:142:28",className:"h-4 w-4 mr-1 animate-spin"}),"保存"]})]})]})})}const U={name:"",provider:"",metric:"daily",threshold:"",operator:">",enabled:!0};function Re({open:d,onOpenChange:n,editingRule:t,onSuccess:a}){const[o,i]=c.useState(U),[B,C]=c.useState(!1);c.useEffect(()=>{d&&i(t?{name:t.name,provider:t.provider||"",metric:t.metric||"daily",threshold:t.threshold,operator:t.operator||">",enabled:t.enabled}:{...U})},[d,t]);const y=async()=>{if(!o.name||!o.threshold){p.error("请填写规则名称和阈值");return}C(!0);try{const l={...o,threshold:parseFloat(o.threshold)};t?await h.updateAlertRule(t.id,l):await h.createAlertRule(l),n(!1),a(),p("保存成功")}catch(l){p.error("保存失败",{description:l.message})}finally{C(!1)}};return e.jsx(X,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:81:5",open:d,onOpenChange:n,children:e.jsxs(Y,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:82:7",className:"max-w-md",children:[e.jsxs(Z,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:83:9",children:[e.jsx(ee,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:84:11",children:t?"编辑预警规则":"添加预警规则"}),e.jsx(se,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:85:11",children:"设置成本阈值,超标时自动预警"})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:87:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:88:11",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:89:13",className:"text-sm text-slate-300",children:"规则名称 *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:90:13",className:"mt-1",placeholder:"如:日成本超 500 元预警",value:o.name,onChange:l=>i({...o,name:l.target.value})})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:92:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:93:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:94:15",className:"text-sm text-slate-300",children:"厂商"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:95:15",value:o.provider||"all",onValueChange:l=>i({...o,provider:l==="all"?"":l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:96:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:96:49"})}),e.jsxs(k,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:97:17",children:[e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:98:19",value:"all",children:"全部厂商"}),Object.entries(v).map(([l,f])=>e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:100:21",value:l,children:f},l))]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:105:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:106:15",className:"text-sm text-slate-300",children:"指标"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:107:15",value:o.metric,onValueChange:l=>i({...o,metric:l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:108:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:108:49"})}),e.jsxs(k,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:109:17",children:[e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:110:19",value:"daily",children:"日成本"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:111:19",value:"monthly",children:"月累计"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:116:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:117:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:118:15",className:"text-sm text-slate-300",children:"比较"}),e.jsxs(R,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:119:15",value:o.operator,onValueChange:l=>i({...o,operator:l}),children:[e.jsx(w,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:120:17",className:"mt-1",children:e.jsx(S,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:120:49"})}),e.jsxs(k,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:121:17",children:[e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:122:19",value:">",children:"大于 >"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:123:19",value:">=",children:"大于等于 ≥"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:124:19",value:"<",children:"小于 <"}),e.jsx(x,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:125:19",value:"<=",children:"小于等于 ≤"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:129:13",children:[e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:130:15",className:"text-sm text-slate-300",children:"阈值(元) *"}),e.jsx(j,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:131:15",type:"number",step:"0.01",className:"mt-1",placeholder:"500.00",value:o.threshold,onChange:l=>i({...o,threshold:l.target.value})})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/BillingRuleDialog.tsx:134:11",className:"flex items-center gap-2",children:[e.jsx(oe,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:135:13",checked:o.enabled,onCheckedChange:l=>i({...o,enabled:l})}),e.jsx(r,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:136:13",className:"text-sm text-slate-300",children:"启用"})]})]}),e.jsxs(le,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:139:9",children:[e.jsx(m,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:140:11",variant:"outline",onClick:()=>n(!1),children:"取消"}),e.jsxs(m,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:141:11",onClick:y,disabled:B,children:[B&&e.jsx(_,{"code-path":"src/components/cloud/BillingRuleDialog.tsx:142:28",className:"h-4 w-4 mr-1 animate-spin"}),"保存"]})]})]})})}function Oe(){const d=ve(),[n,t]=c.useState("overview"),[a,o]=c.useState(null),[i,B]=c.useState(!0),[C,y]=c.useState([]),[l,f]=c.useState(!0),[z,te]=c.useState(""),[E,ce]=c.useState(""),[F,ne]=c.useState(""),[P,ae]=c.useState([]),[ie,I]=c.useState(!0),[de,L]=c.useState(!1),[re,M]=c.useState(null),[pe,$]=c.useState(!1),[ue,W]=c.useState(null),N=c.useCallback(async()=>{B(!0);try{const s=await h.getStats();o(s)}catch(s){p.error("加载统计失败",{description:s.message})}finally{B(!1)}},[]),b=c.useCallback(async()=>{f(!0);try{const s={};z&&(s.provider=z),E&&(s.start_date=E),F&&(s.end_date=F);const u=await h.list(s);y(u.list||[])}catch(s){p.error("加载账单失败",{description:s.message})}finally{f(!1)}},[z,E,F]),D=c.useCallback(async()=>{I(!0);try{const s=await h.listAlertRules();ae(s.list||[])}catch(s){p.error("加载预警规则失败",{description:s.message})}finally{I(!1)}},[]);c.useEffect(()=>{N()},[N]),c.useEffect(()=>{n==="records"&&b()},[n,b]),c.useEffect(()=>{n==="alerts"&&D()},[n,D]);const me=()=>{M(null),L(!0)},xe=s=>{M(s),L(!0)},he=()=>{W(null),$(!0)},ge=s=>{W(s),$(!0)},je=async s=>{if(await d({title:"删除账单记录",description:"确定删除这条成本记录?",variant:"destructive"}))try{await h.remove(s),b(),N(),p("删除成功")}catch(A){p.error("删除失败",{description:A.message})}},Be=async s=>{if(await d({title:"删除预警规则",description:"确定删除此预警规则?",variant:"destructive"}))try{await h.deleteAlertRule(s),D(),p("删除成功")}catch(A){p.error("删除失败",{description:A.message})}},Ce=async s=>{try{await h.toggleAlertRule(s),D(),N()}catch(u){p.error("操作失败",{description:u.message})}};return e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:163:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:164:7",className:"flex items-center justify-between",children:[e.jsx("h2",{"code-path":"src/components/cloud/CloudBilling.tsx:165:9",className:"text-lg font-semibold text-slate-100",children:"云账单管理"}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:166:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:167:11",variant:"outline",size:"sm",onClick:()=>{N(),n==="records"&&b(),n==="alerts"&&D()},children:[e.jsx(q,{"code-path":"src/components/cloud/CloudBilling.tsx:168:13",className:"h-4 w-4 mr-1"}),"刷新"]}),n==="records"&&e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:171:13",size:"sm",onClick:me,children:[e.jsx(G,{"code-path":"src/components/cloud/CloudBilling.tsx:172:15",className:"h-4 w-4 mr-1"}),"记录成本"]}),n==="alerts"&&e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:176:13",size:"sm",onClick:he,children:[e.jsx(G,{"code-path":"src/components/cloud/CloudBilling.tsx:177:15",className:"h-4 w-4 mr-1"}),"添加规则"]})]})]}),e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:183:7",className:"flex gap-1 border-b border-slate-800",children:[{key:"overview",label:"概览统计"},{key:"records",label:"成本记录"},{key:"alerts",label:"预警规则"}].map(s=>e.jsx("button",{"code-path":"src/components/cloud/CloudBilling.tsx:189:11",onClick:()=>t(s.key),className:`px-4 py-2 text-sm font-medium transition-colors border-b-2 -mb-px ${n===s.key?"text-blue-400 border-blue-400":"text-slate-400 border-transparent hover:text-slate-200"}`,children:s.label},s.key))}),n==="overview"&&e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:204:9",className:"space-y-4",children:i?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:206:13",className:"flex items-center justify-center py-20 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudBilling.tsx:206:84",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]}):a?e.jsxs(e.Fragment,{children:[e.jsx(fe,{"code-path":"src/components/cloud/CloudBilling.tsx:209:15",items:[{label:"今日",value:g(a.today_cost||0),color:"blue"},{label:"本月",value:g(a.month_cost||0),color:"amber"},{label:"年度",value:g(a.year_cost||0),color:"purple"},{label:"预警",value:`${a.alerts?.length||0} 条`,color:a.alerts?.length>0?"red":"muted"}]}),a.alerts?.length>0&&e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:219:17",className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:220:19",className:"flex items-center gap-2 mb-3",children:[e.jsx(O,{"code-path":"src/components/cloud/CloudBilling.tsx:221:21",className:"h-4 w-4 text-amber-400"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:222:21",className:"text-sm font-medium text-amber-300",children:"成本预警"})]}),e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:224:19",className:"space-y-2",children:a.alerts.map((s,u)=>e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:226:23",className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:227:25",className:"flex items-center gap-2",children:[e.jsx(Ne,{"code-path":"src/components/cloud/CloudBilling.tsx:228:27",variant:"outline",className:"border-amber-500/50 text-amber-300",children:s.rule_name}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:229:27",className:"text-slate-400",children:[s.provider," · ",s.metric==="daily"?"日":"月","成本"]})]}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:233:25",className:"text-slate-300",children:["当前 ",e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:234:30",className:"text-amber-300 font-medium",children:g(s.current)})," ",s.operator," ","阈值 ",e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:236:30",className:"text-red-400 font-medium",children:g(s.threshold)})]})]},u))})]}),e.jsx(H,{"code-path":"src/components/cloud/CloudBilling.tsx:244:15",className:"bg-slate-900/50 border-slate-800",children:e.jsxs(T,{"code-path":"src/components/cloud/CloudBilling.tsx:245:17",className:"pt-4",children:[e.jsx("h3",{"code-path":"src/components/cloud/CloudBilling.tsx:246:19",className:"text-sm font-medium text-slate-200 mb-4",children:"近 30 天成本趋势"}),e.jsx(De,{"code-path":"src/components/cloud/CloudBilling.tsx:247:19",data:a.month_trend||[]})]})}),e.jsx(H,{"code-path":"src/components/cloud/CloudBilling.tsx:251:15",className:"bg-slate-900/50 border-slate-800",children:e.jsxs(T,{"code-path":"src/components/cloud/CloudBilling.tsx:252:17",className:"pt-4",children:[e.jsx("h3",{"code-path":"src/components/cloud/CloudBilling.tsx:253:19",className:"text-sm font-medium text-slate-200 mb-4",children:"本月厂商成本分布"}),(a.provider_dist||[]).length===0?e.jsx("p",{"code-path":"src/components/cloud/CloudBilling.tsx:255:21",className:"text-sm text-slate-500 py-8 text-center",children:"暂无数据"}):e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:257:21",className:"space-y-3",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:258:23",className:"flex h-8 rounded-lg overflow-hidden",children:a.provider_dist.map((s,u)=>e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:260:27",className:`${V[s.provider]||"bg-slate-600"} flex items-center justify-center text-xs text-white font-medium`,style:{width:`${s.percent}%`},title:`${v[s.provider]||s.provider}: ${g(s.cost)} (${s.percent.toFixed(1)}%)`,children:s.percent>8?v[s.provider]||s.provider:""},u))}),e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:270:23",className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:a.provider_dist.map((s,u)=>e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:272:27",className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:273:29",className:"flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:274:31",className:`w-3 h-3 rounded ${V[s.provider]||"bg-slate-600"}`}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:275:31",className:"text-slate-300",children:v[s.provider]||s.provider})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:277:29",className:"text-right",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:278:31",className:"text-slate-200 font-medium",children:g(s.cost)}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:279:31",className:"text-slate-500 ml-2",children:[s.percent.toFixed(1),"%"]})]})]},u))})]})]})})]}):null}),n==="records"&&e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:294:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:295:11",className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:296:13",children:[e.jsx(r,{"code-path":"src/components/cloud/CloudBilling.tsx:297:15",className:"text-xs text-slate-400 mb-1",children:"厂商"}),e.jsxs(R,{"code-path":"src/components/cloud/CloudBilling.tsx:298:15",value:z||"all",onValueChange:s=>te(s==="all"?"":s),children:[e.jsx(w,{"code-path":"src/components/cloud/CloudBilling.tsx:299:17",className:"w-32 h-9",children:e.jsx(S,{"code-path":"src/components/cloud/CloudBilling.tsx:299:53"})}),e.jsxs(k,{"code-path":"src/components/cloud/CloudBilling.tsx:300:17",children:[e.jsx(x,{"code-path":"src/components/cloud/CloudBilling.tsx:301:19",value:"all",children:"全部"}),Object.entries(v).map(([s,u])=>e.jsx(x,{"code-path":"src/components/cloud/CloudBilling.tsx:303:21",value:s,children:u},s))]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:308:13",children:[e.jsx(r,{"code-path":"src/components/cloud/CloudBilling.tsx:309:15",className:"text-xs text-slate-400 mb-1",children:"开始日期"}),e.jsx(j,{"code-path":"src/components/cloud/CloudBilling.tsx:310:15",type:"date",className:"w-40 h-9",value:E,onChange:s=>ce(s.target.value)})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:312:13",children:[e.jsx(r,{"code-path":"src/components/cloud/CloudBilling.tsx:313:15",className:"text-xs text-slate-400 mb-1",children:"结束日期"}),e.jsx(j,{"code-path":"src/components/cloud/CloudBilling.tsx:314:15",type:"date",className:"w-40 h-9",value:F,onChange:s=>ne(s.target.value)})]}),e.jsxs(m,{"code-path":"src/components/cloud/CloudBilling.tsx:316:13",variant:"outline",size:"sm",onClick:b,children:[e.jsx(q,{"code-path":"src/components/cloud/CloudBilling.tsx:317:15",className:"h-4 w-4 mr-1"}),"查询"]})]}),l?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:322:13",className:"flex items-center justify-center py-20 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudBilling.tsx:322:84",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]}):C.length===0?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:324:13",className:"py-20 text-center text-slate-500",children:[e.jsx(be,{"code-path":"src/components/cloud/CloudBilling.tsx:325:15",className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/cloud/CloudBilling.tsx:326:15",className:"text-sm",children:"暂无成本记录"})]}):e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:329:13",className:"overflow-x-auto rounded-lg border border-slate-800",children:e.jsxs("table",{"code-path":"src/components/cloud/CloudBilling.tsx:330:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/cloud/CloudBilling.tsx:331:17",className:"bg-slate-900/80 text-slate-400",children:e.jsxs("tr",{"code-path":"src/components/cloud/CloudBilling.tsx:332:19",children:[e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:333:21",className:"px-4 py-2.5 text-left font-medium",children:"日期"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:334:21",className:"px-4 py-2.5 text-left font-medium",children:"厂商"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:335:21",className:"px-4 py-2.5 text-left font-medium",children:"服务"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:336:21",className:"px-4 py-2.5 text-left font-medium",children:"区域"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:337:21",className:"px-4 py-2.5 text-left font-medium",children:"账号"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:338:21",className:"px-4 py-2.5 text-right font-medium",children:"费用"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:339:21",className:"px-4 py-2.5 text-left font-medium",children:"说明"}),e.jsx("th",{"code-path":"src/components/cloud/CloudBilling.tsx:340:21",className:"px-4 py-2.5 text-center font-medium",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/cloud/CloudBilling.tsx:343:17",children:C.map(s=>e.jsxs("tr",{"code-path":"src/components/cloud/CloudBilling.tsx:345:21",className:"border-t border-slate-800 hover:bg-slate-800/30",children:[e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:346:23",className:"px-4 py-2.5 text-slate-300",children:s.billing_date}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:347:23",className:"px-4 py-2.5",children:e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:348:25",className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:349:27",className:`w-2 h-2 rounded-full ${V[s.provider]||"bg-slate-500"}`}),v[s.provider]||s.provider]})}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:353:23",className:"px-4 py-2.5 text-slate-400",children:s.service||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:354:23",className:"px-4 py-2.5 text-slate-400",children:s.region||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:355:23",className:"px-4 py-2.5 text-slate-400",children:s.account_name||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:356:23",className:"px-4 py-2.5 text-right text-slate-200 font-medium",children:g(s.cost)}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:357:23",className:"px-4 py-2.5 text-slate-500 max-w-xs truncate",children:s.description||"-"}),e.jsx("td",{"code-path":"src/components/cloud/CloudBilling.tsx:358:23",className:"px-4 py-2.5",children:e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:359:25",className:"flex items-center justify-center gap-1",children:[e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:360:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>xe(s),children:e.jsx(J,{"code-path":"src/components/cloud/CloudBilling.tsx:361:29",className:"h-3.5 w-3.5"})}),e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:363:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>je(s.id),children:e.jsx(K,{"code-path":"src/components/cloud/CloudBilling.tsx:364:29",className:"h-3.5 w-3.5"})})]})})]},s.id))})]})})]}),n==="alerts"&&e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:378:9",className:"space-y-3",children:ie?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:380:13",className:"flex items-center justify-center py-20 text-slate-500",children:[e.jsx(_,{"code-path":"src/components/cloud/CloudBilling.tsx:380:84",className:"h-6 w-6 animate-spin mr-2"}),"加载中..."]}):P.length===0?e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:382:13",className:"py-20 text-center text-slate-500",children:[e.jsx(O,{"code-path":"src/components/cloud/CloudBilling.tsx:383:15",className:"h-12 w-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/cloud/CloudBilling.tsx:384:15",className:"text-sm",children:"暂无预警规则"})]}):e.jsx("div",{"code-path":"src/components/cloud/CloudBilling.tsx:387:13",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:P.map(s=>e.jsx(H,{"code-path":"src/components/cloud/CloudBilling.tsx:389:17",className:"bg-slate-900/50 border-slate-800",children:e.jsxs(T,{"code-path":"src/components/cloud/CloudBilling.tsx:390:19",className:"pt-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:391:21",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:392:23",className:"flex items-center gap-2",children:[e.jsx(O,{"code-path":"src/components/cloud/CloudBilling.tsx:393:25",className:`h-4 w-4 ${s.enabled?"text-amber-400":"text-slate-600"}`}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:394:25",className:"text-sm font-medium text-slate-200",children:s.name})]}),e.jsx(oe,{"code-path":"src/components/cloud/CloudBilling.tsx:396:23",checked:s.enabled,onCheckedChange:()=>Ce(s.id)})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:398:21",className:"grid grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:399:23",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:400:25",className:"text-slate-500",children:"厂商"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:401:25",className:"ml-2 text-slate-300",children:s.provider?v[s.provider]||s.provider:"全部"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:403:23",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:404:25",className:"text-slate-500",children:"指标"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:405:25",className:"ml-2 text-slate-300",children:s.metric==="daily"?"日成本":"月累计"})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:407:23",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:408:25",className:"text-slate-500",children:"阈值"}),e.jsxs("span",{"code-path":"src/components/cloud/CloudBilling.tsx:409:25",className:"ml-2 text-amber-300 font-medium",children:[s.operator," ",g(s.threshold)]})]}),s.last_triggered&&e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:412:25",children:[e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:413:27",className:"text-slate-500",children:"最后触发"}),e.jsx("span",{"code-path":"src/components/cloud/CloudBilling.tsx:414:27",className:"ml-2 text-slate-400",children:new Date(s.last_triggered).toLocaleString("zh-CN")})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/CloudBilling.tsx:418:21",className:"flex justify-end gap-1 mt-3",children:[e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:419:23",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>ge(s),children:e.jsx(J,{"code-path":"src/components/cloud/CloudBilling.tsx:420:25",className:"h-3.5 w-3.5"})}),e.jsx(m,{"code-path":"src/components/cloud/CloudBilling.tsx:422:23",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>Be(s.id),children:e.jsx(K,{"code-path":"src/components/cloud/CloudBilling.tsx:423:25",className:"h-3.5 w-3.5"})})]})]})},s.id))})}),e.jsx(ye,{"code-path":"src/components/cloud/CloudBilling.tsx:434:7",open:de,onOpenChange:L,editingRecord:re,onSuccess:()=>{b(),N()}}),e.jsx(Re,{"code-path":"src/components/cloud/CloudBilling.tsx:440:7",open:pe,onOpenChange:$,editingRule:ue,onSuccess:()=>{D(),N()}})]})}export{Oe as CloudBilling}; diff --git a/backend/static/assets/ClusterOverviewPage-CBfjCIXY.js b/backend/static/assets/ClusterOverviewPage-Bd5kYrZX.js similarity index 96% rename from backend/static/assets/ClusterOverviewPage-CBfjCIXY.js rename to backend/static/assets/ClusterOverviewPage-Bd5kYrZX.js index bf36533..17901eb 100644 --- a/backend/static/assets/ClusterOverviewPage-CBfjCIXY.js +++ b/backend/static/assets/ClusterOverviewPage-Bd5kYrZX.js @@ -1 +1 @@ -import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as i,a as u}from"./card-B-RtdR4H.js";import{g as F,i as K,L as w,B as G}from"./index-LZWfu62c.js";import{B as A}from"./badge-B0F5ZNtn.js";import{T as H,a as z,b as x,c as n,d as D,e as a}from"./table-BPFYQwjr.js";import{k as C}from"./index-Z0O8nAcG.js";import{u as q}from"./use-toast-CkA38LVP.js";import{f as k,L as R,R as J,g as j,B as M,h as T,i as Q,A as V,j as W,k as X}from"./vendor-icons-Aso0-eeY.js";const Y={"kube-system":T,"kube-public":W,"kube-node-lease":V,default:Q};function oe(){const{clusterCode:r}=F(),B=K(),{toast:E}=q(),[,P]=c.useState([]),[m,O]=c.useState([]),[N,f]=c.useState([]),[d,I]=c.useState(null),[p,y]=c.useState(!1),_=c.useCallback(async()=>{try{const t=(await C.getClusters())?.list||[];P(t);const o=t.find(l=>(l.code||String(l.id))===r);I(o||null),!o&&t.length>0&&r&&E({title:"集群未找到",description:`找不到集群 ${r}`,variant:"destructive"})}catch{P([])}},[r]),v=c.useCallback(async()=>{if(r){y(!0);try{const[s,t]=await Promise.all([C.getNodes(r).catch(()=>[]),C.getNamespaces(r).catch(()=>[])]);O(Array.isArray(s)?s:s?.list||s?.data||[]);const o=Array.isArray(t)?t:t?.list||t?.data||[];f(o)}catch{O([]),f([])}finally{y(!1)}}},[r]);c.useEffect(()=>{_()},[_]),c.useEffect(()=>{v()},[v]);const L=s=>s?.role==="master"||s?.role==="control-plane"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30";return e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:83:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:84:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:85:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:86:9",className:"text-slate-300",children:r})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:90:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:91:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:92:11",className:"text-2xl font-bold text-slate-100",children:r}),e.jsxs("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:93:11",className:"text-sm text-slate-500 mt-1",children:["集群概览",d?.version?` — Kubernetes ${d.version}`:""]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:98:9",className:"flex items-center gap-2",children:e.jsx(G,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:99:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:v,disabled:p,children:p?e.jsx(R,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:24",className:"h-4 w-4 animate-spin"}):e.jsx(J,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:71",className:"h-4 w-4"})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:107:7",className:"grid grid-cols-3 md:grid-cols-3 gap-4",children:[e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:108:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:109:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:110:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:20",className:"text-sm text-slate-500",children:"节点"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:64",className:"text-2xl font-bold text-blue-400",children:m.length})]}),e.jsx(j,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:112:15",className:"h-8 w-8 opacity-30 text-blue-400"})]})})}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:116:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:117:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:118:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:20",className:"text-sm text-slate-500",children:"命名空间"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:66",className:"text-2xl font-bold text-emerald-400",children:N.length})]}),e.jsx(M,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:120:15",className:"h-8 w-8 opacity-30 text-emerald-400"})]})})}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:124:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:125:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:126:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:127:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:127:20",className:"text-sm text-slate-500",children:"版本"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:127:64",className:"text-lg font-bold text-slate-300",children:d?.version||"-"})]}),e.jsx(T,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:128:15",className:"h-8 w-8 opacity-30 text-slate-400"})]})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:135:7",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:136:9",className:"text-lg font-semibold text-slate-100 mb-3 flex items-center gap-2",children:[e.jsx(j,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:137:11",className:"h-4 w-4 text-blue-400"}),"节点列表"]}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:139:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:140:11",className:"p-0",children:e.jsxs(H,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:141:13",children:[e.jsx(z,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:142:15",children:e.jsxs(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:143:17",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:144:19",className:"text-slate-400",children:"名称"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:145:19",className:"text-slate-400",children:"角色"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:146:19",className:"text-slate-400",children:"状态"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:147:19",className:"text-slate-400",children:"IP"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:148:19",className:"text-slate-400",children:"OS"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:149:19",className:"text-slate-400",children:"Kubelet"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:150:19",className:"text-slate-400",children:"CPU"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:151:19",className:"text-slate-400",children:"内存"})]})}),e.jsx(D,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:154:15",children:p?e.jsx(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:156:19",children:e.jsxs(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:156:29",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(R,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:156:97",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):m.length===0?e.jsx(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:158:19",children:e.jsxs(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:158:29",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(j,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:158:97",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"暂无节点"]})}):m.map(s=>{const t=s.cpu||0,o=s.cpu_usage_m?parseFloat(s.cpu_usage_m.replace("m","")):0,l=t>0?o/1e3/t*100:0,h=s.memory_mb||0,b=s.mem_usage_mi?parseFloat(s.mem_usage_mi.replace("Mi","").replace("Ki","").replace("Gi","")):0,U=s.mem_usage_mi?.includes("Ki")?b/1024:s.mem_usage_mi?.includes("Gi")?b*1024:b,g=h>0?U/h*100:0,S=$=>$>80?"bg-red-500":$>60?"bg-yellow-500":"bg-emerald-500";return e.jsxs(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:171:21",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>B(`/kubernetes/${r}/nodes/${s.name}`),children:[e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:173:23",className:"font-medium text-blue-400 hover:text-blue-300",children:s.name}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:174:23",children:e.jsx(A,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:174:34",className:L(s),children:s.role||"worker"})}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:175:23",children:e.jsx(A,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:175:34",className:s.status==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:s.status||"Unknown"})}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:176:23",className:"text-sm text-slate-400",children:s.ip||"-"}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:177:23",className:"text-sm text-slate-400 max-w-[200px] truncate",children:s.os||"-"}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:178:23",className:"text-sm text-slate-400",children:s.kubelet_version||"-"}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:179:23",className:"text-xs",children:s.cpu_usage_m?e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:181:27",className:"flex items-center gap-1.5 min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:182:29",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:183:31",className:`h-full rounded-full ${S(l)}`,style:{width:`${Math.min(l,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:185:29",className:"text-slate-400",children:[l.toFixed(0),"%"]})]}):e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:188:27",className:"text-slate-500",children:[t," 核"]})}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:191:23",className:"text-xs",children:s.mem_usage_mi?e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:193:27",className:"flex items-center gap-1.5 min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:194:29",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:195:31",className:`h-full rounded-full ${S(g)}`,style:{width:`${Math.min(g,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:197:29",className:"text-slate-400",children:[g.toFixed(0),"%"]})]}):e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:200:27",className:"text-slate-500",children:[h,"Mi"]})})]},s.name)})})]})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:214:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:215:9",className:"flex items-center justify-between mb-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:216:11",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(M,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:217:13",className:"h-4 w-4 text-emerald-400"}),"命名空间"]}),e.jsxs(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:219:11",to:`/kubernetes/${r}/namespaces`,className:"text-sm text-blue-400 hover:text-blue-300 transition-colors flex items-center gap-1",children:["管理全部 ",e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:220:18",className:"h-3 w-3"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:223:9",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:N.map(s=>{const t=Y[s]||X;return e.jsx(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:227:15",to:`/kubernetes/${r}/namespace/${s}`,className:"bg-slate-900 border border-slate-800 rounded-lg p-4 hover:border-slate-600 hover:bg-slate-800/50 transition-all group",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:231:17",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:232:19",className:"flex items-center gap-2",children:[e.jsx(t,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:233:21",className:"h-5 w-5 text-slate-500 group-hover:text-slate-300 transition-colors"}),e.jsx("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:234:21",className:"text-sm font-medium text-slate-300 group-hover:text-slate-100 transition-colors",children:s})]}),e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:236:19",className:"h-4 w-4 text-slate-600 group-hover:text-slate-400 transition-colors"})]})},s)})})]})]})}export{oe as default}; +import{r as c,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as i,a as u}from"./card-BHSBTtub.js";import{g as F,i as K,L as w,B as G}from"./index-Bp-M7P_8.js";import{B as A}from"./badge-B00SZHvE.js";import{T as H,a as z,b as x,c as n,d as D,e as a}from"./table-u8V9iTZf.js";import{k as C}from"./index-BkulU9RM.js";import{u as q}from"./use-toast-DNZLibQY.js";import{f as k,L as R,R as J,g as j,B as M,h as T,i as Q,A as V,j as W,k as X}from"./vendor-icons-BWk-DH7F.js";const Y={"kube-system":T,"kube-public":W,"kube-node-lease":V,default:Q};function oe(){const{clusterCode:r}=F(),B=K(),{toast:E}=q(),[,P]=c.useState([]),[m,O]=c.useState([]),[N,f]=c.useState([]),[d,I]=c.useState(null),[p,y]=c.useState(!1),_=c.useCallback(async()=>{try{const t=(await C.getClusters())?.list||[];P(t);const o=t.find(l=>(l.code||String(l.id))===r);I(o||null),!o&&t.length>0&&r&&E({title:"集群未找到",description:`找不到集群 ${r}`,variant:"destructive"})}catch{P([])}},[r]),v=c.useCallback(async()=>{if(r){y(!0);try{const[s,t]=await Promise.all([C.getNodes(r).catch(()=>[]),C.getNamespaces(r).catch(()=>[])]);O(Array.isArray(s)?s:s?.list||s?.data||[]);const o=Array.isArray(t)?t:t?.list||t?.data||[];f(o)}catch{O([]),f([])}finally{y(!1)}}},[r]);c.useEffect(()=>{_()},[_]),c.useEffect(()=>{v()},[v]);const L=s=>s?.role==="master"||s?.role==="control-plane"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30";return e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:83:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:84:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:85:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:86:9",className:"text-slate-300",children:r})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:90:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:91:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:92:11",className:"text-2xl font-bold text-slate-100",children:r}),e.jsxs("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:93:11",className:"text-sm text-slate-500 mt-1",children:["集群概览",d?.version?` — Kubernetes ${d.version}`:""]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:98:9",className:"flex items-center gap-2",children:e.jsx(G,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:99:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:v,disabled:p,children:p?e.jsx(R,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:24",className:"h-4 w-4 animate-spin"}):e.jsx(J,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:101:71",className:"h-4 w-4"})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:107:7",className:"grid grid-cols-3 md:grid-cols-3 gap-4",children:[e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:108:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:109:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:110:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:20",className:"text-sm text-slate-500",children:"节点"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:111:64",className:"text-2xl font-bold text-blue-400",children:m.length})]}),e.jsx(j,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:112:15",className:"h-8 w-8 opacity-30 text-blue-400"})]})})}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:116:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:117:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:118:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:20",className:"text-sm text-slate-500",children:"命名空间"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:119:66",className:"text-2xl font-bold text-emerald-400",children:N.length})]}),e.jsx(M,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:120:15",className:"h-8 w-8 opacity-30 text-emerald-400"})]})})}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:124:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:125:11",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:126:13",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:127:15",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:127:20",className:"text-sm text-slate-500",children:"版本"}),e.jsx("p",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:127:64",className:"text-lg font-bold text-slate-300",children:d?.version||"-"})]}),e.jsx(T,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:128:15",className:"h-8 w-8 opacity-30 text-slate-400"})]})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:135:7",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:136:9",className:"text-lg font-semibold text-slate-100 mb-3 flex items-center gap-2",children:[e.jsx(j,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:137:11",className:"h-4 w-4 text-blue-400"}),"节点列表"]}),e.jsx(i,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:139:9",className:"bg-slate-900 border-slate-800",children:e.jsx(u,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:140:11",className:"p-0",children:e.jsxs(H,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:141:13",children:[e.jsx(z,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:142:15",children:e.jsxs(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:143:17",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:144:19",className:"text-slate-400",children:"名称"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:145:19",className:"text-slate-400",children:"角色"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:146:19",className:"text-slate-400",children:"状态"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:147:19",className:"text-slate-400",children:"IP"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:148:19",className:"text-slate-400",children:"OS"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:149:19",className:"text-slate-400",children:"Kubelet"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:150:19",className:"text-slate-400",children:"CPU"}),e.jsx(n,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:151:19",className:"text-slate-400",children:"内存"})]})}),e.jsx(D,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:154:15",children:p?e.jsx(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:156:19",children:e.jsxs(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:156:29",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(R,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:156:97",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):m.length===0?e.jsx(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:158:19",children:e.jsxs(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:158:29",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(j,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:158:97",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"暂无节点"]})}):m.map(s=>{const t=s.cpu||0,o=s.cpu_usage_m?parseFloat(s.cpu_usage_m.replace("m","")):0,l=t>0?o/1e3/t*100:0,h=s.memory_mb||0,b=s.mem_usage_mi?parseFloat(s.mem_usage_mi.replace("Mi","").replace("Ki","").replace("Gi","")):0,U=s.mem_usage_mi?.includes("Ki")?b/1024:s.mem_usage_mi?.includes("Gi")?b*1024:b,g=h>0?U/h*100:0,S=$=>$>80?"bg-red-500":$>60?"bg-yellow-500":"bg-emerald-500";return e.jsxs(x,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:171:21",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>B(`/kubernetes/${r}/nodes/${s.name}`),children:[e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:173:23",className:"font-medium text-blue-400 hover:text-blue-300",children:s.name}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:174:23",children:e.jsx(A,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:174:34",className:L(s),children:s.role||"worker"})}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:175:23",children:e.jsx(A,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:175:34",className:s.status==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:s.status||"Unknown"})}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:176:23",className:"text-sm text-slate-400",children:s.ip||"-"}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:177:23",className:"text-sm text-slate-400 max-w-[200px] truncate",children:s.os||"-"}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:178:23",className:"text-sm text-slate-400",children:s.kubelet_version||"-"}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:179:23",className:"text-xs",children:s.cpu_usage_m?e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:181:27",className:"flex items-center gap-1.5 min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:182:29",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:183:31",className:`h-full rounded-full ${S(l)}`,style:{width:`${Math.min(l,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:185:29",className:"text-slate-400",children:[l.toFixed(0),"%"]})]}):e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:188:27",className:"text-slate-500",children:[t," 核"]})}),e.jsx(a,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:191:23",className:"text-xs",children:s.mem_usage_mi?e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:193:27",className:"flex items-center gap-1.5 min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:194:29",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:195:31",className:`h-full rounded-full ${S(g)}`,style:{width:`${Math.min(g,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:197:29",className:"text-slate-400",children:[g.toFixed(0),"%"]})]}):e.jsxs("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:200:27",className:"text-slate-500",children:[h,"Mi"]})})]},s.name)})})]})})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:214:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:215:9",className:"flex items-center justify-between mb-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:216:11",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(M,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:217:13",className:"h-4 w-4 text-emerald-400"}),"命名空间"]}),e.jsxs(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:219:11",to:`/kubernetes/${r}/namespaces`,className:"text-sm text-blue-400 hover:text-blue-300 transition-colors flex items-center gap-1",children:["管理全部 ",e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:220:18",className:"h-3 w-3"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:223:9",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:N.map(s=>{const t=Y[s]||X;return e.jsx(w,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:227:15",to:`/kubernetes/${r}/namespace/${s}`,className:"bg-slate-900 border border-slate-800 rounded-lg p-4 hover:border-slate-600 hover:bg-slate-800/50 transition-all group",children:e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:231:17",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:232:19",className:"flex items-center gap-2",children:[e.jsx(t,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:233:21",className:"h-5 w-5 text-slate-500 group-hover:text-slate-300 transition-colors"}),e.jsx("span",{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:234:21",className:"text-sm font-medium text-slate-300 group-hover:text-slate-100 transition-colors",children:s})]}),e.jsx(k,{"code-path":"src/components/kubernetes/ClusterOverviewPage.tsx:236:19",className:"h-4 w-4 text-slate-600 group-hover:text-slate-400 transition-colors"})]})},s)})})]})]})}export{oe as default}; diff --git a/backend/static/assets/CredentialManager-VPjoE2mR.js b/backend/static/assets/CredentialManager-DwnNccLC.js similarity index 98% rename from backend/static/assets/CredentialManager-VPjoE2mR.js rename to backend/static/assets/CredentialManager-DwnNccLC.js index 3cfd195..29dd1ac 100644 --- a/backend/static/assets/CredentialManager-VPjoE2mR.js +++ b/backend/static/assets/CredentialManager-DwnNccLC.js @@ -1 +1 @@ -import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{G as na,D as ze,a as Be,b as Ge,c as Ue,e as Qe,B as N,t as S,d as ca,f as da}from"./index-LZWfu62c.js";import{I as p}from"./input-BdDauX3U.js";import{B as w}from"./badge-B0F5ZNtn.js";import{S as Me,a as Ke,b as Ae,c as Pe,d as M}from"./select-4xU_9B3_.js";import{u as $e,q as Ye,b as la}from"./unwrap-BmWy-KM2.js";import{u as V}from"./useMutation-Bp3lz5hm.js";import{c as P}from"./credential-CwQY-4Ba.js";import{F as ia,G as pa,D as ma,i as xa,j as Ze,k as ga,h as ha,ag as z,C as We,a as Xe,l as ya,aF as Re,aN as va,aO as Je,x as ea,R as Ca,P as Ve,S as ua,a4 as Da,b as ba,d as ja,T as Na}from"./vendor-icons-Aso0-eeY.js";import{L as i}from"./label-u-lNUbKh.js";import"./index-CYARH0Cq.js";function fa(c={page_size:100}){return $e({queryKey:Ye.credentials(c),queryFn:async()=>{const d=await P.list(c);return la(d)},staleTime:3e4})}function Fa(c,d=!0){return $e({queryKey:Ye.credentialDetail(c),queryFn:()=>P.get(c),enabled:!!c&&d,staleTime:1e4})}function Sa(){const c=na(),d=()=>c.invalidateQueries({queryKey:["credentials"]}),u=V({mutationFn:h=>P.create(h),onSuccess:d}),x=V({mutationFn:({id:h,data:D})=>P.update(h,D),onSuccess:d}),g=V({mutationFn:h=>P.delete(h),onSuccess:d}),v=V({mutationFn:({id:h,isActive:D})=>P.toggleActive(h,D),onSuccess:d});return{createMutation:u,updateMutation:x,deleteMutation:g,toggleActiveMutation:v,invalidate:d}}const H={ssh:{label:"SSH 密钥",icon:ha,color:"text-amber-400",desc:"SSH 私钥/公钥/密码"},docker:{label:"Docker 凭证",icon:ga,color:"text-cyan-400",desc:"Docker Registry 登录凭据"},tls:{label:"TLS 证书",icon:Ze,color:"text-green-400",desc:"TLS/SSL 证书与私钥"},aksk:{label:"AKSK 密钥",icon:xa,color:"text-purple-400",desc:"云服务 AccessKey/SecretKey"},database:{label:"数据库凭证",icon:ma,color:"text-blue-400",desc:"数据库连接信息"},api:{label:"API 密钥",icon:pa,color:"text-orange-400",desc:"API Token/Key + 端点"},generic:{label:"通用凭证",icon:ia,color:"text-gray-400",desc:"自定义 Key/Value 键值对"}},aa={ssh:"bg-amber-500/20 text-amber-400 border-amber-500/30",docker:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",tls:"bg-green-500/20 text-green-400 border-green-500/30",aksk:"bg-purple-500/20 text-purple-400 border-purple-500/30",database:"bg-blue-500/20 text-blue-400 border-blue-500/30",api:"bg-orange-500/20 text-orange-400 border-orange-500/30",generic:"bg-gray-500/20 text-gray-400 border-gray-500/30"};function wa({open:c,onClose:d,credId:u}){const[x,g]=t.useState({}),{data:v,isLoading:h}=Fa(u,c);if(!c||!u)return null;const D=m=>g(y=>({...y,[m]:!y[m]})),_=m=>{navigator.clipboard.writeText(m),S.success("已复制")},s=v?.secret_type,f=H[s],o=v?.content||{},n=({label:m,value:y,sensitive:k,fieldKey:K})=>{if(y==null||y==="")return null;const I=typeof y=="string"&&y.length>80,T=K?x[K]:!1;return e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:40:7",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:41:9",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)] mb-1",children:[e.jsx(va,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:42:11",className:"h-3 w-3"}),m]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:44:9",className:"flex gap-1",children:[I?e.jsx("textarea",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:46:13",readOnly:!0,value:k&&!T?"••••••••":String(y),className:"flex-1 rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] p-2 text-xs font-mono resize-none",rows:4}):e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:50:13",readOnly:!0,value:k&&!T?"••••••••":String(y),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono text-xs"}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:53:11",className:"flex flex-col gap-0.5 shrink-0",children:[k&&e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:55:15",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>D(K),children:T?e.jsx(Je,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:56:25",className:"h-3 w-3"}):e.jsx(ea,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:56:58",className:"h-3 w-3"})}),e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:59:13",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>_(String(y)),children:e.jsx(Re,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:60:15",className:"h-3 w-3"})})]})]})]})},l=v;return e.jsx(ze,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:71:5",open:c,onOpenChange:d,children:e.jsxs(Be,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:72:7",className:"sm:max-w-[680px] max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(Ge,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:73:9",children:e.jsxs(Ue,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:74:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[f?e.jsx(f.icon,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:75:20",className:`h-5 w-5 ${f.color}`}):e.jsx(z,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:75:70",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),"凭据详情"]})}),h?e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:80:11",className:"text-center py-8 text-[var(--dg-text-muted)]",children:"加载中..."}):v?e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:82:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:84:13",className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:85:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:85:20",className:"text-[var(--dg-text-muted)]",children:"名称:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:85:76",className:"text-[var(--dg-text-primary)] font-medium",children:l?.name})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:86:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:86:20",className:"text-[var(--dg-text-muted)]",children:"类型:"}),e.jsx(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:87:17",variant:"outline",className:`text-xs ml-1 ${aa[s]||""}`,children:f?.label||s})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:89:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:89:20",className:"text-[var(--dg-text-muted)]",children:"状态:"}),l?.is_active?e.jsxs(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:91:21",className:"bg-green-500/20 text-green-400 text-xs ml-1",children:[e.jsx(We,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:91:84",className:"h-3 w-3 mr-0.5"}),"启用"]}):e.jsxs(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:92:21",className:"bg-red-500/20 text-red-400 text-xs ml-1",children:[e.jsx(Xe,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:92:80",className:"h-3 w-3 mr-0.5"}),"禁用"]}),l?.expires_at&&new Date(l.expires_at)_(l?.env_prefix||""),children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:98:17",className:"text-[var(--dg-text-muted)]",children:"引用ID:"}),e.jsx("code",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:99:17",className:"text-[var(--dg-blue)] font-mono text-xs",children:l?.env_prefix||"无"}),e.jsx(Re,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:100:17",className:"h-3 w-3 inline ml-1 text-[var(--dg-text-muted)]"})]}),l?.tags?.length>0&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:103:17",className:"col-span-2",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:104:19",className:"text-[var(--dg-text-muted)]",children:"标签:"}),(l?.tags).map(m=>e.jsx(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:106:21",variant:"outline",className:"text-xs ml-1 border-[var(--dg-border)]",children:m},m))]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:110:15",className:"col-span-2",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:110:43",className:"text-[var(--dg-text-muted)]",children:"描述:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:110:99",className:"text-[var(--dg-text-secondary)]",children:l?.description||"无"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:111:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:111:20",className:"text-[var(--dg-text-muted)]",children:"创建:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:111:76",className:"text-[var(--dg-text-secondary)] text-xs",children:new Date(l?.created_at).toLocaleString()})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:112:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:112:20",className:"text-[var(--dg-text-muted)]",children:"更新:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:112:76",className:"text-[var(--dg-text-secondary)] text-xs",children:new Date(l?.updated_at).toLocaleString()})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:116:13",className:"border-t border-[var(--dg-border)] pt-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:117:15",className:"flex items-center gap-2 text-sm text-[var(--dg-text-primary)] font-medium mb-3",children:[e.jsx(z,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:118:17",className:"h-4 w-4 text-yellow-500"}),"密钥数据"]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:120:15",className:"p-3 rounded-md bg-yellow-500/5 border border-yellow-500/20 mb-3",children:e.jsx("p",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:121:17",className:"text-xs text-yellow-400/80",children:"以下内容包含敏感信息,请妥善保管,不要泄露给他人。"})}),s==="ssh"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:125:17",label:"SSH 用户",value:o.ssh_user}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:126:17",label:"SSH 端口",value:o.ssh_port}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:127:17",label:"SSH 密码",value:o.password,sensitive:!0,fieldKey:"ssh_password"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:128:17",label:"私钥",value:o.private_key,sensitive:!0,fieldKey:"ssh_private_key"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:129:17",label:"公钥",value:o.public_key,fieldKey:"ssh_public_key"})]}),s==="docker"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:132:17",label:"Registry 地址",value:o.server}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:133:17",label:"用户名",value:o.username}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:134:17",label:"密码",value:o.password,sensitive:!0,fieldKey:"docker_password"})]}),s==="tls"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:137:17",label:"证书",value:o.cert,sensitive:!0,fieldKey:"tls_cert"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:138:17",label:"私钥",value:o.key,sensitive:!0,fieldKey:"tls_key"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:139:17",label:"CA 证书",value:o.ca,sensitive:!0,fieldKey:"tls_ca"})]}),s==="aksk"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:142:17",label:"Access Key ID",value:o.access_key}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:143:17",label:"Secret Access Key",value:o.secret_key,sensitive:!0,fieldKey:"aksk_secret_key"})]}),s==="database"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:146:17",label:"数据库类型",value:String(o.db_type||"").toUpperCase()}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:147:17",label:"主机",value:o.host}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:148:17",label:"端口",value:o.port}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:149:17",label:"数据库名",value:o.db_name}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:150:17",label:"用户名",value:o.username}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:151:17",label:"密码",value:o.password,sensitive:!0,fieldKey:"db_password"})]}),s==="api"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:154:17",label:"API Key",value:o.api_key,sensitive:!0,fieldKey:"api_key"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:155:17",label:"API 端点",value:o.endpoint})]}),s==="generic"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:158:17",label:"Key",value:o.generic_key}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:159:17",label:"Value",value:o.generic_value,sensitive:!0,fieldKey:"generic_value"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:164:13",className:"border-t border-[var(--dg-border)] pt-3",children:[e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:165:15",className:"text-xs text-[var(--dg-text-muted)] mb-2",children:"在流水线/脚本中引用此凭据:"}),e.jsxs("code",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:166:15",className:"text-xs bg-[var(--dg-bg-tertiary)] px-3 py-1.5 rounded block text-[var(--dg-blue)]",children:["${",String(l?.variable_name||String(l?.name||"").toUpperCase().replace(/[^A-Z0-9]/g,"_")),"}"]})]})]}):e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:172:11",className:"text-center py-8 text-[var(--dg-text-muted)]",children:"未找到凭据数据"}),e.jsx(Qe,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:174:9",children:e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:175:11",variant:"outline",onClick:d,children:"关闭"})})]})})}function _a({open:c,onClose:d,onSaved:u,editData:x}){const g=!!x,[v,h]=t.useState(""),[D,_]=t.useState(""),[s,f]=t.useState("ssh"),[o,n]=t.useState(""),[l,m]=t.useState(""),[y,k]=t.useState(!0),[K,I]=t.useState(!1),[T,O]=t.useState({}),[E,L]=t.useState("root"),[r,b]=t.useState("22"),[A,q]=t.useState(""),[F,B]=t.useState(""),[G,U]=t.useState(""),[Q,$]=t.useState(""),[Y,Z]=t.useState(""),[W,X]=t.useState(""),[J,ee]=t.useState(""),[ae,te]=t.useState(""),[re,se]=t.useState(""),[,Te]=t.useState(""),[oe,ne]=t.useState(""),[ce,de]=t.useState(""),[,Ie]=t.useState(""),[le,ie]=t.useState("mysql"),[pe,me]=t.useState(""),[xe,ge]=t.useState("3306"),[he,ye]=t.useState(""),[ve,Ce]=t.useState(""),[ue,De]=t.useState(""),[be,je]=t.useState(""),[Ne,fe]=t.useState(""),[Fe,Se]=t.useState(""),[we,_e]=t.useState("");t.useEffect(()=>{c&&(x?(h(x.name),_(x.variable_name||""),f(x.secret_type),n(x.description||""),m((x.tags||[]).join(", ")),k(x.is_active),L(""),b("22"),q(""),B(""),U(""),$(""),Z(""),X(""),ee(""),te(""),se(""),Te(""),ne(""),de(""),Ie(""),ie("mysql"),me(""),ge("3306"),ye(""),Ce(""),De(""),je(""),fe(""),Se(""),_e("")):(h(""),_(""),f("ssh"),n(""),m(""),k(!0),L("root"),b("22"),q(""),B(""),U(""),$(""),Z(""),X(""),ee(""),te(""),se(""),Te(""),ne(""),de(""),Ie(""),ie("mysql"),me(""),ge("3306"),ye(""),Ce(""),De(""),je(""),fe(""),Se(""),_e("")),O({}))},[x,c]);const ta=a=>O(C=>({...C,[a]:!C[a]})),ra=async()=>{if(!v.trim()){S.error("请填写凭据名称");return}I(!0);try{const a={name:v.trim(),secret_type:s,description:o.trim(),tags:l.split(",").map(C=>C.trim()).filter(Boolean),is_active:y};D.trim()&&(a.variable_name=D.trim()),s==="ssh"?(E.trim()&&(a.ssh_user=E.trim()),r&&(a.ssh_port=parseInt(r)||22),A.trim()&&(a.ssh_password=A.trim()),F.trim()&&(a.ssh_private_key=F.trim()),G.trim()&&(a.ssh_public_key=G.trim())):s==="docker"?(Q.trim()&&(a.docker_server=Q.trim()),Y.trim()&&(a.docker_username=Y.trim()),W.trim()&&(a.docker_password=W.trim())):s==="tls"?(J.trim()&&(a.tls_cert=J.trim()),ae.trim()&&(a.tls_key=ae.trim()),re.trim()&&(a.tls_ca=re.trim())):s==="aksk"?(oe.trim()&&(a.aksk_access_key=oe.trim()),ce.trim()&&(a.aksk_secret_key=ce.trim())):s==="database"?(le.trim()&&(a.db_type=le.trim()),pe.trim()&&(a.db_host=pe.trim()),xe&&(a.db_port=parseInt(xe)||3306),he.trim()&&(a.db_name=he.trim()),ve.trim()&&(a.db_username=ve.trim()),ue.trim()&&(a.db_password=ue.trim())):s==="api"?(be.trim()&&(a.api_key=be.trim()),Ne.trim()&&(a.api_endpoint=Ne.trim())):s==="generic"&&(Fe.trim()&&(a.generic_key=Fe.trim()),we.trim()&&(a.generic_value=we.trim())),g?(await P.update(x.id,a),S.success("已更新")):(await P.create(a),S.success("已创建")),u(),d()}catch(a){const C=a;S.error(C?.response?.data?.message||"操作失败")}finally{I(!1)}},j=({label:a,value:C,onChange:Le,placeholder:qe,fieldKey:He,required:sa,isLong:oa})=>{const Oe=T[He];return e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:163:7",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:164:9",className:"text-[var(--dg-text-secondary)] text-xs",children:[a,sa&&!g&&e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:164:99",className:"text-red-400",children:" *"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:165:9",className:"relative",children:[oa?e.jsx("textarea",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:167:13",value:C,onChange:ke=>Le(ke.target.value),placeholder:qe,rows:5,className:"w-full rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] p-2 text-sm font-mono placeholder:text-[var(--dg-text-muted)]"}):e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:171:13",value:C,onChange:ke=>Le(ke.target.value),type:Oe?"text":"password",placeholder:qe,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] pr-10 font-mono text-sm"}),e.jsx("button",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:175:11",type:"button",onClick:()=>ta(He),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)] text-xs",children:Oe?e.jsx(Je,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:177:21",className:"h-3.5 w-3.5"}):e.jsx(ea,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:177:58",className:"h-3.5 w-3.5"})})]})]})},R=H[s],Ee=R?.icon||z;return e.jsx(ze,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:188:5",open:c,onOpenChange:d,children:e.jsxs(Be,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:189:7",className:"sm:max-w-[620px] max-h-[90vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(Ge,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:190:9",children:[e.jsxs(Ue,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:191:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(Ee,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:192:13",className:`h-5 w-5 ${R?.color||""}`}),g?"编辑凭据":"新增凭据"]}),e.jsx(ca,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:195:11",className:"text-[var(--dg-text-muted)] text-xs",children:R?.desc||"管理敏感凭据信息"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:199:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:201:11",className:"border-b border-[var(--dg-border)] pb-3",children:[e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:202:13",className:"text-xs font-medium text-[var(--dg-text-secondary)] mb-2",children:"基本信息"}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:203:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:204:15",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:205:17",className:"text-[var(--dg-text-secondary)] text-xs",children:["凭据名称 ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:205:81",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:206:17",value:v,onChange:a=>h(a.target.value),placeholder:"如:生产环境 SSH",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:209:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:210:17",className:"text-[var(--dg-text-secondary)] text-xs",children:"变量别名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:211:17",value:D,onChange:a=>_(a.target.value),placeholder:"如:MYSQL_PROD",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:214:15",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:215:17",className:"text-[var(--dg-text-secondary)] text-xs",children:["类型",!g&&e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:215:90",className:"text-red-400",children:" *"})]}),e.jsxs(Me,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:216:17",value:s,onValueChange:a=>f(a),disabled:g,children:[e.jsx(Ke,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:217:19",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(Ae,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:218:21"})}),e.jsx(Pe,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:220:19",className:"max-h-[300px]",children:Object.entries(H).map(([a,C])=>e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:222:23",value:a,children:e.jsxs("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:223:25",className:"flex items-center gap-2",children:[e.jsx(C.icon,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:223:67",className:"h-4 w-4"}),C.label]})},a))})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:229:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:230:17",className:"text-[var(--dg-text-secondary)] text-xs",children:"标签"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:231:17",value:l,onChange:a=>m(a.target.value),placeholder:"生产环境, 阿里云",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:235:13",className:"mt-2 space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:236:15",className:"text-[var(--dg-text-secondary)] text-xs",children:"描述"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:237:15",value:o,onChange:a=>n(a.target.value),placeholder:"可选备注信息",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:243:11",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:244:13",className:"text-xs font-medium text-[var(--dg-text-secondary)] mb-2 flex items-center gap-2",children:[e.jsx(Ee,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:245:15",className:"h-3.5 w-3.5"}),R?.label||s," 配置",g&&e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:246:26",className:"text-[var(--dg-text-muted)]",children:"(仅填写需要修改的字段)"})]}),s==="ssh"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:250:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:251:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:252:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"SSH 用户"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:253:19",value:E,onChange:a=>L(a.target.value),placeholder:"root",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:256:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:257:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"SSH 端口"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:258:19",value:r,onChange:a=>b(a.target.value),placeholder:"22",type:"number",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:261:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:262:19",label:"SSH 密码",value:A,onChange:q,placeholder:"密码(或留空用密钥)",fieldKey:"ssh_pwd"})}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:265:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:266:19",label:"私钥内容",value:F,onChange:B,placeholder:"粘贴 SSH 私钥...",fieldKey:"ssh_pk",isLong:!0})}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:269:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:270:19",label:"公钥内容",value:G,onChange:U,placeholder:"粘贴 SSH 公钥...",fieldKey:"ssh_pub",isLong:!0})})]}),s==="docker"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:277:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:278:17",className:"col-span-2 space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:279:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["Registry 地址 ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:279:90",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:280:19",value:Q,onChange:a=>$(a.target.value),placeholder:"registry.example.com",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:283:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:284:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"用户名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:285:19",value:Y,onChange:a=>Z(a.target.value),placeholder:"admin",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:288:17",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:288:22",label:"密码",value:W,onChange:X,placeholder:"Registry 密码",fieldKey:"docker_pwd",required:!0})})]}),s==="tls"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:294:15",className:"space-y-3",children:[e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:295:17",label:"证书 (PEM)",value:J,onChange:ee,placeholder:"-----BEGIN CERTIFICATE-----",fieldKey:"tls_cert",isLong:!0,required:!0}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:297:17",label:"私钥 (PEM)",value:ae,onChange:te,placeholder:"-----BEGIN PRIVATE KEY-----",fieldKey:"tls_key",isLong:!0,required:!0}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:299:17",label:"CA 证书",value:re,onChange:se,placeholder:"CA 证书内容...",fieldKey:"tls_ca",isLong:!0})]}),s==="aksk"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:305:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:306:17",className:"col-span-2 space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:307:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["Access Key ID ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:307:92",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:308:19",value:oe,onChange:a=>ne(a.target.value),placeholder:"AKIDxxxx...",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:311:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:312:19",label:"Secret Access Key",value:ce,onChange:de,placeholder:"输入 Secret Key",fieldKey:"aksk_sk",required:!0})})]}),s==="database"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:319:15",className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:320:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:321:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"数据库类型"}),e.jsxs(Me,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:322:19",value:le,onValueChange:ie,children:[e.jsx(Ke,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:323:21",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(Ae,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:324:23"})}),e.jsxs(Pe,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:326:21",children:[e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:327:23",value:"mysql",children:"MySQL"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:328:23",value:"postgres",children:"PostgreSQL"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:329:23",value:"mongodb",children:"MongoDB"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:330:23",value:"redis",children:"Redis"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:331:23",value:"mssql",children:"SQL Server"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:332:23",value:"oracle",children:"Oracle"})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:336:17",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:337:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["主机 ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:337:81",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:338:19",value:pe,onChange:a=>me(a.target.value),placeholder:"10.0.0.1",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:341:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:342:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"端口"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:343:19",value:xe,onChange:a=>ge(a.target.value),placeholder:"3306",type:"number",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:346:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:347:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"数据库名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:348:19",value:he,onChange:a=>ye(a.target.value),placeholder:"aiops",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:351:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:352:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"用户名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:353:19",value:ve,onChange:a=>Ce(a.target.value),placeholder:"root",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:356:17",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:356:22",label:"密码",value:ue,onChange:De,placeholder:"数据库密码",fieldKey:"db_pwd"})})]}),s==="api"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:362:15",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:363:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:364:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"API 端点"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:365:19",value:Ne,onChange:a=>fe(a.target.value),placeholder:"https://api.example.com",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:368:17",label:"API Key / Token",value:be,onChange:je,placeholder:"sk-xxxx...",fieldKey:"api_key",required:!0})]}),s==="generic"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:374:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:375:17",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:376:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["Key ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:376:82",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:377:19",value:Fe,onChange:a=>Se(a.target.value),placeholder:"MY_SECRET",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:380:17",label:"Value",value:we,onChange:_e,placeholder:"密钥值",fieldKey:"generic_val",required:!0})]})]})]}),e.jsxs(Qe,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:386:9",children:[e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:387:11",variant:"outline",onClick:d,children:"取消"}),e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:388:11",onClick:ra,disabled:K,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/80",children:K?"保存中...":g?"更新":"创建"})]})]})})}function Oa(){const c=da(),[d,u]=t.useState(!1),[x,g]=t.useState(null),[v,h]=t.useState(null),[D,_]=t.useState(!1),[s,f]=t.useState("all"),[o,n]=t.useState(""),l={page_size:100,...o?{search:o}:{},...s&&s!=="all"?{secret_type:s}:{}},{data:m=[],isLoading:y,refetch:k}=fa(l),{deleteMutation:K,toggleActiveMutation:I}=Sa(),T=async r=>{if(await c({title:"删除凭据",description:`确定删除凭据「${r.name}」?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{await K.mutateAsync(r.id),S.success("已删除")}catch{S.error("删除失败")}},O=async r=>{try{await I.mutateAsync({id:r.id,isActive:!r.is_active}),S.success(r.is_active?"已禁用":"已启用")}catch{S.error("操作失败")}},E=r=>{navigator.clipboard.writeText(r),S.success("引用 ID 已复制")},L=Object.entries(H);return e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:68:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:69:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:70:9",children:[e.jsx("h2",{"code-path":"src/components/deploy/CredentialManager.tsx:71:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:"凭据管理"}),e.jsx("p",{"code-path":"src/components/deploy/CredentialManager.tsx:72:11",className:"text-sm text-[var(--dg-text-muted)] mt-0.5",children:"统一管理 SSH 密钥、Docker 密码、AKSK、数据库等敏感凭据(AES 加密存储)"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:76:9",className:"flex items-center gap-2",children:[e.jsxs(N,{"code-path":"src/components/deploy/CredentialManager.tsx:77:11",variant:"outline",size:"sm",onClick:()=>k(),children:[e.jsx(Ca,{"code-path":"src/components/deploy/CredentialManager.tsx:78:13",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(N,{"code-path":"src/components/deploy/CredentialManager.tsx:80:11",size:"sm",onClick:()=>{g(null),u(!0)},children:[e.jsx(Ve,{"code-path":"src/components/deploy/CredentialManager.tsx:81:13",className:"w-4 h-4 mr-1"}),"新增凭据"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:87:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs(Me,{"code-path":"src/components/deploy/CredentialManager.tsx:88:9",value:s,onValueChange:f,children:[e.jsx(Ke,{"code-path":"src/components/deploy/CredentialManager.tsx:89:11",className:"w-[140px] bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] h-9 text-sm",children:e.jsx(Ae,{"code-path":"src/components/deploy/CredentialManager.tsx:90:13",placeholder:"全部类型"})}),e.jsxs(Pe,{"code-path":"src/components/deploy/CredentialManager.tsx:92:11",children:[e.jsx(M,{"code-path":"src/components/deploy/CredentialManager.tsx:93:13",value:"all",children:"全部类型"}),L.map(([r,b])=>e.jsx(M,{"code-path":"src/components/deploy/CredentialManager.tsx:95:15",value:r,children:e.jsxs("span",{"code-path":"src/components/deploy/CredentialManager.tsx:96:17",className:"flex items-center gap-2",children:[e.jsx(b.icon,{"code-path":"src/components/deploy/CredentialManager.tsx:96:59",className:"h-3.5 w-3.5"}),b.label]})},r))]})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:101:9",className:"relative flex-1 max-w-xs",children:[e.jsx(ua,{"code-path":"src/components/deploy/CredentialManager.tsx:102:11",className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx(p,{"code-path":"src/components/deploy/CredentialManager.tsx:103:11",value:o,onChange:r=>n(r.target.value),placeholder:"搜索名称、描述...",className:"pl-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] h-9 text-sm"})]}),e.jsxs("span",{"code-path":"src/components/deploy/CredentialManager.tsx:107:9",className:"text-xs text-[var(--dg-text-muted)]",children:[m.length," 个凭据"]})]}),y?e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:111:9",className:"text-center py-16 text-[var(--dg-text-secondary)]",children:[e.jsx(Da,{"code-path":"src/components/deploy/CredentialManager.tsx:112:11",className:"w-6 h-6 animate-spin mx-auto mb-2 text-[var(--dg-blue)]"}),"加载中..."]}):m.length===0?e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:115:9",className:"text-center py-16 border border-dashed border-[var(--dg-border)] rounded-lg",children:[e.jsx(Ze,{"code-path":"src/components/deploy/CredentialManager.tsx:116:11",className:"w-12 h-12 mx-auto mb-3 text-[var(--dg-text-muted)]"}),e.jsx("p",{"code-path":"src/components/deploy/CredentialManager.tsx:117:11",className:"text-[var(--dg-text-secondary)] mb-2",children:"暂无凭据"}),e.jsx("p",{"code-path":"src/components/deploy/CredentialManager.tsx:118:11",className:"text-xs text-[var(--dg-text-muted)] mb-4",children:"创建 SSH、Docker、AKSK 等类型的凭据,供流水线和服务器使用"}),e.jsxs(N,{"code-path":"src/components/deploy/CredentialManager.tsx:119:11",onClick:()=>{g(null),u(!0)},children:[e.jsx(Ve,{"code-path":"src/components/deploy/CredentialManager.tsx:120:13",className:"w-4 h-4 mr-1"}),"创建第一个凭据"]})]}):e.jsx("div",{"code-path":"src/components/deploy/CredentialManager.tsx:124:9",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/CredentialManager.tsx:125:11",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/CredentialManager.tsx:126:13",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/CredentialManager.tsx:127:15",children:[e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:128:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:129:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"类型"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:130:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"摘要"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:131:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden lg:table-cell",children:"标签"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:132:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden xl:table-cell",children:"引用ID"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:133:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:134:17",className:"px-3 py-2.5 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/CredentialManager.tsx:137:13",children:m.map(r=>{const b=r.secret_type,A=H[b],q=r.expires_at&&new Date(r.expires_at){h(r.id),_(!0)},children:[e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:146:21",className:"px-3 py-2.5",children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:147:23",className:"flex items-center gap-2",children:[A?e.jsx(A.icon,{"code-path":"src/components/deploy/CredentialManager.tsx:148:32",className:`h-4 w-4 ${A.color} shrink-0`}):e.jsx(z,{"code-path":"src/components/deploy/CredentialManager.tsx:148:91",className:"h-4 w-4 text-[var(--dg-text-muted)] shrink-0"}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:149:25",children:[e.jsx("div",{"code-path":"src/components/deploy/CredentialManager.tsx:150:27",className:"font-medium text-[var(--dg-text-primary)]",children:r.name}),r.variable_name&&e.jsx("div",{"code-path":"src/components/deploy/CredentialManager.tsx:152:29",className:"text-xs text-[var(--dg-text-muted)] font-mono",children:r.variable_name})]})]})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:157:21",className:"px-3 py-2.5",children:e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:158:23",variant:"outline",className:`text-xs ${aa[b]||""}`,children:A?.label||b})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:162:21",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] text-xs hidden md:table-cell max-w-[180px] truncate font-mono",children:r.summary||"-"}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:165:21",className:"px-3 py-2.5 hidden lg:table-cell",children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:166:23",className:"flex gap-1 flex-wrap",children:[(r.tags||[]).slice(0,3).map(F=>e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:168:27",variant:"outline",className:"text-xs border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:F},F)),(r.tags||[]).length>3&&e.jsxs("span",{"code-path":"src/components/deploy/CredentialManager.tsx:171:27",className:"text-xs text-[var(--dg-text-muted)]",children:["+",r.tags.length-3]})]})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:175:21",className:"px-3 py-2.5 hidden xl:table-cell",children:e.jsx("code",{"code-path":"src/components/deploy/CredentialManager.tsx:176:23",className:"text-xs text-[var(--dg-blue)] cursor-pointer font-mono",onClick:F=>{F.stopPropagation(),E(r.env_prefix)},children:r.env_prefix})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:181:21",className:"px-3 py-2.5",children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:182:23",className:"flex items-center gap-1",children:[r.is_active?e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:184:27",className:"bg-green-500/20 text-green-400 text-xs border-0",children:"启用"}):e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:186:27",className:"bg-red-500/20 text-red-400 text-xs border-0",children:"禁用"}),q&&e.jsxs(w,{"code-path":"src/components/deploy/CredentialManager.tsx:189:27",className:"bg-yellow-500/20 text-yellow-400 text-xs border-0",children:[e.jsx(ba,{"code-path":"src/components/deploy/CredentialManager.tsx:189:96",className:"h-2.5 w-2.5 mr-0.5"}),"过期"]})]})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:193:21",className:"px-3 py-2.5 text-right",onClick:F=>F.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:194:23",className:"flex justify-end gap-1",children:[e.jsx(N,{"code-path":"src/components/deploy/CredentialManager.tsx:195:25",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{g(r),u(!0)},title:"编辑",children:e.jsx(ja,{"code-path":"src/components/deploy/CredentialManager.tsx:197:27",className:"w-3.5 h-3.5"})}),e.jsx(N,{"code-path":"src/components/deploy/CredentialManager.tsx:199:25",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>O(r),title:r.is_active?"禁用":"启用",children:r.is_active?e.jsx(Xe,{"code-path":"src/components/deploy/CredentialManager.tsx:202:45",className:"w-3.5 h-3.5 text-yellow-500"}):e.jsx(We,{"code-path":"src/components/deploy/CredentialManager.tsx:202:99",className:"w-3.5 h-3.5 text-green-500"})}),e.jsx(N,{"code-path":"src/components/deploy/CredentialManager.tsx:204:25",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>T(r),title:"删除",children:e.jsx(Na,{"code-path":"src/components/deploy/CredentialManager.tsx:206:27",className:"w-3.5 h-3.5"})})]})})]},r.id)})})]})}),e.jsx(_a,{"code-path":"src/components/deploy/CredentialManager.tsx:218:7",open:d,onClose:()=>u(!1),onSaved:()=>k(),editData:x}),e.jsx(wa,{"code-path":"src/components/deploy/CredentialManager.tsx:219:7",open:D,onClose:()=>_(!1),credId:v})]})}export{Oa as default}; +import{r as t,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{G as na,D as ze,a as Be,b as Ge,c as Ue,e as Qe,B as N,t as S,d as ca,f as da}from"./index-Bp-M7P_8.js";import{I as p}from"./input-Bnlm--la.js";import{B as w}from"./badge-B00SZHvE.js";import{S as Me,a as Ke,b as Ae,c as Pe,d as M}from"./select-DbhcBWnH.js";import{u as $e,q as Ye,b as la}from"./unwrap-D6sbt6TG.js";import{u as V}from"./useMutation-DTWI9Q1n.js";import{c as P}from"./credential-Df-OY-sx.js";import{F as ia,G as pa,D as ma,i as xa,j as Ze,k as ga,h as ha,ag as z,C as We,a as Xe,l as ya,aF as Re,aK as va,aL as Je,x as ea,R as Ca,P as Ve,S as ua,a4 as Da,b as ba,d as ja,T as Na}from"./vendor-icons-BWk-DH7F.js";import{L as i}from"./label-NkONM5Mp.js";import"./index-5FEebgvX.js";function fa(c={page_size:100}){return $e({queryKey:Ye.credentials(c),queryFn:async()=>{const d=await P.list(c);return la(d)},staleTime:3e4})}function Fa(c,d=!0){return $e({queryKey:Ye.credentialDetail(c),queryFn:()=>P.get(c),enabled:!!c&&d,staleTime:1e4})}function Sa(){const c=na(),d=()=>c.invalidateQueries({queryKey:["credentials"]}),u=V({mutationFn:h=>P.create(h),onSuccess:d}),x=V({mutationFn:({id:h,data:D})=>P.update(h,D),onSuccess:d}),g=V({mutationFn:h=>P.delete(h),onSuccess:d}),v=V({mutationFn:({id:h,isActive:D})=>P.toggleActive(h,D),onSuccess:d});return{createMutation:u,updateMutation:x,deleteMutation:g,toggleActiveMutation:v,invalidate:d}}const H={ssh:{label:"SSH 密钥",icon:ha,color:"text-amber-400",desc:"SSH 私钥/公钥/密码"},docker:{label:"Docker 凭证",icon:ga,color:"text-cyan-400",desc:"Docker Registry 登录凭据"},tls:{label:"TLS 证书",icon:Ze,color:"text-green-400",desc:"TLS/SSL 证书与私钥"},aksk:{label:"AKSK 密钥",icon:xa,color:"text-purple-400",desc:"云服务 AccessKey/SecretKey"},database:{label:"数据库凭证",icon:ma,color:"text-blue-400",desc:"数据库连接信息"},api:{label:"API 密钥",icon:pa,color:"text-orange-400",desc:"API Token/Key + 端点"},generic:{label:"通用凭证",icon:ia,color:"text-gray-400",desc:"自定义 Key/Value 键值对"}},aa={ssh:"bg-amber-500/20 text-amber-400 border-amber-500/30",docker:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",tls:"bg-green-500/20 text-green-400 border-green-500/30",aksk:"bg-purple-500/20 text-purple-400 border-purple-500/30",database:"bg-blue-500/20 text-blue-400 border-blue-500/30",api:"bg-orange-500/20 text-orange-400 border-orange-500/30",generic:"bg-gray-500/20 text-gray-400 border-gray-500/30"};function wa({open:c,onClose:d,credId:u}){const[x,g]=t.useState({}),{data:v,isLoading:h}=Fa(u,c);if(!c||!u)return null;const D=m=>g(y=>({...y,[m]:!y[m]})),_=m=>{navigator.clipboard.writeText(m),S.success("已复制")},s=v?.secret_type,f=H[s],o=v?.content||{},n=({label:m,value:y,sensitive:k,fieldKey:K})=>{if(y==null||y==="")return null;const I=typeof y=="string"&&y.length>80,T=K?x[K]:!1;return e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:40:7",className:"mb-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:41:9",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)] mb-1",children:[e.jsx(va,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:42:11",className:"h-3 w-3"}),m]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:44:9",className:"flex gap-1",children:[I?e.jsx("textarea",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:46:13",readOnly:!0,value:k&&!T?"••••••••":String(y),className:"flex-1 rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] p-2 text-xs font-mono resize-none",rows:4}):e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:50:13",readOnly:!0,value:k&&!T?"••••••••":String(y),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono text-xs"}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:53:11",className:"flex flex-col gap-0.5 shrink-0",children:[k&&e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:55:15",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>D(K),children:T?e.jsx(Je,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:56:25",className:"h-3 w-3"}):e.jsx(ea,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:56:58",className:"h-3 w-3"})}),e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:59:13",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>_(String(y)),children:e.jsx(Re,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:60:15",className:"h-3 w-3"})})]})]})]})},l=v;return e.jsx(ze,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:71:5",open:c,onOpenChange:d,children:e.jsxs(Be,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:72:7",className:"sm:max-w-[680px] max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(Ge,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:73:9",children:e.jsxs(Ue,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:74:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[f?e.jsx(f.icon,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:75:20",className:`h-5 w-5 ${f.color}`}):e.jsx(z,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:75:70",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),"凭据详情"]})}),h?e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:80:11",className:"text-center py-8 text-[var(--dg-text-muted)]",children:"加载中..."}):v?e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:82:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:84:13",className:"grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:85:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:85:20",className:"text-[var(--dg-text-muted)]",children:"名称:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:85:76",className:"text-[var(--dg-text-primary)] font-medium",children:l?.name})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:86:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:86:20",className:"text-[var(--dg-text-muted)]",children:"类型:"}),e.jsx(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:87:17",variant:"outline",className:`text-xs ml-1 ${aa[s]||""}`,children:f?.label||s})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:89:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:89:20",className:"text-[var(--dg-text-muted)]",children:"状态:"}),l?.is_active?e.jsxs(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:91:21",className:"bg-green-500/20 text-green-400 text-xs ml-1",children:[e.jsx(We,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:91:84",className:"h-3 w-3 mr-0.5"}),"启用"]}):e.jsxs(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:92:21",className:"bg-red-500/20 text-red-400 text-xs ml-1",children:[e.jsx(Xe,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:92:80",className:"h-3 w-3 mr-0.5"}),"禁用"]}),l?.expires_at&&new Date(l.expires_at)_(l?.env_prefix||""),children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:98:17",className:"text-[var(--dg-text-muted)]",children:"引用ID:"}),e.jsx("code",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:99:17",className:"text-[var(--dg-blue)] font-mono text-xs",children:l?.env_prefix||"无"}),e.jsx(Re,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:100:17",className:"h-3 w-3 inline ml-1 text-[var(--dg-text-muted)]"})]}),l?.tags?.length>0&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:103:17",className:"col-span-2",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:104:19",className:"text-[var(--dg-text-muted)]",children:"标签:"}),(l?.tags).map(m=>e.jsx(w,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:106:21",variant:"outline",className:"text-xs ml-1 border-[var(--dg-border)]",children:m},m))]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:110:15",className:"col-span-2",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:110:43",className:"text-[var(--dg-text-muted)]",children:"描述:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:110:99",className:"text-[var(--dg-text-secondary)]",children:l?.description||"无"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:111:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:111:20",className:"text-[var(--dg-text-muted)]",children:"创建:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:111:76",className:"text-[var(--dg-text-secondary)] text-xs",children:new Date(l?.created_at).toLocaleString()})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:112:15",children:[e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:112:20",className:"text-[var(--dg-text-muted)]",children:"更新:"}),e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:112:76",className:"text-[var(--dg-text-secondary)] text-xs",children:new Date(l?.updated_at).toLocaleString()})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:116:13",className:"border-t border-[var(--dg-border)] pt-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:117:15",className:"flex items-center gap-2 text-sm text-[var(--dg-text-primary)] font-medium mb-3",children:[e.jsx(z,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:118:17",className:"h-4 w-4 text-yellow-500"}),"密钥数据"]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:120:15",className:"p-3 rounded-md bg-yellow-500/5 border border-yellow-500/20 mb-3",children:e.jsx("p",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:121:17",className:"text-xs text-yellow-400/80",children:"以下内容包含敏感信息,请妥善保管,不要泄露给他人。"})}),s==="ssh"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:125:17",label:"SSH 用户",value:o.ssh_user}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:126:17",label:"SSH 端口",value:o.ssh_port}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:127:17",label:"SSH 密码",value:o.password,sensitive:!0,fieldKey:"ssh_password"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:128:17",label:"私钥",value:o.private_key,sensitive:!0,fieldKey:"ssh_private_key"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:129:17",label:"公钥",value:o.public_key,fieldKey:"ssh_public_key"})]}),s==="docker"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:132:17",label:"Registry 地址",value:o.server}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:133:17",label:"用户名",value:o.username}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:134:17",label:"密码",value:o.password,sensitive:!0,fieldKey:"docker_password"})]}),s==="tls"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:137:17",label:"证书",value:o.cert,sensitive:!0,fieldKey:"tls_cert"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:138:17",label:"私钥",value:o.key,sensitive:!0,fieldKey:"tls_key"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:139:17",label:"CA 证书",value:o.ca,sensitive:!0,fieldKey:"tls_ca"})]}),s==="aksk"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:142:17",label:"Access Key ID",value:o.access_key}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:143:17",label:"Secret Access Key",value:o.secret_key,sensitive:!0,fieldKey:"aksk_secret_key"})]}),s==="database"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:146:17",label:"数据库类型",value:String(o.db_type||"").toUpperCase()}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:147:17",label:"主机",value:o.host}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:148:17",label:"端口",value:o.port}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:149:17",label:"数据库名",value:o.db_name}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:150:17",label:"用户名",value:o.username}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:151:17",label:"密码",value:o.password,sensitive:!0,fieldKey:"db_password"})]}),s==="api"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:154:17",label:"API Key",value:o.api_key,sensitive:!0,fieldKey:"api_key"}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:155:17",label:"API 端点",value:o.endpoint})]}),s==="generic"&&e.jsxs(e.Fragment,{children:[e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:158:17",label:"Key",value:o.generic_key}),e.jsx(n,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:159:17",label:"Value",value:o.generic_value,sensitive:!0,fieldKey:"generic_value"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:164:13",className:"border-t border-[var(--dg-border)] pt-3",children:[e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:165:15",className:"text-xs text-[var(--dg-text-muted)] mb-2",children:"在流水线/脚本中引用此凭据:"}),e.jsxs("code",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:166:15",className:"text-xs bg-[var(--dg-bg-tertiary)] px-3 py-1.5 rounded block text-[var(--dg-blue)]",children:["${",String(l?.variable_name||String(l?.name||"").toUpperCase().replace(/[^A-Z0-9]/g,"_")),"}"]})]})]}):e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:172:11",className:"text-center py-8 text-[var(--dg-text-muted)]",children:"未找到凭据数据"}),e.jsx(Qe,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:174:9",children:e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredDetailDialog.tsx:175:11",variant:"outline",onClick:d,children:"关闭"})})]})})}function _a({open:c,onClose:d,onSaved:u,editData:x}){const g=!!x,[v,h]=t.useState(""),[D,_]=t.useState(""),[s,f]=t.useState("ssh"),[o,n]=t.useState(""),[l,m]=t.useState(""),[y,k]=t.useState(!0),[K,I]=t.useState(!1),[T,O]=t.useState({}),[E,L]=t.useState("root"),[r,b]=t.useState("22"),[A,q]=t.useState(""),[F,B]=t.useState(""),[G,U]=t.useState(""),[Q,$]=t.useState(""),[Y,Z]=t.useState(""),[W,X]=t.useState(""),[J,ee]=t.useState(""),[ae,te]=t.useState(""),[re,se]=t.useState(""),[,Te]=t.useState(""),[oe,ne]=t.useState(""),[ce,de]=t.useState(""),[,Ie]=t.useState(""),[le,ie]=t.useState("mysql"),[pe,me]=t.useState(""),[xe,ge]=t.useState("3306"),[he,ye]=t.useState(""),[ve,Ce]=t.useState(""),[ue,De]=t.useState(""),[be,je]=t.useState(""),[Ne,fe]=t.useState(""),[Fe,Se]=t.useState(""),[we,_e]=t.useState("");t.useEffect(()=>{c&&(x?(h(x.name),_(x.variable_name||""),f(x.secret_type),n(x.description||""),m((x.tags||[]).join(", ")),k(x.is_active),L(""),b("22"),q(""),B(""),U(""),$(""),Z(""),X(""),ee(""),te(""),se(""),Te(""),ne(""),de(""),Ie(""),ie("mysql"),me(""),ge("3306"),ye(""),Ce(""),De(""),je(""),fe(""),Se(""),_e("")):(h(""),_(""),f("ssh"),n(""),m(""),k(!0),L("root"),b("22"),q(""),B(""),U(""),$(""),Z(""),X(""),ee(""),te(""),se(""),Te(""),ne(""),de(""),Ie(""),ie("mysql"),me(""),ge("3306"),ye(""),Ce(""),De(""),je(""),fe(""),Se(""),_e("")),O({}))},[x,c]);const ta=a=>O(C=>({...C,[a]:!C[a]})),ra=async()=>{if(!v.trim()){S.error("请填写凭据名称");return}I(!0);try{const a={name:v.trim(),secret_type:s,description:o.trim(),tags:l.split(",").map(C=>C.trim()).filter(Boolean),is_active:y};D.trim()&&(a.variable_name=D.trim()),s==="ssh"?(E.trim()&&(a.ssh_user=E.trim()),r&&(a.ssh_port=parseInt(r)||22),A.trim()&&(a.ssh_password=A.trim()),F.trim()&&(a.ssh_private_key=F.trim()),G.trim()&&(a.ssh_public_key=G.trim())):s==="docker"?(Q.trim()&&(a.docker_server=Q.trim()),Y.trim()&&(a.docker_username=Y.trim()),W.trim()&&(a.docker_password=W.trim())):s==="tls"?(J.trim()&&(a.tls_cert=J.trim()),ae.trim()&&(a.tls_key=ae.trim()),re.trim()&&(a.tls_ca=re.trim())):s==="aksk"?(oe.trim()&&(a.aksk_access_key=oe.trim()),ce.trim()&&(a.aksk_secret_key=ce.trim())):s==="database"?(le.trim()&&(a.db_type=le.trim()),pe.trim()&&(a.db_host=pe.trim()),xe&&(a.db_port=parseInt(xe)||3306),he.trim()&&(a.db_name=he.trim()),ve.trim()&&(a.db_username=ve.trim()),ue.trim()&&(a.db_password=ue.trim())):s==="api"?(be.trim()&&(a.api_key=be.trim()),Ne.trim()&&(a.api_endpoint=Ne.trim())):s==="generic"&&(Fe.trim()&&(a.generic_key=Fe.trim()),we.trim()&&(a.generic_value=we.trim())),g?(await P.update(x.id,a),S.success("已更新")):(await P.create(a),S.success("已创建")),u(),d()}catch(a){const C=a;S.error(C?.response?.data?.message||"操作失败")}finally{I(!1)}},j=({label:a,value:C,onChange:Le,placeholder:qe,fieldKey:He,required:sa,isLong:oa})=>{const Oe=T[He];return e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:163:7",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:164:9",className:"text-[var(--dg-text-secondary)] text-xs",children:[a,sa&&!g&&e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:164:99",className:"text-red-400",children:" *"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:165:9",className:"relative",children:[oa?e.jsx("textarea",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:167:13",value:C,onChange:ke=>Le(ke.target.value),placeholder:qe,rows:5,className:"w-full rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] text-[var(--dg-text-primary)] p-2 text-sm font-mono placeholder:text-[var(--dg-text-muted)]"}):e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:171:13",value:C,onChange:ke=>Le(ke.target.value),type:Oe?"text":"password",placeholder:qe,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] pr-10 font-mono text-sm"}),e.jsx("button",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:175:11",type:"button",onClick:()=>ta(He),className:"absolute right-2 top-1/2 -translate-y-1/2 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)] text-xs",children:Oe?e.jsx(Je,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:177:21",className:"h-3.5 w-3.5"}):e.jsx(ea,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:177:58",className:"h-3.5 w-3.5"})})]})]})},R=H[s],Ee=R?.icon||z;return e.jsx(ze,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:188:5",open:c,onOpenChange:d,children:e.jsxs(Be,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:189:7",className:"sm:max-w-[620px] max-h-[90vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(Ge,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:190:9",children:[e.jsxs(Ue,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:191:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(Ee,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:192:13",className:`h-5 w-5 ${R?.color||""}`}),g?"编辑凭据":"新增凭据"]}),e.jsx(ca,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:195:11",className:"text-[var(--dg-text-muted)] text-xs",children:R?.desc||"管理敏感凭据信息"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:199:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:201:11",className:"border-b border-[var(--dg-border)] pb-3",children:[e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:202:13",className:"text-xs font-medium text-[var(--dg-text-secondary)] mb-2",children:"基本信息"}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:203:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:204:15",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:205:17",className:"text-[var(--dg-text-secondary)] text-xs",children:["凭据名称 ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:205:81",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:206:17",value:v,onChange:a=>h(a.target.value),placeholder:"如:生产环境 SSH",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:209:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:210:17",className:"text-[var(--dg-text-secondary)] text-xs",children:"变量别名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:211:17",value:D,onChange:a=>_(a.target.value),placeholder:"如:MYSQL_PROD",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:214:15",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:215:17",className:"text-[var(--dg-text-secondary)] text-xs",children:["类型",!g&&e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:215:90",className:"text-red-400",children:" *"})]}),e.jsxs(Me,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:216:17",value:s,onValueChange:a=>f(a),disabled:g,children:[e.jsx(Ke,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:217:19",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(Ae,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:218:21"})}),e.jsx(Pe,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:220:19",className:"max-h-[300px]",children:Object.entries(H).map(([a,C])=>e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:222:23",value:a,children:e.jsxs("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:223:25",className:"flex items-center gap-2",children:[e.jsx(C.icon,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:223:67",className:"h-4 w-4"}),C.label]})},a))})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:229:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:230:17",className:"text-[var(--dg-text-secondary)] text-xs",children:"标签"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:231:17",value:l,onChange:a=>m(a.target.value),placeholder:"生产环境, 阿里云",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:235:13",className:"mt-2 space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:236:15",className:"text-[var(--dg-text-secondary)] text-xs",children:"描述"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:237:15",value:o,onChange:a=>n(a.target.value),placeholder:"可选备注信息",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:243:11",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:244:13",className:"text-xs font-medium text-[var(--dg-text-secondary)] mb-2 flex items-center gap-2",children:[e.jsx(Ee,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:245:15",className:"h-3.5 w-3.5"}),R?.label||s," 配置",g&&e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:246:26",className:"text-[var(--dg-text-muted)]",children:"(仅填写需要修改的字段)"})]}),s==="ssh"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:250:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:251:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:252:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"SSH 用户"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:253:19",value:E,onChange:a=>L(a.target.value),placeholder:"root",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:256:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:257:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"SSH 端口"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:258:19",value:r,onChange:a=>b(a.target.value),placeholder:"22",type:"number",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:261:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:262:19",label:"SSH 密码",value:A,onChange:q,placeholder:"密码(或留空用密钥)",fieldKey:"ssh_pwd"})}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:265:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:266:19",label:"私钥内容",value:F,onChange:B,placeholder:"粘贴 SSH 私钥...",fieldKey:"ssh_pk",isLong:!0})}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:269:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:270:19",label:"公钥内容",value:G,onChange:U,placeholder:"粘贴 SSH 公钥...",fieldKey:"ssh_pub",isLong:!0})})]}),s==="docker"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:277:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:278:17",className:"col-span-2 space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:279:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["Registry 地址 ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:279:90",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:280:19",value:Q,onChange:a=>$(a.target.value),placeholder:"registry.example.com",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:283:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:284:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"用户名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:285:19",value:Y,onChange:a=>Z(a.target.value),placeholder:"admin",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:288:17",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:288:22",label:"密码",value:W,onChange:X,placeholder:"Registry 密码",fieldKey:"docker_pwd",required:!0})})]}),s==="tls"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:294:15",className:"space-y-3",children:[e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:295:17",label:"证书 (PEM)",value:J,onChange:ee,placeholder:"-----BEGIN CERTIFICATE-----",fieldKey:"tls_cert",isLong:!0,required:!0}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:297:17",label:"私钥 (PEM)",value:ae,onChange:te,placeholder:"-----BEGIN PRIVATE KEY-----",fieldKey:"tls_key",isLong:!0,required:!0}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:299:17",label:"CA 证书",value:re,onChange:se,placeholder:"CA 证书内容...",fieldKey:"tls_ca",isLong:!0})]}),s==="aksk"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:305:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:306:17",className:"col-span-2 space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:307:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["Access Key ID ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:307:92",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:308:19",value:oe,onChange:a=>ne(a.target.value),placeholder:"AKIDxxxx...",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:311:17",className:"col-span-2",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:312:19",label:"Secret Access Key",value:ce,onChange:de,placeholder:"输入 Secret Key",fieldKey:"aksk_sk",required:!0})})]}),s==="database"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:319:15",className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:320:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:321:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"数据库类型"}),e.jsxs(Me,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:322:19",value:le,onValueChange:ie,children:[e.jsx(Ke,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:323:21",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(Ae,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:324:23"})}),e.jsxs(Pe,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:326:21",children:[e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:327:23",value:"mysql",children:"MySQL"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:328:23",value:"postgres",children:"PostgreSQL"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:329:23",value:"mongodb",children:"MongoDB"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:330:23",value:"redis",children:"Redis"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:331:23",value:"mssql",children:"SQL Server"}),e.jsx(M,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:332:23",value:"oracle",children:"Oracle"})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:336:17",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:337:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["主机 ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:337:81",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:338:19",value:pe,onChange:a=>me(a.target.value),placeholder:"10.0.0.1",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:341:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:342:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"端口"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:343:19",value:xe,onChange:a=>ge(a.target.value),placeholder:"3306",type:"number",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:346:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:347:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"数据库名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:348:19",value:he,onChange:a=>ye(a.target.value),placeholder:"aiops",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:351:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:352:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"用户名"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:353:19",value:ve,onChange:a=>Ce(a.target.value),placeholder:"root",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:356:17",children:e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:356:22",label:"密码",value:ue,onChange:De,placeholder:"数据库密码",fieldKey:"db_pwd"})})]}),s==="api"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:362:15",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:363:17",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:364:19",className:"text-[var(--dg-text-secondary)] text-xs",children:"API 端点"}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:365:19",value:Ne,onChange:a=>fe(a.target.value),placeholder:"https://api.example.com",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:368:17",label:"API Key / Token",value:be,onChange:je,placeholder:"sk-xxxx...",fieldKey:"api_key",required:!0})]}),s==="generic"&&e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:374:15",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:375:17",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:376:19",className:"text-[var(--dg-text-secondary)] text-xs",children:["Key ",e.jsx("span",{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:376:82",className:"text-red-400",children:"*"})]}),e.jsx(p,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:377:19",value:Fe,onChange:a=>Se(a.target.value),placeholder:"MY_SECRET",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] font-mono"})]}),e.jsx(j,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:380:17",label:"Value",value:we,onChange:_e,placeholder:"密钥值",fieldKey:"generic_val",required:!0})]})]})]}),e.jsxs(Qe,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:386:9",children:[e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:387:11",variant:"outline",onClick:d,children:"取消"}),e.jsx(N,{"code-path":"src/components/deploy/credential-manager/CredFormDialog.tsx:388:11",onClick:ra,disabled:K,className:"bg-[var(--dg-blue)] hover:bg-[var(--dg-blue)]/80",children:K?"保存中...":g?"更新":"创建"})]})]})})}function Oa(){const c=da(),[d,u]=t.useState(!1),[x,g]=t.useState(null),[v,h]=t.useState(null),[D,_]=t.useState(!1),[s,f]=t.useState("all"),[o,n]=t.useState(""),l={page_size:100,...o?{search:o}:{},...s&&s!=="all"?{secret_type:s}:{}},{data:m=[],isLoading:y,refetch:k}=fa(l),{deleteMutation:K,toggleActiveMutation:I}=Sa(),T=async r=>{if(await c({title:"删除凭据",description:`确定删除凭据「${r.name}」?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{await K.mutateAsync(r.id),S.success("已删除")}catch{S.error("删除失败")}},O=async r=>{try{await I.mutateAsync({id:r.id,isActive:!r.is_active}),S.success(r.is_active?"已禁用":"已启用")}catch{S.error("操作失败")}},E=r=>{navigator.clipboard.writeText(r),S.success("引用 ID 已复制")},L=Object.entries(H);return e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:68:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:69:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:70:9",children:[e.jsx("h2",{"code-path":"src/components/deploy/CredentialManager.tsx:71:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:"凭据管理"}),e.jsx("p",{"code-path":"src/components/deploy/CredentialManager.tsx:72:11",className:"text-sm text-[var(--dg-text-muted)] mt-0.5",children:"统一管理 SSH 密钥、Docker 密码、AKSK、数据库等敏感凭据(AES 加密存储)"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:76:9",className:"flex items-center gap-2",children:[e.jsxs(N,{"code-path":"src/components/deploy/CredentialManager.tsx:77:11",variant:"outline",size:"sm",onClick:()=>k(),children:[e.jsx(Ca,{"code-path":"src/components/deploy/CredentialManager.tsx:78:13",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(N,{"code-path":"src/components/deploy/CredentialManager.tsx:80:11",size:"sm",onClick:()=>{g(null),u(!0)},children:[e.jsx(Ve,{"code-path":"src/components/deploy/CredentialManager.tsx:81:13",className:"w-4 h-4 mr-1"}),"新增凭据"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:87:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs(Me,{"code-path":"src/components/deploy/CredentialManager.tsx:88:9",value:s,onValueChange:f,children:[e.jsx(Ke,{"code-path":"src/components/deploy/CredentialManager.tsx:89:11",className:"w-[140px] bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] h-9 text-sm",children:e.jsx(Ae,{"code-path":"src/components/deploy/CredentialManager.tsx:90:13",placeholder:"全部类型"})}),e.jsxs(Pe,{"code-path":"src/components/deploy/CredentialManager.tsx:92:11",children:[e.jsx(M,{"code-path":"src/components/deploy/CredentialManager.tsx:93:13",value:"all",children:"全部类型"}),L.map(([r,b])=>e.jsx(M,{"code-path":"src/components/deploy/CredentialManager.tsx:95:15",value:r,children:e.jsxs("span",{"code-path":"src/components/deploy/CredentialManager.tsx:96:17",className:"flex items-center gap-2",children:[e.jsx(b.icon,{"code-path":"src/components/deploy/CredentialManager.tsx:96:59",className:"h-3.5 w-3.5"}),b.label]})},r))]})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:101:9",className:"relative flex-1 max-w-xs",children:[e.jsx(ua,{"code-path":"src/components/deploy/CredentialManager.tsx:102:11",className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx(p,{"code-path":"src/components/deploy/CredentialManager.tsx:103:11",value:o,onChange:r=>n(r.target.value),placeholder:"搜索名称、描述...",className:"pl-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] h-9 text-sm"})]}),e.jsxs("span",{"code-path":"src/components/deploy/CredentialManager.tsx:107:9",className:"text-xs text-[var(--dg-text-muted)]",children:[m.length," 个凭据"]})]}),y?e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:111:9",className:"text-center py-16 text-[var(--dg-text-secondary)]",children:[e.jsx(Da,{"code-path":"src/components/deploy/CredentialManager.tsx:112:11",className:"w-6 h-6 animate-spin mx-auto mb-2 text-[var(--dg-blue)]"}),"加载中..."]}):m.length===0?e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:115:9",className:"text-center py-16 border border-dashed border-[var(--dg-border)] rounded-lg",children:[e.jsx(Ze,{"code-path":"src/components/deploy/CredentialManager.tsx:116:11",className:"w-12 h-12 mx-auto mb-3 text-[var(--dg-text-muted)]"}),e.jsx("p",{"code-path":"src/components/deploy/CredentialManager.tsx:117:11",className:"text-[var(--dg-text-secondary)] mb-2",children:"暂无凭据"}),e.jsx("p",{"code-path":"src/components/deploy/CredentialManager.tsx:118:11",className:"text-xs text-[var(--dg-text-muted)] mb-4",children:"创建 SSH、Docker、AKSK 等类型的凭据,供流水线和服务器使用"}),e.jsxs(N,{"code-path":"src/components/deploy/CredentialManager.tsx:119:11",onClick:()=>{g(null),u(!0)},children:[e.jsx(Ve,{"code-path":"src/components/deploy/CredentialManager.tsx:120:13",className:"w-4 h-4 mr-1"}),"创建第一个凭据"]})]}):e.jsx("div",{"code-path":"src/components/deploy/CredentialManager.tsx:124:9",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/CredentialManager.tsx:125:11",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/CredentialManager.tsx:126:13",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/CredentialManager.tsx:127:15",children:[e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:128:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:129:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"类型"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:130:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"摘要"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:131:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden lg:table-cell",children:"标签"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:132:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden xl:table-cell",children:"引用ID"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:133:17",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/CredentialManager.tsx:134:17",className:"px-3 py-2.5 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/CredentialManager.tsx:137:13",children:m.map(r=>{const b=r.secret_type,A=H[b],q=r.expires_at&&new Date(r.expires_at){h(r.id),_(!0)},children:[e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:146:21",className:"px-3 py-2.5",children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:147:23",className:"flex items-center gap-2",children:[A?e.jsx(A.icon,{"code-path":"src/components/deploy/CredentialManager.tsx:148:32",className:`h-4 w-4 ${A.color} shrink-0`}):e.jsx(z,{"code-path":"src/components/deploy/CredentialManager.tsx:148:91",className:"h-4 w-4 text-[var(--dg-text-muted)] shrink-0"}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:149:25",children:[e.jsx("div",{"code-path":"src/components/deploy/CredentialManager.tsx:150:27",className:"font-medium text-[var(--dg-text-primary)]",children:r.name}),r.variable_name&&e.jsx("div",{"code-path":"src/components/deploy/CredentialManager.tsx:152:29",className:"text-xs text-[var(--dg-text-muted)] font-mono",children:r.variable_name})]})]})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:157:21",className:"px-3 py-2.5",children:e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:158:23",variant:"outline",className:`text-xs ${aa[b]||""}`,children:A?.label||b})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:162:21",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] text-xs hidden md:table-cell max-w-[180px] truncate font-mono",children:r.summary||"-"}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:165:21",className:"px-3 py-2.5 hidden lg:table-cell",children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:166:23",className:"flex gap-1 flex-wrap",children:[(r.tags||[]).slice(0,3).map(F=>e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:168:27",variant:"outline",className:"text-xs border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:F},F)),(r.tags||[]).length>3&&e.jsxs("span",{"code-path":"src/components/deploy/CredentialManager.tsx:171:27",className:"text-xs text-[var(--dg-text-muted)]",children:["+",r.tags.length-3]})]})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:175:21",className:"px-3 py-2.5 hidden xl:table-cell",children:e.jsx("code",{"code-path":"src/components/deploy/CredentialManager.tsx:176:23",className:"text-xs text-[var(--dg-blue)] cursor-pointer font-mono",onClick:F=>{F.stopPropagation(),E(r.env_prefix)},children:r.env_prefix})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:181:21",className:"px-3 py-2.5",children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:182:23",className:"flex items-center gap-1",children:[r.is_active?e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:184:27",className:"bg-green-500/20 text-green-400 text-xs border-0",children:"启用"}):e.jsx(w,{"code-path":"src/components/deploy/CredentialManager.tsx:186:27",className:"bg-red-500/20 text-red-400 text-xs border-0",children:"禁用"}),q&&e.jsxs(w,{"code-path":"src/components/deploy/CredentialManager.tsx:189:27",className:"bg-yellow-500/20 text-yellow-400 text-xs border-0",children:[e.jsx(ba,{"code-path":"src/components/deploy/CredentialManager.tsx:189:96",className:"h-2.5 w-2.5 mr-0.5"}),"过期"]})]})}),e.jsx("td",{"code-path":"src/components/deploy/CredentialManager.tsx:193:21",className:"px-3 py-2.5 text-right",onClick:F=>F.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/deploy/CredentialManager.tsx:194:23",className:"flex justify-end gap-1",children:[e.jsx(N,{"code-path":"src/components/deploy/CredentialManager.tsx:195:25",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{g(r),u(!0)},title:"编辑",children:e.jsx(ja,{"code-path":"src/components/deploy/CredentialManager.tsx:197:27",className:"w-3.5 h-3.5"})}),e.jsx(N,{"code-path":"src/components/deploy/CredentialManager.tsx:199:25",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>O(r),title:r.is_active?"禁用":"启用",children:r.is_active?e.jsx(Xe,{"code-path":"src/components/deploy/CredentialManager.tsx:202:45",className:"w-3.5 h-3.5 text-yellow-500"}):e.jsx(We,{"code-path":"src/components/deploy/CredentialManager.tsx:202:99",className:"w-3.5 h-3.5 text-green-500"})}),e.jsx(N,{"code-path":"src/components/deploy/CredentialManager.tsx:204:25",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>T(r),title:"删除",children:e.jsx(Na,{"code-path":"src/components/deploy/CredentialManager.tsx:206:27",className:"w-3.5 h-3.5"})})]})})]},r.id)})})]})}),e.jsx(_a,{"code-path":"src/components/deploy/CredentialManager.tsx:218:7",open:d,onClose:()=>u(!1),onSaved:()=>k(),editData:x}),e.jsx(wa,{"code-path":"src/components/deploy/CredentialManager.tsx:219:7",open:D,onClose:()=>_(!1),credId:v})]})}export{Oa as default}; diff --git a/backend/static/assets/CronJobManager-Dow5NQrR.js b/backend/static/assets/CronJobManager-DjJMLSuO.js similarity index 97% rename from backend/static/assets/CronJobManager-Dow5NQrR.js rename to backend/static/assets/CronJobManager-DjJMLSuO.js index 29c4bf7..d252412 100644 --- a/backend/static/assets/CronJobManager-Dow5NQrR.js +++ b/backend/static/assets/CronJobManager-DjJMLSuO.js @@ -1,2 +1,2 @@ -import{j as t,r as n}from"./vendor-codemirror-C7mXSpXt.js";import{C as lt,a as dt}from"./card-B-RtdR4H.js";import{S as mt}from"./stat-strip-BPzU38xY.js";import{D as X,a as G,b as K,c as U,d as W,e as xt,B as p,t as l,f as pt}from"./index-LZWfu62c.js";import{I as P}from"./input-BdDauX3U.js";import{B as C}from"./badge-B0F5ZNtn.js";import{C as I}from"./checkbox-DL3onEGv.js";import{s as $,c as y,t as ht}from"./automation-BrmX02Sx.js";import{L as k,a as gt,y as ut,aq as Y,r as Z,R as bt,P as vt,S as yt,T as z,aC as Ct,b as jt,o as Jt,z as B,aD as Nt,aE as ft}from"./vendor-icons-Aso0-eeY.js";import{S as O,a as R,b as A,c as V,d as J}from"./select-4xU_9B3_.js";import{T as q}from"./textarea-BdtIagjy.js";import{L as N}from"./label-u-lNUbKh.js";import{T as Dt,a as Ft,b as L,c as w,d as Mt,e as f}from"./table-BPFYQwjr.js";import"./index-CYARH0Cq.js";function tt(i){switch(i){case"success":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:9:9",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[t.jsx(ut,{"code-path":"src/components/automation/cronJobHelpers.tsx:10:11",className:"h-3 w-3 mr-1"}),"成功"]});case"failed":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:16:9",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[t.jsx(gt,{"code-path":"src/components/automation/cronJobHelpers.tsx:17:11",className:"h-3 w-3 mr-1"}),"失败"]});case"running":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:23:9",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 animate-pulse",children:[t.jsx(k,{"code-path":"src/components/automation/cronJobHelpers.tsx:24:11",className:"h-3 w-3 mr-1 animate-spin"}),"执行中"]});default:return t.jsx(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:30:9",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:"从未执行"})}}function wt(i){return{"0 2 * * *":"每天 02:00","0 3 * * 0":"每周日 03:00","*/5 * * * *":"每 5 分钟","0 * * * *":"每小时","0 9 * * 1":"每周一 09:00"}[i]||i}const Q=[{value:"shell",label:"Shell 脚本",desc:"关联脚本库中的 Shell 脚本"},{value:"python",label:"Python 脚本",desc:"关联脚本库中的 Python 脚本"},{value:"command",label:"自定义命令",desc:"手动输入命令或脚本路径"}];function St({open:i,onOpenChange:g,editJob:s,onSuccess:D}){const[a,d]=n.useState({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),[h,v]=n.useState([]),[r,m]=n.useState(null),[S,F]=n.useState(!1);n.useEffect(()=>{i&&($.getScripts({page_size:200}).then(e=>{v(e?.list||[])}).catch(()=>v([])),s?(d({name:s.name||"",description:s.description||"",cron_expr:s.cron_expr||"",type:s.type||"shell",content:s.content||"",script_id:s.script_id||null}),s.script_id?$.getScript(s.script_id).then(e=>{m(e)}).catch(()=>m(null)):m(null)):(d({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),m(null)))},[i,s]);const M=a.type==="shell"||a.type==="python"?h.filter(e=>e.type===a.type):[],E=e=>{const x=h.find(j=>String(j.id)===e);x&&(m(x),d(j=>({...j,script_id:x.id,content:x.content})))},T=e=>{d(x=>({...x,type:e,script_id:null,content:e==="command"?x.content:""})),m(null)},H=async()=>{if(!a.name||!a.cron_expr){l.error("请填写任务名称和 Cron 表达式");return}if((a.type==="shell"||a.type==="python")&&!a.script_id){l.error("请选择关联的脚本");return}try{F(!0);const e={name:a.name,description:a.description,cron_expr:a.cron_expr,type:a.type,content:a.content,script_id:a.script_id};s?(await y.updateJob(s.id,e),l.success("任务更新成功")):(await y.createJob(e),l.success("任务创建成功")),g(!1),D()}catch(e){console.error("Failed to save cron job:",e),l.error(s?"更新失败":"创建失败")}finally{F(!1)}};return t.jsx(X,{"code-path":"src/components/automation/CronJobFormDialog.tsx:149:5",open:i,onOpenChange:g,children:t.jsxs(G,{"code-path":"src/components/automation/CronJobFormDialog.tsx:150:7",className:"max-w-2xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[t.jsxs(K,{"code-path":"src/components/automation/CronJobFormDialog.tsx:151:9",children:[t.jsx(U,{"code-path":"src/components/automation/CronJobFormDialog.tsx:152:11",children:s?"编辑定时任务":"新建定时任务"}),t.jsx(W,{"code-path":"src/components/automation/CronJobFormDialog.tsx:153:11",className:"text-[var(--dg-text-secondary)]",children:"配置 Cron 定时任务"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:155:9",className:"space-y-4 py-4 max-h-[60vh] overflow-y-auto pr-1",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:157:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:158:13",className:"text-[var(--dg-text-primary)]",children:"任务名称"}),t.jsx(P,{"code-path":"src/components/automation/CronJobFormDialog.tsx:159:13",value:a.name,onChange:e=>d({...a,name:e.target.value}),placeholder:"例如: 数据库备份",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:168:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:169:13",className:"text-[var(--dg-text-primary)]",children:"描述"}),t.jsx(q,{"code-path":"src/components/automation/CronJobFormDialog.tsx:170:13",value:a.description,onChange:e=>d({...a,description:e.target.value}),placeholder:"任务描述...",rows:2,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:180:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:181:13",className:"text-[var(--dg-text-primary)]",children:"Cron 表达式"}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:182:13",className:"flex gap-2",children:[t.jsx(P,{"code-path":"src/components/automation/CronJobFormDialog.tsx:183:15",value:a.cron_expr,onChange:e=>d({...a,cron_expr:e.target.value}),placeholder:"0 2 * * *",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1"}),t.jsxs(O,{"code-path":"src/components/automation/CronJobFormDialog.tsx:189:15",onValueChange:e=>d({...a,cron_expr:e}),children:[t.jsx(R,{"code-path":"src/components/automation/CronJobFormDialog.tsx:190:17",className:"w-48 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1",children:t.jsx(A,{"code-path":"src/components/automation/CronJobFormDialog.tsx:191:19",placeholder:"快速选择"})}),t.jsxs(V,{"code-path":"src/components/automation/CronJobFormDialog.tsx:193:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:194:19",value:"*/5 * * * *",className:"text-[var(--dg-text-primary)]",children:"每 5 分钟"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:195:19",value:"0 * * * *",className:"text-[var(--dg-text-primary)]",children:"每小时"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:196:19",value:"0 2 * * *",className:"text-[var(--dg-text-primary)]",children:"每天 02:00"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:197:19",value:"0 3 * * 0",className:"text-[var(--dg-text-primary)]",children:"每周日 03:00"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:198:19",value:"0 9 * * 1",className:"text-[var(--dg-text-primary)]",children:"每周一 09:00"})]})]})]}),t.jsx("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:202:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"格式: 分 时 日 月 周"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:206:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:207:13",className:"text-[var(--dg-text-primary)]",children:"执行类型"}),t.jsx("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:208:13",className:"grid grid-cols-3 gap-2 mt-1",children:Q.map(e=>t.jsx("button",{"code-path":"src/components/automation/CronJobFormDialog.tsx:210:17",type:"button",onClick:()=>T(e.value),className:`px-3 py-2 rounded-md border text-sm transition-colors text-left ${a.type===e.value?"border-[var(--dg-blue)] bg-[var(--dg-blue)]/10 text-[var(--dg-blue)]":"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-hover)]"}`,children:t.jsx("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:220:19",className:"font-medium",children:e.label})},e.value))}),t.jsx("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:224:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:Q.find(e=>e.value===a.type)?.desc})]}),a.type==="shell"||a.type==="python"?t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:231:13",className:"space-y-3",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:232:15",children:[t.jsxs(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:233:17",className:"text-[var(--dg-text-primary)]",children:["选择脚本 ",t.jsx("span",{"code-path":"src/components/automation/CronJobFormDialog.tsx:234:24",className:"text-red-400",children:"*"})]}),M.length===0?t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:237:19",className:"mt-1 px-3 py-4 rounded-md border border-dashed border-[var(--dg-border)] text-center",children:[t.jsxs("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:238:21",className:"text-sm text-[var(--dg-text-muted)]",children:["脚本库中没有 ",a.type==="shell"?"Shell":"Python"," 脚本"]}),t.jsxs("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:241:21",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:["请先到「脚本库」创建 ",a.type==="shell"?"Shell":"Python"," 脚本"]})]}):t.jsxs(O,{"code-path":"src/components/automation/CronJobFormDialog.tsx:246:19",value:a.script_id?String(a.script_id):"",onValueChange:E,children:[t.jsx(R,{"code-path":"src/components/automation/CronJobFormDialog.tsx:250:21",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1",children:t.jsx(A,{"code-path":"src/components/automation/CronJobFormDialog.tsx:251:23",placeholder:"选择脚本库中的脚本..."})}),t.jsx(V,{"code-path":"src/components/automation/CronJobFormDialog.tsx:253:21",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:M.map(e=>t.jsxs(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:255:25",value:String(e.id),className:"text-[var(--dg-text-primary)]",children:[e.name,e.description?` — ${e.description}`:""]},e.id))})]})]}),r&&t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:266:17",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:267:19",className:"flex items-center gap-2 mb-1",children:[t.jsx(C,{"code-path":"src/components/automation/CronJobFormDialog.tsx:268:21",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:r.type==="shell"?"Shell":"Python"}),t.jsxs("span",{"code-path":"src/components/automation/CronJobFormDialog.tsx:271:21",className:"text-xs text-[var(--dg-text-muted)]",children:[(r.content||"").split(` +import{j as t,r as n}from"./vendor-codemirror-B1SGo4xl.js";import{C as lt,a as dt}from"./card-BHSBTtub.js";import{S as mt}from"./stat-strip-CSMyyoYr.js";import{D as X,a as G,b as K,c as U,d as W,e as xt,B as p,t as l,f as pt}from"./index-Bp-M7P_8.js";import{I as P}from"./input-Bnlm--la.js";import{B as C}from"./badge-B00SZHvE.js";import{C as I}from"./checkbox-Bsb-ZRm9.js";import{s as $,c as y,t as ht}from"./automation-BAtbOw0o.js";import{L as k,a as gt,y as ut,aq as Y,r as Z,R as bt,P as vt,S as yt,T as z,aC as Ct,b as jt,o as Jt,z as B,aD as Nt,aE as ft}from"./vendor-icons-BWk-DH7F.js";import{S as O,a as R,b as A,c as V,d as J}from"./select-DbhcBWnH.js";import{T as q}from"./textarea-BvOVhaCD.js";import{L as N}from"./label-NkONM5Mp.js";import{T as Dt,a as Ft,b as L,c as w,d as Mt,e as f}from"./table-u8V9iTZf.js";import"./index-5FEebgvX.js";function tt(i){switch(i){case"success":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:9:9",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[t.jsx(ut,{"code-path":"src/components/automation/cronJobHelpers.tsx:10:11",className:"h-3 w-3 mr-1"}),"成功"]});case"failed":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:16:9",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[t.jsx(gt,{"code-path":"src/components/automation/cronJobHelpers.tsx:17:11",className:"h-3 w-3 mr-1"}),"失败"]});case"running":return t.jsxs(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:23:9",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 animate-pulse",children:[t.jsx(k,{"code-path":"src/components/automation/cronJobHelpers.tsx:24:11",className:"h-3 w-3 mr-1 animate-spin"}),"执行中"]});default:return t.jsx(C,{"code-path":"src/components/automation/cronJobHelpers.tsx:30:9",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:"从未执行"})}}function wt(i){return{"0 2 * * *":"每天 02:00","0 3 * * 0":"每周日 03:00","*/5 * * * *":"每 5 分钟","0 * * * *":"每小时","0 9 * * 1":"每周一 09:00"}[i]||i}const Q=[{value:"shell",label:"Shell 脚本",desc:"关联脚本库中的 Shell 脚本"},{value:"python",label:"Python 脚本",desc:"关联脚本库中的 Python 脚本"},{value:"command",label:"自定义命令",desc:"手动输入命令或脚本路径"}];function St({open:i,onOpenChange:g,editJob:s,onSuccess:D}){const[a,d]=n.useState({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),[h,v]=n.useState([]),[r,m]=n.useState(null),[S,F]=n.useState(!1);n.useEffect(()=>{i&&($.getScripts({page_size:200}).then(e=>{v(e?.list||[])}).catch(()=>v([])),s?(d({name:s.name||"",description:s.description||"",cron_expr:s.cron_expr||"",type:s.type||"shell",content:s.content||"",script_id:s.script_id||null}),s.script_id?$.getScript(s.script_id).then(e=>{m(e)}).catch(()=>m(null)):m(null)):(d({name:"",description:"",cron_expr:"",type:"shell",content:"",script_id:null}),m(null)))},[i,s]);const M=a.type==="shell"||a.type==="python"?h.filter(e=>e.type===a.type):[],E=e=>{const x=h.find(j=>String(j.id)===e);x&&(m(x),d(j=>({...j,script_id:x.id,content:x.content})))},T=e=>{d(x=>({...x,type:e,script_id:null,content:e==="command"?x.content:""})),m(null)},H=async()=>{if(!a.name||!a.cron_expr){l.error("请填写任务名称和 Cron 表达式");return}if((a.type==="shell"||a.type==="python")&&!a.script_id){l.error("请选择关联的脚本");return}try{F(!0);const e={name:a.name,description:a.description,cron_expr:a.cron_expr,type:a.type,content:a.content,script_id:a.script_id};s?(await y.updateJob(s.id,e),l.success("任务更新成功")):(await y.createJob(e),l.success("任务创建成功")),g(!1),D()}catch(e){console.error("Failed to save cron job:",e),l.error(s?"更新失败":"创建失败")}finally{F(!1)}};return t.jsx(X,{"code-path":"src/components/automation/CronJobFormDialog.tsx:149:5",open:i,onOpenChange:g,children:t.jsxs(G,{"code-path":"src/components/automation/CronJobFormDialog.tsx:150:7",className:"max-w-2xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[t.jsxs(K,{"code-path":"src/components/automation/CronJobFormDialog.tsx:151:9",children:[t.jsx(U,{"code-path":"src/components/automation/CronJobFormDialog.tsx:152:11",children:s?"编辑定时任务":"新建定时任务"}),t.jsx(W,{"code-path":"src/components/automation/CronJobFormDialog.tsx:153:11",className:"text-[var(--dg-text-secondary)]",children:"配置 Cron 定时任务"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:155:9",className:"space-y-4 py-4 max-h-[60vh] overflow-y-auto pr-1",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:157:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:158:13",className:"text-[var(--dg-text-primary)]",children:"任务名称"}),t.jsx(P,{"code-path":"src/components/automation/CronJobFormDialog.tsx:159:13",value:a.name,onChange:e=>d({...a,name:e.target.value}),placeholder:"例如: 数据库备份",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:168:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:169:13",className:"text-[var(--dg-text-primary)]",children:"描述"}),t.jsx(q,{"code-path":"src/components/automation/CronJobFormDialog.tsx:170:13",value:a.description,onChange:e=>d({...a,description:e.target.value}),placeholder:"任务描述...",rows:2,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:180:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:181:13",className:"text-[var(--dg-text-primary)]",children:"Cron 表达式"}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:182:13",className:"flex gap-2",children:[t.jsx(P,{"code-path":"src/components/automation/CronJobFormDialog.tsx:183:15",value:a.cron_expr,onChange:e=>d({...a,cron_expr:e.target.value}),placeholder:"0 2 * * *",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1"}),t.jsxs(O,{"code-path":"src/components/automation/CronJobFormDialog.tsx:189:15",onValueChange:e=>d({...a,cron_expr:e}),children:[t.jsx(R,{"code-path":"src/components/automation/CronJobFormDialog.tsx:190:17",className:"w-48 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1",children:t.jsx(A,{"code-path":"src/components/automation/CronJobFormDialog.tsx:191:19",placeholder:"快速选择"})}),t.jsxs(V,{"code-path":"src/components/automation/CronJobFormDialog.tsx:193:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:194:19",value:"*/5 * * * *",className:"text-[var(--dg-text-primary)]",children:"每 5 分钟"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:195:19",value:"0 * * * *",className:"text-[var(--dg-text-primary)]",children:"每小时"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:196:19",value:"0 2 * * *",className:"text-[var(--dg-text-primary)]",children:"每天 02:00"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:197:19",value:"0 3 * * 0",className:"text-[var(--dg-text-primary)]",children:"每周日 03:00"}),t.jsx(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:198:19",value:"0 9 * * 1",className:"text-[var(--dg-text-primary)]",children:"每周一 09:00"})]})]})]}),t.jsx("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:202:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"格式: 分 时 日 月 周"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:206:11",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:207:13",className:"text-[var(--dg-text-primary)]",children:"执行类型"}),t.jsx("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:208:13",className:"grid grid-cols-3 gap-2 mt-1",children:Q.map(e=>t.jsx("button",{"code-path":"src/components/automation/CronJobFormDialog.tsx:210:17",type:"button",onClick:()=>T(e.value),className:`px-3 py-2 rounded-md border text-sm transition-colors text-left ${a.type===e.value?"border-[var(--dg-blue)] bg-[var(--dg-blue)]/10 text-[var(--dg-blue)]":"border-[var(--dg-border)] text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-hover)]"}`,children:t.jsx("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:220:19",className:"font-medium",children:e.label})},e.value))}),t.jsx("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:224:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:Q.find(e=>e.value===a.type)?.desc})]}),a.type==="shell"||a.type==="python"?t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:231:13",className:"space-y-3",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:232:15",children:[t.jsxs(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:233:17",className:"text-[var(--dg-text-primary)]",children:["选择脚本 ",t.jsx("span",{"code-path":"src/components/automation/CronJobFormDialog.tsx:234:24",className:"text-red-400",children:"*"})]}),M.length===0?t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:237:19",className:"mt-1 px-3 py-4 rounded-md border border-dashed border-[var(--dg-border)] text-center",children:[t.jsxs("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:238:21",className:"text-sm text-[var(--dg-text-muted)]",children:["脚本库中没有 ",a.type==="shell"?"Shell":"Python"," 脚本"]}),t.jsxs("p",{"code-path":"src/components/automation/CronJobFormDialog.tsx:241:21",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:["请先到「脚本库」创建 ",a.type==="shell"?"Shell":"Python"," 脚本"]})]}):t.jsxs(O,{"code-path":"src/components/automation/CronJobFormDialog.tsx:246:19",value:a.script_id?String(a.script_id):"",onValueChange:E,children:[t.jsx(R,{"code-path":"src/components/automation/CronJobFormDialog.tsx:250:21",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1",children:t.jsx(A,{"code-path":"src/components/automation/CronJobFormDialog.tsx:251:23",placeholder:"选择脚本库中的脚本..."})}),t.jsx(V,{"code-path":"src/components/automation/CronJobFormDialog.tsx:253:21",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:M.map(e=>t.jsxs(J,{"code-path":"src/components/automation/CronJobFormDialog.tsx:255:25",value:String(e.id),className:"text-[var(--dg-text-primary)]",children:[e.name,e.description?` — ${e.description}`:""]},e.id))})]})]}),r&&t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:266:17",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:267:19",className:"flex items-center gap-2 mb-1",children:[t.jsx(C,{"code-path":"src/components/automation/CronJobFormDialog.tsx:268:21",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:r.type==="shell"?"Shell":"Python"}),t.jsxs("span",{"code-path":"src/components/automation/CronJobFormDialog.tsx:271:21",className:"text-xs text-[var(--dg-text-muted)]",children:[(r.content||"").split(` `).length," 行"]})]}),t.jsx("pre",{"code-path":"src/components/automation/CronJobFormDialog.tsx:275:19",className:"max-h-48 overflow-auto rounded-md bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] p-3 text-xs font-mono text-[var(--dg-text-secondary)] whitespace-pre-wrap break-all",children:r.content||"(空脚本)"})]})]}):t.jsxs("div",{"code-path":"src/components/automation/CronJobFormDialog.tsx:282:13",children:[t.jsx(N,{"code-path":"src/components/automation/CronJobFormDialog.tsx:283:15",className:"text-[var(--dg-text-primary)]",children:"执行命令"}),t.jsx(q,{"code-path":"src/components/automation/CronJobFormDialog.tsx:284:15",value:a.content,onChange:e=>d({...a,content:e.target.value}),placeholder:"/scripts/backup.sh arg1 arg2",rows:4,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] mt-1 font-mono"})]})]}),t.jsxs(xt,{"code-path":"src/components/automation/CronJobFormDialog.tsx:294:9",children:[t.jsx(p,{"code-path":"src/components/automation/CronJobFormDialog.tsx:295:11",variant:"outline",onClick:()=>g(!1),className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"取消"}),t.jsx(p,{"code-path":"src/components/automation/CronJobFormDialog.tsx:298:11",className:"bg-blue-600 hover:bg-blue-700",onClick:H,disabled:S,children:S?"保存中...":s?"保存修改":"创建任务"})]})]})})}function Et({open:i,onOpenChange:g}){const[s,D]=n.useState([]),[a,d]=n.useState(!1),[h,v]=n.useState(null);return n.useEffect(()=>{if(!i)return;(async()=>{try{d(!0);const m=await ht.getExecutions({task_type:"cron",page_size:50});D(m.list||[])}catch(m){console.error("Failed to load executions:",m)}finally{d(!1)}})()},[i]),t.jsx(X,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:51:5",open:i,onOpenChange:g,children:t.jsxs(G,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:52:7",className:"max-w-4xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] max-h-[85vh] overflow-y-auto",children:[t.jsxs(K,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:53:9",children:[t.jsx(U,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:54:11",children:"执行历史"}),t.jsx(W,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:55:11",className:"text-[var(--dg-text-secondary)]",children:"定时任务执行记录与输出日志"})]}),t.jsx("div",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:57:9",className:"mt-4",children:a?t.jsx("div",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:59:13",className:"flex items-center justify-center py-8",children:t.jsx(k,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:60:15",className:"h-6 w-6 text-[var(--dg-text-secondary)] animate-spin"})}):s.length===0?t.jsxs("div",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:63:13",className:"flex flex-col items-center justify-center py-12 text-[var(--dg-text-secondary)]",children:[t.jsx(Y,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:64:15",className:"h-10 w-10 mb-3 opacity-40"}),t.jsx("p",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:65:15",className:"text-sm",children:"暂无执行记录"})]}):t.jsxs(Dt,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:68:13",children:[t.jsx(Ft,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:69:15",children:t.jsxs(L,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:70:17",className:"border-[var(--dg-border)]",children:[t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:71:19",className:"text-[var(--dg-text-secondary)]",children:"任务"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:72:19",className:"text-[var(--dg-text-secondary)]",children:"状态"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:73:19",className:"text-[var(--dg-text-secondary)]",children:"耗时"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:74:19",className:"text-[var(--dg-text-secondary)]",children:"执行时间"}),t.jsx(w,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:75:19",className:"text-[var(--dg-text-secondary)]",children:"输出"})]})}),t.jsx(Mt,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:78:15",children:s.map(r=>t.jsxs(n.Fragment,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:80:19",children:[t.jsxs(L,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:81:21",className:"border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]/50",onClick:()=>v(h===r.id?null:r.id),children:[t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:82:23",className:"text-[var(--dg-text-primary)]",children:r.task_name}),t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:83:23",children:tt(r.status)}),t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:84:23",className:"text-[var(--dg-text-secondary)]",children:r.duration?`${r.duration}ms`:"--"}),t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:85:23",className:"text-[var(--dg-text-secondary)]",children:r.started_at?new Date(r.started_at).toLocaleString():"--"}),t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:88:23",className:"text-[var(--dg-text-secondary)]",children:r.output?t.jsxs("span",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:90:27",className:"text-blue-400 text-xs flex items-center gap-1",children:[t.jsx(Z,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:91:29",className:"h-3 w-3"}),h===r.id?"收起":"查看"]}):"--"})]}),h===r.id&&r.output&&t.jsx(L,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:100:23",className:"border-[var(--dg-border)]",children:t.jsx(f,{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:101:25",colSpan:5,className:"bg-[var(--dg-bg-tertiary)] p-0",children:t.jsx("pre",{"code-path":"src/components/automation/ExecutionHistoryDialog.tsx:102:27",className:"p-4 text-xs text-[var(--dg-text-primary)] font-mono whitespace-pre-wrap max-h-64 overflow-y-auto",children:r.output})})},`${r.id}-out`)]},r.id))})]})})]})})}function qt(){const[i,g]=n.useState(""),[s,D]=n.useState([]),[a,d]=n.useState(!0),[h,v]=n.useState(!1),[r,m]=n.useState(!1),[S,F]=n.useState(!1),[M,E]=n.useState(null),[T,H]=n.useState(null),[e,x]=n.useState([]),j=pt(),ot=()=>{H(null),m(!0)},et=o=>{H(o),m(!0)},u=n.useCallback(async()=>{v(!0);try{const o=await y.getJobs();D(o.list||[])}catch(o){console.error("Failed to load cron jobs:",o),l.error("加载失败")}finally{v(!1),d(!1)}},[]);n.useEffect(()=>{u()},[u]);const b=s.filter(o=>(o.name||"").toLowerCase().includes(i.toLowerCase())||(o.description||"").toLowerCase().includes(i.toLowerCase())),at=async o=>{try{await y.toggleJob(o),l.success("状态已切换"),u()}catch(c){console.error("Failed to toggle job:",c),l.error("操作失败")}},st=async o=>{E(o);try{const c=await y.executeJob(o);(c?.status||"success")==="success"?l.success("执行成功",{description:`耗时 ${c?.duration||0}ms`}):l.error("执行失败",{description:(c?.output||"").slice(0,100)}),u()}catch(c){console.error("Failed to execute job:",c),l.error("执行失败")}finally{E(null)}},rt=async o=>{if(await j({title:"删除定时任务",description:`确定删除「${o.name}」吗?此操作不可恢复。`,variant:"destructive"}))try{await y.deleteJob(o.id),l.success("任务已删除"),u()}catch(_){console.error("Failed to delete job:",_),l.error("删除失败")}},nt=o=>{x(c=>c.includes(o)?c.filter(_=>_!==o):[...c,o])},ct=()=>{e.length===b.length&&b.length>0?x([]):x(b.map(o=>o.id))},it=async()=>{if(!(e.length===0||!await j({title:"批量删除定时任务",description:`确定删除选中的 ${e.length} 个任务吗?此操作不可恢复。`,confirmText:"批量删除",variant:"destructive"})))try{await y.batchDelete(e),l.success(`已删除 ${e.length} 个任务`),x([]),u()}catch(c){console.error("Failed to batch delete jobs:",c),l.error("批量删除失败")}};return t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:165:5",className:"space-y-6",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:167:7",className:"flex items-center justify-between",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:168:9",children:[t.jsx("h1",{"code-path":"src/components/automation/CronJobManager.tsx:169:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"定时任务"}),t.jsx("p",{"code-path":"src/components/automation/CronJobManager.tsx:170:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"Cron 任务管理与执行"})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:172:9",className:"flex items-center gap-2",children:[t.jsxs(p,{"code-path":"src/components/automation/CronJobManager.tsx:173:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>F(!0),children:[t.jsx(Y,{"code-path":"src/components/automation/CronJobManager.tsx:178:13",className:"h-4 w-4 mr-2"}),"执行历史"]}),t.jsxs(p,{"code-path":"src/components/automation/CronJobManager.tsx:181:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>u(),disabled:h,children:[t.jsx(bt,{"code-path":"src/components/automation/CronJobManager.tsx:187:13",className:`h-4 w-4 mr-2 ${h?"animate-spin":""}`}),"刷新"]}),t.jsxs(p,{"code-path":"src/components/automation/CronJobManager.tsx:190:11",className:"bg-blue-600 hover:bg-blue-700",onClick:ot,children:[t.jsx(vt,{"code-path":"src/components/automation/CronJobManager.tsx:191:13",className:"h-4 w-4 mr-2"}),"新建任务"]})]})]}),t.jsx(mt,{"code-path":"src/components/automation/CronJobManager.tsx:198:7",items:[{label:"任务总数",value:s.length,color:"blue"},{label:"已启用",value:s.filter(o=>o.enabled).length,color:"emerald"},{label:"累计成功",value:s.reduce((o,c)=>o+(c.success_count||0),0),color:"emerald"},{label:"累计失败",value:s.reduce((o,c)=>o+(c.fail_count||0),0),color:"red"}]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:208:7",className:"flex items-center justify-between flex-wrap gap-4",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:209:9",className:"flex items-center gap-3 flex-wrap",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:210:11",className:"relative flex-1 max-w-md",children:[t.jsx(yt,{"code-path":"src/components/automation/CronJobManager.tsx:211:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-secondary)]"}),t.jsx(P,{"code-path":"src/components/automation/CronJobManager.tsx:212:13",placeholder:"搜索任务...",value:i,onChange:o=>g(o.target.value),className:"pl-10 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),b.length>0&&t.jsxs("label",{"code-path":"src/components/automation/CronJobManager.tsx:220:13",className:"flex items-center gap-2 text-sm text-[var(--dg-text-secondary)] cursor-pointer select-none",children:[t.jsx(I,{"code-path":"src/components/automation/CronJobManager.tsx:221:15",checked:e.length===b.length&&b.length>0,onCheckedChange:ct,className:"border-[var(--dg-border)]"}),"全选"]})]}),e.length>0&&t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:233:11",className:"flex items-center gap-2",children:[t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:234:13",className:"text-sm text-[var(--dg-text-secondary)]",children:["已选择 ",e.length," 项"]}),t.jsxs(p,{"code-path":"src/components/automation/CronJobManager.tsx:235:13",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:it,children:[t.jsx(z,{"code-path":"src/components/automation/CronJobManager.tsx:241:15",className:"h-4 w-4 mr-2"}),"批量删除"]})]})]}),a?t.jsx("div",{"code-path":"src/components/automation/CronJobManager.tsx:249:9",className:"flex items-center justify-center py-12",children:t.jsx(k,{"code-path":"src/components/automation/CronJobManager.tsx:250:11",className:"h-6 w-6 text-[var(--dg-text-secondary)] animate-spin"})}):b.length===0?t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:253:9",className:"flex flex-col items-center justify-center py-16 text-[var(--dg-text-secondary)]",children:[t.jsx(Ct,{"code-path":"src/components/automation/CronJobManager.tsx:254:11",className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{"code-path":"src/components/automation/CronJobManager.tsx:255:11",className:"text-sm",children:"暂无定时任务"})]}):null,t.jsx("div",{"code-path":"src/components/automation/CronJobManager.tsx:260:7",className:"space-y-3",children:b.map(o=>t.jsx(lt,{"code-path":"src/components/automation/CronJobManager.tsx:262:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(dt,{"code-path":"src/components/automation/CronJobManager.tsx:263:13",className:"p-4",children:t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:264:15",className:"flex items-start justify-between gap-3",children:[t.jsx("div",{"code-path":"src/components/automation/CronJobManager.tsx:265:17",className:"flex items-center pt-1",children:t.jsx(I,{"code-path":"src/components/automation/CronJobManager.tsx:266:19",checked:e.includes(o.id),onCheckedChange:()=>nt(o.id),className:"border-[var(--dg-border)]"})}),t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:272:17",className:"flex-1 min-w-0",children:[t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:273:19",className:"flex items-center gap-3 flex-wrap",children:[t.jsx("h3",{"code-path":"src/components/automation/CronJobManager.tsx:274:21",className:"font-medium text-[var(--dg-text-primary)]",children:o.name}),t.jsx(C,{"code-path":"src/components/automation/CronJobManager.tsx:275:21",variant:"outline",className:o.enabled?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:o.enabled?"已启用":"已禁用"}),tt(o.last_status),t.jsx(C,{"code-path":"src/components/automation/CronJobManager.tsx:286:21",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:o.type==="shell"?"Shell":o.type==="python"?"Python":"命令"})]}),t.jsx("p",{"code-path":"src/components/automation/CronJobManager.tsx:290:19",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:o.description||"—"}),t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:291:19",className:"flex items-center gap-4 mt-2 text-sm",children:[t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:292:21",className:"flex items-center gap-1 text-[var(--dg-text-secondary)]",children:[t.jsx(jt,{"code-path":"src/components/automation/CronJobManager.tsx:293:23",className:"h-3 w-3"}),wt(o.cron_expr)]}),(o.type==="shell"||o.type==="python")&&o.script?.name?t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:297:23",className:"flex items-center gap-1 text-[var(--dg-text-secondary)]",children:[t.jsx(Jt,{"code-path":"src/components/automation/CronJobManager.tsx:298:25",className:"h-3 w-3"}),t.jsx("span",{"code-path":"src/components/automation/CronJobManager.tsx:299:25",className:"text-xs",children:o.script.name})]}):o.content&&t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:302:23",className:"flex items-center gap-1 text-[var(--dg-text-secondary)]",children:[t.jsx(Z,{"code-path":"src/components/automation/CronJobManager.tsx:303:25",className:"h-3 w-3"}),t.jsx("code",{"code-path":"src/components/automation/CronJobManager.tsx:304:25",className:"text-xs bg-[var(--dg-bg-tertiary)] px-2 py-0.5 rounded truncate max-w-xs",children:o.content})]})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:310:19",className:"flex items-center gap-4 mt-2 text-xs text-[var(--dg-text-muted)]",children:[t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:311:21",children:["上次执行: ",o.last_run_at?new Date(o.last_run_at).toLocaleString():"--"]}),t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:312:21",children:["成功: ",o.success_count||0," / 失败: ",o.fail_count||0]}),t.jsxs("span",{"code-path":"src/components/automation/CronJobManager.tsx:313:21",children:["累计: ",o.run_count||0," 次"]})]})]}),t.jsxs("div",{"code-path":"src/components/automation/CronJobManager.tsx:317:17",className:"flex items-center gap-2 shrink-0",children:[t.jsxs(p,{"code-path":"src/components/automation/CronJobManager.tsx:318:19",variant:"outline",size:"sm",className:"border-emerald-600 text-emerald-400 hover:bg-emerald-600/20",disabled:M===o.id,onClick:()=>st(o.id),children:[M===o.id?t.jsx(k,{"code-path":"src/components/automation/CronJobManager.tsx:326:23",className:"h-4 w-4 mr-1 animate-spin"}):t.jsx(B,{"code-path":"src/components/automation/CronJobManager.tsx:328:23",className:"h-4 w-4 mr-1"}),"立即执行"]}),t.jsx(p,{"code-path":"src/components/automation/CronJobManager.tsx:332:19",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)] hover:text-blue-400",title:o.enabled?"禁用":"启用",onClick:()=>at(o.id),children:o.enabled?t.jsx(Nt,{"code-path":"src/components/automation/CronJobManager.tsx:339:36",className:"h-4 w-4"}):t.jsx(B,{"code-path":"src/components/automation/CronJobManager.tsx:339:68",className:"h-4 w-4"})}),t.jsx(p,{"code-path":"src/components/automation/CronJobManager.tsx:341:19",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)] hover:text-blue-400",title:"编辑",onClick:()=>et(o),children:t.jsx(ft,{"code-path":"src/components/automation/CronJobManager.tsx:348:21",className:"h-4 w-4"})}),t.jsx(p,{"code-path":"src/components/automation/CronJobManager.tsx:350:19",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)] hover:text-red-400",title:"删除",onClick:()=>rt(o),children:t.jsx(z,{"code-path":"src/components/automation/CronJobManager.tsx:357:21",className:"h-4 w-4"})})]})]})})},o.id))}),t.jsx(St,{"code-path":"src/components/automation/CronJobManager.tsx:367:7",open:r,onOpenChange:m,editJob:T,onSuccess:u}),t.jsx(Et,{"code-path":"src/components/automation/CronJobManager.tsx:375:7",open:S,onOpenChange:F})]})}export{qt as CronJobManager}; diff --git a/backend/static/assets/Dashboard-DQzWxW5H.js b/backend/static/assets/Dashboard-DNebnMdf.js similarity index 96% rename from backend/static/assets/Dashboard-DQzWxW5H.js rename to backend/static/assets/Dashboard-DNebnMdf.js index 4a8fb21..ae55056 100644 --- a/backend/static/assets/Dashboard-DQzWxW5H.js +++ b/backend/static/assets/Dashboard-DNebnMdf.js @@ -1,4 +1,4 @@ -import{a as m,g as st,r as R,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{au as K,m as u,i as ie,B as se,q as rt}from"./index-LZWfu62c.js";import{d as he}from"./dashboard-7Sl2aero.js";import{s as Ct}from"./server-BUAZv7ZV.js";import{k as kt}from"./index-Z0O8nAcG.js";import{S as At}from"./stat-strip-BPzU38xY.js";import{C as B,b as U,c as z,d as V,a as q}from"./card-B-RtdR4H.js";import{B as L}from"./badge-B0F5ZNtn.js";import{g as ot,A as Rt,H as wt,az as St,D as Ot,ae as le,l as nt,j as Me,ar as Ke,aG as Pt,h as ct,i as Be,b as _t}from"./vendor-icons-Aso0-eeY.js";import{f as C,r as dt,b as Et,c as it,d as Tt,i as X,e as Ee,p as I,L as T,g as lt,h as Te,j as ht,D as Lt,k as It,l as ae,m as J,S as $t,n as Ft,o as Mt,q as Ue,s as Kt,t as Q,u as Bt,v as Ut,G as zt,w as me,x as Vt,y as pt,z as qt,E as pe,F as ze,H as mt,I as ut,X as Le,Y as Ie,J as Wt,K as Gt,R as Ae,A as Ht,C as xt,T as Re,a as Ne}from"./AreaChart-Czgv4pNk.js";var Zt=["points","className","baseLinePoints","connectNulls"];function ee(){return ee=Object.assign?Object.assign.bind():function(t){for(var a=1;a=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function Yt(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function Ve(t){return ta(t)||ea(t)||Qt(t)||Jt()}function Jt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qt(t,a){if(t){if(typeof t=="string")return we(t,a);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return we(t,a)}}function ea(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ta(t){if(Array.isArray(t))return we(t)}function we(t,a){(a==null||a>t.length)&&(a=t.length);for(var r=0,e=new Array(a);r0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return a.forEach(function(e){qe(e)?r[r.length-1].push(e):r[r.length-1].length>0&&r.push([])}),qe(a[0])&&r[r.length-1].push(a[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},ce=function(a,r){var e=aa(a);r&&(e=[e.reduce(function(n,c){return[].concat(Ve(n),Ve(c))},[])]);var o=e.map(function(n){return n.reduce(function(c,d,l){return"".concat(c).concat(l===0?"M":"L").concat(d.x,",").concat(d.y)},"")}).join("");return e.length===1?"".concat(o,"Z"):o},sa=function(a,r,e){var o=ce(a,e);return"".concat(o.slice(-1)==="Z"?o.slice(0,-1):o,"L").concat(ce(r.reverse(),e).slice(1))},ra=function(a){var r=a.points,e=a.className,o=a.baseLinePoints,n=a.connectNulls,c=Xt(a,Zt);if(!r||!r.length)return null;var d=K("recharts-polygon",e);if(o&&o.length){var l=c.stroke&&c.stroke!=="none",i=sa(r,o,n);return m.createElement("g",{className:d},m.createElement("path",ee({},C(c,!0),{fill:i.slice(-1)==="Z"?c.fill:"none",stroke:"none",d:i})),l?m.createElement("path",ee({},C(c,!0),{fill:"none",d:ce(r,n)})):null,l?m.createElement("path",ee({},C(c,!0),{fill:"none",d:ce(o,n)})):null)}var p=ce(r,n);return m.createElement("path",ee({},C(c,!0),{fill:p.slice(-1)==="Z"?c.fill:"none",className:d,d:p}))},Ce,We;function oa(){if(We)return Ce;We=1;var t=dt(),a=Et(),r=it();function e(o,n){return o&&o.length?t(o,r(n,2),a):void 0}return Ce=e,Ce}var na=oa();const ca=st(na);var ke,Ge;function da(){if(Ge)return ke;Ge=1;var t=dt(),a=it(),r=Tt();function e(o,n){return o&&o.length?t(o,a(n,2),r):void 0}return ke=e,ke}var ia=da();const la=st(ia);var ha=["cx","cy","angle","ticks","axisLine"],pa=["ticks","tick","angle","tickFormatter","stroke"];function re(t){"@babel/helpers - typeof";return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},re(t)}function de(){return de=Object.assign?Object.assign.bind():function(t){for(var a=1;a=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function ma(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function ua(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function Xe(t,a){for(var r=0;rQe?c=o==="outer"?"start":"end":n<-Qe?c=o==="outer"?"end":"start":c="middle",c}},{key:"renderAxisLine",value:function(){var e=this.props,o=e.cx,n=e.cy,c=e.radius,d=e.axisLine,l=e.axisLineType,i=Z(Z({},C(this.props,!1)),{},{fill:"none"},C(d,!1));if(l==="circle")return m.createElement(Lt,Y({className:"recharts-polar-angle-axis-line"},i,{cx:o,cy:n,r:c}));var p=this.props.ticks,x=p.map(function(b){return I(o,n,c,b.coordinate)});return m.createElement(ra,Y({className:"recharts-polar-angle-axis-line"},i,{points:x}))}},{key:"renderTicks",value:function(){var e=this,o=this.props,n=o.ticks,c=o.tick,d=o.tickLine,l=o.tickFormatter,i=o.stroke,p=C(this.props,!1),x=C(c,!1),b=Z(Z({},p),{},{fill:"none"},C(d,!1)),N=n.map(function(f,h){var v=e.getTickLineCoord(f),y=e.getTickTextAnchor(f),j=Z(Z(Z({textAnchor:y},p),{},{stroke:"none",fill:i},x),{},{index:h,payload:f,x:v.x2,y:v.y2});return m.createElement(T,Y({className:K("recharts-polar-angle-axis-tick",lt(c)),key:"tick-".concat(f.coordinate)},Te(e.props,f,h)),d&&m.createElement("line",Y({className:"recharts-polar-angle-axis-tick-line"},b,v)),c&&a.renderTickItem(c,j,l?l(f.value,h):f.value))});return m.createElement(T,{className:"recharts-polar-angle-axis-ticks"},N)}},{key:"render",value:function(){var e=this.props,o=e.ticks,n=e.radius,c=e.axisLine;return n<=0||!o||!o.length?null:m.createElement(T,{className:K("recharts-polar-angle-axis",this.props.className)},c&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(e,o,n){var c;return m.isValidElement(e)?c=m.cloneElement(e,o):X(e)?c=e(o):c=m.createElement(Ee,Y({},o,{className:"recharts-polar-angle-axis-tick-value"}),n),c}}])})(R.PureComponent);je(De,"displayName","PolarAngleAxis");je(De,"axisType","angleAxis");je(De,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var ue;function ne(t){"@babel/helpers - typeof";return ne=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},ne(t)}function te(){return te=Object.assign?Object.assign.bind():function(t){for(var a=1;a0?Mt(k,"paddingAngle",0):0;if(w){var F=Ue(w.endAngle-w.startAngle,k.endAngle-k.startAngle),D=g(g({},k),{},{startAngle:j+_,endAngle:j+F(h)+_});v.push(D),j=D.endAngle}else{var M=k.endAngle,O=k.startAngle,W=Ue(0,M-O),G=W(h),E=g(g({},k),{},{startAngle:j+_,endAngle:j+G+_});v.push(E),j=E.endAngle}}),m.createElement(T,null,e.renderSectorsStatically(v))})}},{key:"attachKeyboardHandlers",value:function(e){var o=this;e.onkeydown=function(n){if(!n.altKey)switch(n.key){case"ArrowLeft":{var c=++o.state.sectorToFocus%o.sectorRefs.length;o.sectorRefs[c].focus(),o.setState({sectorToFocus:c});break}case"ArrowRight":{var d=--o.state.sectorToFocus<0?o.sectorRefs.length-1:o.state.sectorToFocus%o.sectorRefs.length;o.sectorRefs[d].focus(),o.setState({sectorToFocus:d});break}case"Escape":{o.sectorRefs[o.state.sectorToFocus].blur(),o.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var e=this.props,o=e.sectors,n=e.isAnimationActive,c=this.state.prevSectors;return n&&o&&o.length&&(!c||!Kt(c,o))?this.renderSectorsWithAnimation():this.renderSectorsStatically(o)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var e=this,o=this.props,n=o.hide,c=o.sectors,d=o.className,l=o.label,i=o.cx,p=o.cy,x=o.innerRadius,b=o.outerRadius,N=o.isAnimationActive,f=this.state.isAnimationFinished;if(n||!c||!c.length||!Q(i)||!Q(p)||!Q(x)||!Q(b))return null;var h=K("recharts-pie",d);return m.createElement(T,{tabIndex:this.props.rootTabIndex,className:h,ref:function(y){e.pieRef=y}},this.renderSectors(),l&&this.renderLabels(c),ht.renderCallByParent(this.props,null,!1),(!N||f)&&Bt.renderCallByParent(this.props,c,!1))}}],[{key:"getDerivedStateFromProps",value:function(e,o){return o.prevIsAnimationActive!==e.isAnimationActive?{prevIsAnimationActive:e.isAnimationActive,prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:[],isAnimationFinished:!0}:e.isAnimationActive&&e.animationId!==o.prevAnimationId?{prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:o.curSectors,isAnimationFinished:!0}:e.sectors!==o.curSectors?{curSectors:e.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(e,o){return e>o?"start":e=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function Yt(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function Ve(t){return ta(t)||ea(t)||Qt(t)||Jt()}function Jt(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qt(t,a){if(t){if(typeof t=="string")return we(t,a);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return we(t,a)}}function ea(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ta(t){if(Array.isArray(t))return we(t)}function we(t,a){(a==null||a>t.length)&&(a=t.length);for(var r=0,e=new Array(a);r0&&arguments[0]!==void 0?arguments[0]:[],r=[[]];return a.forEach(function(e){qe(e)?r[r.length-1].push(e):r[r.length-1].length>0&&r.push([])}),qe(a[0])&&r[r.length-1].push(a[0]),r[r.length-1].length<=0&&(r=r.slice(0,-1)),r},ce=function(a,r){var e=aa(a);r&&(e=[e.reduce(function(n,c){return[].concat(Ve(n),Ve(c))},[])]);var o=e.map(function(n){return n.reduce(function(c,d,l){return"".concat(c).concat(l===0?"M":"L").concat(d.x,",").concat(d.y)},"")}).join("");return e.length===1?"".concat(o,"Z"):o},sa=function(a,r,e){var o=ce(a,e);return"".concat(o.slice(-1)==="Z"?o.slice(0,-1):o,"L").concat(ce(r.reverse(),e).slice(1))},ra=function(a){var r=a.points,e=a.className,o=a.baseLinePoints,n=a.connectNulls,c=Xt(a,Zt);if(!r||!r.length)return null;var d=K("recharts-polygon",e);if(o&&o.length){var l=c.stroke&&c.stroke!=="none",i=sa(r,o,n);return m.createElement("g",{className:d},m.createElement("path",ee({},C(c,!0),{fill:i.slice(-1)==="Z"?c.fill:"none",stroke:"none",d:i})),l?m.createElement("path",ee({},C(c,!0),{fill:"none",d:ce(r,n)})):null,l?m.createElement("path",ee({},C(c,!0),{fill:"none",d:ce(o,n)})):null)}var p=ce(r,n);return m.createElement("path",ee({},C(c,!0),{fill:p.slice(-1)==="Z"?c.fill:"none",className:d,d:p}))},Ce,We;function oa(){if(We)return Ce;We=1;var t=dt(),a=Et(),r=it();function e(o,n){return o&&o.length?t(o,r(n,2),a):void 0}return Ce=e,Ce}var na=oa();const ca=st(na);var ke,Ge;function da(){if(Ge)return ke;Ge=1;var t=dt(),a=it(),r=Tt();function e(o,n){return o&&o.length?t(o,a(n,2),r):void 0}return ke=e,ke}var ia=da();const la=st(ia);var ha=["cx","cy","angle","ticks","axisLine"],pa=["ticks","tick","angle","tickFormatter","stroke"];function re(t){"@babel/helpers - typeof";return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},re(t)}function de(){return de=Object.assign?Object.assign.bind():function(t){for(var a=1;a=0)&&Object.prototype.propertyIsEnumerable.call(t,e)&&(r[e]=t[e])}return r}function ma(t,a){if(t==null)return{};var r={};for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e)){if(a.indexOf(e)>=0)continue;r[e]=t[e]}return r}function ua(t,a){if(!(t instanceof a))throw new TypeError("Cannot call a class as a function")}function Xe(t,a){for(var r=0;rQe?c=o==="outer"?"start":"end":n<-Qe?c=o==="outer"?"end":"start":c="middle",c}},{key:"renderAxisLine",value:function(){var e=this.props,o=e.cx,n=e.cy,c=e.radius,d=e.axisLine,l=e.axisLineType,i=Z(Z({},C(this.props,!1)),{},{fill:"none"},C(d,!1));if(l==="circle")return m.createElement(Lt,Y({className:"recharts-polar-angle-axis-line"},i,{cx:o,cy:n,r:c}));var p=this.props.ticks,x=p.map(function(b){return I(o,n,c,b.coordinate)});return m.createElement(ra,Y({className:"recharts-polar-angle-axis-line"},i,{points:x}))}},{key:"renderTicks",value:function(){var e=this,o=this.props,n=o.ticks,c=o.tick,d=o.tickLine,l=o.tickFormatter,i=o.stroke,p=C(this.props,!1),x=C(c,!1),b=Z(Z({},p),{},{fill:"none"},C(d,!1)),N=n.map(function(f,h){var v=e.getTickLineCoord(f),y=e.getTickTextAnchor(f),j=Z(Z(Z({textAnchor:y},p),{},{stroke:"none",fill:i},x),{},{index:h,payload:f,x:v.x2,y:v.y2});return m.createElement(T,Y({className:K("recharts-polar-angle-axis-tick",lt(c)),key:"tick-".concat(f.coordinate)},Te(e.props,f,h)),d&&m.createElement("line",Y({className:"recharts-polar-angle-axis-tick-line"},b,v)),c&&a.renderTickItem(c,j,l?l(f.value,h):f.value))});return m.createElement(T,{className:"recharts-polar-angle-axis-ticks"},N)}},{key:"render",value:function(){var e=this.props,o=e.ticks,n=e.radius,c=e.axisLine;return n<=0||!o||!o.length?null:m.createElement(T,{className:K("recharts-polar-angle-axis",this.props.className)},c&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(e,o,n){var c;return m.isValidElement(e)?c=m.cloneElement(e,o):X(e)?c=e(o):c=m.createElement(Ee,Y({},o,{className:"recharts-polar-angle-axis-tick-value"}),n),c}}])})(A.PureComponent);je(De,"displayName","PolarAngleAxis");je(De,"axisType","angleAxis");je(De,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var ue;function ne(t){"@babel/helpers - typeof";return ne=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},ne(t)}function te(){return te=Object.assign?Object.assign.bind():function(t){for(var a=1;a0?Mt(k,"paddingAngle",0):0;if(w){var F=Ue(w.endAngle-w.startAngle,k.endAngle-k.startAngle),D=g(g({},k),{},{startAngle:j+_,endAngle:j+F(h)+_});v.push(D),j=D.endAngle}else{var M=k.endAngle,O=k.startAngle,W=Ue(0,M-O),G=W(h),E=g(g({},k),{},{startAngle:j+_,endAngle:j+G+_});v.push(E),j=E.endAngle}}),m.createElement(T,null,e.renderSectorsStatically(v))})}},{key:"attachKeyboardHandlers",value:function(e){var o=this;e.onkeydown=function(n){if(!n.altKey)switch(n.key){case"ArrowLeft":{var c=++o.state.sectorToFocus%o.sectorRefs.length;o.sectorRefs[c].focus(),o.setState({sectorToFocus:c});break}case"ArrowRight":{var d=--o.state.sectorToFocus<0?o.sectorRefs.length-1:o.state.sectorToFocus%o.sectorRefs.length;o.sectorRefs[d].focus(),o.setState({sectorToFocus:d});break}case"Escape":{o.sectorRefs[o.state.sectorToFocus].blur(),o.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var e=this.props,o=e.sectors,n=e.isAnimationActive,c=this.state.prevSectors;return n&&o&&o.length&&(!c||!Kt(c,o))?this.renderSectorsWithAnimation():this.renderSectorsStatically(o)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var e=this,o=this.props,n=o.hide,c=o.sectors,d=o.className,l=o.label,i=o.cx,p=o.cy,x=o.innerRadius,b=o.outerRadius,N=o.isAnimationActive,f=this.state.isAnimationFinished;if(n||!c||!c.length||!Q(i)||!Q(p)||!Q(x)||!Q(b))return null;var h=K("recharts-pie",d);return m.createElement(T,{tabIndex:this.props.rootTabIndex,className:h,ref:function(y){e.pieRef=y}},this.renderSectors(),l&&this.renderLabels(c),ht.renderCallByParent(this.props,null,!1),(!N||f)&&Bt.renderCallByParent(this.props,c,!1))}}],[{key:"getDerivedStateFromProps",value:function(e,o){return o.prevIsAnimationActive!==e.isAnimationActive?{prevIsAnimationActive:e.isAnimationActive,prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:[],isAnimationFinished:!0}:e.isAnimationActive&&e.animationId!==o.prevAnimationId?{prevAnimationId:e.animationId,curSectors:e.sectors,prevSectors:o.curSectors,isAnimationFinished:!0}:e.sectors!==o.curSectors?{curSectors:e.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(e,o){return e>o?"start":e=360?j:j-1)*l,S=v-j*N-k,w=o.reduce(function(D,M){var O=J(M,y,0);return D+(Q(O)?O:0)},0),_;if(w>0){var F;_=o.map(function(D,M){var O=J(D,y,0),W=J(D,p,M),G=(Q(O)?O:0)/w,E;M?E=F.endAngle+me(h)*l*(O!==0?1:0):E=c;var A=E+me(h)*((O!==0?N:0)+G*S),$e=(E+A)/2,Fe=(f.innerRadius+f.outerRadius)/2,Dt=[{name:W,value:O,payload:D,dataKey:y,type:b}],Nt=I(f.cx,f.cy,Fe,$e);return F=g(g(g({percent:G,cornerRadius:n,name:W,tooltipPayload:Dt,midAngle:$e,middleRadius:Fe,tooltipPosition:Nt},D),f),{},{value:J(D,y),startAngle:E,endAngle:A,payload:D,paddingAngle:me(h)*l}),F})}return g(g({},f),{},{sectors:_,data:o})});var Ia=mt({chartName:"BarChart",GraphicalChild:ut,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Le},{axisType:"yAxis",AxisComp:Ie}],formatAxisMap:Wt}),$a=mt({chartName:"PieChart",GraphicalChild:$,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:De},{axisType:"radiusAxis",AxisComp:ye}],formatAxisMap:Gt,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const Fa={阿里云:"#ff6a00",aliyun:"#ff6a00",AWS:"#ff9900",aws:"#ff9900",腾讯云:"#006eff",tencent:"#006eff",华为云:"#ff0000",huawei:"#ff0000",Azure:"#0078d4",azure:"#0078d4"},at=["#ff6a00","#ff9900","#006eff","#ff0000","#0078d4","#10b981","#a855f7","#ec4899"];function Ma(t){if(!t||t.length<2)return{pct:0,label:"暂无数据",direction:"neutral"};const a=Number(t[t.length-1].cost??0),r=Number(t[t.length-2].cost??0);if(r===0)return{pct:0,label:a>0?"新增费用":"持平",direction:"neutral"};const e=(a-r)/r*100,o=e>.05?"up":e<-.05?"down":"neutral",n=`${e>0?"+":""}${e.toFixed(1)}% 较上月`;return{pct:e,label:n,direction:o}}function Ka(t,a,r,e=24){const o=[];for(let n=e-1;n>=0;n--){const c=new Date(Date.now()-n*60*60*1e3);o.push({time:`${c.getHours().toString().padStart(2,"0")}:00`,cpu:Number(Math.max(0,Math.min(100,t+(Math.random()-.5)*15)).toFixed(1)),memory:Number(Math.max(0,Math.min(100,a+(Math.random()-.5)*10)).toFixed(1)),disk:Number(Math.max(0,Math.min(100,r+(Math.random()-.5)*5)).toFixed(1))})}return o}function Ba(t,a){if(!t||t.length===0)return[];const r={};for(const e of t){const o=e.timestamp;if(!o)continue;const c=`${new Date(o).getHours().toString().padStart(2,"0")}:00`;r[c]||(r[c]={}),e.name==="cpu"&&(r[c].cpu=Number(e.value)||0),e.name==="memory"&&(r[c].memory=Number(e.value)||0)}return Object.entries(r).sort((e,o)=>e[0].localeCompare(o[0])).map(([e,o])=>({time:e,cpu:Number((o.cpu??0).toFixed(1)),memory:Number((o.memory??0).toFixed(1)),disk:Number(a.toFixed(1))}))}function _e({active:t,payload:a,label:r}){return!t||!a?null:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:94:5",className:"chart-tooltip px-3 py-2",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:95:7",className:"text-xs font-medium mb-1.5",style:{color:"var(--dg-text-secondary)"},children:r}),a.map((e,o)=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:97:9",className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:98:11",className:"w-2 h-2 rounded-full",style:{backgroundColor:e.color}}),s.jsxs("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:99:11",style:{color:"var(--dg-text-muted)"},children:[e.name,":"]}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:100:11",className:"font-medium",style:{color:"var(--dg-text-primary)"},children:typeof e.value=="number"?`${e.value}%`:e.value})]},o))]})}function Ua({costStats:t}){const a=t?.cloud_costs??[],r=t?.month_trend??[],e=a.map((d,l)=>({name:d.cloud,value:d.cost,color:Fa[d.cloud]||at[l%at.length]})),o=r.map(d=>({month:d.month,cost:d.cost})),n=t?.total_cost??e.reduce((d,l)=>d+l.value,0),c=Ma(r);return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardCharts.tsx:123:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardCharts.tsx:124:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:125:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:126:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardCharts.tsx:127:13",className:"text-[var(--dg-text-primary)]",children:"云成本概览"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardCharts.tsx:128:13",className:"text-[var(--dg-text-muted)]",children:"本月各云平台费用支出"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:130:11",className:"text-right",children:[s.jsxs("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:131:13",className:"text-2xl font-bold text-[var(--dg-text-primary)] tracking-tight",children:["¥",Number(n).toLocaleString()]}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:134:13",className:u("text-xs font-medium mt-0.5",c.direction==="up"?"text-[var(--dg-green)]":c.direction==="down"?"text-[var(--dg-red)]":"text-[var(--dg-text-muted)]"),children:c.label})]})]})}),s.jsxs(q,{"code-path":"src/components/dashboard/DashboardCharts.tsx:145:7",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:146:9",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:147:11",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:148:13",className:"text-sm text-[var(--dg-text-secondary)] mb-2",children:"费用分布"}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:149:13",className:"h-[180px]",children:s.jsx(Ae,{"code-path":"src/components/dashboard/DashboardCharts.tsx:150:15",width:"100%",height:"100%",children:s.jsxs($a,{"code-path":"src/components/dashboard/DashboardCharts.tsx:151:17",children:[s.jsx($,{"code-path":"src/components/dashboard/DashboardCharts.tsx:152:19",data:e,cx:"50%",cy:"50%",innerRadius:40,outerRadius:70,paddingAngle:2,dataKey:"value",stroke:"none",children:e.map((d,l)=>s.jsx(pt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:163:23",fill:d.color},`cell-${l}`))}),s.jsx(Re,{"code-path":"src/components/dashboard/DashboardCharts.tsx:166:19",content:s.jsx(_e,{"code-path":"src/components/dashboard/DashboardCharts.tsx:166:37"})})]})})})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:171:11",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:172:13",className:"text-sm text-[var(--dg-text-secondary)] mb-2",children:"月度趋势"}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:173:13",className:"h-[180px]",children:s.jsx(Ae,{"code-path":"src/components/dashboard/DashboardCharts.tsx:174:15",width:"100%",height:"100%",children:s.jsxs(Ia,{"code-path":"src/components/dashboard/DashboardCharts.tsx:175:17",data:o,margin:{top:5,right:5,left:0,bottom:5},children:[s.jsx(xt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:176:19",strokeDasharray:"3 3",className:"chart-grid-stroke",stroke:"var(--chart-grid)"}),s.jsx(Le,{"code-path":"src/components/dashboard/DashboardCharts.tsx:177:19",dataKey:"month",stroke:"var(--chart-axis)",fontSize:10,tickLine:!1,axisLine:!1}),s.jsx(Ie,{"code-path":"src/components/dashboard/DashboardCharts.tsx:178:19",stroke:"var(--chart-axis)",fontSize:10,tickLine:!1,axisLine:!1}),s.jsx(Re,{"code-path":"src/components/dashboard/DashboardCharts.tsx:179:19",content:s.jsx(_e,{"code-path":"src/components/dashboard/DashboardCharts.tsx:179:37"})}),s.jsx(ut,{"code-path":"src/components/dashboard/DashboardCharts.tsx:180:19",dataKey:"cost",fill:"var(--dg-blue)",radius:[4,4,0,0]})]})})})]})]}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:186:9",className:"mt-4 space-y-2",children:e.map(d=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:188:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:189:15",className:"flex items-center gap-2",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:190:17",className:"w-3 h-3 rounded-full",style:{backgroundColor:d.color}}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:191:17",className:"text-sm text-[var(--dg-text-secondary)]",children:d.name})]}),s.jsxs("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:193:15",className:"text-sm font-semibold text-[var(--dg-text-primary)]",children:["¥",Number(d.value).toLocaleString()]})]},d.name))})]})]})}function za({topUsage:t}){const a=(t?.cpu??[]).slice(0,5),r=(t?.memory??[]).slice(0,5),e=(t?.disk??[]).slice(0,5),o=(n,c,d,l,i)=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:215:5",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:216:7",className:"flex items-center gap-2 mb-3",children:[l,s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:218:9",className:"text-sm font-semibold text-[var(--dg-text-secondary)]",children:i})]}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:220:7",className:"space-y-2.5",children:n.map((p,x)=>{const b=Number(p.usage??0);return s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:224:13",className:"flex items-center gap-2.5",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:225:15",className:"text-xs font-mono text-[var(--dg-text-muted)] w-5 text-center",children:x+1}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:228:15",className:"flex-1 min-w-0",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:229:17",className:"text-xs text-[var(--dg-text-secondary)] truncate font-medium",children:p.hostname}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:230:17",className:"flex items-center gap-2 mt-1",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:231:19",className:"flex-1 h-1.5 bg-[var(--dg-bg-tertiary)] rounded-full overflow-hidden",children:s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:232:21",className:u("h-full rounded-full transition-all duration-500",b>80?"bg-[var(--dg-red)]":b>60?"bg-[var(--dg-yellow)]":d),style:{width:`${Math.min(b,100)}%`}})}),s.jsxs("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:240:19",className:u("text-xs font-mono font-medium w-12 text-right",b>80?"text-[var(--dg-red)]":b>60?"text-[var(--dg-yellow)]":"text-[var(--dg-text-muted)]"),children:[b.toFixed(1),"%"]})]})]})]},p.id??x)})})]});return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardCharts.tsx:256:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardCharts.tsx:257:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:258:9",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardCharts.tsx:259:11",className:"text-[var(--dg-text-primary)]",children:"Top5 资源使用"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardCharts.tsx:260:11",className:"text-[var(--dg-text-muted)]",children:"CPU、内存、磁盘使用率最高"})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardCharts.tsx:263:7",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:264:9",className:"grid grid-cols-3 gap-4",children:[o(a,"blue","bg-[var(--dg-blue)]",s.jsx(ot,{"code-path":"src/components/dashboard/DashboardCharts.tsx:265:69",className:"h-4 w-4 text-[var(--dg-blue)]"}),"CPU"),o(r,"emerald","bg-[var(--dg-green)]",s.jsx(St,{"code-path":"src/components/dashboard/DashboardCharts.tsx:266:76",className:"h-4 w-4 text-[var(--dg-green)]"}),"内存"),o(e,"purple","bg-[var(--dg-purple)]",s.jsx(Ot,{"code-path":"src/components/dashboard/DashboardCharts.tsx:267:74",className:"h-4 w-4 text-[var(--dg-purple)]"}),"磁盘")]})})]})}function Va({avgCpu:t,avgMemory:a,avgDisk:r,metrics:e}){const o=Ba(e??[],r),n=o.length>0?o:Ka(t,a,r,24);return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardCharts.tsx:289:5",className:"dg-card",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardCharts.tsx:290:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:291:9",className:"flex items-center justify-between flex-wrap gap-3",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:292:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardCharts.tsx:293:13",className:"text-[var(--dg-text-primary)]",children:"资源使用率趋势"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardCharts.tsx:294:13",className:"text-[var(--dg-text-muted)]",children:"过去24小时系统资源使用情况"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:296:11",className:"flex items-center gap-2",children:[s.jsxs(L,{"code-path":"src/components/dashboard/DashboardCharts.tsx:297:13",variant:"outline",className:"dg-badge-blue border",children:[s.jsx(ot,{"code-path":"src/components/dashboard/DashboardCharts.tsx:298:15",className:"h-3 w-3 mr-1"}),"CPU"]}),s.jsxs(L,{"code-path":"src/components/dashboard/DashboardCharts.tsx:301:13",variant:"outline",className:"dg-badge-green border",children:[s.jsx(Rt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:302:15",className:"h-3 w-3 mr-1"}),"内存"]}),s.jsxs(L,{"code-path":"src/components/dashboard/DashboardCharts.tsx:305:13",variant:"outline",className:"dg-badge-purple border",children:[s.jsx(wt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:306:15",className:"h-3 w-3 mr-1"}),"磁盘"]})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardCharts.tsx:312:7",children:s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:313:9",className:"h-[280px]",children:s.jsx(Ae,{"code-path":"src/components/dashboard/DashboardCharts.tsx:314:11",width:"100%",height:"100%",children:s.jsxs(Ht,{"code-path":"src/components/dashboard/DashboardCharts.tsx:315:13",data:n,margin:{top:10,right:10,left:0,bottom:0},children:[s.jsxs("defs",{"code-path":"src/components/dashboard/DashboardCharts.tsx:316:15",children:[s.jsxs("linearGradient",{"code-path":"src/components/dashboard/DashboardCharts.tsx:317:17",id:"colorCpu",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:318:19",offset:"5%",stopColor:"var(--dg-blue)",stopOpacity:.3}),s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:319:19",offset:"95%",stopColor:"var(--dg-blue)",stopOpacity:0})]}),s.jsxs("linearGradient",{"code-path":"src/components/dashboard/DashboardCharts.tsx:321:17",id:"colorMemory",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:322:19",offset:"5%",stopColor:"var(--dg-green)",stopOpacity:.3}),s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:323:19",offset:"95%",stopColor:"var(--dg-green)",stopOpacity:0})]}),s.jsxs("linearGradient",{"code-path":"src/components/dashboard/DashboardCharts.tsx:325:17",id:"colorDisk",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:326:19",offset:"5%",stopColor:"var(--dg-purple)",stopOpacity:.3}),s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:327:19",offset:"95%",stopColor:"var(--dg-purple)",stopOpacity:0})]})]}),s.jsx(xt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:330:15",strokeDasharray:"3 3",stroke:"var(--chart-grid)"}),s.jsx(Le,{"code-path":"src/components/dashboard/DashboardCharts.tsx:331:15",dataKey:"time",stroke:"var(--chart-axis)",fontSize:12,tickLine:!1,axisLine:!1}),s.jsx(Ie,{"code-path":"src/components/dashboard/DashboardCharts.tsx:332:15",stroke:"var(--chart-axis)",fontSize:12,tickLine:!1,axisLine:!1,unit:"%"}),s.jsx(Re,{"code-path":"src/components/dashboard/DashboardCharts.tsx:333:15",content:s.jsx(_e,{"code-path":"src/components/dashboard/DashboardCharts.tsx:333:33"})}),s.jsx(Ne,{"code-path":"src/components/dashboard/DashboardCharts.tsx:334:15",type:"monotone",dataKey:"cpu",stroke:"var(--dg-blue)",fillOpacity:1,fill:"url(#colorCpu)",strokeWidth:2,name:"CPU"}),s.jsx(Ne,{"code-path":"src/components/dashboard/DashboardCharts.tsx:335:15",type:"monotone",dataKey:"memory",stroke:"var(--dg-green)",fillOpacity:1,fill:"url(#colorMemory)",strokeWidth:2,name:"内存"}),s.jsx(Ne,{"code-path":"src/components/dashboard/DashboardCharts.tsx:336:15",type:"monotone",dataKey:"disk",stroke:"var(--dg-purple)",fillOpacity:1,fill:"url(#colorDisk)",strokeWidth:2,name:"磁盘"})]})})})})]})}function qa({severity:t}){return s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:31:5",className:u("w-2 h-2 rounded-full flex-shrink-0 mt-1.5",t==="critical"&&"bg-[var(--dg-red)]",t==="warning"&&"bg-[var(--dg-yellow)]",t==="info"&&"bg-[var(--dg-blue)]")})}function Wa({severity:t}){return s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:45:5",variant:"outline",className:u("text-xs font-medium",t==="critical"&&"dg-badge-red border",t==="warning"&&"dg-badge-yellow border",t==="info"&&"dg-badge-blue border"),children:t==="critical"?"严重":t==="warning"?"警告":"提示"})}function Ga({alerts:t}){const a=ie(),r=t.filter(e=>e.status==="firing").slice(0,8);return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:64:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:65:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:66:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:67:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:68:13",className:"text-[var(--dg-text-primary)]",children:"告警消息"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:69:13",className:"text-[var(--dg-text-muted)]",children:"最近触发的告警事件"})]}),s.jsxs(se,{"code-path":"src/components/dashboard/DashboardRecent.tsx:71:11",variant:"ghost",size:"sm",className:"dg-btn-ghost text-xs",onClick:()=>a("/alerts"),children:["查看全部",s.jsx(le,{"code-path":"src/components/dashboard/DashboardRecent.tsx:78:13",className:"h-3.5 w-3.5 ml-1"})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:82:7",children:s.jsx(rt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:83:9",className:"h-[320px] scrollbar-thin",children:r.length===0?s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:85:13",className:"flex flex-col items-center justify-center py-12 text-[var(--dg-text-muted)]",children:[s.jsx(nt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:86:15",className:"h-10 w-10 mb-3 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:87:15",className:"text-sm",children:"暂无告警事件"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:88:15",className:"text-xs mt-1 opacity-60",children:"所有系统运行正常"})]}):s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:91:13",className:"space-y-1.5 pr-2",children:r.map(e=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:93:17",className:"flex items-start gap-3 p-3 rounded-lg bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200 cursor-pointer group",onClick:()=>a("/alert-center"),children:[s.jsx(qa,{"code-path":"src/components/dashboard/DashboardRecent.tsx:98:19",severity:e.severity||"info"}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:99:19",className:"flex-1 min-w-0",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:100:21",className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:101:23",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:e.rule_name}),s.jsx(Wa,{"code-path":"src/components/dashboard/DashboardRecent.tsx:104:23",severity:e.severity||"info"})]}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:106:21",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:e.target}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:107:21",className:"text-xs text-[var(--dg-text-muted)]/70 line-clamp-1",children:e.message})]}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:109:19",className:"text-[11px] text-[var(--dg-text-muted)]/50 whitespace-nowrap flex-shrink-0",children:e.created_at?new Date(e.created_at).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):""})]},e.id))})})})]})}function Ha({expCerts:t}){const a=(t??[]).map(o=>({...o,daysUntilExpiry:o.days_until_expiry??Math.ceil((new Date(o.expire_date).getTime()-Date.now())/864e5)})).sort((o,n)=>o.daysUntilExpiry-n.daysUntilExpiry),r=a.filter(o=>o.daysUntilExpiry<30).length,e=a.filter(o=>o.daysUntilExpiry>=30&&o.daysUntilExpiry<60).length;return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:134:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:135:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:136:9",className:"flex items-center justify-between flex-wrap gap-2",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:137:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:138:13",className:"text-[var(--dg-text-primary)]",children:"证书到期提醒"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:139:13",className:"text-[var(--dg-text-muted)]",children:"SSL证书到期时间监控"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:141:11",className:"flex items-center gap-2",children:[r>0&&s.jsxs(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:143:15",className:"dg-badge-red border",children:[s.jsx(nt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:144:17",className:"h-3 w-3 mr-1"}),r," 即将过期"]}),e>0&&s.jsxs(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:149:15",className:"dg-badge-yellow border",children:[e," 30天内过期"]})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:156:7",children:s.jsx(rt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:157:9",className:"h-[280px] scrollbar-thin",children:a.length===0?s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:159:13",className:"flex flex-col items-center justify-center py-10 text-[var(--dg-text-muted)]",children:[s.jsx(Me,{"code-path":"src/components/dashboard/DashboardRecent.tsx:160:15",className:"h-10 w-10 mb-3 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:161:15",className:"text-sm",children:"暂无证书数据"})]}):s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:164:13",className:"space-y-1.5 pr-2",children:a.map(o=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:166:17",className:"flex items-center justify-between p-3 rounded-lg bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:170:19",className:"flex items-center gap-3 min-w-0",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:171:21",className:u("w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",o.daysUntilExpiry<30?"bg-[var(--dg-red)]/10":o.daysUntilExpiry<60?"bg-[var(--dg-yellow)]/10":"bg-[var(--dg-green)]/10"),children:s.jsx(Me,{"code-path":"src/components/dashboard/DashboardRecent.tsx:179:23",className:u("h-4 w-4",o.daysUntilExpiry<30?"text-[var(--dg-red)]":o.daysUntilExpiry<60?"text-[var(--dg-yellow)]":"text-[var(--dg-green)]")})}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:186:21",className:"min-w-0",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:187:23",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:o.name}),s.jsxs("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:188:23",className:"text-xs text-[var(--dg-text-muted)]",children:["到期: ",o.expire_date?.substring(0,10)]})]})]}),s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:191:19",variant:"outline",className:u("text-xs flex-shrink-0",o.daysUntilExpiry<30?"dg-badge-red border":o.daysUntilExpiry<60?"dg-badge-yellow border":"dg-badge-green border"),children:o.daysUntilExpiry<0?"已过期":`${o.daysUntilExpiry} 天`})]},o.id))})})})]})}function Za({releases:t}){const a=ie(),r=t?.slice(0,5)??[];return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:217:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:218:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:219:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:220:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:221:13",className:"text-[var(--dg-text-primary)]",children:"发布历史"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:222:13",className:"text-[var(--dg-text-muted)]",children:"今日应用发布记录"})]}),s.jsxs(se,{"code-path":"src/components/dashboard/DashboardRecent.tsx:224:11",variant:"ghost",size:"sm",className:"dg-btn-ghost text-xs",onClick:()=>a("/pipelines"),children:["查看全部",s.jsx(le,{"code-path":"src/components/dashboard/DashboardRecent.tsx:231:13",className:"h-3.5 w-3.5 ml-1"})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:235:7",children:r.length===0?s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:237:11",className:"flex flex-col items-center justify-center py-10 text-[var(--dg-text-muted)]",children:[s.jsx(Ke,{"code-path":"src/components/dashboard/DashboardRecent.tsx:238:13",className:"h-10 w-10 mb-3 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:239:13",className:"text-sm",children:"暂无发布记录"})]}):s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:242:11",className:"space-y-2",children:r.map(e=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:244:15",className:"flex items-center gap-3 p-3 rounded-lg bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:248:17",className:u("w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",e.status==="success"?"bg-[var(--dg-green)]/10":e.status==="failed"?"bg-[var(--dg-red)]/10":e.status==="deploying"?"bg-[var(--dg-blue)]/10":"bg-[var(--dg-yellow)]/10"),children:s.jsx(Ke,{"code-path":"src/components/dashboard/DashboardRecent.tsx:257:19",className:u("h-4 w-4",e.status==="success"?"text-[var(--dg-green)]":e.status==="failed"?"text-[var(--dg-red)]":e.status==="deploying"?"text-[var(--dg-blue)]":"text-[var(--dg-yellow)]")})}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:265:17",className:"flex-1 min-w-0",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:266:19",className:"flex items-center gap-2",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:267:21",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:e.app_name}),s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:268:21",variant:"outline",className:"text-xs border-[var(--dg-border)] text-[var(--dg-text-muted)] flex-shrink-0",children:e.version})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:272:19",className:"flex items-center gap-2 mt-0.5",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:273:21",className:"text-xs text-[var(--dg-text-muted)]",children:e.environment}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:274:21",className:"text-xs text-[var(--dg-border)]",children:"·"}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:275:21",className:"text-xs text-[var(--dg-text-muted)] truncate",children:e.commit_id})]})]}),s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:278:17",variant:"outline",className:u("text-xs flex-shrink-0",e.status==="success"?"dg-badge-green border":e.status==="failed"?"dg-badge-red border":e.status==="deploying"?"dg-badge-blue border":"dg-badge-yellow border"),children:e.status==="success"?"成功":e.status==="failed"?"失败":e.status==="deploying"?"发布中":e.status==="rolled_back"?"已回滚":"构建中"})]},e.id))})})]})}function Xa({servers:t}){const a=ie(),r=t.filter(n=>n.status==="running").length,e=t.filter(n=>n.status==="stopped").length,o=t.filter(n=>n.status==="maintenance").length;return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:309:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:310:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:311:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:312:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:313:13",className:"text-[var(--dg-text-primary)]",children:"服务器状态"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:314:13",className:"text-[var(--dg-text-muted)]",children:"服务器运行状态分布"})]}),s.jsxs(se,{"code-path":"src/components/dashboard/DashboardRecent.tsx:316:11",variant:"ghost",size:"sm",className:"dg-btn-ghost text-xs",onClick:()=>a("/servers"),children:["查看全部",s.jsx(le,{"code-path":"src/components/dashboard/DashboardRecent.tsx:323:13",className:"h-3.5 w-3.5 ml-1"})]})]})}),s.jsxs(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:327:7",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:329:9",className:"grid grid-cols-3 gap-3 mb-4",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:330:11",className:"text-center p-3 rounded-xl bg-[var(--dg-green)]/8 border border-[var(--dg-green)]/15",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:331:13",className:"text-2xl font-bold text-[var(--dg-green)]",children:r}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:332:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"运行中"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:334:11",className:"text-center p-3 rounded-xl bg-[var(--dg-yellow)]/8 border border-[var(--dg-yellow)]/15",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:335:13",className:"text-2xl font-bold text-[var(--dg-yellow)]",children:o}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:336:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"维护中"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:338:11",className:"text-center p-3 rounded-xl bg-[var(--dg-text-muted)]/8 border border-[var(--dg-border)]",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:339:13",className:"text-2xl font-bold text-[var(--dg-text-muted)]",children:e}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:340:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"已停止"})]})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:345:9",className:"space-y-1.5",children:[t.slice(0,4).map(n=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:347:13",className:"flex items-center gap-3 p-2.5 rounded-lg bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200",children:[s.jsx(Pt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:351:15",className:u("h-2.5 w-2.5 flex-shrink-0 fill-current",n.status==="running"?"text-[var(--dg-green)]":n.status==="maintenance"?"text-[var(--dg-yellow)]":"text-[var(--dg-text-muted)]")}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:359:15",className:"flex-1 min-w-0",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:360:17",className:"text-sm text-[var(--dg-text-primary)] truncate",children:n.hostname}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:361:17",className:"text-xs text-[var(--dg-text-muted)]",children:n.ip})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:363:15",className:"text-right flex-shrink-0",children:[s.jsxs("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:364:17",className:"text-xs text-[var(--dg-text-muted)]",children:["CPU ",s.jsxs("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:365:23",className:"text-[var(--dg-text-secondary)] font-medium",children:[Number(n.cpu_usage??0).toFixed(1),"%"]})]}),s.jsxs("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:367:17",className:"text-xs text-[var(--dg-text-muted)]",children:["内存 ",s.jsxs("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:368:22",className:"text-[var(--dg-text-secondary)] font-medium",children:[Number(n.memory_usage??0).toFixed(1),"%"]})]})]})]},n.id)),t.length===0&&s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:374:13",className:"flex flex-col items-center justify-center py-6 text-[var(--dg-text-muted)]",children:[s.jsx(ct,{"code-path":"src/components/dashboard/DashboardRecent.tsx:375:15",className:"h-8 w-8 mb-2 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:376:15",className:"text-sm",children:"暂无服务器"})]})]})]})]})}function Ya({clusters:t}){const a=ie();return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:389:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:390:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:391:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:392:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:393:13",className:"text-[var(--dg-text-primary)]",children:"Kubernetes 集群"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:394:13",className:"text-[var(--dg-text-muted)]",children:"Kubernetes集群健康状态"})]}),s.jsxs(se,{"code-path":"src/components/dashboard/DashboardRecent.tsx:396:11",variant:"ghost",size:"sm",className:"dg-btn-ghost text-xs",onClick:()=>a("/kubernetes"),children:["查看全部",s.jsx(le,{"code-path":"src/components/dashboard/DashboardRecent.tsx:403:13",className:"h-3.5 w-3.5 ml-1"})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:407:7",children:t.length===0?s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:409:11",className:"flex flex-col items-center justify-center py-10 text-[var(--dg-text-muted)]",children:[s.jsx(Be,{"code-path":"src/components/dashboard/DashboardRecent.tsx:410:13",className:"h-10 w-10 mb-3 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:411:13",className:"text-sm",children:"暂无集群数据"})]}):s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:414:11",className:"space-y-3",children:t.map(r=>{const e=Number(r.cpu_usage??0),o=Number(r.memory_usage??0);return s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:419:17",className:"p-3.5 rounded-xl bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200 cursor-pointer",onClick:()=>a(`/kubernetes/${r.code||r.id}`),children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:424:19",className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:425:21",className:"flex items-center gap-2.5",children:[s.jsx(Be,{"code-path":"src/components/dashboard/DashboardRecent.tsx:426:23",className:"h-4.5 w-4.5 text-[var(--dg-blue)]"}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:427:23",className:"text-sm font-semibold text-[var(--dg-text-primary)]",children:r.name})]}),s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:429:21",variant:"outline",className:u("text-xs",r.status==="healthy"?"dg-badge-green border":r.status==="warning"?"dg-badge-yellow border":"dg-badge-red border"),children:r.status==="healthy"?"健康":r.status==="warning"?"警告":"异常"})]}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:441:19",className:"grid grid-cols-4 gap-2 text-center",children:[{label:"节点",value:r.node_count??0},{label:"Pod",value:r.pod_count??0},{label:"CPU",value:`${e.toFixed(1)}%`},{label:"内存",value:`${o.toFixed(1)}%`}].map(n=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:448:23",className:"p-1.5 rounded-lg bg-[var(--dg-bg-primary)]/50",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:449:25",className:"text-sm font-semibold text-[var(--dg-text-primary)]",children:n.value}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:450:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5",children:n.label})]},n.label))})]},r.id)})})})]})}function xe({variant:t="card",className:a}){const r="dg-skeleton";return t==="stat"?s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:22:7",className:u("dg-card p-6 space-y-4",a),children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:23:9",className:"flex items-start justify-between",children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:24:11",className:"space-y-3 flex-1",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:25:13",className:u("h-4 w-24 rounded",r)}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:26:13",className:u("h-8 w-16 rounded",r)})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:28:11",className:u("h-10 w-10 rounded-lg",r)})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:30:9",className:u("h-3 w-32 rounded",r)})]}):t==="chart"?s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:37:7",className:u("dg-card p-6 space-y-4",a),children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:38:9",className:"space-y-2",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:39:11",className:u("h-5 w-32 rounded",r)}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:40:11",className:u("h-3 w-48 rounded",r)})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:42:9",className:u("h-[200px] rounded-lg",r)})]}):t==="table"?s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:49:7",className:u("dg-card overflow-hidden",a),children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:51:9",className:"flex items-center gap-4 p-4 border-b border-[var(--dg-border)]",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:52:11",className:u("h-4 w-8 rounded",r)}),Array.from({length:6}).map((e,o)=>s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:54:13",className:u("h-4 flex-1 rounded",r)},o))]}),Array.from({length:5}).map((e,o)=>s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:59:11",className:"flex items-center gap-4 p-4 border-b border-[var(--dg-border)] last:border-0",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:60:13",className:u("h-4 w-8 rounded",r)}),Array.from({length:6}).map((n,c)=>s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:62:15",className:u("h-4 flex-1 rounded",r)},c))]},o))]}):s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:72:5",className:u("dg-card p-6 space-y-4",a),children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:73:7",className:"space-y-2",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:74:9",className:u("h-5 w-40 rounded",r)}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:75:9",className:u("h-3 w-56 rounded",r)})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:77:7",className:"space-y-3",children:Array.from({length:4}).map((e,o)=>s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:79:11",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:80:13",className:u("h-8 w-8 rounded-lg",r)}),s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:81:13",className:"flex-1 space-y-2",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:82:15",className:u("h-3 w-full rounded",r)}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:83:15",className:u("h-3 w-2/3 rounded",r)})]})]},o))})]})}function Ja({count:t=4}){return s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:97:5",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:Array.from({length:t}).map((a,r)=>s.jsx(xe,{"code-path":"src/components/layout/SkeletonCard.tsx:99:9",variant:"stat"},r))})}function Qa(){return s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:110:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:112:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:113:9",className:"space-y-2",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:114:11",className:"dg-skeleton h-7 w-24 rounded"}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:115:11",className:"dg-skeleton h-4 w-48 rounded"})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:117:9",className:"dg-skeleton h-9 w-20 rounded-lg"})]}),s.jsx(Ja,{"code-path":"src/components/layout/SkeletonCard.tsx:121:7",count:4}),s.jsx(xe,{"code-path":"src/components/layout/SkeletonCard.tsx:124:7",variant:"chart"}),s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:127:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[s.jsx(xe,{"code-path":"src/components/layout/SkeletonCard.tsx:128:9",variant:"list"}),s.jsx(xe,{"code-path":"src/components/layout/SkeletonCard.tsx:129:9",variant:"list"})]})]})}function ls(){const t=ie(),[a,r]=R.useState(!0),[e,o]=R.useState(!1),[n,c]=R.useState(null),[d,l]=R.useState([]),[i,p]=R.useState([]),[x,b]=R.useState([]),[N,f]=R.useState([]),[h,v]=R.useState([]),[y,j]=R.useState([]),k=R.useCallback(async()=>{o(!0);try{const[D,M,O,W,G,E]=await Promise.all([he.getStats().catch(A=>(console.error("Failed to fetch dashboard stats:",A),null)),Ct.getServers({page:1,page_size:100}).catch(A=>(console.error("Failed to fetch servers:",A),null)),kt.getClusters().catch(A=>(console.error("Failed to fetch k8s clusters:",A),null)),he.getAlerts(10).catch(A=>(console.error("Failed to fetch dashboard alerts:",A),null)),he.getReleases(5).catch(A=>(console.error("Failed to fetch dashboard releases:",A),null)),he.getMetrics(6).catch(A=>(console.error("Failed to fetch metrics:",A),[]))]);c(D),l(M?.list??[]),p(O?.list??[]),b(Array.isArray(W)?W:[]),f(Array.isArray(G)?G:[]),v(D?.expiring_certs??[]),j(Array.isArray(E)?E:[])}catch(D){console.error("Failed to load dashboard data:",D)}finally{o(!1),r(!1)}},[]);if(R.useEffect(()=>{k();const D=setInterval(k,5e3);return()=>clearInterval(D)},[k]),a)return s.jsx(Qa,{"code-path":"src/components/dashboard/Dashboard.tsx:94:12"});const S=n?.server_stats,w=n?.kubernetes_stats,_=n?.alert_stats,F=n?.cost_stats;return s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:103:5",className:"dg-page",children:[s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:105:7",className:"dg-page-header",children:[s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:106:9",children:[s.jsx("h1",{"code-path":"src/components/dashboard/Dashboard.tsx:107:11",className:"dg-page-title",children:"仪表盘"}),s.jsxs("p",{"code-path":"src/components/dashboard/Dashboard.tsx:108:11",className:"dg-page-subtitle",children:["实时监控和运维概览 · 最后更新: ",new Date().toLocaleTimeString("zh-CN")]})]}),s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:110:9",className:"dg-page-actions",children:[s.jsxs(se,{"code-path":"src/components/dashboard/Dashboard.tsx:111:11",variant:"outline",className:"dg-btn-secondary",onClick:k,disabled:e,children:[s.jsx(_t,{"code-path":"src/components/dashboard/Dashboard.tsx:117:13",className:u("h-4 w-4",e&&"animate-spin")}),e?"刷新中":"刷新"]}),s.jsxs(se,{"code-path":"src/components/dashboard/Dashboard.tsx:120:11",className:"dg-btn-primary",onClick:()=>t("/servers"),children:[s.jsx(ct,{"code-path":"src/components/dashboard/Dashboard.tsx:124:13",className:"h-4 w-4"}),"服务器",s.jsx(le,{"code-path":"src/components/dashboard/Dashboard.tsx:126:13",className:"h-3.5 w-3.5"})]})]})]}),s.jsx("div",{"code-path":"src/components/dashboard/Dashboard.tsx:132:7",className:"animate-fade-in-delay-1",children:s.jsx(At,{"code-path":"src/components/dashboard/Dashboard.tsx:133:9",items:[{label:"服务器",value:S?.total??0,color:"blue"},{label:"运行中",value:S?.running??0,color:"emerald"},{label:"K8s 集群",value:w?.total??0,color:"purple"},{label:"健康集群",value:w?.healthy??0,color:"cyan"},{label:"告警",value:_?.firing??0,color:_?.firing>0?"red":"muted"},{label:"严重",value:_?.critical??0,color:"red"},{label:"本月成本",value:`¥${Number(F?.month_cost??0).toLocaleString()}`,color:"amber"}]})}),s.jsx("div",{"code-path":"src/components/dashboard/Dashboard.tsx:147:7",className:"animate-fade-in-delay-2",children:s.jsx(Va,{"code-path":"src/components/dashboard/Dashboard.tsx:148:9",avgCpu:Number(S?.avg_cpu??0),avgMemory:Number(S?.avg_memory??0),avgDisk:Number(S?.avg_disk??0),metrics:y})}),s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:157:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-6 animate-fade-in-delay-3",children:[s.jsx(Ua,{"code-path":"src/components/dashboard/Dashboard.tsx:158:9",costStats:F}),s.jsx(za,{"code-path":"src/components/dashboard/Dashboard.tsx:159:9",topUsage:n?.top_resource_usage})]}),s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:163:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-6 animate-fade-in-delay-3",children:[s.jsx(Ga,{"code-path":"src/components/dashboard/Dashboard.tsx:164:9",alerts:x}),s.jsx(Ha,{"code-path":"src/components/dashboard/Dashboard.tsx:165:9",expCerts:h})]}),s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:169:7",className:"grid grid-cols-1 lg:grid-cols-3 gap-6 animate-fade-in-delay-4",children:[s.jsx(Za,{"code-path":"src/components/dashboard/Dashboard.tsx:170:9",releases:N}),s.jsx(Xa,{"code-path":"src/components/dashboard/Dashboard.tsx:171:9",servers:d}),s.jsx(Ya,{"code-path":"src/components/dashboard/Dashboard.tsx:172:9",clusters:i})]})]})}export{ls as Dashboard}; + the props "valueKey" will be deprecated in 1.1.0`),y=x);var j=o.filter(function(D){return J(D,y,0)!==0}).length,k=(v>=360?j:j-1)*l,S=v-j*N-k,w=o.reduce(function(D,M){var O=J(M,y,0);return D+(Q(O)?O:0)},0),_;if(w>0){var F;_=o.map(function(D,M){var O=J(D,y,0),W=J(D,p,M),G=(Q(O)?O:0)/w,E;M?E=F.endAngle+me(h)*l*(O!==0?1:0):E=c;var R=E+me(h)*((O!==0?N:0)+G*S),$e=(E+R)/2,Fe=(f.innerRadius+f.outerRadius)/2,Dt=[{name:W,value:O,payload:D,dataKey:y,type:b}],Nt=I(f.cx,f.cy,Fe,$e);return F=g(g(g({percent:G,cornerRadius:n,name:W,tooltipPayload:Dt,midAngle:$e,middleRadius:Fe,tooltipPosition:Nt},D),f),{},{value:J(D,y),startAngle:E,endAngle:R,payload:D,paddingAngle:me(h)*l}),F})}return g(g({},f),{},{sectors:_,data:o})});var Ia=mt({chartName:"BarChart",GraphicalChild:ut,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:Le},{axisType:"yAxis",AxisComp:Ie}],formatAxisMap:Wt}),$a=mt({chartName:"PieChart",GraphicalChild:$,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:De},{axisType:"radiusAxis",AxisComp:ye}],formatAxisMap:Gt,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const Fa={阿里云:"#ff6a00",aliyun:"#ff6a00",AWS:"#ff9900",aws:"#ff9900",腾讯云:"#006eff",tencent:"#006eff",华为云:"#ff0000",huawei:"#ff0000",Azure:"#0078d4",azure:"#0078d4"},at=["#ff6a00","#ff9900","#006eff","#ff0000","#0078d4","#10b981","#a855f7","#ec4899"];function Ma(t){if(!t||t.length<2)return{pct:0,label:"暂无数据",direction:"neutral"};const a=Number(t[t.length-1].cost??0),r=Number(t[t.length-2].cost??0);if(r===0)return{pct:0,label:a>0?"新增费用":"持平",direction:"neutral"};const e=(a-r)/r*100,o=e>.05?"up":e<-.05?"down":"neutral",n=`${e>0?"+":""}${e.toFixed(1)}% 较上月`;return{pct:e,label:n,direction:o}}function Ka(t,a,r,e=24){const o=[];for(let n=e-1;n>=0;n--){const c=new Date(Date.now()-n*60*60*1e3);o.push({time:`${c.getHours().toString().padStart(2,"0")}:00`,cpu:Number(Math.max(0,Math.min(100,t+(Math.random()-.5)*15)).toFixed(1)),memory:Number(Math.max(0,Math.min(100,a+(Math.random()-.5)*10)).toFixed(1)),disk:Number(Math.max(0,Math.min(100,r+(Math.random()-.5)*5)).toFixed(1))})}return o}function Ba(t,a){if(!t||t.length===0)return[];const r={};for(const e of t){const o=e.timestamp;if(!o)continue;const c=`${new Date(o).getHours().toString().padStart(2,"0")}:00`;r[c]||(r[c]={}),e.name==="cpu"&&(r[c].cpu=Number(e.value)||0),e.name==="memory"&&(r[c].memory=Number(e.value)||0)}return Object.entries(r).sort((e,o)=>e[0].localeCompare(o[0])).map(([e,o])=>({time:e,cpu:Number((o.cpu??0).toFixed(1)),memory:Number((o.memory??0).toFixed(1)),disk:Number(a.toFixed(1))}))}function _e({active:t,payload:a,label:r}){return!t||!a?null:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:94:5",className:"chart-tooltip px-3 py-2",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:95:7",className:"text-xs font-medium mb-1.5",style:{color:"var(--dg-text-secondary)"},children:r}),a.map((e,o)=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:97:9",className:"flex items-center gap-2 text-xs",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:98:11",className:"w-2 h-2 rounded-full",style:{backgroundColor:e.color}}),s.jsxs("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:99:11",style:{color:"var(--dg-text-muted)"},children:[e.name,":"]}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:100:11",className:"font-medium",style:{color:"var(--dg-text-primary)"},children:typeof e.value=="number"?`${e.value}%`:e.value})]},o))]})}function Ua({costStats:t}){const a=t?.cloud_costs??[],r=t?.month_trend??[],e=a.map((d,l)=>({name:d.cloud,value:d.cost,color:Fa[d.cloud]||at[l%at.length]})),o=r.map(d=>({month:d.month,cost:d.cost})),n=t?.total_cost??e.reduce((d,l)=>d+l.value,0),c=Ma(r);return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardCharts.tsx:123:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardCharts.tsx:124:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:125:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:126:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardCharts.tsx:127:13",className:"text-[var(--dg-text-primary)]",children:"云成本概览"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardCharts.tsx:128:13",className:"text-[var(--dg-text-muted)]",children:"本月各云平台费用支出"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:130:11",className:"text-right",children:[s.jsxs("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:131:13",className:"text-2xl font-bold text-[var(--dg-text-primary)] tracking-tight",children:["¥",Number(n).toLocaleString()]}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:134:13",className:u("text-xs font-medium mt-0.5",c.direction==="up"?"text-[var(--dg-green)]":c.direction==="down"?"text-[var(--dg-red)]":"text-[var(--dg-text-muted)]"),children:c.label})]})]})}),s.jsxs(q,{"code-path":"src/components/dashboard/DashboardCharts.tsx:145:7",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:146:9",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:147:11",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:148:13",className:"text-sm text-[var(--dg-text-secondary)] mb-2",children:"费用分布"}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:149:13",className:"h-[180px]",children:s.jsx(Re,{"code-path":"src/components/dashboard/DashboardCharts.tsx:150:15",width:"100%",height:"100%",children:s.jsxs($a,{"code-path":"src/components/dashboard/DashboardCharts.tsx:151:17",children:[s.jsx($,{"code-path":"src/components/dashboard/DashboardCharts.tsx:152:19",data:e,cx:"50%",cy:"50%",innerRadius:40,outerRadius:70,paddingAngle:2,dataKey:"value",stroke:"none",children:e.map((d,l)=>s.jsx(pt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:163:23",fill:d.color},`cell-${l}`))}),s.jsx(Ae,{"code-path":"src/components/dashboard/DashboardCharts.tsx:166:19",content:s.jsx(_e,{"code-path":"src/components/dashboard/DashboardCharts.tsx:166:37"})})]})})})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:171:11",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:172:13",className:"text-sm text-[var(--dg-text-secondary)] mb-2",children:"月度趋势"}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:173:13",className:"h-[180px]",children:s.jsx(Re,{"code-path":"src/components/dashboard/DashboardCharts.tsx:174:15",width:"100%",height:"100%",children:s.jsxs(Ia,{"code-path":"src/components/dashboard/DashboardCharts.tsx:175:17",data:o,margin:{top:5,right:5,left:0,bottom:5},children:[s.jsx(xt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:176:19",strokeDasharray:"3 3",className:"chart-grid-stroke",stroke:"var(--chart-grid)"}),s.jsx(Le,{"code-path":"src/components/dashboard/DashboardCharts.tsx:177:19",dataKey:"month",stroke:"var(--chart-axis)",fontSize:10,tickLine:!1,axisLine:!1}),s.jsx(Ie,{"code-path":"src/components/dashboard/DashboardCharts.tsx:178:19",stroke:"var(--chart-axis)",fontSize:10,tickLine:!1,axisLine:!1}),s.jsx(Ae,{"code-path":"src/components/dashboard/DashboardCharts.tsx:179:19",content:s.jsx(_e,{"code-path":"src/components/dashboard/DashboardCharts.tsx:179:37"})}),s.jsx(ut,{"code-path":"src/components/dashboard/DashboardCharts.tsx:180:19",dataKey:"cost",fill:"var(--dg-blue)",radius:[4,4,0,0]})]})})})]})]}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:186:9",className:"mt-4 space-y-2",children:e.map(d=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:188:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:189:15",className:"flex items-center gap-2",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:190:17",className:"w-3 h-3 rounded-full",style:{backgroundColor:d.color}}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:191:17",className:"text-sm text-[var(--dg-text-secondary)]",children:d.name})]}),s.jsxs("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:193:15",className:"text-sm font-semibold text-[var(--dg-text-primary)]",children:["¥",Number(d.value).toLocaleString()]})]},d.name))})]})]})}function za({topUsage:t}){const a=(t?.cpu??[]).slice(0,5),r=(t?.memory??[]).slice(0,5),e=(t?.disk??[]).slice(0,5),o=(n,c,d,l,i)=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:215:5",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:216:7",className:"flex items-center gap-2 mb-3",children:[l,s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:218:9",className:"text-sm font-semibold text-[var(--dg-text-secondary)]",children:i})]}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:220:7",className:"space-y-2.5",children:n.map((p,x)=>{const b=Number(p.usage??0);return s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:224:13",className:"flex items-center gap-2.5",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:225:15",className:"text-xs font-mono text-[var(--dg-text-muted)] w-5 text-center",children:x+1}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:228:15",className:"flex-1 min-w-0",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardCharts.tsx:229:17",className:"text-xs text-[var(--dg-text-secondary)] truncate font-medium",children:p.hostname}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:230:17",className:"flex items-center gap-2 mt-1",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:231:19",className:"flex-1 h-1.5 bg-[var(--dg-bg-tertiary)] rounded-full overflow-hidden",children:s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:232:21",className:u("h-full rounded-full transition-all duration-500",b>80?"bg-[var(--dg-red)]":b>60?"bg-[var(--dg-yellow)]":d),style:{width:`${Math.min(b,100)}%`}})}),s.jsxs("span",{"code-path":"src/components/dashboard/DashboardCharts.tsx:240:19",className:u("text-xs font-mono font-medium w-12 text-right",b>80?"text-[var(--dg-red)]":b>60?"text-[var(--dg-yellow)]":"text-[var(--dg-text-muted)]"),children:[b.toFixed(1),"%"]})]})]})]},p.id??x)})})]});return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardCharts.tsx:256:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardCharts.tsx:257:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:258:9",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardCharts.tsx:259:11",className:"text-[var(--dg-text-primary)]",children:"Top5 资源使用"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardCharts.tsx:260:11",className:"text-[var(--dg-text-muted)]",children:"CPU、内存、磁盘使用率最高"})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardCharts.tsx:263:7",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:264:9",className:"grid grid-cols-3 gap-4",children:[o(a,"blue","bg-[var(--dg-blue)]",s.jsx(ot,{"code-path":"src/components/dashboard/DashboardCharts.tsx:265:69",className:"h-4 w-4 text-[var(--dg-blue)]"}),"CPU"),o(r,"emerald","bg-[var(--dg-green)]",s.jsx(St,{"code-path":"src/components/dashboard/DashboardCharts.tsx:266:76",className:"h-4 w-4 text-[var(--dg-green)]"}),"内存"),o(e,"purple","bg-[var(--dg-purple)]",s.jsx(Ot,{"code-path":"src/components/dashboard/DashboardCharts.tsx:267:74",className:"h-4 w-4 text-[var(--dg-purple)]"}),"磁盘")]})})]})}function Va({avgCpu:t,avgMemory:a,avgDisk:r,metrics:e}){const o=Ba(e??[],r),n=o.length>0?o:Ka(t,a,r,24);return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardCharts.tsx:289:5",className:"dg-card",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardCharts.tsx:290:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:291:9",className:"flex items-center justify-between flex-wrap gap-3",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:292:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardCharts.tsx:293:13",className:"text-[var(--dg-text-primary)]",children:"资源使用率趋势"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardCharts.tsx:294:13",className:"text-[var(--dg-text-muted)]",children:"过去24小时系统资源使用情况"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:296:11",className:"flex items-center gap-2",children:[s.jsxs(L,{"code-path":"src/components/dashboard/DashboardCharts.tsx:297:13",variant:"outline",className:"dg-badge-blue border",children:[s.jsx(ot,{"code-path":"src/components/dashboard/DashboardCharts.tsx:298:15",className:"h-3 w-3 mr-1"}),"CPU"]}),s.jsxs(L,{"code-path":"src/components/dashboard/DashboardCharts.tsx:301:13",variant:"outline",className:"dg-badge-green border",children:[s.jsx(At,{"code-path":"src/components/dashboard/DashboardCharts.tsx:302:15",className:"h-3 w-3 mr-1"}),"内存"]}),s.jsxs(L,{"code-path":"src/components/dashboard/DashboardCharts.tsx:305:13",variant:"outline",className:"dg-badge-purple border",children:[s.jsx(wt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:306:15",className:"h-3 w-3 mr-1"}),"磁盘"]})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardCharts.tsx:312:7",children:s.jsx("div",{"code-path":"src/components/dashboard/DashboardCharts.tsx:313:9",className:"h-[280px]",children:s.jsx(Re,{"code-path":"src/components/dashboard/DashboardCharts.tsx:314:11",width:"100%",height:"100%",children:s.jsxs(Ht,{"code-path":"src/components/dashboard/DashboardCharts.tsx:315:13",data:n,margin:{top:10,right:10,left:0,bottom:0},children:[s.jsxs("defs",{"code-path":"src/components/dashboard/DashboardCharts.tsx:316:15",children:[s.jsxs("linearGradient",{"code-path":"src/components/dashboard/DashboardCharts.tsx:317:17",id:"colorCpu",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:318:19",offset:"5%",stopColor:"var(--dg-blue)",stopOpacity:.3}),s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:319:19",offset:"95%",stopColor:"var(--dg-blue)",stopOpacity:0})]}),s.jsxs("linearGradient",{"code-path":"src/components/dashboard/DashboardCharts.tsx:321:17",id:"colorMemory",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:322:19",offset:"5%",stopColor:"var(--dg-green)",stopOpacity:.3}),s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:323:19",offset:"95%",stopColor:"var(--dg-green)",stopOpacity:0})]}),s.jsxs("linearGradient",{"code-path":"src/components/dashboard/DashboardCharts.tsx:325:17",id:"colorDisk",x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:326:19",offset:"5%",stopColor:"var(--dg-purple)",stopOpacity:.3}),s.jsx("stop",{"code-path":"src/components/dashboard/DashboardCharts.tsx:327:19",offset:"95%",stopColor:"var(--dg-purple)",stopOpacity:0})]})]}),s.jsx(xt,{"code-path":"src/components/dashboard/DashboardCharts.tsx:330:15",strokeDasharray:"3 3",stroke:"var(--chart-grid)"}),s.jsx(Le,{"code-path":"src/components/dashboard/DashboardCharts.tsx:331:15",dataKey:"time",stroke:"var(--chart-axis)",fontSize:12,tickLine:!1,axisLine:!1}),s.jsx(Ie,{"code-path":"src/components/dashboard/DashboardCharts.tsx:332:15",stroke:"var(--chart-axis)",fontSize:12,tickLine:!1,axisLine:!1,unit:"%"}),s.jsx(Ae,{"code-path":"src/components/dashboard/DashboardCharts.tsx:333:15",content:s.jsx(_e,{"code-path":"src/components/dashboard/DashboardCharts.tsx:333:33"})}),s.jsx(Ne,{"code-path":"src/components/dashboard/DashboardCharts.tsx:334:15",type:"monotone",dataKey:"cpu",stroke:"var(--dg-blue)",fillOpacity:1,fill:"url(#colorCpu)",strokeWidth:2,name:"CPU"}),s.jsx(Ne,{"code-path":"src/components/dashboard/DashboardCharts.tsx:335:15",type:"monotone",dataKey:"memory",stroke:"var(--dg-green)",fillOpacity:1,fill:"url(#colorMemory)",strokeWidth:2,name:"内存"}),s.jsx(Ne,{"code-path":"src/components/dashboard/DashboardCharts.tsx:336:15",type:"monotone",dataKey:"disk",stroke:"var(--dg-purple)",fillOpacity:1,fill:"url(#colorDisk)",strokeWidth:2,name:"磁盘"})]})})})})]})}function qa({severity:t}){return s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:31:5",className:u("w-2 h-2 rounded-full flex-shrink-0 mt-1.5",t==="critical"&&"bg-[var(--dg-red)]",t==="warning"&&"bg-[var(--dg-yellow)]",t==="info"&&"bg-[var(--dg-blue)]")})}function Wa({severity:t}){return s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:45:5",variant:"outline",className:u("text-xs font-medium",t==="critical"&&"dg-badge-red border",t==="warning"&&"dg-badge-yellow border",t==="info"&&"dg-badge-blue border"),children:t==="critical"?"严重":t==="warning"?"警告":"提示"})}function Ga({alerts:t}){const a=ie(),r=t.filter(e=>e.status==="firing").slice(0,8);return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:64:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:65:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:66:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:67:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:68:13",className:"text-[var(--dg-text-primary)]",children:"告警消息"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:69:13",className:"text-[var(--dg-text-muted)]",children:"最近触发的告警事件"})]}),s.jsxs(se,{"code-path":"src/components/dashboard/DashboardRecent.tsx:71:11",variant:"ghost",size:"sm",className:"dg-btn-ghost text-xs",onClick:()=>a("/alerts"),children:["查看全部",s.jsx(le,{"code-path":"src/components/dashboard/DashboardRecent.tsx:78:13",className:"h-3.5 w-3.5 ml-1"})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:82:7",children:s.jsx(rt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:83:9",className:"h-[320px] scrollbar-thin",children:r.length===0?s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:85:13",className:"flex flex-col items-center justify-center py-12 text-[var(--dg-text-muted)]",children:[s.jsx(nt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:86:15",className:"h-10 w-10 mb-3 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:87:15",className:"text-sm",children:"暂无告警事件"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:88:15",className:"text-xs mt-1 opacity-60",children:"所有系统运行正常"})]}):s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:91:13",className:"space-y-1.5 pr-2",children:r.map(e=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:93:17",className:"flex items-start gap-3 p-3 rounded-lg bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200 cursor-pointer group",onClick:()=>a("/alert-center"),children:[s.jsx(qa,{"code-path":"src/components/dashboard/DashboardRecent.tsx:98:19",severity:e.severity||"info"}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:99:19",className:"flex-1 min-w-0",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:100:21",className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:101:23",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:e.rule_name}),s.jsx(Wa,{"code-path":"src/components/dashboard/DashboardRecent.tsx:104:23",severity:e.severity||"info"})]}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:106:21",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:e.target}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:107:21",className:"text-xs text-[var(--dg-text-muted)]/70 line-clamp-1",children:e.message})]}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:109:19",className:"text-[11px] text-[var(--dg-text-muted)]/50 whitespace-nowrap flex-shrink-0",children:e.created_at?new Date(e.created_at).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):""})]},e.id))})})})]})}function Ha({expCerts:t}){const a=(t??[]).map(o=>({...o,daysUntilExpiry:o.days_until_expiry??Math.ceil((new Date(o.expire_date).getTime()-Date.now())/864e5)})).sort((o,n)=>o.daysUntilExpiry-n.daysUntilExpiry),r=a.filter(o=>o.daysUntilExpiry<30).length,e=a.filter(o=>o.daysUntilExpiry>=30&&o.daysUntilExpiry<60).length;return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:134:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:135:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:136:9",className:"flex items-center justify-between flex-wrap gap-2",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:137:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:138:13",className:"text-[var(--dg-text-primary)]",children:"证书到期提醒"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:139:13",className:"text-[var(--dg-text-muted)]",children:"SSL证书到期时间监控"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:141:11",className:"flex items-center gap-2",children:[r>0&&s.jsxs(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:143:15",className:"dg-badge-red border",children:[s.jsx(nt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:144:17",className:"h-3 w-3 mr-1"}),r," 即将过期"]}),e>0&&s.jsxs(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:149:15",className:"dg-badge-yellow border",children:[e," 30天内过期"]})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:156:7",children:s.jsx(rt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:157:9",className:"h-[280px] scrollbar-thin",children:a.length===0?s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:159:13",className:"flex flex-col items-center justify-center py-10 text-[var(--dg-text-muted)]",children:[s.jsx(Me,{"code-path":"src/components/dashboard/DashboardRecent.tsx:160:15",className:"h-10 w-10 mb-3 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:161:15",className:"text-sm",children:"暂无证书数据"})]}):s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:164:13",className:"space-y-1.5 pr-2",children:a.map(o=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:166:17",className:"flex items-center justify-between p-3 rounded-lg bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:170:19",className:"flex items-center gap-3 min-w-0",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:171:21",className:u("w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",o.daysUntilExpiry<30?"bg-[var(--dg-red)]/10":o.daysUntilExpiry<60?"bg-[var(--dg-yellow)]/10":"bg-[var(--dg-green)]/10"),children:s.jsx(Me,{"code-path":"src/components/dashboard/DashboardRecent.tsx:179:23",className:u("h-4 w-4",o.daysUntilExpiry<30?"text-[var(--dg-red)]":o.daysUntilExpiry<60?"text-[var(--dg-yellow)]":"text-[var(--dg-green)]")})}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:186:21",className:"min-w-0",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:187:23",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:o.name}),s.jsxs("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:188:23",className:"text-xs text-[var(--dg-text-muted)]",children:["到期: ",o.expire_date?.substring(0,10)]})]})]}),s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:191:19",variant:"outline",className:u("text-xs flex-shrink-0",o.daysUntilExpiry<30?"dg-badge-red border":o.daysUntilExpiry<60?"dg-badge-yellow border":"dg-badge-green border"),children:o.daysUntilExpiry<0?"已过期":`${o.daysUntilExpiry} 天`})]},o.id))})})})]})}function Za({releases:t}){const a=ie(),r=t?.slice(0,5)??[];return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:217:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:218:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:219:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:220:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:221:13",className:"text-[var(--dg-text-primary)]",children:"发布历史"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:222:13",className:"text-[var(--dg-text-muted)]",children:"今日应用发布记录"})]}),s.jsxs(se,{"code-path":"src/components/dashboard/DashboardRecent.tsx:224:11",variant:"ghost",size:"sm",className:"dg-btn-ghost text-xs",onClick:()=>a("/pipelines"),children:["查看全部",s.jsx(le,{"code-path":"src/components/dashboard/DashboardRecent.tsx:231:13",className:"h-3.5 w-3.5 ml-1"})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:235:7",children:r.length===0?s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:237:11",className:"flex flex-col items-center justify-center py-10 text-[var(--dg-text-muted)]",children:[s.jsx(Ke,{"code-path":"src/components/dashboard/DashboardRecent.tsx:238:13",className:"h-10 w-10 mb-3 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:239:13",className:"text-sm",children:"暂无发布记录"})]}):s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:242:11",className:"space-y-2",children:r.map(e=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:244:15",className:"flex items-center gap-3 p-3 rounded-lg bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:248:17",className:u("w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",e.status==="success"?"bg-[var(--dg-green)]/10":e.status==="failed"?"bg-[var(--dg-red)]/10":e.status==="deploying"?"bg-[var(--dg-blue)]/10":"bg-[var(--dg-yellow)]/10"),children:s.jsx(Ke,{"code-path":"src/components/dashboard/DashboardRecent.tsx:257:19",className:u("h-4 w-4",e.status==="success"?"text-[var(--dg-green)]":e.status==="failed"?"text-[var(--dg-red)]":e.status==="deploying"?"text-[var(--dg-blue)]":"text-[var(--dg-yellow)]")})}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:265:17",className:"flex-1 min-w-0",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:266:19",className:"flex items-center gap-2",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:267:21",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:e.app_name}),s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:268:21",variant:"outline",className:"text-xs border-[var(--dg-border)] text-[var(--dg-text-muted)] flex-shrink-0",children:e.version})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:272:19",className:"flex items-center gap-2 mt-0.5",children:[s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:273:21",className:"text-xs text-[var(--dg-text-muted)]",children:e.environment}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:274:21",className:"text-xs text-[var(--dg-border)]",children:"·"}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:275:21",className:"text-xs text-[var(--dg-text-muted)] truncate",children:e.commit_id})]})]}),s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:278:17",variant:"outline",className:u("text-xs flex-shrink-0",e.status==="success"?"dg-badge-green border":e.status==="failed"?"dg-badge-red border":e.status==="deploying"?"dg-badge-blue border":"dg-badge-yellow border"),children:e.status==="success"?"成功":e.status==="failed"?"失败":e.status==="deploying"?"发布中":e.status==="rolled_back"?"已回滚":"构建中"})]},e.id))})})]})}function Xa({servers:t}){const a=ie(),r=t.filter(n=>n.status==="running").length,e=t.filter(n=>n.status==="stopped").length,o=t.filter(n=>n.status==="maintenance").length;return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:309:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:310:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:311:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:312:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:313:13",className:"text-[var(--dg-text-primary)]",children:"服务器状态"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:314:13",className:"text-[var(--dg-text-muted)]",children:"服务器运行状态分布"})]}),s.jsxs(se,{"code-path":"src/components/dashboard/DashboardRecent.tsx:316:11",variant:"ghost",size:"sm",className:"dg-btn-ghost text-xs",onClick:()=>a("/servers"),children:["查看全部",s.jsx(le,{"code-path":"src/components/dashboard/DashboardRecent.tsx:323:13",className:"h-3.5 w-3.5 ml-1"})]})]})}),s.jsxs(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:327:7",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:329:9",className:"grid grid-cols-3 gap-3 mb-4",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:330:11",className:"text-center p-3 rounded-xl bg-[var(--dg-green)]/8 border border-[var(--dg-green)]/15",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:331:13",className:"text-2xl font-bold text-[var(--dg-green)]",children:r}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:332:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"运行中"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:334:11",className:"text-center p-3 rounded-xl bg-[var(--dg-yellow)]/8 border border-[var(--dg-yellow)]/15",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:335:13",className:"text-2xl font-bold text-[var(--dg-yellow)]",children:o}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:336:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"维护中"})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:338:11",className:"text-center p-3 rounded-xl bg-[var(--dg-text-muted)]/8 border border-[var(--dg-border)]",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:339:13",className:"text-2xl font-bold text-[var(--dg-text-muted)]",children:e}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:340:13",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"已停止"})]})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:345:9",className:"space-y-1.5",children:[t.slice(0,4).map(n=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:347:13",className:"flex items-center gap-3 p-2.5 rounded-lg bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200",children:[s.jsx(Pt,{"code-path":"src/components/dashboard/DashboardRecent.tsx:351:15",className:u("h-2.5 w-2.5 flex-shrink-0 fill-current",n.status==="running"?"text-[var(--dg-green)]":n.status==="maintenance"?"text-[var(--dg-yellow)]":"text-[var(--dg-text-muted)]")}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:359:15",className:"flex-1 min-w-0",children:[s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:360:17",className:"text-sm text-[var(--dg-text-primary)] truncate",children:n.hostname}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:361:17",className:"text-xs text-[var(--dg-text-muted)]",children:n.ip})]}),s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:363:15",className:"text-right flex-shrink-0",children:[s.jsxs("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:364:17",className:"text-xs text-[var(--dg-text-muted)]",children:["CPU ",s.jsxs("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:365:23",className:"text-[var(--dg-text-secondary)] font-medium",children:[Number(n.cpu_usage??0).toFixed(1),"%"]})]}),s.jsxs("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:367:17",className:"text-xs text-[var(--dg-text-muted)]",children:["内存 ",s.jsxs("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:368:22",className:"text-[var(--dg-text-secondary)] font-medium",children:[Number(n.memory_usage??0).toFixed(1),"%"]})]})]})]},n.id)),t.length===0&&s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:374:13",className:"flex flex-col items-center justify-center py-6 text-[var(--dg-text-muted)]",children:[s.jsx(ct,{"code-path":"src/components/dashboard/DashboardRecent.tsx:375:15",className:"h-8 w-8 mb-2 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:376:15",className:"text-sm",children:"暂无服务器"})]})]})]})]})}function Ya({clusters:t}){const a=ie();return s.jsxs(B,{"code-path":"src/components/dashboard/DashboardRecent.tsx:389:5",className:"dg-card dg-card-hover",children:[s.jsx(U,{"code-path":"src/components/dashboard/DashboardRecent.tsx:390:7",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:391:9",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:392:11",children:[s.jsx(z,{"code-path":"src/components/dashboard/DashboardRecent.tsx:393:13",className:"text-[var(--dg-text-primary)]",children:"Kubernetes 集群"}),s.jsx(V,{"code-path":"src/components/dashboard/DashboardRecent.tsx:394:13",className:"text-[var(--dg-text-muted)]",children:"Kubernetes集群健康状态"})]}),s.jsxs(se,{"code-path":"src/components/dashboard/DashboardRecent.tsx:396:11",variant:"ghost",size:"sm",className:"dg-btn-ghost text-xs",onClick:()=>a("/kubernetes"),children:["查看全部",s.jsx(le,{"code-path":"src/components/dashboard/DashboardRecent.tsx:403:13",className:"h-3.5 w-3.5 ml-1"})]})]})}),s.jsx(q,{"code-path":"src/components/dashboard/DashboardRecent.tsx:407:7",children:t.length===0?s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:409:11",className:"flex flex-col items-center justify-center py-10 text-[var(--dg-text-muted)]",children:[s.jsx(Be,{"code-path":"src/components/dashboard/DashboardRecent.tsx:410:13",className:"h-10 w-10 mb-3 opacity-30"}),s.jsx("p",{"code-path":"src/components/dashboard/DashboardRecent.tsx:411:13",className:"text-sm",children:"暂无集群数据"})]}):s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:414:11",className:"space-y-3",children:t.map(r=>{const e=Number(r.cpu_usage??0),o=Number(r.memory_usage??0);return s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:419:17",className:"p-3.5 rounded-xl bg-[var(--dg-bg-tertiary)]/50 hover:bg-[var(--dg-bg-hover)] transition-all duration-200 cursor-pointer",onClick:()=>a(`/kubernetes/${r.code||r.id}`),children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:424:19",className:"flex items-center justify-between mb-3",children:[s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:425:21",className:"flex items-center gap-2.5",children:[s.jsx(Be,{"code-path":"src/components/dashboard/DashboardRecent.tsx:426:23",className:"h-4.5 w-4.5 text-[var(--dg-blue)]"}),s.jsx("span",{"code-path":"src/components/dashboard/DashboardRecent.tsx:427:23",className:"text-sm font-semibold text-[var(--dg-text-primary)]",children:r.name})]}),s.jsx(L,{"code-path":"src/components/dashboard/DashboardRecent.tsx:429:21",variant:"outline",className:u("text-xs",r.status==="healthy"?"dg-badge-green border":r.status==="warning"?"dg-badge-yellow border":"dg-badge-red border"),children:r.status==="healthy"?"健康":r.status==="warning"?"警告":"异常"})]}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:441:19",className:"grid grid-cols-4 gap-2 text-center",children:[{label:"节点",value:r.node_count??0},{label:"Pod",value:r.pod_count??0},{label:"CPU",value:`${e.toFixed(1)}%`},{label:"内存",value:`${o.toFixed(1)}%`}].map(n=>s.jsxs("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:448:23",className:"p-1.5 rounded-lg bg-[var(--dg-bg-primary)]/50",children:[s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:449:25",className:"text-sm font-semibold text-[var(--dg-text-primary)]",children:n.value}),s.jsx("div",{"code-path":"src/components/dashboard/DashboardRecent.tsx:450:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5",children:n.label})]},n.label))})]},r.id)})})})]})}function xe({variant:t="card",className:a}){const r="dg-skeleton";return t==="stat"?s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:22:7",className:u("dg-card p-6 space-y-4",a),children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:23:9",className:"flex items-start justify-between",children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:24:11",className:"space-y-3 flex-1",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:25:13",className:u("h-4 w-24 rounded",r)}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:26:13",className:u("h-8 w-16 rounded",r)})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:28:11",className:u("h-10 w-10 rounded-lg",r)})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:30:9",className:u("h-3 w-32 rounded",r)})]}):t==="chart"?s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:37:7",className:u("dg-card p-6 space-y-4",a),children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:38:9",className:"space-y-2",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:39:11",className:u("h-5 w-32 rounded",r)}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:40:11",className:u("h-3 w-48 rounded",r)})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:42:9",className:u("h-[200px] rounded-lg",r)})]}):t==="table"?s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:49:7",className:u("dg-card overflow-hidden",a),children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:51:9",className:"flex items-center gap-4 p-4 border-b border-[var(--dg-border)]",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:52:11",className:u("h-4 w-8 rounded",r)}),Array.from({length:6}).map((e,o)=>s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:54:13",className:u("h-4 flex-1 rounded",r)},o))]}),Array.from({length:5}).map((e,o)=>s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:59:11",className:"flex items-center gap-4 p-4 border-b border-[var(--dg-border)] last:border-0",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:60:13",className:u("h-4 w-8 rounded",r)}),Array.from({length:6}).map((n,c)=>s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:62:15",className:u("h-4 flex-1 rounded",r)},c))]},o))]}):s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:72:5",className:u("dg-card p-6 space-y-4",a),children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:73:7",className:"space-y-2",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:74:9",className:u("h-5 w-40 rounded",r)}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:75:9",className:u("h-3 w-56 rounded",r)})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:77:7",className:"space-y-3",children:Array.from({length:4}).map((e,o)=>s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:79:11",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:80:13",className:u("h-8 w-8 rounded-lg",r)}),s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:81:13",className:"flex-1 space-y-2",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:82:15",className:u("h-3 w-full rounded",r)}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:83:15",className:u("h-3 w-2/3 rounded",r)})]})]},o))})]})}function Ja({count:t=4}){return s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:97:5",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:Array.from({length:t}).map((a,r)=>s.jsx(xe,{"code-path":"src/components/layout/SkeletonCard.tsx:99:9",variant:"stat"},r))})}function Qa(){return s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:110:5",className:"space-y-6",children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:112:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:113:9",className:"space-y-2",children:[s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:114:11",className:"dg-skeleton h-7 w-24 rounded"}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:115:11",className:"dg-skeleton h-4 w-48 rounded"})]}),s.jsx("div",{"code-path":"src/components/layout/SkeletonCard.tsx:117:9",className:"dg-skeleton h-9 w-20 rounded-lg"})]}),s.jsx(Ja,{"code-path":"src/components/layout/SkeletonCard.tsx:121:7",count:4}),s.jsx(xe,{"code-path":"src/components/layout/SkeletonCard.tsx:124:7",variant:"chart"}),s.jsxs("div",{"code-path":"src/components/layout/SkeletonCard.tsx:127:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[s.jsx(xe,{"code-path":"src/components/layout/SkeletonCard.tsx:128:9",variant:"list"}),s.jsx(xe,{"code-path":"src/components/layout/SkeletonCard.tsx:129:9",variant:"list"})]})]})}function ls(){const t=ie(),[a,r]=A.useState(!0),[e,o]=A.useState(!1),[n,c]=A.useState(null),[d,l]=A.useState([]),[i,p]=A.useState([]),[x,b]=A.useState([]),[N,f]=A.useState([]),[h,v]=A.useState([]),[y,j]=A.useState([]),k=A.useCallback(async()=>{o(!0);try{const[D,M,O,W,G,E]=await Promise.all([he.getStats().catch(R=>(console.error("Failed to fetch dashboard stats:",R),null)),Ct.getServers({page:1,page_size:100}).catch(R=>(console.error("Failed to fetch servers:",R),null)),kt.getClusters().catch(R=>(console.error("Failed to fetch k8s clusters:",R),null)),he.getAlerts(10).catch(R=>(console.error("Failed to fetch dashboard alerts:",R),null)),he.getReleases(5).catch(R=>(console.error("Failed to fetch dashboard releases:",R),null)),he.getMetrics(6).catch(R=>(console.error("Failed to fetch metrics:",R),[]))]);c(D),l(M?.list??[]),p(O?.list??[]),b(Array.isArray(W)?W:[]),f(Array.isArray(G)?G:[]),v(D?.expiring_certs??[]),j(Array.isArray(E)?E:[])}catch(D){console.error("Failed to load dashboard data:",D)}finally{o(!1),r(!1)}},[]);if(A.useEffect(()=>{k();const D=setInterval(k,5e3);return()=>clearInterval(D)},[k]),a)return s.jsx(Qa,{"code-path":"src/components/dashboard/Dashboard.tsx:94:12"});const S=n?.server_stats,w=n?.kubernetes_stats,_=n?.alert_stats,F=n?.cost_stats;return s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:103:5",className:"dg-page",children:[s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:105:7",className:"dg-page-header",children:[s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:106:9",children:[s.jsx("h1",{"code-path":"src/components/dashboard/Dashboard.tsx:107:11",className:"dg-page-title",children:"仪表盘"}),s.jsxs("p",{"code-path":"src/components/dashboard/Dashboard.tsx:108:11",className:"dg-page-subtitle",children:["实时监控和运维概览 · 最后更新: ",new Date().toLocaleTimeString("zh-CN")]})]}),s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:110:9",className:"dg-page-actions",children:[s.jsxs(se,{"code-path":"src/components/dashboard/Dashboard.tsx:111:11",variant:"outline",className:"dg-btn-secondary",onClick:k,disabled:e,children:[s.jsx(_t,{"code-path":"src/components/dashboard/Dashboard.tsx:117:13",className:u("h-4 w-4",e&&"animate-spin")}),e?"刷新中":"刷新"]}),s.jsxs(se,{"code-path":"src/components/dashboard/Dashboard.tsx:120:11",className:"dg-btn-primary",onClick:()=>t("/servers"),children:[s.jsx(ct,{"code-path":"src/components/dashboard/Dashboard.tsx:124:13",className:"h-4 w-4"}),"服务器",s.jsx(le,{"code-path":"src/components/dashboard/Dashboard.tsx:126:13",className:"h-3.5 w-3.5"})]})]})]}),s.jsx("div",{"code-path":"src/components/dashboard/Dashboard.tsx:132:7",className:"animate-fade-in-delay-1",children:s.jsx(Rt,{"code-path":"src/components/dashboard/Dashboard.tsx:133:9",items:[{label:"服务器",value:S?.total??0,color:"blue"},{label:"运行中",value:S?.running??0,color:"emerald"},{label:"K8s 集群",value:w?.total??0,color:"purple"},{label:"健康集群",value:w?.healthy??0,color:"cyan"},{label:"告警",value:_?.firing??0,color:_?.firing>0?"red":"muted"},{label:"严重",value:_?.critical??0,color:"red"},{label:"本月成本",value:`¥${Number(F?.month_cost??0).toLocaleString()}`,color:"amber"}]})}),s.jsx("div",{"code-path":"src/components/dashboard/Dashboard.tsx:147:7",className:"animate-fade-in-delay-2",children:s.jsx(Va,{"code-path":"src/components/dashboard/Dashboard.tsx:148:9",avgCpu:Number(S?.avg_cpu??0),avgMemory:Number(S?.avg_memory??0),avgDisk:Number(S?.avg_disk??0),metrics:y})}),s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:157:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-6 animate-fade-in-delay-3",children:[s.jsx(Ua,{"code-path":"src/components/dashboard/Dashboard.tsx:158:9",costStats:F}),s.jsx(za,{"code-path":"src/components/dashboard/Dashboard.tsx:159:9",topUsage:n?.top_resource_usage})]}),s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:163:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-6 animate-fade-in-delay-3",children:[s.jsx(Ga,{"code-path":"src/components/dashboard/Dashboard.tsx:164:9",alerts:x}),s.jsx(Ha,{"code-path":"src/components/dashboard/Dashboard.tsx:165:9",expCerts:h})]}),s.jsxs("div",{"code-path":"src/components/dashboard/Dashboard.tsx:169:7",className:"grid grid-cols-1 lg:grid-cols-3 gap-6 animate-fade-in-delay-4",children:[s.jsx(Za,{"code-path":"src/components/dashboard/Dashboard.tsx:170:9",releases:N}),s.jsx(Xa,{"code-path":"src/components/dashboard/Dashboard.tsx:171:9",servers:d}),s.jsx(Ya,{"code-path":"src/components/dashboard/Dashboard.tsx:172:9",clusters:i})]})]})}export{ls as Dashboard}; diff --git a/backend/static/assets/DatasourcePage-7FoNVKhF.js b/backend/static/assets/DatasourcePage-Bk6XpYxr.js similarity index 98% rename from backend/static/assets/DatasourcePage-7FoNVKhF.js rename to backend/static/assets/DatasourcePage-Bk6XpYxr.js index 1e2681d..d471ca7 100644 --- a/backend/static/assets/DatasourcePage-7FoNVKhF.js +++ b/backend/static/assets/DatasourcePage-Bk6XpYxr.js @@ -1 +1 @@ -import{r as d,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{T as ye,a as Me,b as ce,c as ne}from"./tabs-kmtfM2I-.js";import{G as we,t as n,D as ie,a as le,b as ue,c as pe,d as he,B as h,e as xe,f as ge}from"./index-LZWfu62c.js";import{B as P}from"./badge-B0F5ZNtn.js";import{C as se,b as Fe,c as Ze,a as ae}from"./card-B-RtdR4H.js";import{u as Ce,q as ke,b as Se}from"./unwrap-BmWy-KM2.js";import{u as O}from"./useMutation-Bp3lz5hm.js";import{p as q,z as T}from"./datasource-DuIT0c1H.js";import{I as x}from"./input-BdDauX3U.js";import{L as m}from"./label-u-lNUbKh.js";import{S as j}from"./switch-C4PJnJ9I.js";import{S as J,a as X,b as Y,c as ee,d as A}from"./select-4xU_9B3_.js";import{D as L,G as be,j as De,O as z,Q as E,a6 as Te,P as B,X as Ae,l as qe,b as te,p as je,y as ze,a as ve,R as oe,aW as re,ag as Ee,K as $,aE as _e,T as Ne,C as Le}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function Ie(){return Ce({queryKey:ke.promDatasources(),queryFn:async()=>{const a=await q.list();return Se(a)},staleTime:3e4})}function fe(){const a=we(),o=()=>a.invalidateQueries({queryKey:["prom-datasources"]}),p=O({mutationFn:l=>q.create(l),onSuccess:o}),y=O({mutationFn:({id:l,data:t})=>q.update(l,t),onSuccess:o}),M=O({mutationFn:l=>q.delete(l),onSuccess:o}),w=O({mutationFn:l=>q.setDefault(l),onSuccess:o});return{createMutation:p,updateMutation:y,deleteMutation:M,setDefaultMutation:w,invalidate:o}}function Re(a){return{name:a.name,url:a.url,access:a.access||"server",http_method:a.http_method||"POST",basic_auth:a.basic_auth||!1,basic_auth_user:a.basic_auth_user||"",basic_auth_pass:a.basic_auth_pass||"",with_credentials:a.with_credentials||!1,tls_client_auth:a.tls_client_auth||!1,with_ca_cert:a.with_ca_cert||!1,ca_cert:a.ca_cert||"",skip_tls_verify:a.skip_tls_verify||!1,custom_headers_json:a.custom_headers||"",enable_alerting:a.enable_alerting!==!1,alertmanager_ds:a.alertmanager_ds||"",scrape_interval:a.scrape_interval||15,query_timeout:a.query_timeout||60,disable_metrics_lookup:a.disable_metrics_lookup||!1,custom_query_params:a.custom_query_params||"",is_default:a.is_default||!1}}function He(a){try{const o=JSON.parse(a||"[]");return Array.isArray(o)?o:[]}catch{return[]}}function Oe(a,o){return{name:a.name.trim(),url:a.url.trim(),access:a.access,http_method:a.http_method,basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,with_credentials:a.with_credentials,tls_client_auth:a.tls_client_auth,with_ca_cert:a.with_ca_cert,ca_cert:a.ca_cert,skip_tls_verify:a.skip_tls_verify,custom_headers:JSON.stringify(o),enable_alerting:a.enable_alerting,alertmanager_ds:a.alertmanager_ds,scrape_interval:a.scrape_interval,query_timeout:a.query_timeout,disable_metrics_lookup:a.disable_metrics_lookup,custom_query_params:a.custom_query_params,is_default:a.is_default}}async function Pe(a){const o=await q.testConnection({url:a.url.trim(),basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,skip_tls_verify:a.skip_tls_verify});return o?.data||o}async function Be(a){try{const o=await Pe({url:a.url,basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,skip_tls_verify:a.skip_tls_verify});o?.success?n.success(`连接成功 · ${o.target_count||0} targets`):n.error(o?.message||"连接失败")}catch(o){const p=o instanceof Error?o.message:"测试失败";n.error(p)}}const me={name:"",url:"",access:"server",http_method:"POST",basic_auth:!1,basic_auth_user:"",basic_auth_pass:"",with_credentials:!1,tls_client_auth:!1,with_ca_cert:!1,ca_cert:"",skip_tls_verify:!1,custom_headers_json:"",enable_alerting:!0,alertmanager_ds:"",scrape_interval:15,query_timeout:60,disable_metrics_lookup:!1,custom_query_params:"",is_default:!1};function $e({open:a,onOpenChange:o,editingDs:p,sources:y}){const{createMutation:M,updateMutation:w}=fe(),l=p?.id??null,[t,F]=d.useState({...me}),[r,v]=d.useState([]),[N,Z]=d.useState(!1),[,C]=d.useState(!1),[c,f]=d.useState(!1),[S,I]=d.useState(!1),[R,k]=d.useState(!1),[b,_]=d.useState(null);d.useEffect(()=>{a&&(p?(F(Re(p)),v(He(p.custom_headers))):(F({...me}),v([])),_(null),Z(!1),C(!1),f(!1),I(!1))},[a,p]);const i=(s,u)=>{F(D=>({...D,[s]:u}))},U=()=>{v(s=>[...s,{header:"",value:""}])},g=s=>{v(u=>u.filter((D,K)=>K!==s))},H=(s,u,D)=>{v(K=>{const W=[...K];return W[s]={...W[s],[u]:D},W})},V=async()=>{if(!t.name.trim()){n.error("请输入数据源名称");return}if(!t.url.trim()){n.error("请输入 Prometheus URL");return}const s=Oe(t,r);try{l?(await w.mutateAsync({id:l,data:s}),n.success("数据源更新成功")):(await M.mutateAsync(s),n.success("数据源创建成功")),o(!1)}catch(u){const D=u instanceof Error?u.message:"操作失败";n.error(D)}},G=async()=>{if(!t.url.trim()){n.error("请先输入 URL");return}k(!0),_(null);try{const s=await Pe({url:t.url,basic_auth:t.basic_auth,basic_auth_user:t.basic_auth_user,basic_auth_pass:t.basic_auth_pass,skip_tls_verify:t.skip_tls_verify});_(s)}catch(s){const u=s instanceof Error?s.message:"测试失败";_({success:!1,message:u})}finally{k(!1)}},Q=M.isPending||w.isPending;return e.jsx(ie,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:147:5",open:a,onOpenChange:o,children:e.jsxs(le,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:148:7",className:"max-w-2xl max-h-[90vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(ue,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:149:9",children:[e.jsxs(pe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:150:11",className:"flex items-center gap-2 text-lg",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:151:13",className:"w-5 h-5 text-orange-400"}),l?"编辑数据源":"添加数据源"]}),e.jsx(he,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:154:11",children:"Prometheus 数据源配置 · 参考 Grafana 数据源管理"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:159:9",className:"space-y-5 py-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:161:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:162:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:163:15",htmlFor:"ds-name",className:"text-sm",children:["Name ",e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:163:65",className:"text-red-400",children:"*"})]}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:164:15",id:"ds-name",placeholder:"Prometheus 数据源名称",value:t.name,onChange:s=>i("name",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:172:13",className:"flex items-end pb-2",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:173:15",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:174:17",id:"ds-default",checked:t.is_default,onCheckedChange:s=>i("is_default",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:179:17",htmlFor:"ds-default",className:"text-sm cursor-pointer",children:"Default"})]})})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:185:11",className:"space-y-3 bg-[var(--dg-bg-tertiary)]/50 rounded-lg p-4 border border-[var(--dg-border)]/50",children:[e.jsxs("h4",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:186:13",className:"text-sm font-medium flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(be,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:187:15",className:"w-4 h-4"})," HTTP"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:189:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:190:15",htmlFor:"ds-url",className:"text-sm",children:["URL ",e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:190:63",className:"text-red-400",children:"*"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:191:15",className:"flex gap-2",children:[e.jsxs(J,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:192:17",value:t.access,onValueChange:s=>i("access",s),children:[e.jsx(X,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:193:19",className:"w-32 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm",children:e.jsx(Y,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:194:21"})}),e.jsxs(ee,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:196:19",children:[e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:197:21",value:"server",children:"Server"}),e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:198:21",value:"browser",children:"Browser"})]})]}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:201:17",id:"ds-url",placeholder:"http://localhost:9090",value:t.url,onChange:s=>i("url",s.target.value),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] font-mono text-sm"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:210:13",className:"text-xs text-[var(--dg-text-secondary)]",children:["Access: ",e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:211:23",className:"text-[var(--dg-text-primary)]",children:t.access==="server"?"Server (default)":"Browser"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:216:11",className:"border border-[var(--dg-border)]/50 rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:217:13",type:"button",className:"w-full flex items-center justify-between px-4 py-3 bg-[var(--dg-bg-tertiary)]/30 hover:bg-[var(--dg-bg-tertiary)]/60 transition-colors",onClick:()=>Z(!N),children:[e.jsxs("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:222:15",className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(De,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:223:17",className:"w-4 h-4"})," Auth"]}),N?e.jsx(z,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:225:27",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:225:63",className:"w-4 h-4"})]}),N&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:228:15",className:"p-4 space-y-4 border-t border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:229:17",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:230:19",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:231:21",id:"ds-basic-auth",checked:t.basic_auth,onCheckedChange:s=>i("basic_auth",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:236:21",htmlFor:"ds-basic-auth",className:"text-sm cursor-pointer",children:"Basic auth"})]}),t.basic_auth&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:239:21",className:"grid grid-cols-2 gap-3 ml-9",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:240:23",placeholder:"用户名",value:t.basic_auth_user,onChange:s=>i("basic_auth_user",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:246:23",type:"password",placeholder:"密码",value:t.basic_auth_pass,onChange:s=>i("basic_auth_pass",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:257:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:258:19",id:"ds-with-creds",checked:t.with_credentials,onCheckedChange:s=>i("with_credentials",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:263:19",htmlFor:"ds-with-creds",className:"text-sm cursor-pointer",children:"With Credentials"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:266:17",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:267:19",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:268:21",id:"ds-tls-auth",checked:t.tls_client_auth,onCheckedChange:s=>i("tls_client_auth",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:273:21",htmlFor:"ds-tls-auth",className:"text-sm cursor-pointer",children:"TLS Client Auth"})]}),t.tls_client_auth&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:276:21",className:"ml-9 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:277:23",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:278:25",id:"ds-ca-cert",checked:t.with_ca_cert,onCheckedChange:s=>i("with_ca_cert",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:283:25",htmlFor:"ds-ca-cert",className:"text-sm cursor-pointer",children:"With CA Cert"})]}),t.with_ca_cert&&e.jsx("textarea",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:286:25",placeholder:"PEM 格式的 CA 证书内容...",value:t.ca_cert,onChange:s=>i("ca_cert",s.target.value),rows:4,className:"w-full bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md p-3 text-xs font-mono text-[var(--dg-text-primary)] resize-y"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:298:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:299:19",id:"ds-skip-tls",checked:t.skip_tls_verify,onCheckedChange:s=>i("skip_tls_verify",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:304:19",htmlFor:"ds-skip-tls",className:"text-sm cursor-pointer",children:"Skip TLS Verify"})]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:307:17",className:"text-xs text-[var(--dg-text-secondary)] italic",children:"Forward OAuth Identity"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:315:11",className:"space-y-3 bg-[var(--dg-bg-tertiary)]/30 rounded-lg p-4 border border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:316:13",className:"flex items-center justify-between",children:[e.jsxs("h4",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:317:15",className:"text-sm font-medium flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(Te,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:318:17",className:"w-4 h-4"})," Custom HTTP Headers"]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:320:15",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:U,children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:321:17",className:"w-3 h-3 mr-1"})," Add header"]})]}),r.length===0?e.jsx("p",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:325:15",className:"text-xs text-[var(--dg-text-secondary)] italic",children:"暂无自定义 Header"}):e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:327:15",className:"space-y-2",children:r.map((s,u)=>e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:329:19",className:"flex items-center gap-2",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:330:21",placeholder:"Header",value:s.header,onChange:D=>H(u,"header",D.target.value),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm h-8"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:336:21",placeholder:"Value",value:s.value,onChange:D=>H(u,"value",D.target.value),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm h-8"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:342:21",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-red-400 hover:text-red-300",onClick:()=>g(u),children:e.jsx(Ae,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:346:23",className:"w-3.5 h-3.5"})})]},u))})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:355:11",className:"border border-[var(--dg-border)]/50 rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:356:13",type:"button",className:"w-full flex items-center justify-between px-4 py-3 bg-[var(--dg-bg-tertiary)]/30 hover:bg-[var(--dg-bg-tertiary)]/60 transition-colors",onClick:()=>f(!c),children:[e.jsxs("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:361:15",className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(qe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:362:17",className:"w-4 h-4"})," Alerting"]}),c?e.jsx(z,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:364:31",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:364:67",className:"w-4 h-4"})]}),c&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:367:15",className:"p-4 space-y-4 border-t border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:368:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:369:19",id:"ds-enable-alerting",checked:t.enable_alerting,onCheckedChange:s=>i("enable_alerting",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:374:19",htmlFor:"ds-enable-alerting",className:"text-sm cursor-pointer",children:"Manage alerts via Alerting UI"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:378:17",className:"space-y-2",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:379:19",className:"text-sm text-[var(--dg-text-secondary)]",children:"Alertmanager data source"}),e.jsxs(J,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:380:19",value:t.alertmanager_ds,onValueChange:s=>i("alertmanager_ds",s),children:[e.jsx(X,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:381:21",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm",children:e.jsx(Y,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:382:23",placeholder:"Choose"})}),e.jsxs(ee,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:384:21",children:[e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:385:23",value:"__none",children:"无"}),y.filter(s=>s.id!==l).map(s=>e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:387:25",value:String(s.id),children:s.name},s.id))]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:397:11",className:"grid grid-cols-2 gap-4 bg-[var(--dg-bg-tertiary)]/30 rounded-lg p-4 border border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:398:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:399:15",className:"text-sm flex items-center gap-1.5",children:[e.jsx(te,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:400:17",className:"w-3.5 h-3.5"})," Scrape interval"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:402:15",className:"flex items-center gap-2",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:403:17",type:"number",min:1,value:t.scrape_interval,onChange:s=>i("scrape_interval",Number(s.target.value)),className:"w-20 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm text-center"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:410:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"秒"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:413:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:414:15",className:"text-sm flex items-center gap-1.5",children:[e.jsx(te,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:415:17",className:"w-3.5 h-3.5"})," Query timeout"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:417:15",className:"flex items-center gap-2",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:418:17",type:"number",min:1,value:t.query_timeout,onChange:s=>i("query_timeout",Number(s.target.value)),className:"w-20 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm text-center"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:425:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"秒"})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:431:11",className:"space-y-2",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:432:13",className:"text-sm",children:"HTTP Method"}),e.jsxs(J,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:433:13",value:t.http_method,onValueChange:s=>i("http_method",s),children:[e.jsx(X,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:434:15",className:"w-32 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm",children:e.jsx(Y,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:435:17"})}),e.jsxs(ee,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:437:15",children:[e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:438:17",value:"POST",children:"POST"}),e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:439:17",value:"GET",children:"GET"})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:445:11",className:"border border-[var(--dg-border)]/50 rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:446:13",type:"button",className:"w-full flex items-center justify-between px-4 py-3 bg-[var(--dg-bg-tertiary)]/30 hover:bg-[var(--dg-bg-tertiary)]/60 transition-colors",onClick:()=>I(!S),children:[e.jsxs("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:451:15",className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(je,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:452:17",className:"w-4 h-4"})," Misc"]}),S?e.jsx(z,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:454:27",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:454:63",className:"w-4 h-4"})]}),S&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:457:15",className:"p-4 space-y-4 border-t border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:458:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:459:19",id:"ds-disable-lookup",checked:t.disable_metrics_lookup,onCheckedChange:s=>i("disable_metrics_lookup",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:464:19",htmlFor:"ds-disable-lookup",className:"text-sm cursor-pointer",children:"Disable metrics lookup"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:468:17",className:"space-y-2",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:469:19",className:"text-sm text-[var(--dg-text-secondary)]",children:"Custom query parameters"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:470:19",placeholder:'例: {"timeout": "30s"}',value:t.custom_query_params,onChange:s=>i("custom_query_params",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm font-mono"})]})]})]}),b&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:483:13",className:`rounded-lg p-3 flex items-center gap-2 text-sm ${b.success?"bg-emerald-500/10 border border-emerald-500/30 text-emerald-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:[b.success?e.jsx(ze,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:489:19",className:"w-4 h-4 shrink-0"}):e.jsx(ve,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:490:19",className:"w-4 h-4 shrink-0"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:492:15",children:b.message}),b.target_count!==void 0&&e.jsxs(P,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:494:17",variant:"secondary",className:"ml-auto text-xs",children:[b.target_count," targets"]})]})]}),e.jsxs(xe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:502:9",className:"flex items-center gap-2 pt-2 border-t border-[var(--dg-border)]/50",children:[e.jsxs(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:503:11",variant:"outline",onClick:G,disabled:R||!t.url.trim(),className:"gap-2",children:[R?e.jsx(oe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:510:15",className:"w-4 h-4 animate-spin"}):e.jsx(re,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:512:15",className:"w-4 h-4"}),"Save & test"]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:516:11",className:"flex-1"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:517:11",variant:"ghost",onClick:()=>o(!1),children:"取消"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:520:11",onClick:V,disabled:Q,children:l?"更新":"保存"})]})]})})}function Ue(){const a=ge(),{data:o=[],isLoading:p,isError:y}=Ie(),{deleteMutation:M,setDefaultMutation:w}=fe(),[l,t]=d.useState(!1),[F,r]=d.useState(null);d.useEffect(()=>{y&&n.error("获取数据源列表失败")},[y]);const v=()=>{r(null),t(!0)},N=c=>{r(c),t(!0)},Z=async c=>{if(await a({title:"删除数据源",description:`确定删除数据源「${c.name}」吗?此操作不可撤销。`,variant:"destructive"}))try{await M.mutateAsync(c.id),n.success("已删除")}catch{n.error("删除失败")}},C=async c=>{try{await w.mutateAsync(c.id),n.success(`已将「${c.name}」设为默认数据源`)}catch{n.error("设置失败")}};return p?e.jsx("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:73:7",className:"flex items-center justify-center h-96",children:e.jsx(oe,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:74:9",className:"animate-spin w-8 h-8 text-[var(--dg-text-secondary)]"})}):e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:80:5",className:"p-6 space-y-6 max-w-7xl mx-auto",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:82:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:83:9",children:[e.jsx("h1",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:84:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"数据源管理"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:85:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"Prometheus 数据源配置,用于指标监控与监控大屏"})]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:89:9",onClick:v,className:"gap-2",children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:90:11",className:"w-4 h-4"}),"添加数据源"]})]}),e.jsxs(se,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:96:7",className:"border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsx(Fe,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:97:9",className:"pb-2",children:e.jsxs(Ze,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:98:11",className:"text-base flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:99:13",className:"w-4 h-4 text-blue-400"}),"已配置的数据源",e.jsx(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:101:13",variant:"secondary",className:"ml-2",children:o.length})]})}),e.jsx(ae,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:104:9",className:"p-0",children:o.length===0?e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:106:13",className:"py-12 text-center text-[var(--dg-text-secondary)]",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:107:15",className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:108:15",className:"text-sm",children:"暂无数据源"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:109:15",className:"text-xs mt-1",children:"点击「添加数据源」开始配置"})]}):e.jsx("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:112:13",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:113:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:114:17",className:"border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:115:19",className:"text-xs text-[var(--dg-text-secondary)]",children:[e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:116:21",className:"text-left py-3 px-4 font-medium",children:"名称"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:117:21",className:"text-left py-3 px-4 font-medium",children:"URL"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:118:21",className:"text-left py-3 px-4 font-medium w-20",children:"默认"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:119:21",className:"text-left py-3 px-4 font-medium w-16",children:"状态"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:120:21",className:"text-right py-3 px-4 font-medium w-36",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:123:17",children:o.map(c=>e.jsxs("tr",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:125:21",className:"border-b border-[var(--dg-border)]/50 hover:bg-[var(--dg-bg-tertiary)]/50 transition-colors",children:[e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:129:23",className:"py-3 px-4",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:130:25",className:"flex items-center gap-2",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:131:27",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/prometheus.png",alt:"Prometheus",className:"w-5 h-5 rounded",onError:f=>{f.target.style.display="none"}}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:137:27",children:[e.jsx("span",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:138:29",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:c.name}),c.basic_auth&&e.jsx(Ee,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:139:47",className:"w-3 h-3 inline ml-1.5 text-amber-400"})]})]})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:143:23",className:"py-3 px-4",children:e.jsx("code",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:144:25",className:"text-xs text-blue-300 bg-slate-800/50 px-2 py-0.5 rounded max-w-[320px] block truncate",title:c.url,children:c.url})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:149:23",className:"py-3 px-4",children:c.is_default?e.jsxs(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:151:27",variant:"default",className:"bg-amber-500/15 text-amber-400 border-amber-500/30 text-xs",children:[e.jsx($,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:152:29",className:"w-3 h-3 mr-1"})," 默认"]}):e.jsx("span",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:155:27",className:"text-xs text-[var(--dg-text-secondary)]",children:"--"})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:158:23",className:"py-3 px-4",children:c.status===1?e.jsx(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:160:27",variant:"default",className:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30 text-xs",children:"启用"}):e.jsx(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:164:27",variant:"secondary",className:"text-xs",children:"禁用"})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:167:23",className:"py-3 px-4",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:168:25",className:"flex items-center justify-end gap-1",children:[e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:169:27",variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>Be(c),title:"测试连接",children:e.jsx(re,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:175:29",className:"w-3.5 h-3.5"})}),!c.is_default&&e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:178:29",variant:"ghost",size:"sm",className:"h-8 px-2 text-amber-400 hover:text-amber-300",onClick:()=>C(c),title:"设为默认",children:e.jsx($,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:184:31",className:"w-3.5 h-3.5"})}),e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:187:27",variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>N(c),children:e.jsx(_e,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:192:29",className:"w-3.5 h-3.5"})}),e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:194:27",variant:"ghost",size:"sm",className:"h-8 px-2 text-red-400 hover:text-red-300",onClick:()=>Z(c),children:e.jsx(Ne,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:199:29",className:"w-3.5 h-3.5"})})]})})]},c.id))})]})})})]}),e.jsx($e,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:212:7",open:l,onOpenChange:t,editingDs:F,sources:o})]})}const de={name:"",url:"",username:"",password:"",trends_after:0,trends_range:0,trends_cache_ttl:3600,trends_timeout:30,direct_db:!1,disable_acknowledges:!1,disable_data_alignment:!1,is_default:!1};function Ve(){const a=ge(),[o,p]=d.useState([]),[y,M]=d.useState(!0),[w,l]=d.useState(!1),[t,F]=d.useState(null),[r,v]=d.useState({...de}),[N,Z]=d.useState(!1),[C,c]=d.useState(!1),[f,S]=d.useState(!1),[I,R]=d.useState(!1),[k,b]=d.useState(null),_=d.useCallback(async()=>{try{const s=await T.list();p(s?.data||s||[])}catch{n.error("获取数据源列表失败")}finally{M(!1)}},[]);d.useEffect(()=>{_()},[_]);const i=()=>{F(null),v({...de}),b(null),Z(!1),c(!1),S(!1),l(!0)},U=s=>{F(s.id),v({name:s.name,url:s.url,username:s.username||"",password:s.password||"",trends_after:s.trends_after||0,trends_range:s.trends_range||0,trends_cache_ttl:s.trends_cache_ttl||3600,trends_timeout:s.trends_timeout||30,direct_db:s.direct_db||!1,disable_acknowledges:s.disable_acknowledges||!1,disable_data_alignment:s.disable_data_alignment||!1,is_default:s.is_default||!1}),b(null),l(!0)},g=(s,u)=>{v(D=>({...D,[s]:u}))},H=async()=>{if(!r.name.trim()){n.error("请输入数据源名称");return}if(!r.url.trim()){n.error("请输入 Zabbix API URL");return}if(!r.username.trim()){n.error("请输入用户名");return}if(!r.password.trim()){n.error("请输入密码");return}try{t?(await T.update(t,r),n.success("数据源已更新")):(await T.create(r),n.success("数据源已创建")),l(!1),_()}catch(s){n.error(s?.message||"操作失败")}},V=async s=>{if(await a({title:"删除数据源",description:`确定删除「${s.name}」?`,variant:"destructive"}))try{await T.delete(s.id),n.success("已删除"),_()}catch{n.error("删除失败")}},G=async s=>{try{await T.setDefault(s.id),n.success(`已将「${s.name}」设为默认`),_()}catch{n.error("设置失败")}},Q=async()=>{if(!r.url.trim()||!r.username.trim()){n.error("请填写 URL 和用户名");return}R(!0),b(null);try{const s=await T.testConnection({url:r.url.trim(),username:r.username.trim(),password:r.password||""}),u=s?.data||s;b(u)}catch(s){b({success:!1,message:s?.message||"测试失败"})}finally{R(!1)}};return y?e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:183:7",className:"flex items-center justify-center h-96",children:e.jsx(oe,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:184:9",className:"animate-spin w-8 h-8 text-[var(--dg-text-secondary)]"})}):e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:190:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:191:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:192:9",children:[e.jsxs("h2",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:193:11",className:"text-lg font-semibold text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:194:13",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/zabbix.png",className:"w-5 h-5 rounded",onError:s=>{s.target.style.display="none"}}),"Zabbix 数据源"]}),e.jsx("p",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:201:11",className:"text-xs text-[var(--dg-text-muted)]",children:"配置 Zabbix API 连接,获取主机监控数据"})]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:203:9",onClick:i,size:"sm",children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:204:11",className:"w-4 h-4 mr-1"}),"添加"]})]}),o.length===0?e.jsx(se,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:209:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(ae,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:210:11",className:"py-12 text-center text-[var(--dg-text-muted)]",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:211:13",className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:212:13",className:"text-sm",children:"暂无 Zabbix 数据源"}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:213:13",size:"sm",className:"mt-4",onClick:i,children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:214:15",className:"w-4 h-4 mr-1"}),"添加数据源"]})]})}):e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:219:9",className:"grid gap-3",children:o.map(s=>e.jsx(se,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:221:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] hover:border-orange-500/30 transition-colors",children:e.jsx(ae,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:222:15",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:223:17",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:224:19",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:225:21",className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:226:23",className:`w-2 h-2 rounded-full ${s.status===1?"bg-emerald-400":"bg-slate-500"}`}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:227:23",className:"font-medium text-[var(--dg-text-primary)]",children:s.name}),s.is_default&&e.jsxs(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:228:41",className:"bg-amber-500/20 text-amber-400 text-[10px]",children:[e.jsx($,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:228:103",className:"w-3 h-3 mr-0.5"}),"默认"]}),s.status===1?e.jsx(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:230:27",className:"bg-emerald-500/20 text-emerald-400 text-[10px]",children:"启用"}):e.jsx(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:231:27",className:"bg-slate-500/20 text-slate-400 text-[10px]",children:"禁用"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:233:21",className:"text-xs text-[var(--dg-text-muted)] space-x-3",children:[e.jsx("code",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:234:23",className:"text-orange-300",children:s.url}),e.jsxs("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:235:23",children:["用户: ",s.username]}),s.direct_db&&e.jsx(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:236:40",variant:"outline",className:"text-[10px]",children:"直连DB"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:239:19",className:"flex items-center gap-1",children:[!s.is_default&&e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:241:23",variant:"ghost",size:"sm",className:"h-7 text-xs text-amber-400",onClick:()=>G(s),children:[e.jsx($,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:242:25",className:"w-3 h-3 mr-0.5"}),"默认"]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:245:21",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>U(s),children:[e.jsx(_e,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:246:23",className:"w-3 h-3 mr-0.5"}),"编辑"]}),e.jsx(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:248:21",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400",onClick:()=>V(s),children:e.jsx(Ne,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:249:23",className:"w-3 h-3"})})]})]})})},s.id))}),e.jsx(ie,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:260:7",open:w,onOpenChange:l,children:e.jsxs(le,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:261:9",className:"max-w-xl max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(ue,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:262:11",children:[e.jsxs(pe,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:263:13",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:264:15",className:"h-5 w-5 text-orange-400"}),t?"编辑 Zabbix 数据源":"新建 Zabbix 数据源"]}),e.jsx(he,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:267:13",children:"配置 Zabbix API 连接,用于主机监控与告警数据获取"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:272:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:274:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:275:15",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:276:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"名称 *"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:277:17",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",placeholder:"如:生产 Zabbix",value:r.name,onChange:s=>g("name",s.target.value)})]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:280:15",className:"flex items-end pb-1",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:281:17",className:"flex items-center gap-2",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:282:19",checked:r.is_default,onCheckedChange:s=>g("is_default",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:283:19",className:"text-xs cursor-pointer",children:"设为默认"})]})})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:289:13",className:"border border-[var(--dg-border)] rounded-lg p-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:290:15",className:"flex items-center gap-2 text-sm text-[var(--dg-text-primary)]",children:[e.jsx(be,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:291:17",className:"w-4 h-4"})," HTTP"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:293:15",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:294:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"URL *"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:295:17",className:"mt-1 h-9 text-sm font-mono bg-[var(--dg-bg-primary)]",placeholder:"http://zabbix.example.com/api_jsonrpc.php",value:r.url,onChange:s=>g("url",s.target.value)})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:302:13",className:"border border-[var(--dg-border)] rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:303:15",className:"w-full flex items-center justify-between px-3 py-2.5 text-sm hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>Z(!N),children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:305:17",className:"flex items-center gap-2",children:[e.jsx(De,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:306:19",className:"w-4 h-4"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:307:19",children:"Zabbix API 认证"})]}),N?e.jsx(z,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:309:29",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:309:65",className:"w-4 h-4"})]}),N&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:312:17",className:"px-3 pb-3 space-y-3",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:313:19",className:"h-9 text-sm bg-[var(--dg-bg-primary)]",placeholder:"用户名 *",value:r.username,onChange:s=>g("username",s.target.value)}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:315:19",className:"h-9 text-sm bg-[var(--dg-bg-primary)]",type:"password",placeholder:"密码 *",value:r.password,onChange:s=>g("password",s.target.value)})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:322:13",className:"border border-[var(--dg-border)] rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:323:15",className:"w-full flex items-center justify-between px-3 py-2.5 text-sm hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>c(!C),children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:325:17",className:"flex items-center gap-2",children:[e.jsx(te,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:326:19",className:"w-4 h-4"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:327:19",children:"Trends 设置"})]}),C?e.jsx(z,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:329:31",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:329:67",className:"w-4 h-4"})]}),C&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:332:17",className:"px-3 pb-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:333:19",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:334:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:335:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"After (天)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:336:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:0,value:r.trends_after,onChange:s=>g("trends_after",parseInt(s.target.value)||0)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:339:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:340:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"Range (秒)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:341:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:0,value:r.trends_range,onChange:s=>g("trends_range",parseInt(s.target.value)||0)})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:345:19",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:346:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:347:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"Cache TTL (秒)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:348:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:0,value:r.trends_cache_ttl,onChange:s=>g("trends_cache_ttl",parseInt(s.target.value)||3600)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:351:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:352:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"Timeout (秒)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:353:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:1,value:r.trends_timeout,onChange:s=>g("trends_timeout",parseInt(s.target.value)||30)})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:362:13",className:"border border-[var(--dg-border)] rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:363:15",className:"w-full flex items-center justify-between px-3 py-2.5 text-sm hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>S(!f),children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:365:17",className:"flex items-center gap-2",children:[e.jsx(je,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:366:19",className:"w-4 h-4"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:367:19",children:"其他设置"})]}),f?e.jsx(z,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:369:30",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:369:66",className:"w-4 h-4"})]}),f&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:372:17",className:"px-3 pb-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:373:19",className:"flex items-center justify-between",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:374:21",className:"text-xs",children:"Direct DB Connection"}),e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:375:21",checked:r.direct_db,onCheckedChange:s=>g("direct_db",s)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:377:19",className:"flex items-center justify-between",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:378:21",className:"text-xs",children:"只读用户禁用确认"}),e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:379:21",checked:r.disable_acknowledges,onCheckedChange:s=>g("disable_acknowledges",s)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:381:19",className:"flex items-center justify-between",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:382:21",className:"text-xs",children:"禁用数据对齐"}),e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:383:21",checked:r.disable_data_alignment,onCheckedChange:s=>g("disable_data_alignment",s)})]})]})]}),k&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:391:15",className:`flex items-center gap-2 p-2.5 rounded text-sm ${k.success?"bg-emerald-500/10 text-emerald-400":"bg-red-500/10 text-red-400"}`,children:[k.success?e.jsx(Le,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:394:39",className:"h-4 w-4"}):e.jsx(ve,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:394:78",className:"h-4 w-4"}),k.message]})]}),e.jsxs(xe,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:400:11",className:"gap-2",children:[e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:401:13",variant:"outline",size:"sm",onClick:Q,disabled:I,children:[e.jsx(re,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:402:15",className:`w-4 h-4 mr-1 ${I?"animate-pulse":""}`}),"测试连接"]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:405:13",className:"flex-1"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:406:13",variant:"ghost",size:"sm",onClick:()=>l(!1),children:"取消"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:407:13",size:"sm",onClick:H,children:"保存"})]})]})})]})}function ns(){const[a,o]=d.useState("prometheus");return e.jsxs("div",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:12:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:13:7",className:"flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:14:9",className:"h-5 w-5 text-blue-400"}),e.jsx("h1",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:15:9",className:"text-xl font-bold text-[var(--dg-text-primary)]",children:"数据源管理"})]}),e.jsxs(ye,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:18:7",value:a,onValueChange:o,children:[e.jsxs(Me,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:19:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(ce,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:20:11",value:"prometheus",className:"data-[state=active]:bg-orange-500/10 data-[state=active]:text-orange-400",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:21:13",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/prometheus.png",className:"w-4 h-4 rounded mr-1.5",onError:p=>{p.target.style.display="none"}}),"Prometheus"]}),e.jsxs(ce,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:28:11",value:"zabbix",className:"data-[state=active]:bg-orange-500/10 data-[state=active]:text-orange-400",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:29:13",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/zabbix.png",className:"w-4 h-4 rounded mr-1.5",onError:p=>{p.target.style.display="none"}}),"Zabbix"]})]}),e.jsx(ne,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:38:9",value:"prometheus",className:"mt-4",children:e.jsx(Ue,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:39:11"})}),e.jsx(ne,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:41:9",value:"zabbix",className:"mt-4",children:e.jsx(Ve,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:42:11"})})]})]})}export{ns as default}; +import{r as d,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{T as ye,a as Me,b as ce,c as ne}from"./tabs-DbNlmoQJ.js";import{G as we,t as n,D as ie,a as le,b as ue,c as pe,d as he,B as h,e as xe,f as ge}from"./index-Bp-M7P_8.js";import{B as P}from"./badge-B00SZHvE.js";import{C as se,b as Fe,c as Ze,a as ae}from"./card-BHSBTtub.js";import{u as Ce,q as ke,b as Se}from"./unwrap-D6sbt6TG.js";import{u as O}from"./useMutation-DTWI9Q1n.js";import{p as q,z as T}from"./datasource-B9nxnUtk.js";import{I as x}from"./input-Bnlm--la.js";import{L as m}from"./label-NkONM5Mp.js";import{S as j}from"./switch-CEwFnSNV.js";import{S as J,a as X,b as Y,c as ee,d as A}from"./select-DbhcBWnH.js";import{D as L,G as be,j as De,O as z,Q as E,a6 as Te,P as B,X as Ae,l as qe,b as te,p as je,y as ze,a as ve,R as oe,aT as re,ag as Ee,K as $,aE as _e,T as Ne,C as Le}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";function Ie(){return Ce({queryKey:ke.promDatasources(),queryFn:async()=>{const a=await q.list();return Se(a)},staleTime:3e4})}function fe(){const a=we(),o=()=>a.invalidateQueries({queryKey:["prom-datasources"]}),p=O({mutationFn:l=>q.create(l),onSuccess:o}),y=O({mutationFn:({id:l,data:t})=>q.update(l,t),onSuccess:o}),M=O({mutationFn:l=>q.delete(l),onSuccess:o}),w=O({mutationFn:l=>q.setDefault(l),onSuccess:o});return{createMutation:p,updateMutation:y,deleteMutation:M,setDefaultMutation:w,invalidate:o}}function Re(a){return{name:a.name,url:a.url,access:a.access||"server",http_method:a.http_method||"POST",basic_auth:a.basic_auth||!1,basic_auth_user:a.basic_auth_user||"",basic_auth_pass:a.basic_auth_pass||"",with_credentials:a.with_credentials||!1,tls_client_auth:a.tls_client_auth||!1,with_ca_cert:a.with_ca_cert||!1,ca_cert:a.ca_cert||"",skip_tls_verify:a.skip_tls_verify||!1,custom_headers_json:a.custom_headers||"",enable_alerting:a.enable_alerting!==!1,alertmanager_ds:a.alertmanager_ds||"",scrape_interval:a.scrape_interval||15,query_timeout:a.query_timeout||60,disable_metrics_lookup:a.disable_metrics_lookup||!1,custom_query_params:a.custom_query_params||"",is_default:a.is_default||!1}}function He(a){try{const o=JSON.parse(a||"[]");return Array.isArray(o)?o:[]}catch{return[]}}function Oe(a,o){return{name:a.name.trim(),url:a.url.trim(),access:a.access,http_method:a.http_method,basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,with_credentials:a.with_credentials,tls_client_auth:a.tls_client_auth,with_ca_cert:a.with_ca_cert,ca_cert:a.ca_cert,skip_tls_verify:a.skip_tls_verify,custom_headers:JSON.stringify(o),enable_alerting:a.enable_alerting,alertmanager_ds:a.alertmanager_ds,scrape_interval:a.scrape_interval,query_timeout:a.query_timeout,disable_metrics_lookup:a.disable_metrics_lookup,custom_query_params:a.custom_query_params,is_default:a.is_default}}async function Pe(a){const o=await q.testConnection({url:a.url.trim(),basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,skip_tls_verify:a.skip_tls_verify});return o?.data||o}async function Be(a){try{const o=await Pe({url:a.url,basic_auth:a.basic_auth,basic_auth_user:a.basic_auth_user,basic_auth_pass:a.basic_auth_pass,skip_tls_verify:a.skip_tls_verify});o?.success?n.success(`连接成功 · ${o.target_count||0} targets`):n.error(o?.message||"连接失败")}catch(o){const p=o instanceof Error?o.message:"测试失败";n.error(p)}}const me={name:"",url:"",access:"server",http_method:"POST",basic_auth:!1,basic_auth_user:"",basic_auth_pass:"",with_credentials:!1,tls_client_auth:!1,with_ca_cert:!1,ca_cert:"",skip_tls_verify:!1,custom_headers_json:"",enable_alerting:!0,alertmanager_ds:"",scrape_interval:15,query_timeout:60,disable_metrics_lookup:!1,custom_query_params:"",is_default:!1};function $e({open:a,onOpenChange:o,editingDs:p,sources:y}){const{createMutation:M,updateMutation:w}=fe(),l=p?.id??null,[t,F]=d.useState({...me}),[r,v]=d.useState([]),[N,Z]=d.useState(!1),[,C]=d.useState(!1),[c,f]=d.useState(!1),[S,I]=d.useState(!1),[R,k]=d.useState(!1),[b,_]=d.useState(null);d.useEffect(()=>{a&&(p?(F(Re(p)),v(He(p.custom_headers))):(F({...me}),v([])),_(null),Z(!1),C(!1),f(!1),I(!1))},[a,p]);const i=(s,u)=>{F(D=>({...D,[s]:u}))},U=()=>{v(s=>[...s,{header:"",value:""}])},g=s=>{v(u=>u.filter((D,K)=>K!==s))},H=(s,u,D)=>{v(K=>{const W=[...K];return W[s]={...W[s],[u]:D},W})},V=async()=>{if(!t.name.trim()){n.error("请输入数据源名称");return}if(!t.url.trim()){n.error("请输入 Prometheus URL");return}const s=Oe(t,r);try{l?(await w.mutateAsync({id:l,data:s}),n.success("数据源更新成功")):(await M.mutateAsync(s),n.success("数据源创建成功")),o(!1)}catch(u){const D=u instanceof Error?u.message:"操作失败";n.error(D)}},G=async()=>{if(!t.url.trim()){n.error("请先输入 URL");return}k(!0),_(null);try{const s=await Pe({url:t.url,basic_auth:t.basic_auth,basic_auth_user:t.basic_auth_user,basic_auth_pass:t.basic_auth_pass,skip_tls_verify:t.skip_tls_verify});_(s)}catch(s){const u=s instanceof Error?s.message:"测试失败";_({success:!1,message:u})}finally{k(!1)}},Q=M.isPending||w.isPending;return e.jsx(ie,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:147:5",open:a,onOpenChange:o,children:e.jsxs(le,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:148:7",className:"max-w-2xl max-h-[90vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(ue,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:149:9",children:[e.jsxs(pe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:150:11",className:"flex items-center gap-2 text-lg",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:151:13",className:"w-5 h-5 text-orange-400"}),l?"编辑数据源":"添加数据源"]}),e.jsx(he,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:154:11",children:"Prometheus 数据源配置 · 参考 Grafana 数据源管理"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:159:9",className:"space-y-5 py-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:161:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:162:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:163:15",htmlFor:"ds-name",className:"text-sm",children:["Name ",e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:163:65",className:"text-red-400",children:"*"})]}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:164:15",id:"ds-name",placeholder:"Prometheus 数据源名称",value:t.name,onChange:s=>i("name",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:172:13",className:"flex items-end pb-2",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:173:15",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:174:17",id:"ds-default",checked:t.is_default,onCheckedChange:s=>i("is_default",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:179:17",htmlFor:"ds-default",className:"text-sm cursor-pointer",children:"Default"})]})})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:185:11",className:"space-y-3 bg-[var(--dg-bg-tertiary)]/50 rounded-lg p-4 border border-[var(--dg-border)]/50",children:[e.jsxs("h4",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:186:13",className:"text-sm font-medium flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(be,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:187:15",className:"w-4 h-4"})," HTTP"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:189:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:190:15",htmlFor:"ds-url",className:"text-sm",children:["URL ",e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:190:63",className:"text-red-400",children:"*"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:191:15",className:"flex gap-2",children:[e.jsxs(J,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:192:17",value:t.access,onValueChange:s=>i("access",s),children:[e.jsx(X,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:193:19",className:"w-32 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm",children:e.jsx(Y,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:194:21"})}),e.jsxs(ee,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:196:19",children:[e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:197:21",value:"server",children:"Server"}),e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:198:21",value:"browser",children:"Browser"})]})]}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:201:17",id:"ds-url",placeholder:"http://localhost:9090",value:t.url,onChange:s=>i("url",s.target.value),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] font-mono text-sm"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:210:13",className:"text-xs text-[var(--dg-text-secondary)]",children:["Access: ",e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:211:23",className:"text-[var(--dg-text-primary)]",children:t.access==="server"?"Server (default)":"Browser"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:216:11",className:"border border-[var(--dg-border)]/50 rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:217:13",type:"button",className:"w-full flex items-center justify-between px-4 py-3 bg-[var(--dg-bg-tertiary)]/30 hover:bg-[var(--dg-bg-tertiary)]/60 transition-colors",onClick:()=>Z(!N),children:[e.jsxs("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:222:15",className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(De,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:223:17",className:"w-4 h-4"})," Auth"]}),N?e.jsx(z,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:225:27",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:225:63",className:"w-4 h-4"})]}),N&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:228:15",className:"p-4 space-y-4 border-t border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:229:17",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:230:19",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:231:21",id:"ds-basic-auth",checked:t.basic_auth,onCheckedChange:s=>i("basic_auth",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:236:21",htmlFor:"ds-basic-auth",className:"text-sm cursor-pointer",children:"Basic auth"})]}),t.basic_auth&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:239:21",className:"grid grid-cols-2 gap-3 ml-9",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:240:23",placeholder:"用户名",value:t.basic_auth_user,onChange:s=>i("basic_auth_user",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:246:23",type:"password",placeholder:"密码",value:t.basic_auth_pass,onChange:s=>i("basic_auth_pass",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:257:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:258:19",id:"ds-with-creds",checked:t.with_credentials,onCheckedChange:s=>i("with_credentials",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:263:19",htmlFor:"ds-with-creds",className:"text-sm cursor-pointer",children:"With Credentials"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:266:17",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:267:19",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:268:21",id:"ds-tls-auth",checked:t.tls_client_auth,onCheckedChange:s=>i("tls_client_auth",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:273:21",htmlFor:"ds-tls-auth",className:"text-sm cursor-pointer",children:"TLS Client Auth"})]}),t.tls_client_auth&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:276:21",className:"ml-9 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:277:23",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:278:25",id:"ds-ca-cert",checked:t.with_ca_cert,onCheckedChange:s=>i("with_ca_cert",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:283:25",htmlFor:"ds-ca-cert",className:"text-sm cursor-pointer",children:"With CA Cert"})]}),t.with_ca_cert&&e.jsx("textarea",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:286:25",placeholder:"PEM 格式的 CA 证书内容...",value:t.ca_cert,onChange:s=>i("ca_cert",s.target.value),rows:4,className:"w-full bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md p-3 text-xs font-mono text-[var(--dg-text-primary)] resize-y"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:298:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:299:19",id:"ds-skip-tls",checked:t.skip_tls_verify,onCheckedChange:s=>i("skip_tls_verify",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:304:19",htmlFor:"ds-skip-tls",className:"text-sm cursor-pointer",children:"Skip TLS Verify"})]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:307:17",className:"text-xs text-[var(--dg-text-secondary)] italic",children:"Forward OAuth Identity"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:315:11",className:"space-y-3 bg-[var(--dg-bg-tertiary)]/30 rounded-lg p-4 border border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:316:13",className:"flex items-center justify-between",children:[e.jsxs("h4",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:317:15",className:"text-sm font-medium flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(Te,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:318:17",className:"w-4 h-4"})," Custom HTTP Headers"]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:320:15",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:U,children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:321:17",className:"w-3 h-3 mr-1"})," Add header"]})]}),r.length===0?e.jsx("p",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:325:15",className:"text-xs text-[var(--dg-text-secondary)] italic",children:"暂无自定义 Header"}):e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:327:15",className:"space-y-2",children:r.map((s,u)=>e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:329:19",className:"flex items-center gap-2",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:330:21",placeholder:"Header",value:s.header,onChange:D=>H(u,"header",D.target.value),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm h-8"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:336:21",placeholder:"Value",value:s.value,onChange:D=>H(u,"value",D.target.value),className:"flex-1 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm h-8"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:342:21",variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-red-400 hover:text-red-300",onClick:()=>g(u),children:e.jsx(Ae,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:346:23",className:"w-3.5 h-3.5"})})]},u))})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:355:11",className:"border border-[var(--dg-border)]/50 rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:356:13",type:"button",className:"w-full flex items-center justify-between px-4 py-3 bg-[var(--dg-bg-tertiary)]/30 hover:bg-[var(--dg-bg-tertiary)]/60 transition-colors",onClick:()=>f(!c),children:[e.jsxs("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:361:15",className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(qe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:362:17",className:"w-4 h-4"})," Alerting"]}),c?e.jsx(z,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:364:31",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:364:67",className:"w-4 h-4"})]}),c&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:367:15",className:"p-4 space-y-4 border-t border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:368:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:369:19",id:"ds-enable-alerting",checked:t.enable_alerting,onCheckedChange:s=>i("enable_alerting",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:374:19",htmlFor:"ds-enable-alerting",className:"text-sm cursor-pointer",children:"Manage alerts via Alerting UI"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:378:17",className:"space-y-2",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:379:19",className:"text-sm text-[var(--dg-text-secondary)]",children:"Alertmanager data source"}),e.jsxs(J,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:380:19",value:t.alertmanager_ds,onValueChange:s=>i("alertmanager_ds",s),children:[e.jsx(X,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:381:21",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm",children:e.jsx(Y,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:382:23",placeholder:"Choose"})}),e.jsxs(ee,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:384:21",children:[e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:385:23",value:"__none",children:"无"}),y.filter(s=>s.id!==l).map(s=>e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:387:25",value:String(s.id),children:s.name},s.id))]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:397:11",className:"grid grid-cols-2 gap-4 bg-[var(--dg-bg-tertiary)]/30 rounded-lg p-4 border border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:398:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:399:15",className:"text-sm flex items-center gap-1.5",children:[e.jsx(te,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:400:17",className:"w-3.5 h-3.5"})," Scrape interval"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:402:15",className:"flex items-center gap-2",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:403:17",type:"number",min:1,value:t.scrape_interval,onChange:s=>i("scrape_interval",Number(s.target.value)),className:"w-20 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm text-center"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:410:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"秒"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:413:13",className:"space-y-2",children:[e.jsxs(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:414:15",className:"text-sm flex items-center gap-1.5",children:[e.jsx(te,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:415:17",className:"w-3.5 h-3.5"})," Query timeout"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:417:15",className:"flex items-center gap-2",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:418:17",type:"number",min:1,value:t.query_timeout,onChange:s=>i("query_timeout",Number(s.target.value)),className:"w-20 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm text-center"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:425:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"秒"})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:431:11",className:"space-y-2",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:432:13",className:"text-sm",children:"HTTP Method"}),e.jsxs(J,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:433:13",value:t.http_method,onValueChange:s=>i("http_method",s),children:[e.jsx(X,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:434:15",className:"w-32 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm",children:e.jsx(Y,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:435:17"})}),e.jsxs(ee,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:437:15",children:[e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:438:17",value:"POST",children:"POST"}),e.jsx(A,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:439:17",value:"GET",children:"GET"})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:445:11",className:"border border-[var(--dg-border)]/50 rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:446:13",type:"button",className:"w-full flex items-center justify-between px-4 py-3 bg-[var(--dg-bg-tertiary)]/30 hover:bg-[var(--dg-bg-tertiary)]/60 transition-colors",onClick:()=>I(!S),children:[e.jsxs("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:451:15",className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(je,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:452:17",className:"w-4 h-4"})," Misc"]}),S?e.jsx(z,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:454:27",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:454:63",className:"w-4 h-4"})]}),S&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:457:15",className:"p-4 space-y-4 border-t border-[var(--dg-border)]/50",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:458:17",className:"flex items-center gap-3",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:459:19",id:"ds-disable-lookup",checked:t.disable_metrics_lookup,onCheckedChange:s=>i("disable_metrics_lookup",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:464:19",htmlFor:"ds-disable-lookup",className:"text-sm cursor-pointer",children:"Disable metrics lookup"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:468:17",className:"space-y-2",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:469:19",className:"text-sm text-[var(--dg-text-secondary)]",children:"Custom query parameters"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:470:19",placeholder:'例: {"timeout": "30s"}',value:t.custom_query_params,onChange:s=>i("custom_query_params",s.target.value),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-sm font-mono"})]})]})]}),b&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:483:13",className:`rounded-lg p-3 flex items-center gap-2 text-sm ${b.success?"bg-emerald-500/10 border border-emerald-500/30 text-emerald-400":"bg-red-500/10 border border-red-500/30 text-red-400"}`,children:[b.success?e.jsx(ze,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:489:19",className:"w-4 h-4 shrink-0"}):e.jsx(ve,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:490:19",className:"w-4 h-4 shrink-0"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:492:15",children:b.message}),b.target_count!==void 0&&e.jsxs(P,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:494:17",variant:"secondary",className:"ml-auto text-xs",children:[b.target_count," targets"]})]})]}),e.jsxs(xe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:502:9",className:"flex items-center gap-2 pt-2 border-t border-[var(--dg-border)]/50",children:[e.jsxs(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:503:11",variant:"outline",onClick:G,disabled:R||!t.url.trim(),className:"gap-2",children:[R?e.jsx(oe,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:510:15",className:"w-4 h-4 animate-spin"}):e.jsx(re,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:512:15",className:"w-4 h-4"}),"Save & test"]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:516:11",className:"flex-1"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:517:11",variant:"ghost",onClick:()=>o(!1),children:"取消"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/prometheus-ds/PromDsFormDialog.tsx:520:11",onClick:V,disabled:Q,children:l?"更新":"保存"})]})]})})}function Ue(){const a=ge(),{data:o=[],isLoading:p,isError:y}=Ie(),{deleteMutation:M,setDefaultMutation:w}=fe(),[l,t]=d.useState(!1),[F,r]=d.useState(null);d.useEffect(()=>{y&&n.error("获取数据源列表失败")},[y]);const v=()=>{r(null),t(!0)},N=c=>{r(c),t(!0)},Z=async c=>{if(await a({title:"删除数据源",description:`确定删除数据源「${c.name}」吗?此操作不可撤销。`,variant:"destructive"}))try{await M.mutateAsync(c.id),n.success("已删除")}catch{n.error("删除失败")}},C=async c=>{try{await w.mutateAsync(c.id),n.success(`已将「${c.name}」设为默认数据源`)}catch{n.error("设置失败")}};return p?e.jsx("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:73:7",className:"flex items-center justify-center h-96",children:e.jsx(oe,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:74:9",className:"animate-spin w-8 h-8 text-[var(--dg-text-secondary)]"})}):e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:80:5",className:"p-6 space-y-6 max-w-7xl mx-auto",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:82:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:83:9",children:[e.jsx("h1",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:84:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"数据源管理"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:85:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"Prometheus 数据源配置,用于指标监控与监控大屏"})]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:89:9",onClick:v,className:"gap-2",children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:90:11",className:"w-4 h-4"}),"添加数据源"]})]}),e.jsxs(se,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:96:7",className:"border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsx(Fe,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:97:9",className:"pb-2",children:e.jsxs(Ze,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:98:11",className:"text-base flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:99:13",className:"w-4 h-4 text-blue-400"}),"已配置的数据源",e.jsx(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:101:13",variant:"secondary",className:"ml-2",children:o.length})]})}),e.jsx(ae,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:104:9",className:"p-0",children:o.length===0?e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:106:13",className:"py-12 text-center text-[var(--dg-text-secondary)]",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:107:15",className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:108:15",className:"text-sm",children:"暂无数据源"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:109:15",className:"text-xs mt-1",children:"点击「添加数据源」开始配置"})]}):e.jsx("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:112:13",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:113:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:114:17",className:"border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:115:19",className:"text-xs text-[var(--dg-text-secondary)]",children:[e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:116:21",className:"text-left py-3 px-4 font-medium",children:"名称"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:117:21",className:"text-left py-3 px-4 font-medium",children:"URL"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:118:21",className:"text-left py-3 px-4 font-medium w-20",children:"默认"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:119:21",className:"text-left py-3 px-4 font-medium w-16",children:"状态"}),e.jsx("th",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:120:21",className:"text-right py-3 px-4 font-medium w-36",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:123:17",children:o.map(c=>e.jsxs("tr",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:125:21",className:"border-b border-[var(--dg-border)]/50 hover:bg-[var(--dg-bg-tertiary)]/50 transition-colors",children:[e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:129:23",className:"py-3 px-4",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:130:25",className:"flex items-center gap-2",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:131:27",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/prometheus.png",alt:"Prometheus",className:"w-5 h-5 rounded",onError:f=>{f.target.style.display="none"}}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:137:27",children:[e.jsx("span",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:138:29",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:c.name}),c.basic_auth&&e.jsx(Ee,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:139:47",className:"w-3 h-3 inline ml-1.5 text-amber-400"})]})]})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:143:23",className:"py-3 px-4",children:e.jsx("code",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:144:25",className:"text-xs text-blue-300 bg-slate-800/50 px-2 py-0.5 rounded max-w-[320px] block truncate",title:c.url,children:c.url})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:149:23",className:"py-3 px-4",children:c.is_default?e.jsxs(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:151:27",variant:"default",className:"bg-amber-500/15 text-amber-400 border-amber-500/30 text-xs",children:[e.jsx($,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:152:29",className:"w-3 h-3 mr-1"})," 默认"]}):e.jsx("span",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:155:27",className:"text-xs text-[var(--dg-text-secondary)]",children:"--"})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:158:23",className:"py-3 px-4",children:c.status===1?e.jsx(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:160:27",variant:"default",className:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30 text-xs",children:"启用"}):e.jsx(P,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:164:27",variant:"secondary",className:"text-xs",children:"禁用"})}),e.jsx("td",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:167:23",className:"py-3 px-4",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:168:25",className:"flex items-center justify-end gap-1",children:[e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:169:27",variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>Be(c),title:"测试连接",children:e.jsx(re,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:175:29",className:"w-3.5 h-3.5"})}),!c.is_default&&e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:178:29",variant:"ghost",size:"sm",className:"h-8 px-2 text-amber-400 hover:text-amber-300",onClick:()=>C(c),title:"设为默认",children:e.jsx($,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:184:31",className:"w-3.5 h-3.5"})}),e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:187:27",variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>N(c),children:e.jsx(_e,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:192:29",className:"w-3.5 h-3.5"})}),e.jsx(h,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:194:27",variant:"ghost",size:"sm",className:"h-8 px-2 text-red-400 hover:text-red-300",onClick:()=>Z(c),children:e.jsx(Ne,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:199:29",className:"w-3.5 h-3.5"})})]})})]},c.id))})]})})})]}),e.jsx($e,{"code-path":"src/components/monitor/datasource/PrometheusDatasourceManager.tsx:212:7",open:l,onOpenChange:t,editingDs:F,sources:o})]})}const de={name:"",url:"",username:"",password:"",trends_after:0,trends_range:0,trends_cache_ttl:3600,trends_timeout:30,direct_db:!1,disable_acknowledges:!1,disable_data_alignment:!1,is_default:!1};function Ve(){const a=ge(),[o,p]=d.useState([]),[y,M]=d.useState(!0),[w,l]=d.useState(!1),[t,F]=d.useState(null),[r,v]=d.useState({...de}),[N,Z]=d.useState(!1),[C,c]=d.useState(!1),[f,S]=d.useState(!1),[I,R]=d.useState(!1),[k,b]=d.useState(null),_=d.useCallback(async()=>{try{const s=await T.list();p(s?.data||s||[])}catch{n.error("获取数据源列表失败")}finally{M(!1)}},[]);d.useEffect(()=>{_()},[_]);const i=()=>{F(null),v({...de}),b(null),Z(!1),c(!1),S(!1),l(!0)},U=s=>{F(s.id),v({name:s.name,url:s.url,username:s.username||"",password:s.password||"",trends_after:s.trends_after||0,trends_range:s.trends_range||0,trends_cache_ttl:s.trends_cache_ttl||3600,trends_timeout:s.trends_timeout||30,direct_db:s.direct_db||!1,disable_acknowledges:s.disable_acknowledges||!1,disable_data_alignment:s.disable_data_alignment||!1,is_default:s.is_default||!1}),b(null),l(!0)},g=(s,u)=>{v(D=>({...D,[s]:u}))},H=async()=>{if(!r.name.trim()){n.error("请输入数据源名称");return}if(!r.url.trim()){n.error("请输入 Zabbix API URL");return}if(!r.username.trim()){n.error("请输入用户名");return}if(!r.password.trim()){n.error("请输入密码");return}try{t?(await T.update(t,r),n.success("数据源已更新")):(await T.create(r),n.success("数据源已创建")),l(!1),_()}catch(s){n.error(s?.message||"操作失败")}},V=async s=>{if(await a({title:"删除数据源",description:`确定删除「${s.name}」?`,variant:"destructive"}))try{await T.delete(s.id),n.success("已删除"),_()}catch{n.error("删除失败")}},G=async s=>{try{await T.setDefault(s.id),n.success(`已将「${s.name}」设为默认`),_()}catch{n.error("设置失败")}},Q=async()=>{if(!r.url.trim()||!r.username.trim()){n.error("请填写 URL 和用户名");return}R(!0),b(null);try{const s=await T.testConnection({url:r.url.trim(),username:r.username.trim(),password:r.password||""}),u=s?.data||s;b(u)}catch(s){b({success:!1,message:s?.message||"测试失败"})}finally{R(!1)}};return y?e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:183:7",className:"flex items-center justify-center h-96",children:e.jsx(oe,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:184:9",className:"animate-spin w-8 h-8 text-[var(--dg-text-secondary)]"})}):e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:190:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:191:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:192:9",children:[e.jsxs("h2",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:193:11",className:"text-lg font-semibold text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:194:13",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/zabbix.png",className:"w-5 h-5 rounded",onError:s=>{s.target.style.display="none"}}),"Zabbix 数据源"]}),e.jsx("p",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:201:11",className:"text-xs text-[var(--dg-text-muted)]",children:"配置 Zabbix API 连接,获取主机监控数据"})]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:203:9",onClick:i,size:"sm",children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:204:11",className:"w-4 h-4 mr-1"}),"添加"]})]}),o.length===0?e.jsx(se,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:209:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(ae,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:210:11",className:"py-12 text-center text-[var(--dg-text-muted)]",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:211:13",className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:212:13",className:"text-sm",children:"暂无 Zabbix 数据源"}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:213:13",size:"sm",className:"mt-4",onClick:i,children:[e.jsx(B,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:214:15",className:"w-4 h-4 mr-1"}),"添加数据源"]})]})}):e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:219:9",className:"grid gap-3",children:o.map(s=>e.jsx(se,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:221:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] hover:border-orange-500/30 transition-colors",children:e.jsx(ae,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:222:15",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:223:17",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:224:19",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:225:21",className:"flex items-center gap-2 mb-1",children:[e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:226:23",className:`w-2 h-2 rounded-full ${s.status===1?"bg-emerald-400":"bg-slate-500"}`}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:227:23",className:"font-medium text-[var(--dg-text-primary)]",children:s.name}),s.is_default&&e.jsxs(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:228:41",className:"bg-amber-500/20 text-amber-400 text-[10px]",children:[e.jsx($,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:228:103",className:"w-3 h-3 mr-0.5"}),"默认"]}),s.status===1?e.jsx(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:230:27",className:"bg-emerald-500/20 text-emerald-400 text-[10px]",children:"启用"}):e.jsx(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:231:27",className:"bg-slate-500/20 text-slate-400 text-[10px]",children:"禁用"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:233:21",className:"text-xs text-[var(--dg-text-muted)] space-x-3",children:[e.jsx("code",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:234:23",className:"text-orange-300",children:s.url}),e.jsxs("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:235:23",children:["用户: ",s.username]}),s.direct_db&&e.jsx(P,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:236:40",variant:"outline",className:"text-[10px]",children:"直连DB"})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:239:19",className:"flex items-center gap-1",children:[!s.is_default&&e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:241:23",variant:"ghost",size:"sm",className:"h-7 text-xs text-amber-400",onClick:()=>G(s),children:[e.jsx($,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:242:25",className:"w-3 h-3 mr-0.5"}),"默认"]}),e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:245:21",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>U(s),children:[e.jsx(_e,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:246:23",className:"w-3 h-3 mr-0.5"}),"编辑"]}),e.jsx(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:248:21",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400",onClick:()=>V(s),children:e.jsx(Ne,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:249:23",className:"w-3 h-3"})})]})]})})},s.id))}),e.jsx(ie,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:260:7",open:w,onOpenChange:l,children:e.jsxs(le,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:261:9",className:"max-w-xl max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(ue,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:262:11",children:[e.jsxs(pe,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:263:13",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:264:15",className:"h-5 w-5 text-orange-400"}),t?"编辑 Zabbix 数据源":"新建 Zabbix 数据源"]}),e.jsx(he,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:267:13",children:"配置 Zabbix API 连接,用于主机监控与告警数据获取"})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:272:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:274:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:275:15",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:276:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"名称 *"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:277:17",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",placeholder:"如:生产 Zabbix",value:r.name,onChange:s=>g("name",s.target.value)})]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:280:15",className:"flex items-end pb-1",children:e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:281:17",className:"flex items-center gap-2",children:[e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:282:19",checked:r.is_default,onCheckedChange:s=>g("is_default",s)}),e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:283:19",className:"text-xs cursor-pointer",children:"设为默认"})]})})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:289:13",className:"border border-[var(--dg-border)] rounded-lg p-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:290:15",className:"flex items-center gap-2 text-sm text-[var(--dg-text-primary)]",children:[e.jsx(be,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:291:17",className:"w-4 h-4"})," HTTP"]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:293:15",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:294:17",className:"text-xs text-[var(--dg-text-secondary)]",children:"URL *"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:295:17",className:"mt-1 h-9 text-sm font-mono bg-[var(--dg-bg-primary)]",placeholder:"http://zabbix.example.com/api_jsonrpc.php",value:r.url,onChange:s=>g("url",s.target.value)})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:302:13",className:"border border-[var(--dg-border)] rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:303:15",className:"w-full flex items-center justify-between px-3 py-2.5 text-sm hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>Z(!N),children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:305:17",className:"flex items-center gap-2",children:[e.jsx(De,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:306:19",className:"w-4 h-4"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:307:19",children:"Zabbix API 认证"})]}),N?e.jsx(z,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:309:29",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:309:65",className:"w-4 h-4"})]}),N&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:312:17",className:"px-3 pb-3 space-y-3",children:[e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:313:19",className:"h-9 text-sm bg-[var(--dg-bg-primary)]",placeholder:"用户名 *",value:r.username,onChange:s=>g("username",s.target.value)}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:315:19",className:"h-9 text-sm bg-[var(--dg-bg-primary)]",type:"password",placeholder:"密码 *",value:r.password,onChange:s=>g("password",s.target.value)})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:322:13",className:"border border-[var(--dg-border)] rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:323:15",className:"w-full flex items-center justify-between px-3 py-2.5 text-sm hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>c(!C),children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:325:17",className:"flex items-center gap-2",children:[e.jsx(te,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:326:19",className:"w-4 h-4"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:327:19",children:"Trends 设置"})]}),C?e.jsx(z,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:329:31",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:329:67",className:"w-4 h-4"})]}),C&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:332:17",className:"px-3 pb-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:333:19",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:334:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:335:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"After (天)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:336:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:0,value:r.trends_after,onChange:s=>g("trends_after",parseInt(s.target.value)||0)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:339:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:340:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"Range (秒)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:341:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:0,value:r.trends_range,onChange:s=>g("trends_range",parseInt(s.target.value)||0)})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:345:19",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:346:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:347:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"Cache TTL (秒)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:348:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:0,value:r.trends_cache_ttl,onChange:s=>g("trends_cache_ttl",parseInt(s.target.value)||3600)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:351:21",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:352:23",className:"text-xs text-[var(--dg-text-secondary)]",children:"Timeout (秒)"}),e.jsx(x,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:353:23",className:"mt-1 h-9 text-sm bg-[var(--dg-bg-primary)]",type:"number",min:1,value:r.trends_timeout,onChange:s=>g("trends_timeout",parseInt(s.target.value)||30)})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:362:13",className:"border border-[var(--dg-border)] rounded-lg overflow-hidden",children:[e.jsxs("button",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:363:15",className:"w-full flex items-center justify-between px-3 py-2.5 text-sm hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>S(!f),children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:365:17",className:"flex items-center gap-2",children:[e.jsx(je,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:366:19",className:"w-4 h-4"}),e.jsx("span",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:367:19",children:"其他设置"})]}),f?e.jsx(z,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:369:30",className:"w-4 h-4"}):e.jsx(E,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:369:66",className:"w-4 h-4"})]}),f&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:372:17",className:"px-3 pb-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:373:19",className:"flex items-center justify-between",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:374:21",className:"text-xs",children:"Direct DB Connection"}),e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:375:21",checked:r.direct_db,onCheckedChange:s=>g("direct_db",s)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:377:19",className:"flex items-center justify-between",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:378:21",className:"text-xs",children:"只读用户禁用确认"}),e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:379:21",checked:r.disable_acknowledges,onCheckedChange:s=>g("disable_acknowledges",s)})]}),e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:381:19",className:"flex items-center justify-between",children:[e.jsx(m,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:382:21",className:"text-xs",children:"禁用数据对齐"}),e.jsx(j,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:383:21",checked:r.disable_data_alignment,onCheckedChange:s=>g("disable_data_alignment",s)})]})]})]}),k&&e.jsxs("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:391:15",className:`flex items-center gap-2 p-2.5 rounded text-sm ${k.success?"bg-emerald-500/10 text-emerald-400":"bg-red-500/10 text-red-400"}`,children:[k.success?e.jsx(Le,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:394:39",className:"h-4 w-4"}):e.jsx(ve,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:394:78",className:"h-4 w-4"}),k.message]})]}),e.jsxs(xe,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:400:11",className:"gap-2",children:[e.jsxs(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:401:13",variant:"outline",size:"sm",onClick:Q,disabled:I,children:[e.jsx(re,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:402:15",className:`w-4 h-4 mr-1 ${I?"animate-pulse":""}`}),"测试连接"]}),e.jsx("div",{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:405:13",className:"flex-1"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:406:13",variant:"ghost",size:"sm",onClick:()=>l(!1),children:"取消"}),e.jsx(h,{"code-path":"src/components/monitor/datasource/ZabbixDatasourceManager.tsx:407:13",size:"sm",onClick:H,children:"保存"})]})]})})]})}function ns(){const[a,o]=d.useState("prometheus");return e.jsxs("div",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:12:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:13:7",className:"flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:14:9",className:"h-5 w-5 text-blue-400"}),e.jsx("h1",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:15:9",className:"text-xl font-bold text-[var(--dg-text-primary)]",children:"数据源管理"})]}),e.jsxs(ye,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:18:7",value:a,onValueChange:o,children:[e.jsxs(Me,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:19:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsxs(ce,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:20:11",value:"prometheus",className:"data-[state=active]:bg-orange-500/10 data-[state=active]:text-orange-400",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:21:13",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/prometheus.png",className:"w-4 h-4 rounded mr-1.5",onError:p=>{p.target.style.display="none"}}),"Prometheus"]}),e.jsxs(ce,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:28:11",value:"zabbix",className:"data-[state=active]:bg-orange-500/10 data-[state=active]:text-orange-400",children:[e.jsx("img",{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:29:13",src:"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/zabbix.png",className:"w-4 h-4 rounded mr-1.5",onError:p=>{p.target.style.display="none"}}),"Zabbix"]})]}),e.jsx(ne,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:38:9",value:"prometheus",className:"mt-4",children:e.jsx(Ue,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:39:11"})}),e.jsx(ne,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:41:9",value:"zabbix",className:"mt-4",children:e.jsx(Ve,{"code-path":"src/components/monitor/datasource/DatasourcePage.tsx:42:11"})})]})]})}export{ns as default}; diff --git a/backend/static/assets/DeployCredentials-C7pbsNa2.js b/backend/static/assets/DeployCredentials-DBd0aG3R.js similarity index 98% rename from backend/static/assets/DeployCredentials-C7pbsNa2.js rename to backend/static/assets/DeployCredentials-DBd0aG3R.js index b3c3066..008a9ce 100644 --- a/backend/static/assets/DeployCredentials-C7pbsNa2.js +++ b/backend/static/assets/DeployCredentials-DBd0aG3R.js @@ -1 +1 @@ -import{r as o,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{D as A,a as H,b as J,c as K,e as te,B as d,t as r,d as oe,f as ae}from"./index-LZWfu62c.js";import{I as z}from"./input-BdDauX3U.js";import{B as w}from"./badge-B0F5ZNtn.js";import{T as ne,a as le,b as O,c as B}from"./tabs-kmtfM2I-.js";import{L as _}from"./label-u-lNUbKh.js";import{S as M,a as Q,b as W,c as X,d as E}from"./select-4xU_9B3_.js";import{d as i}from"./config-DAXaHuse.js";import{c as ce}from"./credential-CwQY-4Ba.js";import{G as Y,k as Z,ag as de,P as G,R as ee,L as k,y as re,a as pe,b as ie,v as I,Q as xe,au as me,J as ye,a6 as he,d as P,T as U}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function ge({open:S,onOpenChange:b,type:L,editId:n,repos:h,registries:j,onSave:m}){const c=L==="repo",[g,u]=o.useState(""),[C,f]=o.useState(""),[p,v]=o.useState(""),[y,N]=o.useState(""),[D,T]=o.useState(""),[s,l]=o.useState([]),[x,V]=o.useState(!1),t=s.filter(a=>c?!0:a.secret_type==="docker"),F=async()=>{try{const a=await ce.list({page_size:100});l(a?.list||[])}catch{}};o.useEffect(()=>{if(F(),n)if(c){const a=h.find(R=>R.id===n);a&&(u(a.name),f(""),v(a.url),T(a.credential_id||""))}else{const a=j.find(R=>R.id===n);a&&(u(a.name),f(""),v(a.registry_url),N(a.namespace||""),T(a.credential_id||""))}else u(""),f(""),v(""),N(""),T("")},[n,S,c]);const $=async()=>{if(!g.trim()||!p.trim()){r.error("请填写名称和地址");return}V(!0);try{const a=D?Number(D):null,R=c?{name:g.trim(),description:C.trim(),url:p.trim(),credential_id:a}:{name:g.trim(),description:C.trim(),registry_url:p.trim(),namespace:y.trim(),credential_id:a};n?(c?await i.updateRepo(n,R):await i.updateRegistry(n,R),r.success("已更新")):(c?await i.createRepo(R):await i.createRegistry(R),r.success("已创建")),b(!1),m()}catch{r.error("保存失败")}finally{V(!1)}},se=c?Y:Z;return e.jsx(A,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:96:5",open:S,onOpenChange:b,children:e.jsxs(H,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:97:7",className:"sm:max-w-[480px] bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(J,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:98:9",children:e.jsxs(K,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:99:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(se,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:100:13",className:"h-5 w-5 text-[var(--dg-blue)]"}),n?"编辑":"新增",c?" Git 仓库":" 镜像仓库"]})}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:104:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:105:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:105:38",children:"名称 *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:106:13",value:g,onChange:a=>u(a.target.value),placeholder:c?"如:GitLab CE":"如:Harbor",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:107:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:107:38",children:c?"仓库 URL *":"Registry URL *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:108:13",value:p,onChange:a=>v(a.target.value),placeholder:c?"http://10.10.10.72:9000/group/repo.git":"http://10.10.10.72",className:"font-mono text-sm bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),!c&&e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:109:23",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:109:50",children:"默认命名空间"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:110:13",value:y,onChange:a=>N(a.target.value),placeholder:"如:aiops",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:113:11",className:"space-y-1",children:[e.jsxs(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:114:13",children:["关联凭证 ",e.jsx("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:114:25",className:"text-xs text-[var(--dg-text-secondary)] opacity-70",children:"(认证由凭据管理统一配置)"})]}),e.jsxs(M,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:115:13",value:String(D),onValueChange:a=>T(a==="__none"?"":a),children:[e.jsx(Q,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:116:15",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(W,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:117:17",placeholder:c?"选择凭据(API/密码等)":"选择 Docker 密码凭据"})}),e.jsxs(X,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:119:15",children:[e.jsx(E,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:120:17",value:"__none",children:"不关联凭证"}),t.map(a=>e.jsx(E,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:122:19",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:123:21",className:"flex items-center gap-1.5",children:[e.jsx(de,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:124:23",className:"h-3 w-3 opacity-60"}),a.name," ",a.summary&&e.jsxs("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:125:46",className:"text-[10px] opacity-50",children:["(",a.summary,")"]})]})},a.id))]})]}),t.length===0&&e.jsxs("p",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:132:15",className:"text-xs text-amber-400 flex items-center gap-1 mt-1",children:[e.jsx(G,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:133:17",className:"h-3 w-3"}),"暂无",c?"":"Docker 密码","类型凭证,请在凭证配置页面新增"]})]})]}),e.jsxs(te,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:139:9",children:[e.jsx(d,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:140:11",variant:"outline",onClick:()=>b(!1),children:"取消"}),e.jsx(d,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:141:11",onClick:$,disabled:x,children:x?"保存中...":"保存"})]})]})})}const Ce={build:"构建",deploy:"部署",automation:"自动化",other:"其他"},q={build:"bg-amber-500/20 text-amber-400 border-amber-500/30",deploy:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",automation:"bg-purple-500/20 text-purple-400 border-purple-500/30",other:"bg-slate-500/20 text-slate-400 border-slate-500/30"},be=["jdk","nodejs","maven"];function je(){const[S,b]=o.useState([]),[L,n]=o.useState(!1),[h,j]=o.useState(null),[m,c]=o.useState(null),[g,u]=o.useState(""),[C,f]=o.useState(null),p=async()=>{n(!0);try{const s=await i.getTools();b(s?.list||[])}catch{r.error("获取工具配置失败")}finally{n(!1)}};o.useEffect(()=>{p()},[]);const v=async s=>{try{const x=(await i.getToolVersions(s.id))?.versions||[];if(x.length===0){y(s);return}c({tool:s,versions:x}),u(s.default_version||x[0]?.version||"")}catch{y(s)}},y=async(s,l)=>{j(s.id);try{const x=l||s.default_version;await i.installTool(s.id,x),r.success(`${s.display_name}${x?` (${x})`:""} 安装已触发`),c(null),setTimeout(async()=>{try{await i.checkTool(s.id),p()}catch{}j(null)},3e3)}catch{r.error("触发安装失败"),j(null)}},N=async s=>{try{const l=await i.checkTool(s.id);r.success(l?.available?`${s.display_name} 可用`:`${s.display_name} 不可用`),p()}catch{r.error("检测失败")}},D=async(s,l)=>{try{await i.updateTool(s.id,{install_method:l}),r.success("已更新"),p()}catch{r.error("更新失败")}},T=async s=>{f(s.id);const l=Date.now();try{const x=await i.getToolVersions(s.id),V=((Date.now()-l)/1e3).toFixed(1);x?.versions?.length>0?r.success(`${s.display_name} 镜像可访问 (${V}s)`):r(`${s.display_name} 无法获取版本列表`,{description:"请检查网络连接"})}catch{r.error(`${s.display_name} 网络不可达`)}f(null)};return e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:137:5",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:138:7",className:"flex items-center justify-between",children:[e.jsx("p",{"code-path":"src/components/deploy/ToolConfigTab.tsx:139:9",className:"text-xs text-[var(--dg-text-secondary)]",children:"管理 DevOps 工具的安装策略:预装在镜像中、首次使用自动下载(懒加载)、或禁用不安装"}),e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:142:9",variant:"outline",size:"sm",onClick:p,children:[e.jsx(ee,{"code-path":"src/components/deploy/ToolConfigTab.tsx:143:11",className:"w-3.5 h-3.5 mr-1"}),"刷新"]})]}),L?e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:148:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:149:11",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):S.length===0?e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:152:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:"暂无工具配置,请检查后端种子数据"}):e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:156:9",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/ToolConfigTab.tsx:157:11",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/ToolConfigTab.tsx:158:13",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/ToolConfigTab.tsx:159:15",children:[e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:160:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"工具"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:161:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden sm:table-cell",children:"分类"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:162:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"安装方式"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:163:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:164:17",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/ToolConfigTab.tsx:167:13",children:S.map(s=>{const l=be.includes(s.name);return e.jsxs("tr",{"code-path":"src/components/deploy/ToolConfigTab.tsx:171:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:172:21",className:"px-3 py-2",children:[e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:173:23",className:"font-medium text-[var(--dg-text-primary)]",children:s.display_name}),e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:174:23",className:"text-xs text-[var(--dg-text-secondary)] font-mono",children:s.name}),s.description&&e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:176:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5 max-w-[220px] leading-tight",children:s.description}),s.installed_version&&s.status==="installed"&&e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:179:25",className:"text-xs text-emerald-400 font-mono mt-0.5",children:["v",s.installed_version]}),s.error_msg&&e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:182:25",className:"text-xs text-red-400 mt-0.5 max-w-[200px] truncate",title:s.error_msg,children:s.error_msg})]}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:185:21",className:"px-3 py-2 hidden sm:table-cell",children:e.jsx(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:186:23",className:`text-xs ${q[s.category]||q.other}`,children:Ce[s.category]||s.category})}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:190:21",className:"px-3 py-2",children:e.jsxs(M,{"code-path":"src/components/deploy/ToolConfigTab.tsx:191:23",value:s.install_method,onValueChange:x=>D(s,x),children:[e.jsx(Q,{"code-path":"src/components/deploy/ToolConfigTab.tsx:195:25",className:"h-7 w-[90px] text-xs",children:e.jsx(W,{"code-path":"src/components/deploy/ToolConfigTab.tsx:196:27"})}),e.jsxs(X,{"code-path":"src/components/deploy/ToolConfigTab.tsx:198:25",children:[e.jsx(E,{"code-path":"src/components/deploy/ToolConfigTab.tsx:199:27",value:"preinstall",children:"预装"}),e.jsx(E,{"code-path":"src/components/deploy/ToolConfigTab.tsx:200:27",value:"lazy",children:"懒加载"}),e.jsx(E,{"code-path":"src/components/deploy/ToolConfigTab.tsx:201:27",value:"disabled",children:"禁用"})]})]})}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:205:21",className:"px-3 py-2",children:s.status==="installed"?e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:207:25",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30 text-xs gap-1",children:[e.jsx(re,{"code-path":"src/components/deploy/ToolConfigTab.tsx:208:27",className:"w-3 h-3"}),"已安装"]}):s.status==="installing"?e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:211:25",className:"bg-amber-500/20 text-amber-400 border-amber-500/30 text-xs gap-1",children:[e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:212:27",className:"w-3 h-3 animate-spin"}),"安装中"]}):s.status==="failed"?e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:215:25",className:"bg-red-500/20 text-red-400 border-red-500/30 text-xs gap-1",children:[e.jsx(pe,{"code-path":"src/components/deploy/ToolConfigTab.tsx:216:27",className:"w-3 h-3"}),"失败"]}):e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:219:25",className:"bg-slate-500/20 text-slate-400 border-slate-500/30 text-xs gap-1",children:[e.jsx(ie,{"code-path":"src/components/deploy/ToolConfigTab.tsx:220:27",className:"w-3 h-3"}),"未安装"]})}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:224:21",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:225:23",className:"flex justify-end gap-1",children:[s.install_method==="lazy"&&s.status!=="installed"&&(l?e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:228:29",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>v(s),disabled:h===s.id,children:[h===s.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:234:33",className:"w-3 h-3 animate-spin mr-1"}):e.jsx(I,{"code-path":"src/components/deploy/ToolConfigTab.tsx:236:33",className:"w-3 h-3 mr-1"}),"安装"]}):e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:241:29",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>y(s),disabled:h===s.id,children:[h===s.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:247:33",className:"w-3 h-3 animate-spin mr-1"}):e.jsx(I,{"code-path":"src/components/deploy/ToolConfigTab.tsx:249:33",className:"w-3 h-3 mr-1"}),"安装"]})),s.install_method==="lazy"&&e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:256:27",variant:"ghost",size:"sm",className:"h-7 text-xs text-[var(--dg-text-secondary)]",onClick:()=>T(s),disabled:C===s.id,children:[C===s.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:262:31",className:"w-3 h-3 animate-spin mr-1"}):e.jsx(xe,{"code-path":"src/components/deploy/ToolConfigTab.tsx:264:31",className:"w-3 h-3 mr-1"}),"测试"]}),e.jsx(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:269:25",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(s),title:"检测",children:e.jsx(me,{"code-path":"src/components/deploy/ToolConfigTab.tsx:270:27",className:"w-3.5 h-3.5"})})]})})]},s.id)})})]})}),e.jsx(A,{"code-path":"src/components/deploy/ToolConfigTab.tsx:283:7",open:!!m,onOpenChange:()=>c(null),children:e.jsxs(H,{"code-path":"src/components/deploy/ToolConfigTab.tsx:284:9",className:"max-w-sm",children:[e.jsxs(J,{"code-path":"src/components/deploy/ToolConfigTab.tsx:285:11",children:[e.jsx(K,{"code-path":"src/components/deploy/ToolConfigTab.tsx:286:13",children:"选择安装版本"}),e.jsxs(oe,{"code-path":"src/components/deploy/ToolConfigTab.tsx:287:13",children:[m?.tool.display_name," — 请选择要安装的版本"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:291:11",className:"space-y-4 py-2",children:[e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:292:13",className:"space-y-2",children:m?.versions.map((s,l)=>e.jsxs("button",{"code-path":"src/components/deploy/ToolConfigTab.tsx:294:17",onClick:()=>u(s.version),className:`w-full flex items-center justify-between px-3 py-2.5 rounded-lg text-sm border transition-all ${g===s.version?"border-indigo-400/50 bg-indigo-400/10 text-[var(--dg-text-primary)]":"border-[var(--dg-border)] bg-[var(--dg-bg-secondary)] text-[var(--dg-text-secondary)] hover:border-[var(--dg-text-secondary)]/30"}`,children:[e.jsx("span",{"code-path":"src/components/deploy/ToolConfigTab.tsx:303:19",children:s.label}),e.jsx("span",{"code-path":"src/components/deploy/ToolConfigTab.tsx:304:19",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:s.version})]},s.version))}),e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:308:13",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:[e.jsx(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:309:15",variant:"outline",size:"sm",onClick:()=>c(null),children:"取消"}),e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:310:15",size:"sm",onClick:()=>m&&y(m.tool,g),disabled:!g||h===m?.tool.id,children:[h===m?.tool.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:316:19",className:"w-3.5 h-3.5 animate-spin mr-1"}):e.jsx(I,{"code-path":"src/components/deploy/ToolConfigTab.tsx:318:19",className:"w-3.5 h-3.5 mr-1"}),"安装"]})]})]})]})})]})}function ue({open:S,onClose:b,onSaved:L,editData:n}){const[h,j]=o.useState(""),[m,c]=o.useState(""),[g,u]=o.useState("development"),[C,f]=o.useState("#3B82F6"),[p,v]=o.useState(""),[y,N]=o.useState(50),[D,T]=o.useState(!1);o.useEffect(()=>{n?(j(n.name),c(n.display_name),u(n.type),f(n.color),v(n.description||""),N(n.sort_order)):(j(""),c(""),u("development"),f("#3B82F6"),v(""),N(50))},[n,S]);const s=async()=>{if(!h.trim()||!m.trim()){r.error("请填写名称");return}T(!0);try{n?await i.updateEnvironment(n.id,{name:h,display_name:m,type:g,color:C,sort_order:y,description:p}):await i.createEnvironment({name:h,display_name:m,type:g,color:C,sort_order:y,description:p}),r.success(n?"已更新":"已创建"),L(),b()}catch{r.error("操作失败")}finally{T(!1)}};return e.jsx(A,{"code-path":"src/components/deploy/DeployCredentials.tsx:67:5",open:S,onOpenChange:b,children:e.jsxs(H,{"code-path":"src/components/deploy/DeployCredentials.tsx:68:7",children:[e.jsx(J,{"code-path":"src/components/deploy/DeployCredentials.tsx:69:9",children:e.jsx(K,{"code-path":"src/components/deploy/DeployCredentials.tsx:69:23",children:n?"编辑环境":"新增环境"})}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:70:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:71:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:71:38",children:"环境标识"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:71:57",value:h,onChange:l=>j(l.target.value),placeholder:"production"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:72:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:72:38",children:"显示名称"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:72:57",value:m,onChange:l=>c(l.target.value),placeholder:"生产环境"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:73:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:73:38",children:"环境类型"}),e.jsxs(M,{"code-path":"src/components/deploy/DeployCredentials.tsx:74:13",value:g,onValueChange:u,children:[e.jsx(Q,{"code-path":"src/components/deploy/DeployCredentials.tsx:75:15",children:e.jsx(W,{"code-path":"src/components/deploy/DeployCredentials.tsx:75:30"})}),e.jsxs(X,{"code-path":"src/components/deploy/DeployCredentials.tsx:76:15",children:[e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:77:17",value:"production",children:"生产环境"}),e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:78:17",value:"staging",children:"预发布"}),e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:79:17",value:"testing",children:"测试环境"}),e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:80:17",value:"development",children:"开发环境"})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:84:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:84:38",children:"标志颜色"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:84:57",value:C,onChange:l=>f(l.target.value),type:"color",className:"w-16 h-9 p-1"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:85:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:85:38",children:"排序序号"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:85:57",value:y,onChange:l=>N(Number(l.target.value)),type:"number"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:86:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:86:38",children:"描述"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:86:55",value:p,onChange:l=>v(l.target.value),placeholder:"可选"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:88:9",className:"flex justify-end gap-2 mt-4",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:89:11",variant:"outline",onClick:b,children:"取消"}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:90:11",onClick:s,disabled:D,children:D?"...":n?"保存":"创建"})]})]})})}function Re(){const S=ae(),[b,L]=o.useState([]),[n,h]=o.useState([]),[j,m]=o.useState([]),[c,g]=o.useState(!1),[u,C]=o.useState(!1),[f,p]=o.useState("repo"),[v,y]=o.useState(null),[N,D]=o.useState(!1),[T,s]=o.useState(null),l=async()=>{g(!0);try{const[t,F,$]=await Promise.all([i.getRepos(),i.getRegistries(),i.getEnvironments()]);L(t?.list||[]),h(F?.list||[]),m($?.list||[])}catch{r.error("获取数据失败")}finally{g(!1)}};o.useEffect(()=>{l()},[]);const x=async(t,F)=>{if(await S({title:"删除",description:`确定删除「${F.name||F.display_name}」?`,confirmText:"删除",variant:"destructive"}))try{t==="repo"?await i.deleteRepo(F.id):t==="registry"?await i.deleteRegistry(F.id):await i.deleteEnvironment(F.id),r.success("已删除"),l()}catch{r.error("删除失败")}},V={production:"生产",staging:"预发布",testing:"测试",development:"开发"};return e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:137:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:138:7",className:"flex items-center justify-between",children:[e.jsx("h2",{"code-path":"src/components/deploy/DeployCredentials.tsx:139:9",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:"发布配置管理"}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:140:9",className:"flex items-center gap-2",children:[e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:141:11",variant:"outline",size:"sm",onClick:l,children:[e.jsx(ee,{"code-path":"src/components/deploy/DeployCredentials.tsx:141:66",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:142:11",size:"sm",onClick:()=>{p("repo"),y(null),C(!0)},children:[e.jsx(G,{"code-path":"src/components/deploy/DeployCredentials.tsx:143:13",className:"w-4 h-4 mr-1"}),"新增 Git 仓库"]}),e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:145:11",size:"sm",variant:"secondary",onClick:()=>{p("registry"),y(null),C(!0)},children:[e.jsx(G,{"code-path":"src/components/deploy/DeployCredentials.tsx:146:13",className:"w-4 h-4 mr-1"}),"新增镜像仓库"]})]})]}),e.jsxs(ne,{"code-path":"src/components/deploy/DeployCredentials.tsx:151:7",defaultValue:"repos",children:[e.jsxs(le,{"code-path":"src/components/deploy/DeployCredentials.tsx:152:9",children:[e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:153:11",value:"repos",className:"gap-1",children:[e.jsx(ye,{"code-path":"src/components/deploy/DeployCredentials.tsx:153:56",className:"w-4 h-4"}),"Git 仓库 (",b.length,")"]}),e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:154:11",value:"registries",className:"gap-1",children:[e.jsx(Z,{"code-path":"src/components/deploy/DeployCredentials.tsx:154:61",className:"w-4 h-4"}),"镜像仓库 (",n.length,")"]}),e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:155:11",value:"environments",className:"gap-1",children:[e.jsx(Y,{"code-path":"src/components/deploy/DeployCredentials.tsx:155:63",className:"w-4 h-4"}),"环境管理 (",j.length,")"]}),e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:156:11",value:"tools",className:"gap-1",children:[e.jsx(he,{"code-path":"src/components/deploy/DeployCredentials.tsx:156:56",className:"w-4 h-4"}),"工具配置"]})]}),e.jsx(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:159:9",value:"repos",className:"mt-3",children:c?e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:160:22",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/DeployCredentials.tsx:160:88",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):b.length===0?e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:161:34",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:"暂无 Git 仓库认证配置"}):e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:163:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/DeployCredentials.tsx:164:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/DeployCredentials.tsx:165:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:166:19",children:[e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:167:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:168:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"仓库 URL"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:169:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"认证方式"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:170:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:171:21",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/DeployCredentials.tsx:174:17",children:b.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:176:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:177:23",className:"px-3 py-2 font-medium text-[var(--dg-text-primary)]",children:t.name}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:178:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] hidden md:table-cell font-mono text-xs max-w-[300px] truncate",children:t.url}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:179:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:179:49",variant:"outline",className:"text-xs",children:t.auth_type})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:180:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:181:25",className:t.enabled?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:t.enabled?"启用":"禁用"})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:183:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:184:25",className:"flex justify-end gap-1",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:185:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{p("repo"),y(t.id),C(!0)},children:e.jsx(P,{"code-path":"src/components/deploy/DeployCredentials.tsx:185:165",className:"w-3.5 h-3.5"})}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:186:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>x("repo",t),children:e.jsx(U,{"code-path":"src/components/deploy/DeployCredentials.tsx:186:136",className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})}),e.jsx(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:197:9",value:"registries",className:"mt-3",children:c?e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:198:22",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/DeployCredentials.tsx:198:88",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):n.length===0?e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:199:39",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:"暂无镜像仓库认证配置"}):e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:201:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/DeployCredentials.tsx:202:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/DeployCredentials.tsx:203:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:204:19",children:[e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:205:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:206:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"Registry URL"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:207:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden sm:table-cell",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:208:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"认证"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:209:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:210:21",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/DeployCredentials.tsx:213:17",children:n.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:215:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:216:23",className:"px-3 py-2 font-medium text-[var(--dg-text-primary)]",children:t.name}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:217:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] hidden md:table-cell font-mono text-xs max-w-[250px] truncate",children:t.registry_url}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:218:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] hidden sm:table-cell",children:t.namespace||"-"}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:219:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:219:49",variant:"outline",className:"text-xs",children:t.auth_type})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:220:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:221:25",className:t.enabled?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:t.enabled?"启用":"禁用"})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:223:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:224:25",className:"flex justify-end gap-1",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:225:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{p("registry"),y(t.id),C(!0)},children:e.jsx(P,{"code-path":"src/components/deploy/DeployCredentials.tsx:225:169",className:"w-3.5 h-3.5"})}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:226:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>x("registry",t),children:e.jsx(U,{"code-path":"src/components/deploy/DeployCredentials.tsx:226:140",className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})}),e.jsxs(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:238:9",value:"environments",className:"mt-3",children:[e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:239:11",className:"flex items-center justify-end mb-3",children:e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:240:13",size:"sm",onClick:()=>{s(null),D(!0)},children:[e.jsx(G,{"code-path":"src/components/deploy/DeployCredentials.tsx:241:15",className:"w-4 h-4 mr-1"}),"新增环境"]})}),c?e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:244:22",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/DeployCredentials.tsx:244:88",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):j.length===0?e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:245:41",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:'暂无环境配置,点击"新增环境"创建'}):e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:247:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/DeployCredentials.tsx:248:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/DeployCredentials.tsx:249:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:250:19",children:[e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:251:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"环境标识"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:252:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"显示名称"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:253:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"类型"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:254:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"颜色"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:255:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"排序"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:256:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:257:21",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/DeployCredentials.tsx:260:17",children:j.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:262:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:263:23",className:"px-3 py-2 font-mono text-xs font-medium text-[var(--dg-text-primary)]",children:t.name}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:264:23",className:"px-3 py-2 text-[var(--dg-text-primary)]",children:e.jsxs("span",{"code-path":"src/components/deploy/DeployCredentials.tsx:265:25",className:"flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/deploy/DeployCredentials.tsx:266:27",className:"w-2.5 h-2.5 rounded-full inline-block",style:{backgroundColor:t.color}}),t.display_name]})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:270:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:270:49",variant:"secondary",className:"text-xs",children:V[t.type]||t.type})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:271:23",className:"px-3 py-2",children:e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:271:49",className:"w-6 h-6 rounded border",style:{backgroundColor:t.color}})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:272:23",className:"px-3 py-2 text-[var(--dg-text-secondary)]",children:t.sort_order}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:273:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:274:25",className:t.enabled?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:t.enabled?"启用":"禁用"})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:276:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:277:25",className:"flex justify-end gap-1",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:278:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{s(t),D(!0)},children:e.jsx(P,{"code-path":"src/components/deploy/DeployCredentials.tsx:278:144",className:"w-3.5 h-3.5"})}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:279:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>x("env",t),children:e.jsx(U,{"code-path":"src/components/deploy/DeployCredentials.tsx:279:137",className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})]}),e.jsx(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:291:9",value:"tools",className:"mt-3",children:e.jsx(je,{"code-path":"src/components/deploy/DeployCredentials.tsx:292:11"})})]}),e.jsx(ge,{"code-path":"src/components/deploy/DeployCredentials.tsx:296:7",open:u,onOpenChange:C,type:f,editId:v,repos:b,registries:n,onSave:l}),e.jsx(ue,{"code-path":"src/components/deploy/DeployCredentials.tsx:301:7",open:N,onClose:()=>D(!1),onSaved:l,editData:T})]})}export{Re as default}; +import{r as o,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{D as A,a as H,b as J,c as K,e as te,B as d,t as r,d as oe,f as ae}from"./index-Bp-M7P_8.js";import{I as z}from"./input-Bnlm--la.js";import{B as w}from"./badge-B00SZHvE.js";import{T as ne,a as le,b as O,c as B}from"./tabs-DbNlmoQJ.js";import{L as _}from"./label-NkONM5Mp.js";import{S as M,a as Q,b as W,c as X,d as E}from"./select-DbhcBWnH.js";import{d as i}from"./config-CBy2SxR-.js";import{c as ce}from"./credential-Df-OY-sx.js";import{G as Y,k as Z,ag as de,P as G,R as ee,L as k,y as re,a as pe,b as ie,v as I,Q as xe,au as me,J as ye,a6 as he,d as P,T as U}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";function ge({open:S,onOpenChange:b,type:L,editId:n,repos:h,registries:j,onSave:m}){const c=L==="repo",[g,u]=o.useState(""),[C,f]=o.useState(""),[p,v]=o.useState(""),[y,N]=o.useState(""),[D,T]=o.useState(""),[s,l]=o.useState([]),[x,V]=o.useState(!1),t=s.filter(a=>c?!0:a.secret_type==="docker"),F=async()=>{try{const a=await ce.list({page_size:100});l(a?.list||[])}catch{}};o.useEffect(()=>{if(F(),n)if(c){const a=h.find(R=>R.id===n);a&&(u(a.name),f(""),v(a.url),T(a.credential_id||""))}else{const a=j.find(R=>R.id===n);a&&(u(a.name),f(""),v(a.registry_url),N(a.namespace||""),T(a.credential_id||""))}else u(""),f(""),v(""),N(""),T("")},[n,S,c]);const $=async()=>{if(!g.trim()||!p.trim()){r.error("请填写名称和地址");return}V(!0);try{const a=D?Number(D):null,R=c?{name:g.trim(),description:C.trim(),url:p.trim(),credential_id:a}:{name:g.trim(),description:C.trim(),registry_url:p.trim(),namespace:y.trim(),credential_id:a};n?(c?await i.updateRepo(n,R):await i.updateRegistry(n,R),r.success("已更新")):(c?await i.createRepo(R):await i.createRegistry(R),r.success("已创建")),b(!1),m()}catch{r.error("保存失败")}finally{V(!1)}},se=c?Y:Z;return e.jsx(A,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:96:5",open:S,onOpenChange:b,children:e.jsxs(H,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:97:7",className:"sm:max-w-[480px] bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[e.jsx(J,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:98:9",children:e.jsxs(K,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:99:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(se,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:100:13",className:"h-5 w-5 text-[var(--dg-blue)]"}),n?"编辑":"新增",c?" Git 仓库":" 镜像仓库"]})}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:104:9",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:105:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:105:38",children:"名称 *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:106:13",value:g,onChange:a=>u(a.target.value),placeholder:c?"如:GitLab CE":"如:Harbor",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:107:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:107:38",children:c?"仓库 URL *":"Registry URL *"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:108:13",value:p,onChange:a=>v(a.target.value),placeholder:c?"http://10.10.10.72:9000/group/repo.git":"http://10.10.10.72",className:"font-mono text-sm bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),!c&&e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:109:23",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:109:50",children:"默认命名空间"}),e.jsx(z,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:110:13",value:y,onChange:a=>N(a.target.value),placeholder:"如:aiops",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:113:11",className:"space-y-1",children:[e.jsxs(_,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:114:13",children:["关联凭证 ",e.jsx("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:114:25",className:"text-xs text-[var(--dg-text-secondary)] opacity-70",children:"(认证由凭据管理统一配置)"})]}),e.jsxs(M,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:115:13",value:String(D),onValueChange:a=>T(a==="__none"?"":a),children:[e.jsx(Q,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:116:15",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(W,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:117:17",placeholder:c?"选择凭据(API/密码等)":"选择 Docker 密码凭据"})}),e.jsxs(X,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:119:15",children:[e.jsx(E,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:120:17",value:"__none",children:"不关联凭证"}),t.map(a=>e.jsx(E,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:122:19",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:123:21",className:"flex items-center gap-1.5",children:[e.jsx(de,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:124:23",className:"h-3 w-3 opacity-60"}),a.name," ",a.summary&&e.jsxs("span",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:125:46",className:"text-[10px] opacity-50",children:["(",a.summary,")"]})]})},a.id))]})]}),t.length===0&&e.jsxs("p",{"code-path":"src/components/deploy/CredentialFormDialog.tsx:132:15",className:"text-xs text-amber-400 flex items-center gap-1 mt-1",children:[e.jsx(G,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:133:17",className:"h-3 w-3"}),"暂无",c?"":"Docker 密码","类型凭证,请在凭证配置页面新增"]})]})]}),e.jsxs(te,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:139:9",children:[e.jsx(d,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:140:11",variant:"outline",onClick:()=>b(!1),children:"取消"}),e.jsx(d,{"code-path":"src/components/deploy/CredentialFormDialog.tsx:141:11",onClick:$,disabled:x,children:x?"保存中...":"保存"})]})]})})}const Ce={build:"构建",deploy:"部署",automation:"自动化",other:"其他"},q={build:"bg-amber-500/20 text-amber-400 border-amber-500/30",deploy:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",automation:"bg-purple-500/20 text-purple-400 border-purple-500/30",other:"bg-slate-500/20 text-slate-400 border-slate-500/30"},be=["jdk","nodejs","maven"];function je(){const[S,b]=o.useState([]),[L,n]=o.useState(!1),[h,j]=o.useState(null),[m,c]=o.useState(null),[g,u]=o.useState(""),[C,f]=o.useState(null),p=async()=>{n(!0);try{const s=await i.getTools();b(s?.list||[])}catch{r.error("获取工具配置失败")}finally{n(!1)}};o.useEffect(()=>{p()},[]);const v=async s=>{try{const x=(await i.getToolVersions(s.id))?.versions||[];if(x.length===0){y(s);return}c({tool:s,versions:x}),u(s.default_version||x[0]?.version||"")}catch{y(s)}},y=async(s,l)=>{j(s.id);try{const x=l||s.default_version;await i.installTool(s.id,x),r.success(`${s.display_name}${x?` (${x})`:""} 安装已触发`),c(null),setTimeout(async()=>{try{await i.checkTool(s.id),p()}catch{}j(null)},3e3)}catch{r.error("触发安装失败"),j(null)}},N=async s=>{try{const l=await i.checkTool(s.id);r.success(l?.available?`${s.display_name} 可用`:`${s.display_name} 不可用`),p()}catch{r.error("检测失败")}},D=async(s,l)=>{try{await i.updateTool(s.id,{install_method:l}),r.success("已更新"),p()}catch{r.error("更新失败")}},T=async s=>{f(s.id);const l=Date.now();try{const x=await i.getToolVersions(s.id),V=((Date.now()-l)/1e3).toFixed(1);x?.versions?.length>0?r.success(`${s.display_name} 镜像可访问 (${V}s)`):r(`${s.display_name} 无法获取版本列表`,{description:"请检查网络连接"})}catch{r.error(`${s.display_name} 网络不可达`)}f(null)};return e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:137:5",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:138:7",className:"flex items-center justify-between",children:[e.jsx("p",{"code-path":"src/components/deploy/ToolConfigTab.tsx:139:9",className:"text-xs text-[var(--dg-text-secondary)]",children:"管理 DevOps 工具的安装策略:预装在镜像中、首次使用自动下载(懒加载)、或禁用不安装"}),e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:142:9",variant:"outline",size:"sm",onClick:p,children:[e.jsx(ee,{"code-path":"src/components/deploy/ToolConfigTab.tsx:143:11",className:"w-3.5 h-3.5 mr-1"}),"刷新"]})]}),L?e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:148:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:149:11",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):S.length===0?e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:152:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:"暂无工具配置,请检查后端种子数据"}):e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:156:9",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/ToolConfigTab.tsx:157:11",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/ToolConfigTab.tsx:158:13",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/ToolConfigTab.tsx:159:15",children:[e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:160:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"工具"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:161:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden sm:table-cell",children:"分类"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:162:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"安装方式"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:163:17",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/ToolConfigTab.tsx:164:17",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/ToolConfigTab.tsx:167:13",children:S.map(s=>{const l=be.includes(s.name);return e.jsxs("tr",{"code-path":"src/components/deploy/ToolConfigTab.tsx:171:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:172:21",className:"px-3 py-2",children:[e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:173:23",className:"font-medium text-[var(--dg-text-primary)]",children:s.display_name}),e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:174:23",className:"text-xs text-[var(--dg-text-secondary)] font-mono",children:s.name}),s.description&&e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:176:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5 max-w-[220px] leading-tight",children:s.description}),s.installed_version&&s.status==="installed"&&e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:179:25",className:"text-xs text-emerald-400 font-mono mt-0.5",children:["v",s.installed_version]}),s.error_msg&&e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:182:25",className:"text-xs text-red-400 mt-0.5 max-w-[200px] truncate",title:s.error_msg,children:s.error_msg})]}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:185:21",className:"px-3 py-2 hidden sm:table-cell",children:e.jsx(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:186:23",className:`text-xs ${q[s.category]||q.other}`,children:Ce[s.category]||s.category})}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:190:21",className:"px-3 py-2",children:e.jsxs(M,{"code-path":"src/components/deploy/ToolConfigTab.tsx:191:23",value:s.install_method,onValueChange:x=>D(s,x),children:[e.jsx(Q,{"code-path":"src/components/deploy/ToolConfigTab.tsx:195:25",className:"h-7 w-[90px] text-xs",children:e.jsx(W,{"code-path":"src/components/deploy/ToolConfigTab.tsx:196:27"})}),e.jsxs(X,{"code-path":"src/components/deploy/ToolConfigTab.tsx:198:25",children:[e.jsx(E,{"code-path":"src/components/deploy/ToolConfigTab.tsx:199:27",value:"preinstall",children:"预装"}),e.jsx(E,{"code-path":"src/components/deploy/ToolConfigTab.tsx:200:27",value:"lazy",children:"懒加载"}),e.jsx(E,{"code-path":"src/components/deploy/ToolConfigTab.tsx:201:27",value:"disabled",children:"禁用"})]})]})}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:205:21",className:"px-3 py-2",children:s.status==="installed"?e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:207:25",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30 text-xs gap-1",children:[e.jsx(re,{"code-path":"src/components/deploy/ToolConfigTab.tsx:208:27",className:"w-3 h-3"}),"已安装"]}):s.status==="installing"?e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:211:25",className:"bg-amber-500/20 text-amber-400 border-amber-500/30 text-xs gap-1",children:[e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:212:27",className:"w-3 h-3 animate-spin"}),"安装中"]}):s.status==="failed"?e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:215:25",className:"bg-red-500/20 text-red-400 border-red-500/30 text-xs gap-1",children:[e.jsx(pe,{"code-path":"src/components/deploy/ToolConfigTab.tsx:216:27",className:"w-3 h-3"}),"失败"]}):e.jsxs(w,{"code-path":"src/components/deploy/ToolConfigTab.tsx:219:25",className:"bg-slate-500/20 text-slate-400 border-slate-500/30 text-xs gap-1",children:[e.jsx(ie,{"code-path":"src/components/deploy/ToolConfigTab.tsx:220:27",className:"w-3 h-3"}),"未安装"]})}),e.jsx("td",{"code-path":"src/components/deploy/ToolConfigTab.tsx:224:21",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:225:23",className:"flex justify-end gap-1",children:[s.install_method==="lazy"&&s.status!=="installed"&&(l?e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:228:29",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>v(s),disabled:h===s.id,children:[h===s.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:234:33",className:"w-3 h-3 animate-spin mr-1"}):e.jsx(I,{"code-path":"src/components/deploy/ToolConfigTab.tsx:236:33",className:"w-3 h-3 mr-1"}),"安装"]}):e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:241:29",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>y(s),disabled:h===s.id,children:[h===s.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:247:33",className:"w-3 h-3 animate-spin mr-1"}):e.jsx(I,{"code-path":"src/components/deploy/ToolConfigTab.tsx:249:33",className:"w-3 h-3 mr-1"}),"安装"]})),s.install_method==="lazy"&&e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:256:27",variant:"ghost",size:"sm",className:"h-7 text-xs text-[var(--dg-text-secondary)]",onClick:()=>T(s),disabled:C===s.id,children:[C===s.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:262:31",className:"w-3 h-3 animate-spin mr-1"}):e.jsx(xe,{"code-path":"src/components/deploy/ToolConfigTab.tsx:264:31",className:"w-3 h-3 mr-1"}),"测试"]}),e.jsx(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:269:25",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>N(s),title:"检测",children:e.jsx(me,{"code-path":"src/components/deploy/ToolConfigTab.tsx:270:27",className:"w-3.5 h-3.5"})})]})})]},s.id)})})]})}),e.jsx(A,{"code-path":"src/components/deploy/ToolConfigTab.tsx:283:7",open:!!m,onOpenChange:()=>c(null),children:e.jsxs(H,{"code-path":"src/components/deploy/ToolConfigTab.tsx:284:9",className:"max-w-sm",children:[e.jsxs(J,{"code-path":"src/components/deploy/ToolConfigTab.tsx:285:11",children:[e.jsx(K,{"code-path":"src/components/deploy/ToolConfigTab.tsx:286:13",children:"选择安装版本"}),e.jsxs(oe,{"code-path":"src/components/deploy/ToolConfigTab.tsx:287:13",children:[m?.tool.display_name," — 请选择要安装的版本"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:291:11",className:"space-y-4 py-2",children:[e.jsx("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:292:13",className:"space-y-2",children:m?.versions.map((s,l)=>e.jsxs("button",{"code-path":"src/components/deploy/ToolConfigTab.tsx:294:17",onClick:()=>u(s.version),className:`w-full flex items-center justify-between px-3 py-2.5 rounded-lg text-sm border transition-all ${g===s.version?"border-indigo-400/50 bg-indigo-400/10 text-[var(--dg-text-primary)]":"border-[var(--dg-border)] bg-[var(--dg-bg-secondary)] text-[var(--dg-text-secondary)] hover:border-[var(--dg-text-secondary)]/30"}`,children:[e.jsx("span",{"code-path":"src/components/deploy/ToolConfigTab.tsx:303:19",children:s.label}),e.jsx("span",{"code-path":"src/components/deploy/ToolConfigTab.tsx:304:19",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:s.version})]},s.version))}),e.jsxs("div",{"code-path":"src/components/deploy/ToolConfigTab.tsx:308:13",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:[e.jsx(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:309:15",variant:"outline",size:"sm",onClick:()=>c(null),children:"取消"}),e.jsxs(d,{"code-path":"src/components/deploy/ToolConfigTab.tsx:310:15",size:"sm",onClick:()=>m&&y(m.tool,g),disabled:!g||h===m?.tool.id,children:[h===m?.tool.id?e.jsx(k,{"code-path":"src/components/deploy/ToolConfigTab.tsx:316:19",className:"w-3.5 h-3.5 animate-spin mr-1"}):e.jsx(I,{"code-path":"src/components/deploy/ToolConfigTab.tsx:318:19",className:"w-3.5 h-3.5 mr-1"}),"安装"]})]})]})]})})]})}function ue({open:S,onClose:b,onSaved:L,editData:n}){const[h,j]=o.useState(""),[m,c]=o.useState(""),[g,u]=o.useState("development"),[C,f]=o.useState("#3B82F6"),[p,v]=o.useState(""),[y,N]=o.useState(50),[D,T]=o.useState(!1);o.useEffect(()=>{n?(j(n.name),c(n.display_name),u(n.type),f(n.color),v(n.description||""),N(n.sort_order)):(j(""),c(""),u("development"),f("#3B82F6"),v(""),N(50))},[n,S]);const s=async()=>{if(!h.trim()||!m.trim()){r.error("请填写名称");return}T(!0);try{n?await i.updateEnvironment(n.id,{name:h,display_name:m,type:g,color:C,sort_order:y,description:p}):await i.createEnvironment({name:h,display_name:m,type:g,color:C,sort_order:y,description:p}),r.success(n?"已更新":"已创建"),L(),b()}catch{r.error("操作失败")}finally{T(!1)}};return e.jsx(A,{"code-path":"src/components/deploy/DeployCredentials.tsx:67:5",open:S,onOpenChange:b,children:e.jsxs(H,{"code-path":"src/components/deploy/DeployCredentials.tsx:68:7",children:[e.jsx(J,{"code-path":"src/components/deploy/DeployCredentials.tsx:69:9",children:e.jsx(K,{"code-path":"src/components/deploy/DeployCredentials.tsx:69:23",children:n?"编辑环境":"新增环境"})}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:70:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:71:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:71:38",children:"环境标识"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:71:57",value:h,onChange:l=>j(l.target.value),placeholder:"production"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:72:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:72:38",children:"显示名称"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:72:57",value:m,onChange:l=>c(l.target.value),placeholder:"生产环境"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:73:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:73:38",children:"环境类型"}),e.jsxs(M,{"code-path":"src/components/deploy/DeployCredentials.tsx:74:13",value:g,onValueChange:u,children:[e.jsx(Q,{"code-path":"src/components/deploy/DeployCredentials.tsx:75:15",children:e.jsx(W,{"code-path":"src/components/deploy/DeployCredentials.tsx:75:30"})}),e.jsxs(X,{"code-path":"src/components/deploy/DeployCredentials.tsx:76:15",children:[e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:77:17",value:"production",children:"生产环境"}),e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:78:17",value:"staging",children:"预发布"}),e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:79:17",value:"testing",children:"测试环境"}),e.jsx(E,{"code-path":"src/components/deploy/DeployCredentials.tsx:80:17",value:"development",children:"开发环境"})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:84:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:84:38",children:"标志颜色"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:84:57",value:C,onChange:l=>f(l.target.value),type:"color",className:"w-16 h-9 p-1"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:85:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:85:38",children:"排序序号"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:85:57",value:y,onChange:l=>N(Number(l.target.value)),type:"number"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:86:11",className:"space-y-1",children:[e.jsx(_,{"code-path":"src/components/deploy/DeployCredentials.tsx:86:38",children:"描述"}),e.jsx(z,{"code-path":"src/components/deploy/DeployCredentials.tsx:86:55",value:p,onChange:l=>v(l.target.value),placeholder:"可选"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:88:9",className:"flex justify-end gap-2 mt-4",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:89:11",variant:"outline",onClick:b,children:"取消"}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:90:11",onClick:s,disabled:D,children:D?"...":n?"保存":"创建"})]})]})})}function Re(){const S=ae(),[b,L]=o.useState([]),[n,h]=o.useState([]),[j,m]=o.useState([]),[c,g]=o.useState(!1),[u,C]=o.useState(!1),[f,p]=o.useState("repo"),[v,y]=o.useState(null),[N,D]=o.useState(!1),[T,s]=o.useState(null),l=async()=>{g(!0);try{const[t,F,$]=await Promise.all([i.getRepos(),i.getRegistries(),i.getEnvironments()]);L(t?.list||[]),h(F?.list||[]),m($?.list||[])}catch{r.error("获取数据失败")}finally{g(!1)}};o.useEffect(()=>{l()},[]);const x=async(t,F)=>{if(await S({title:"删除",description:`确定删除「${F.name||F.display_name}」?`,confirmText:"删除",variant:"destructive"}))try{t==="repo"?await i.deleteRepo(F.id):t==="registry"?await i.deleteRegistry(F.id):await i.deleteEnvironment(F.id),r.success("已删除"),l()}catch{r.error("删除失败")}},V={production:"生产",staging:"预发布",testing:"测试",development:"开发"};return e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:137:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:138:7",className:"flex items-center justify-between",children:[e.jsx("h2",{"code-path":"src/components/deploy/DeployCredentials.tsx:139:9",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:"发布配置管理"}),e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:140:9",className:"flex items-center gap-2",children:[e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:141:11",variant:"outline",size:"sm",onClick:l,children:[e.jsx(ee,{"code-path":"src/components/deploy/DeployCredentials.tsx:141:66",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:142:11",size:"sm",onClick:()=>{p("repo"),y(null),C(!0)},children:[e.jsx(G,{"code-path":"src/components/deploy/DeployCredentials.tsx:143:13",className:"w-4 h-4 mr-1"}),"新增 Git 仓库"]}),e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:145:11",size:"sm",variant:"secondary",onClick:()=>{p("registry"),y(null),C(!0)},children:[e.jsx(G,{"code-path":"src/components/deploy/DeployCredentials.tsx:146:13",className:"w-4 h-4 mr-1"}),"新增镜像仓库"]})]})]}),e.jsxs(ne,{"code-path":"src/components/deploy/DeployCredentials.tsx:151:7",defaultValue:"repos",children:[e.jsxs(le,{"code-path":"src/components/deploy/DeployCredentials.tsx:152:9",children:[e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:153:11",value:"repos",className:"gap-1",children:[e.jsx(ye,{"code-path":"src/components/deploy/DeployCredentials.tsx:153:56",className:"w-4 h-4"}),"Git 仓库 (",b.length,")"]}),e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:154:11",value:"registries",className:"gap-1",children:[e.jsx(Z,{"code-path":"src/components/deploy/DeployCredentials.tsx:154:61",className:"w-4 h-4"}),"镜像仓库 (",n.length,")"]}),e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:155:11",value:"environments",className:"gap-1",children:[e.jsx(Y,{"code-path":"src/components/deploy/DeployCredentials.tsx:155:63",className:"w-4 h-4"}),"环境管理 (",j.length,")"]}),e.jsxs(O,{"code-path":"src/components/deploy/DeployCredentials.tsx:156:11",value:"tools",className:"gap-1",children:[e.jsx(he,{"code-path":"src/components/deploy/DeployCredentials.tsx:156:56",className:"w-4 h-4"}),"工具配置"]})]}),e.jsx(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:159:9",value:"repos",className:"mt-3",children:c?e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:160:22",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/DeployCredentials.tsx:160:88",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):b.length===0?e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:161:34",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:"暂无 Git 仓库认证配置"}):e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:163:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/DeployCredentials.tsx:164:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/DeployCredentials.tsx:165:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:166:19",children:[e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:167:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:168:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"仓库 URL"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:169:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"认证方式"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:170:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:171:21",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/DeployCredentials.tsx:174:17",children:b.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:176:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:177:23",className:"px-3 py-2 font-medium text-[var(--dg-text-primary)]",children:t.name}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:178:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] hidden md:table-cell font-mono text-xs max-w-[300px] truncate",children:t.url}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:179:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:179:49",variant:"outline",className:"text-xs",children:t.auth_type})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:180:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:181:25",className:t.enabled?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:t.enabled?"启用":"禁用"})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:183:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:184:25",className:"flex justify-end gap-1",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:185:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{p("repo"),y(t.id),C(!0)},children:e.jsx(P,{"code-path":"src/components/deploy/DeployCredentials.tsx:185:165",className:"w-3.5 h-3.5"})}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:186:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>x("repo",t),children:e.jsx(U,{"code-path":"src/components/deploy/DeployCredentials.tsx:186:136",className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})}),e.jsx(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:197:9",value:"registries",className:"mt-3",children:c?e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:198:22",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/DeployCredentials.tsx:198:88",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):n.length===0?e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:199:39",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:"暂无镜像仓库认证配置"}):e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:201:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/DeployCredentials.tsx:202:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/DeployCredentials.tsx:203:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:204:19",children:[e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:205:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:206:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"Registry URL"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:207:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] hidden sm:table-cell",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:208:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"认证"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:209:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:210:21",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/DeployCredentials.tsx:213:17",children:n.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:215:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:216:23",className:"px-3 py-2 font-medium text-[var(--dg-text-primary)]",children:t.name}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:217:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] hidden md:table-cell font-mono text-xs max-w-[250px] truncate",children:t.registry_url}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:218:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] hidden sm:table-cell",children:t.namespace||"-"}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:219:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:219:49",variant:"outline",className:"text-xs",children:t.auth_type})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:220:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:221:25",className:t.enabled?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:t.enabled?"启用":"禁用"})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:223:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:224:25",className:"flex justify-end gap-1",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:225:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{p("registry"),y(t.id),C(!0)},children:e.jsx(P,{"code-path":"src/components/deploy/DeployCredentials.tsx:225:169",className:"w-3.5 h-3.5"})}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:226:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>x("registry",t),children:e.jsx(U,{"code-path":"src/components/deploy/DeployCredentials.tsx:226:140",className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})}),e.jsxs(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:238:9",value:"environments",className:"mt-3",children:[e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:239:11",className:"flex items-center justify-end mb-3",children:e.jsxs(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:240:13",size:"sm",onClick:()=>{s(null),D(!0)},children:[e.jsx(G,{"code-path":"src/components/deploy/DeployCredentials.tsx:241:15",className:"w-4 h-4 mr-1"}),"新增环境"]})}),c?e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:244:22",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:[e.jsx(k,{"code-path":"src/components/deploy/DeployCredentials.tsx:244:88",className:"w-5 h-5 animate-spin mx-auto mb-2"}),"加载中..."]}):j.length===0?e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:245:41",className:"text-center py-8 text-[var(--dg-text-secondary)]",children:'暂无环境配置,点击"新增环境"创建'}):e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:247:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/DeployCredentials.tsx:248:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/DeployCredentials.tsx:249:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:250:19",children:[e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:251:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"环境标识"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:252:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"显示名称"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:253:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"类型"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:254:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"颜色"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:255:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"排序"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:256:21",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/DeployCredentials.tsx:257:21",className:"px-3 py-2 text-right font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/DeployCredentials.tsx:260:17",children:j.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/DeployCredentials.tsx:262:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:263:23",className:"px-3 py-2 font-mono text-xs font-medium text-[var(--dg-text-primary)]",children:t.name}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:264:23",className:"px-3 py-2 text-[var(--dg-text-primary)]",children:e.jsxs("span",{"code-path":"src/components/deploy/DeployCredentials.tsx:265:25",className:"flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/deploy/DeployCredentials.tsx:266:27",className:"w-2.5 h-2.5 rounded-full inline-block",style:{backgroundColor:t.color}}),t.display_name]})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:270:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:270:49",variant:"secondary",className:"text-xs",children:V[t.type]||t.type})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:271:23",className:"px-3 py-2",children:e.jsx("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:271:49",className:"w-6 h-6 rounded border",style:{backgroundColor:t.color}})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:272:23",className:"px-3 py-2 text-[var(--dg-text-secondary)]",children:t.sort_order}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:273:23",className:"px-3 py-2",children:e.jsx(w,{"code-path":"src/components/deploy/DeployCredentials.tsx:274:25",className:t.enabled?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:t.enabled?"启用":"禁用"})}),e.jsx("td",{"code-path":"src/components/deploy/DeployCredentials.tsx:276:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployCredentials.tsx:277:25",className:"flex justify-end gap-1",children:[e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:278:27",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>{s(t),D(!0)},children:e.jsx(P,{"code-path":"src/components/deploy/DeployCredentials.tsx:278:144",className:"w-3.5 h-3.5"})}),e.jsx(d,{"code-path":"src/components/deploy/DeployCredentials.tsx:279:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>x("env",t),children:e.jsx(U,{"code-path":"src/components/deploy/DeployCredentials.tsx:279:137",className:"w-3.5 h-3.5"})})]})})]},t.id))})]})})]}),e.jsx(B,{"code-path":"src/components/deploy/DeployCredentials.tsx:291:9",value:"tools",className:"mt-3",children:e.jsx(je,{"code-path":"src/components/deploy/DeployCredentials.tsx:292:11"})})]}),e.jsx(ge,{"code-path":"src/components/deploy/DeployCredentials.tsx:296:7",open:u,onOpenChange:C,type:f,editId:v,repos:b,registries:n,onSave:l}),e.jsx(ue,{"code-path":"src/components/deploy/DeployCredentials.tsx:301:7",open:N,onClose:()=>D(!1),onSaved:l,editData:T})]})}export{Re as default}; diff --git a/backend/static/assets/DeployRBAC-XP_74TOu.js b/backend/static/assets/DeployRBAC-DIvf4JmJ.js similarity index 97% rename from backend/static/assets/DeployRBAC-XP_74TOu.js rename to backend/static/assets/DeployRBAC-DIvf4JmJ.js index cb49d8b..1dbfacf 100644 --- a/backend/static/assets/DeployRBAC-XP_74TOu.js +++ b/backend/static/assets/DeployRBAC-DIvf4JmJ.js @@ -1 +1 @@ -import{r as o,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as D,a as g}from"./card-B-RtdR4H.js";import{f as Ne,B as a,u as ve,t as c}from"./index-LZWfu62c.js";import{I as h}from"./input-BdDauX3U.js";import{B as m}from"./badge-B0F5ZNtn.js";import{S as N,a as v,b as f,c as w,d as r}from"./select-4xU_9B3_.js";import{L as i}from"./label-u-lNUbKh.js";import{p as fe}from"./pipeline-Lgvc2XUS.js";import{d as x}from"./config-DAXaHuse.js";import{L as T,j as ae,P as le,J as b,a8 as pe,$ as ne,w as we,X as de,T as be,a3 as re,V as Se}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function Je(){const[p,xe]=o.useState([]),[me,F]=o.useState(!0),[S,A]=o.useState(!1),[y,ie]=o.useState([]),[n,k]=o.useState(null),[J,ye]=o.useState([]),[I,_]=o.useState([]),[l,he]=o.useState(""),[j,M]=o.useState(""),[G,X]=o.useState(!1),[q,z]=o.useState(!1),[P,H]=o.useState(""),[E,K]=o.useState(""),[C,O]=o.useState(""),[Q,W]=o.useState("editor"),[Y,Z]=o.useState(""),[Ce,U]=o.useState(null),[$,ee]=o.useState(""),[se,te]=o.useState(""),Re=Ne(),R=async()=>{F(!0);try{const[s,t,d]=await Promise.all([x.getItemRoles(),fe.getPipelines({page_size:200}),ve.getUsers({page_size:500})]);xe(Array.isArray(s)?s:s?.list||s?.data||[]),ie(Array.isArray(t)?t:t?.list||t?.data||[]);const u=Array.isArray(d)?d:d?.list||d?.data||[];ye(u)}catch{}finally{F(!1)}};o.useEffect(()=>{R()},[]);const L=async()=>{if(!l){_([]);return}try{const s=await x.getUserItemRoles(Number(l));_(Array.isArray(s)?s:s?.data||s?.list||[])}catch{_([])}};o.useEffect(()=>{L()},[l]);const B=o.useMemo(()=>{const s={};return p.forEach(t=>{try{const d=new RegExp(t.pattern);s[t.id]=y.filter(u=>d.test(u.code)).map(u=>u.code)}catch{s[t.id]=[]}}),s},[p,y]),oe=(n?p.find(s=>s.id===n):null)?B[n]||[]:[],ue=async()=>{if(!P.trim()||!E.trim()||!C.trim()){c.error("名称、代码、正则表达式不能为空");return}A(!0);try{await x.createItemRole({name:P.trim(),code:E.trim(),pattern:C.trim(),role:Q,description:Y}),c.success("已创建"),z(!1),H(""),K(""),O(""),W("editor"),Z(""),R()}catch(s){c.error(s?.message||"创建失败")}finally{A(!1)}},Ae=async s=>{if(!$.trim()){c.error("正则不能为空");return}A(!0);try{await x.updateItemRole(s,{pattern:$,role:se}),c.success("已更新"),U(null),R()}catch(t){c.error(t?.message||"更新失败")}finally{A(!1)}},je=async s=>{if(await Re({title:"删除角色",description:`确定删除「${s.name}」?匹配 ${B[s.id]?.length||0} 条流水线`,variant:"destructive"}))try{await x.deleteItemRole(s.id),c.success("已删除"),R()}catch{c.error("删除失败")}},Be=async s=>{try{await x.updateItemRole(s.id,{status:s.status?0:1}),c.success(s.status?"已禁用":"已启用"),R()}catch{c.error("操作失败")}},De=async()=>{if(!l||!j){c.error("请选择用户和角色");return}X(!0);try{await x.assignItemRole(Number(l),{user_id:Number(l),item_role_id:Number(j)}),c.success("已分配"),M(""),L()}catch(s){c.error(s?.message||"分配失败")}finally{X(!1)}},ge=async s=>{try{await x.removeItemRole(Number(l),s),c.success("已撤销"),L()}catch{c.error("撤销失败")}},ce=s=>s==="owner"?"bg-amber-500/20 text-amber-400 border-amber-500/30":s==="editor"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",V=J.find(s=>String(s.id)===l);return me?e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:167:23",className:"flex items-center justify-center py-20",children:e.jsx(T,{"code-path":"src/components/deploy/DeployRBAC.tsx:167:79",className:"w-6 h-6 animate-spin"})}):e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:170:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:172:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:173:9",children:[e.jsxs("h1",{"code-path":"src/components/deploy/DeployRBAC.tsx:174:11",className:"text-xl font-bold flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ae,{"code-path":"src/components/deploy/DeployRBAC.tsx:175:13",className:"w-5 h-5 text-purple-500"}),"发布权限"]}),e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:177:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"Jenkins-style Role Strategy — 按流水线 code 正则匹配分配角色"})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:181:9",onClick:()=>z(!0),disabled:q,children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:182:11",className:"w-4 h-4 mr-1"}),"新建角色"]})]}),e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:187:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:188:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:189:11",className:"flex items-center gap-2 mb-3",children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:190:13",className:"w-4 h-4 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:191:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"流水线命中预览"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:192:13",className:"text-xs text-[var(--dg-text-muted)]",children:"— 选择一个角色查看哪些流水线会被匹配"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:194:11",className:"flex gap-2 mb-3 flex-wrap",children:[e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:195:13",variant:n===null?"secondary":"ghost",size:"sm",onClick:()=>k(null),children:["全部 (",y.length,")"]}),p.map(s=>e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:197:15",variant:n===s.id?"secondary":"ghost",size:"sm",onClick:()=>k(s.id),className:s.status===0?"opacity-40":"",children:[s.name," (",B[s.id]?.length||0,")"]},s.id))]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:203:11",className:"flex flex-wrap gap-1.5 max-h-32 overflow-y-auto",children:[n===null?y.map(s=>e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:205:36",variant:"secondary",className:"text-xs",children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:205:94",className:"w-3 h-3 mr-0.5"}),s.code]},s.id)):y.map(s=>{const t=oe.includes(s.code);return e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:209:21",variant:t?"default":"secondary",className:`text-xs ${t?"bg-purple-500/20 text-purple-300 border-purple-500/30":"opacity-30"}`,children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:211:23",className:"w-3 h-3 mr-0.5"}),s.code]},s.id)}),n!==null&&oe.length===0&&e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:217:15",className:"text-xs text-red-400",children:"无匹配 — 请调整正则表达式"})]})]})}),q&&e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:225:9",className:"bg-[var(--dg-bg-secondary)] border-purple-500/20",children:e.jsxs(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:226:11",className:"p-4 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:227:13",className:"flex items-center justify-between",children:[e.jsxs("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:228:15",className:"text-sm font-medium text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:228:107",className:"w-4 h-4"}),"新建 Item Role"]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:229:15",variant:"ghost",size:"sm",onClick:()=>z(!1),children:"取消"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:231:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:232:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:232:42",className:"text-xs",children:"名称"}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:232:79",value:P,onChange:s=>H(s.target.value),placeholder:"如: backend",className:"h-8 text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:233:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:233:42",className:"text-xs",children:"代码 (唯一标识)"}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:233:86",value:E,onChange:s=>K(s.target.value),placeholder:"如: backend",className:"h-8 text-sm font-mono"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:235:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:236:15",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:237:17",className:"text-xs flex items-center gap-1",children:[e.jsx(pe,{"code-path":"src/components/deploy/DeployRBAC.tsx:237:68",className:"w-3 h-3"}),"正则匹配 Pattern"]}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:238:17",value:C,onChange:s=>{O(s.target.value)},placeholder:"如: ^cex-.*",className:"h-8 text-sm font-mono"}),C&&e.jsxs("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:240:19",className:"text-xs text-[var(--dg-text-muted)]",children:["实时匹配: ",(()=>{try{const s=y.filter(t=>new RegExp(C).test(t.code)).length;return s>0?`✅ 命中 ${s} 条流水线`:"⚠️ 无匹配"}catch{return"❌ 正则语法错误"}})()]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:245:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:246:17",className:"text-xs",children:"角色"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:247:17",value:Q,onValueChange:W,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:248:19",className:"h-8 text-sm",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:248:58"})}),e.jsxs(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:249:19",children:[e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:250:21",value:"owner",children:"拥有者 (owner)"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:251:21",value:"editor",children:"编辑者 (editor)"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:252:21",value:"viewer",children:"查看者 (viewer)"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:257:13",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:257:40",className:"text-xs",children:"描述 (可选)"}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:257:82",value:Y,onChange:s=>Z(s.target.value),placeholder:"简要说明此角色的用途",className:"h-8 text-sm"})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:258:13",onClick:ue,disabled:S,className:"w-full",children:[S?e.jsx(T,{"code-path":"src/components/deploy/DeployRBAC.tsx:259:25",className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(ne,{"code-path":"src/components/deploy/DeployRBAC.tsx:259:77",className:"w-4 h-4 mr-1"}),S?"创建中...":"创建"]})]})}),p.length===0?e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:268:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:[e.jsx(ae,{"code-path":"src/components/deploy/DeployRBAC.tsx:269:11",className:"w-10 h-10 mx-auto mb-2 opacity-20"}),e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:270:11",className:"text-sm",children:"暂无 Item Role"})]}):e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:273:9",className:"space-y-2",children:p.map(s=>e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:275:13",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${s.status===0?"opacity-50":""}`,children:e.jsx(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:276:15",className:"p-3",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:277:17",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:278:19",className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:279:21",className:"w-9 h-9 rounded-lg bg-purple-500/20 flex items-center justify-center shrink-0",children:e.jsx(pe,{"code-path":"src/components/deploy/DeployRBAC.tsx:280:23",className:"w-4 h-4 text-purple-400"})}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:282:21",className:"min-w-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:283:23",className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:284:25",className:"text-sm font-semibold text-[var(--dg-text-primary)]",children:s.name}),e.jsx(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:285:25",className:`text-xs border ${ce(s.role)}`,children:s.role==="owner"?"拥有者":s.role==="editor"?"编辑者":"查看者"}),s.status===0&&e.jsx(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:286:47",variant:"secondary",className:"text-xs text-red-400",children:"已禁用"}),e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:287:25",variant:"secondary",className:"text-xs cursor-pointer",onClick:()=>k(n===s.id?null:s.id),children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:288:27",className:"w-3 h-3 mr-0.5"}),B[s.id]?.length||0," 条"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:291:23",className:"text-xs text-[var(--dg-text-secondary)] mt-0.5 truncate",children:[e.jsx("code",{"code-path":"src/components/deploy/DeployRBAC.tsx:292:25",className:"font-mono text-purple-400 bg-purple-500/10 px-1 rounded",children:s.code}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:293:25",className:"mx-1",children:"→"}),e.jsx("code",{"code-path":"src/components/deploy/DeployRBAC.tsx:294:25",className:"font-mono text-blue-400 bg-blue-500/10 px-1 rounded",children:s.pattern}),s.description&&e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:295:46",className:"ml-2 opacity-60",children:s.description})]})]})]}),e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:299:19",className:"flex items-center gap-1 shrink-0",children:Ce===s.id?e.jsxs(e.Fragment,{children:[e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:302:25",value:$,onChange:t=>ee(t.target.value),className:"h-7 w-36 text-xs font-mono",placeholder:"正则表达式"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:303:25",value:se,onValueChange:te,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:304:27",className:"h-7 w-20 text-xs",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:304:71"})}),e.jsxs(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:305:27",children:[e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:306:29",value:"owner",children:"拥有者"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:307:29",value:"editor",children:"编辑者"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:308:29",value:"viewer",children:"查看者"})]})]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:311:25",size:"icon",variant:"ghost",className:"h-7 w-7 text-green-400",onClick:()=>Ae(s.id),children:e.jsx(we,{"code-path":"src/components/deploy/DeployRBAC.tsx:311:134",className:"w-3.5 h-3.5"})}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:312:25",size:"icon",variant:"ghost",className:"h-7 w-7 text-red-400",onClick:()=>U(null),children:e.jsx(de,{"code-path":"src/components/deploy/DeployRBAC.tsx:312:127",className:"w-3.5 h-3.5"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:316:25",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{U(s.id),ee(s.pattern),te(s.role)},children:[e.jsx(ne,{"code-path":"src/components/deploy/DeployRBAC.tsx:316:178",className:"w-3 h-3 mr-1"}),"编辑"]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:317:25",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>Be(s),children:s.status?"禁用":"启用"}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:318:25",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>je(s),children:e.jsx(be,{"code-path":"src/components/deploy/DeployRBAC.tsx:318:129",className:"w-3.5 h-3.5"})})]})})]})})},s.id))}),e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:330:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:331:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:332:11",className:"flex items-center gap-2 mb-3",children:[e.jsx(re,{"code-path":"src/components/deploy/DeployRBAC.tsx:333:13",className:"w-4 h-4 text-amber-400"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:334:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"分配角色给用户"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:336:11",className:"flex gap-3 items-end mb-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:337:13",className:"space-y-1 flex-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:338:15",className:"text-xs",children:"选择用户"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:339:15",value:l,onValueChange:he,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:340:17",className:"h-8 text-sm",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:340:56",placeholder:"选择用户..."})}),e.jsxs(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:341:17",className:"max-h-60",children:[e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:342:19",className:"px-2 py-1.5 sticky top-0 bg-popover z-10",children:e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:342:77",placeholder:"搜索用户...",className:"h-7 text-xs"})}),J.map(s=>e.jsxs(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:344:21",value:String(s.id),children:[s.real_name||s.username," (",s.username,")",I.some(t=>t.user_id===s.id)&&e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:346:69",className:"ml-2 text-xs text-purple-400",children:"已分配"})]},s.id))]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:352:13",className:"space-y-1 w-48",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:353:15",className:"text-xs",children:"Item Role"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:354:15",value:j,onValueChange:M,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:355:17",className:"h-8 text-sm",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:355:56",placeholder:"选择角色"})}),e.jsx(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:356:17",children:p.filter(s=>s.status===1).map(s=>e.jsxs(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:358:21",value:String(s.id),children:[s.name," (",s.role,")"]},s.id))})]})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:363:13",className:"h-8",onClick:De,disabled:G||!l||!j,children:[G?e.jsx(T,{"code-path":"src/components/deploy/DeployRBAC.tsx:364:32",className:"w-3.5 h-3.5 mr-1 animate-spin"}):e.jsx(re,{"code-path":"src/components/deploy/DeployRBAC.tsx:364:88",className:"w-3.5 h-3.5 mr-1"}),"分配"]})]}),V&&e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:371:13",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:372:15",className:"flex items-center gap-2 mb-2",children:[e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:373:17",variant:"secondary",className:"text-xs",children:[e.jsx(Se,{"code-path":"src/components/deploy/DeployRBAC.tsx:374:19",className:"w-3 h-3 mr-1"}),V.real_name||V.username]}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:376:17",className:"text-xs text-[var(--dg-text-muted)]",children:"已分配角色:"})]}),I.length===0?e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:379:17",className:"text-xs text-[var(--dg-text-muted)] py-2",children:"该用户尚未分配任何 Item Role"}):e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:381:17",className:"space-y-1",children:I.map(s=>{const t=s.item_role||p.find(d=>d.id===s.item_role_id);return e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:385:23",className:"flex items-center justify-between py-1.5 px-2 rounded bg-[var(--dg-bg-tertiary)] text-xs",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:386:25",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:387:27",className:`text-xs border ${ce(t?.role||"viewer")}`,children:t?.role==="owner"?"拥有者":t?.role==="editor"?"编辑者":"查看者"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:390:27",className:"text-[var(--dg-text-primary)]",children:t?.name||`#${s.item_role_id}`}),t&&e.jsx("code",{"code-path":"src/components/deploy/DeployRBAC.tsx:392:29",className:"font-mono text-[var(--dg-text-muted)] bg-[var(--dg-bg-primary)] px-1 rounded text-xs",children:t.pattern})]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:397:25",variant:"ghost",size:"icon",className:"h-6 w-6 text-red-400",onClick:()=>ge(s.id),children:e.jsx(de,{"code-path":"src/components/deploy/DeployRBAC.tsx:398:27",className:"w-3 h-3"})})]},s.id)})})]})]})})]})}export{Je as default}; +import{r as o,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as D,a as g}from"./card-BHSBTtub.js";import{f as Ne,B as a,u as ve,t as c}from"./index-Bp-M7P_8.js";import{I as h}from"./input-Bnlm--la.js";import{B as m}from"./badge-B00SZHvE.js";import{S as N,a as v,b as f,c as w,d as r}from"./select-DbhcBWnH.js";import{L as i}from"./label-NkONM5Mp.js";import{p as fe}from"./pipeline-BGteNHr0.js";import{d as x}from"./config-CBy2SxR-.js";import{L as T,j as ae,P as le,J as b,a8 as pe,$ as ne,w as we,X as de,T as be,a3 as re,V as Se}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";function Je(){const[p,xe]=o.useState([]),[me,F]=o.useState(!0),[S,A]=o.useState(!1),[y,ie]=o.useState([]),[n,k]=o.useState(null),[J,ye]=o.useState([]),[I,_]=o.useState([]),[l,he]=o.useState(""),[j,M]=o.useState(""),[G,X]=o.useState(!1),[q,z]=o.useState(!1),[P,H]=o.useState(""),[E,K]=o.useState(""),[C,O]=o.useState(""),[Q,W]=o.useState("editor"),[Y,Z]=o.useState(""),[Ce,U]=o.useState(null),[$,ee]=o.useState(""),[se,te]=o.useState(""),Re=Ne(),R=async()=>{F(!0);try{const[s,t,d]=await Promise.all([x.getItemRoles(),fe.getPipelines({page_size:200}),ve.getUsers({page_size:500})]);xe(Array.isArray(s)?s:s?.list||s?.data||[]),ie(Array.isArray(t)?t:t?.list||t?.data||[]);const u=Array.isArray(d)?d:d?.list||d?.data||[];ye(u)}catch{}finally{F(!1)}};o.useEffect(()=>{R()},[]);const L=async()=>{if(!l){_([]);return}try{const s=await x.getUserItemRoles(Number(l));_(Array.isArray(s)?s:s?.data||s?.list||[])}catch{_([])}};o.useEffect(()=>{L()},[l]);const B=o.useMemo(()=>{const s={};return p.forEach(t=>{try{const d=new RegExp(t.pattern);s[t.id]=y.filter(u=>d.test(u.code)).map(u=>u.code)}catch{s[t.id]=[]}}),s},[p,y]),oe=(n?p.find(s=>s.id===n):null)?B[n]||[]:[],ue=async()=>{if(!P.trim()||!E.trim()||!C.trim()){c.error("名称、代码、正则表达式不能为空");return}A(!0);try{await x.createItemRole({name:P.trim(),code:E.trim(),pattern:C.trim(),role:Q,description:Y}),c.success("已创建"),z(!1),H(""),K(""),O(""),W("editor"),Z(""),R()}catch(s){c.error(s?.message||"创建失败")}finally{A(!1)}},Ae=async s=>{if(!$.trim()){c.error("正则不能为空");return}A(!0);try{await x.updateItemRole(s,{pattern:$,role:se}),c.success("已更新"),U(null),R()}catch(t){c.error(t?.message||"更新失败")}finally{A(!1)}},je=async s=>{if(await Re({title:"删除角色",description:`确定删除「${s.name}」?匹配 ${B[s.id]?.length||0} 条流水线`,variant:"destructive"}))try{await x.deleteItemRole(s.id),c.success("已删除"),R()}catch{c.error("删除失败")}},Be=async s=>{try{await x.updateItemRole(s.id,{status:s.status?0:1}),c.success(s.status?"已禁用":"已启用"),R()}catch{c.error("操作失败")}},De=async()=>{if(!l||!j){c.error("请选择用户和角色");return}X(!0);try{await x.assignItemRole(Number(l),{user_id:Number(l),item_role_id:Number(j)}),c.success("已分配"),M(""),L()}catch(s){c.error(s?.message||"分配失败")}finally{X(!1)}},ge=async s=>{try{await x.removeItemRole(Number(l),s),c.success("已撤销"),L()}catch{c.error("撤销失败")}},ce=s=>s==="owner"?"bg-amber-500/20 text-amber-400 border-amber-500/30":s==="editor"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",V=J.find(s=>String(s.id)===l);return me?e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:167:23",className:"flex items-center justify-center py-20",children:e.jsx(T,{"code-path":"src/components/deploy/DeployRBAC.tsx:167:79",className:"w-6 h-6 animate-spin"})}):e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:170:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:172:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:173:9",children:[e.jsxs("h1",{"code-path":"src/components/deploy/DeployRBAC.tsx:174:11",className:"text-xl font-bold flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ae,{"code-path":"src/components/deploy/DeployRBAC.tsx:175:13",className:"w-5 h-5 text-purple-500"}),"发布权限"]}),e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:177:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"Jenkins-style Role Strategy — 按流水线 code 正则匹配分配角色"})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:181:9",onClick:()=>z(!0),disabled:q,children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:182:11",className:"w-4 h-4 mr-1"}),"新建角色"]})]}),e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:187:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:188:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:189:11",className:"flex items-center gap-2 mb-3",children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:190:13",className:"w-4 h-4 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:191:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"流水线命中预览"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:192:13",className:"text-xs text-[var(--dg-text-muted)]",children:"— 选择一个角色查看哪些流水线会被匹配"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:194:11",className:"flex gap-2 mb-3 flex-wrap",children:[e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:195:13",variant:n===null?"secondary":"ghost",size:"sm",onClick:()=>k(null),children:["全部 (",y.length,")"]}),p.map(s=>e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:197:15",variant:n===s.id?"secondary":"ghost",size:"sm",onClick:()=>k(s.id),className:s.status===0?"opacity-40":"",children:[s.name," (",B[s.id]?.length||0,")"]},s.id))]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:203:11",className:"flex flex-wrap gap-1.5 max-h-32 overflow-y-auto",children:[n===null?y.map(s=>e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:205:36",variant:"secondary",className:"text-xs",children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:205:94",className:"w-3 h-3 mr-0.5"}),s.code]},s.id)):y.map(s=>{const t=oe.includes(s.code);return e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:209:21",variant:t?"default":"secondary",className:`text-xs ${t?"bg-purple-500/20 text-purple-300 border-purple-500/30":"opacity-30"}`,children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:211:23",className:"w-3 h-3 mr-0.5"}),s.code]},s.id)}),n!==null&&oe.length===0&&e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:217:15",className:"text-xs text-red-400",children:"无匹配 — 请调整正则表达式"})]})]})}),q&&e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:225:9",className:"bg-[var(--dg-bg-secondary)] border-purple-500/20",children:e.jsxs(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:226:11",className:"p-4 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:227:13",className:"flex items-center justify-between",children:[e.jsxs("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:228:15",className:"text-sm font-medium text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(le,{"code-path":"src/components/deploy/DeployRBAC.tsx:228:107",className:"w-4 h-4"}),"新建 Item Role"]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:229:15",variant:"ghost",size:"sm",onClick:()=>z(!1),children:"取消"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:231:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:232:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:232:42",className:"text-xs",children:"名称"}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:232:79",value:P,onChange:s=>H(s.target.value),placeholder:"如: backend",className:"h-8 text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:233:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:233:42",className:"text-xs",children:"代码 (唯一标识)"}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:233:86",value:E,onChange:s=>K(s.target.value),placeholder:"如: backend",className:"h-8 text-sm font-mono"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:235:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:236:15",className:"space-y-1",children:[e.jsxs(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:237:17",className:"text-xs flex items-center gap-1",children:[e.jsx(pe,{"code-path":"src/components/deploy/DeployRBAC.tsx:237:68",className:"w-3 h-3"}),"正则匹配 Pattern"]}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:238:17",value:C,onChange:s=>{O(s.target.value)},placeholder:"如: ^cex-.*",className:"h-8 text-sm font-mono"}),C&&e.jsxs("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:240:19",className:"text-xs text-[var(--dg-text-muted)]",children:["实时匹配: ",(()=>{try{const s=y.filter(t=>new RegExp(C).test(t.code)).length;return s>0?`✅ 命中 ${s} 条流水线`:"⚠️ 无匹配"}catch{return"❌ 正则语法错误"}})()]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:245:15",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:246:17",className:"text-xs",children:"角色"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:247:17",value:Q,onValueChange:W,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:248:19",className:"h-8 text-sm",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:248:58"})}),e.jsxs(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:249:19",children:[e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:250:21",value:"owner",children:"拥有者 (owner)"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:251:21",value:"editor",children:"编辑者 (editor)"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:252:21",value:"viewer",children:"查看者 (viewer)"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:257:13",className:"space-y-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:257:40",className:"text-xs",children:"描述 (可选)"}),e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:257:82",value:Y,onChange:s=>Z(s.target.value),placeholder:"简要说明此角色的用途",className:"h-8 text-sm"})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:258:13",onClick:ue,disabled:S,className:"w-full",children:[S?e.jsx(T,{"code-path":"src/components/deploy/DeployRBAC.tsx:259:25",className:"w-4 h-4 mr-1 animate-spin"}):e.jsx(ne,{"code-path":"src/components/deploy/DeployRBAC.tsx:259:77",className:"w-4 h-4 mr-1"}),S?"创建中...":"创建"]})]})}),p.length===0?e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:268:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:[e.jsx(ae,{"code-path":"src/components/deploy/DeployRBAC.tsx:269:11",className:"w-10 h-10 mx-auto mb-2 opacity-20"}),e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:270:11",className:"text-sm",children:"暂无 Item Role"})]}):e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:273:9",className:"space-y-2",children:p.map(s=>e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:275:13",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${s.status===0?"opacity-50":""}`,children:e.jsx(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:276:15",className:"p-3",children:e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:277:17",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:278:19",className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:279:21",className:"w-9 h-9 rounded-lg bg-purple-500/20 flex items-center justify-center shrink-0",children:e.jsx(pe,{"code-path":"src/components/deploy/DeployRBAC.tsx:280:23",className:"w-4 h-4 text-purple-400"})}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:282:21",className:"min-w-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:283:23",className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:284:25",className:"text-sm font-semibold text-[var(--dg-text-primary)]",children:s.name}),e.jsx(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:285:25",className:`text-xs border ${ce(s.role)}`,children:s.role==="owner"?"拥有者":s.role==="editor"?"编辑者":"查看者"}),s.status===0&&e.jsx(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:286:47",variant:"secondary",className:"text-xs text-red-400",children:"已禁用"}),e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:287:25",variant:"secondary",className:"text-xs cursor-pointer",onClick:()=>k(n===s.id?null:s.id),children:[e.jsx(b,{"code-path":"src/components/deploy/DeployRBAC.tsx:288:27",className:"w-3 h-3 mr-0.5"}),B[s.id]?.length||0," 条"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:291:23",className:"text-xs text-[var(--dg-text-secondary)] mt-0.5 truncate",children:[e.jsx("code",{"code-path":"src/components/deploy/DeployRBAC.tsx:292:25",className:"font-mono text-purple-400 bg-purple-500/10 px-1 rounded",children:s.code}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:293:25",className:"mx-1",children:"→"}),e.jsx("code",{"code-path":"src/components/deploy/DeployRBAC.tsx:294:25",className:"font-mono text-blue-400 bg-blue-500/10 px-1 rounded",children:s.pattern}),s.description&&e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:295:46",className:"ml-2 opacity-60",children:s.description})]})]})]}),e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:299:19",className:"flex items-center gap-1 shrink-0",children:Ce===s.id?e.jsxs(e.Fragment,{children:[e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:302:25",value:$,onChange:t=>ee(t.target.value),className:"h-7 w-36 text-xs font-mono",placeholder:"正则表达式"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:303:25",value:se,onValueChange:te,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:304:27",className:"h-7 w-20 text-xs",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:304:71"})}),e.jsxs(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:305:27",children:[e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:306:29",value:"owner",children:"拥有者"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:307:29",value:"editor",children:"编辑者"}),e.jsx(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:308:29",value:"viewer",children:"查看者"})]})]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:311:25",size:"icon",variant:"ghost",className:"h-7 w-7 text-green-400",onClick:()=>Ae(s.id),children:e.jsx(we,{"code-path":"src/components/deploy/DeployRBAC.tsx:311:134",className:"w-3.5 h-3.5"})}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:312:25",size:"icon",variant:"ghost",className:"h-7 w-7 text-red-400",onClick:()=>U(null),children:e.jsx(de,{"code-path":"src/components/deploy/DeployRBAC.tsx:312:127",className:"w-3.5 h-3.5"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:316:25",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{U(s.id),ee(s.pattern),te(s.role)},children:[e.jsx(ne,{"code-path":"src/components/deploy/DeployRBAC.tsx:316:178",className:"w-3 h-3 mr-1"}),"编辑"]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:317:25",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>Be(s),children:s.status?"禁用":"启用"}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:318:25",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>je(s),children:e.jsx(be,{"code-path":"src/components/deploy/DeployRBAC.tsx:318:129",className:"w-3.5 h-3.5"})})]})})]})})},s.id))}),e.jsx(D,{"code-path":"src/components/deploy/DeployRBAC.tsx:330:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(g,{"code-path":"src/components/deploy/DeployRBAC.tsx:331:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:332:11",className:"flex items-center gap-2 mb-3",children:[e.jsx(re,{"code-path":"src/components/deploy/DeployRBAC.tsx:333:13",className:"w-4 h-4 text-amber-400"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:334:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"分配角色给用户"})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:336:11",className:"flex gap-3 items-end mb-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:337:13",className:"space-y-1 flex-1",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:338:15",className:"text-xs",children:"选择用户"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:339:15",value:l,onValueChange:he,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:340:17",className:"h-8 text-sm",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:340:56",placeholder:"选择用户..."})}),e.jsxs(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:341:17",className:"max-h-60",children:[e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:342:19",className:"px-2 py-1.5 sticky top-0 bg-popover z-10",children:e.jsx(h,{"code-path":"src/components/deploy/DeployRBAC.tsx:342:77",placeholder:"搜索用户...",className:"h-7 text-xs"})}),J.map(s=>e.jsxs(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:344:21",value:String(s.id),children:[s.real_name||s.username," (",s.username,")",I.some(t=>t.user_id===s.id)&&e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:346:69",className:"ml-2 text-xs text-purple-400",children:"已分配"})]},s.id))]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:352:13",className:"space-y-1 w-48",children:[e.jsx(i,{"code-path":"src/components/deploy/DeployRBAC.tsx:353:15",className:"text-xs",children:"Item Role"}),e.jsxs(N,{"code-path":"src/components/deploy/DeployRBAC.tsx:354:15",value:j,onValueChange:M,children:[e.jsx(v,{"code-path":"src/components/deploy/DeployRBAC.tsx:355:17",className:"h-8 text-sm",children:e.jsx(f,{"code-path":"src/components/deploy/DeployRBAC.tsx:355:56",placeholder:"选择角色"})}),e.jsx(w,{"code-path":"src/components/deploy/DeployRBAC.tsx:356:17",children:p.filter(s=>s.status===1).map(s=>e.jsxs(r,{"code-path":"src/components/deploy/DeployRBAC.tsx:358:21",value:String(s.id),children:[s.name," (",s.role,")"]},s.id))})]})]}),e.jsxs(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:363:13",className:"h-8",onClick:De,disabled:G||!l||!j,children:[G?e.jsx(T,{"code-path":"src/components/deploy/DeployRBAC.tsx:364:32",className:"w-3.5 h-3.5 mr-1 animate-spin"}):e.jsx(re,{"code-path":"src/components/deploy/DeployRBAC.tsx:364:88",className:"w-3.5 h-3.5 mr-1"}),"分配"]})]}),V&&e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:371:13",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:372:15",className:"flex items-center gap-2 mb-2",children:[e.jsxs(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:373:17",variant:"secondary",className:"text-xs",children:[e.jsx(Se,{"code-path":"src/components/deploy/DeployRBAC.tsx:374:19",className:"w-3 h-3 mr-1"}),V.real_name||V.username]}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:376:17",className:"text-xs text-[var(--dg-text-muted)]",children:"已分配角色:"})]}),I.length===0?e.jsx("p",{"code-path":"src/components/deploy/DeployRBAC.tsx:379:17",className:"text-xs text-[var(--dg-text-muted)] py-2",children:"该用户尚未分配任何 Item Role"}):e.jsx("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:381:17",className:"space-y-1",children:I.map(s=>{const t=s.item_role||p.find(d=>d.id===s.item_role_id);return e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:385:23",className:"flex items-center justify-between py-1.5 px-2 rounded bg-[var(--dg-bg-tertiary)] text-xs",children:[e.jsxs("div",{"code-path":"src/components/deploy/DeployRBAC.tsx:386:25",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/deploy/DeployRBAC.tsx:387:27",className:`text-xs border ${ce(t?.role||"viewer")}`,children:t?.role==="owner"?"拥有者":t?.role==="editor"?"编辑者":"查看者"}),e.jsx("span",{"code-path":"src/components/deploy/DeployRBAC.tsx:390:27",className:"text-[var(--dg-text-primary)]",children:t?.name||`#${s.item_role_id}`}),t&&e.jsx("code",{"code-path":"src/components/deploy/DeployRBAC.tsx:392:29",className:"font-mono text-[var(--dg-text-muted)] bg-[var(--dg-bg-primary)] px-1 rounded text-xs",children:t.pattern})]}),e.jsx(a,{"code-path":"src/components/deploy/DeployRBAC.tsx:397:25",variant:"ghost",size:"icon",className:"h-6 w-6 text-red-400",onClick:()=>ge(s.id),children:e.jsx(de,{"code-path":"src/components/deploy/DeployRBAC.tsx:398:27",className:"w-3 h-3"})})]},s.id)})})]})]})})]})}export{Je as default}; diff --git a/backend/static/assets/DeploymentDetailPage-DEq3tEZd.js b/backend/static/assets/DeploymentDetailPage-DEq3tEZd.js deleted file mode 100644 index 45b1806..0000000 --- a/backend/static/assets/DeploymentDetailPage-DEq3tEZd.js +++ /dev/null @@ -1,20 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PodFileBrowser-Bs6KRfHw.js","assets/vendor-codemirror-C7mXSpXt.js","assets/index-LZWfu62c.js","assets/vendor-icons-Aso0-eeY.js","assets/index-BzYDIT5o.css","assets/use-toast-CkA38LVP.js","assets/index-Z0O8nAcG.js","assets/select-4xU_9B3_.js","assets/index-CYARH0Cq.js","assets/vendor-xterm-20M9KZE1.js","assets/vendor-xterm-DXOU9pbP.css","assets/badge-B0F5ZNtn.js"])))=>i.map(i=>d[i]); -import{j as e,r as p}from"./vendor-codemirror-C7mXSpXt.js";import{B as u,f as nt,o as vt,i as Xt,a8 as js,g as Ns}from"./index-LZWfu62c.js";import{C as V,a as F,b as me,c as xe}from"./card-B-RtdR4H.js";import{B as te}from"./badge-B0F5ZNtn.js";import{k as ce}from"./index-Z0O8nAcG.js";import{u as Te}from"./use-toast-CkA38LVP.js";import{S as we,g as fs,f as Ve,h as Ss,s as pt,e as Es,d as It,Y as Ot,P as ws,a as Cs}from"./PodFileBrowser-Bs6KRfHw.js";import{I as y}from"./input-BdDauX3U.js";import{Q as Qt,f as Zt,F as kt,r as es,H as ts,L as ue,N as Ae,E as Ds,A as ss,b as ns,n as Ps,k as Fe,P as oe,aq as As,s as gt,b8 as Ts,aN as os,b9 as mt,T as he,$ as ot,g as Hs,ba as Ms,a4 as as,j as rs,am as Bs,aK as cs,bb as Rs,z as ls,D as et,b2 as Is,h as jt,aM as Os,aL as Ls,G as _s,M as zs,R as at,p as ut,y as bt,d as Lt,J as xt,X as ds,l as is,a as $s,m as Ws,aD as _t,bc as Gs,ar as Vs}from"./vendor-icons-Aso0-eeY.js";import{T as Ie,a as Oe,b as Ne,c as K,d as Le,e as X}from"./table-BPFYQwjr.js";import{L as T}from"./label-u-lNUbKh.js";import{T as tt}from"./textarea-BdtIagjy.js";import{S as $e,a as We,b as st,c as Ge,d as ve}from"./select-4xU_9B3_.js";import{S as Nt}from"./switch-C4PJnJ9I.js";import{R as Fs}from"./ResourceVisualEditor-CXyg-7xn.js";import"./vendor-xterm-20M9KZE1.js";import"./index-CYARH0Cq.js";function ps(t){const s=t.conditions||t.pod_conditions||[],o=n=>s.find(c=>(c.type||c.Type)===n),a=n=>n?.lastTransitionTime||n?.LastTransitionTime||n?.last_transition_time;return{scheduled:a(o("PodScheduled")||{}),initialized:a(o("Initialized")||{}),containersReady:a(o("ContainersReady")||{}),ready:a(o("Ready")||{}),startTime:t.start_time||t.startTime}}function Be({label:t,value:s}){return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:25:5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:26:7",className:"text-xs text-[var(--dg-text-muted)] mb-1",children:t}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:27:7",className:"text-sm text-[var(--dg-text-primary)]",children:s})]})}function ms({pod:t}){const s=ps(t),o=[{label:"已调度",ts:s.scheduled,color:we.blue},{label:"已初始化",ts:s.initialized,color:we.orange},{label:"容器已就绪",ts:s.containersReady,color:we.green},{label:"容器组已就绪",ts:s.ready,color:we.green}];return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:42:5",className:"flex items-center gap-2 overflow-x-auto",children:o.map((a,n)=>{const c=o[n-1],d=fs(c?.ts,a.ts);return e.jsxs(p.Fragment,{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:47:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:48:13",className:"flex flex-col items-center min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:49:15",className:"h-2 w-2 rounded-full",style:{background:a.ts?a.color:"#334155"}}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:50:15",className:"text-[10px] mt-1 font-medium",style:{color:a.ts?a.color:"#475569"},children:a.label}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:51:15",className:"text-[9px] text-[var(--dg-text-muted)]",children:a.ts?Ve(a.ts):"-"})]}),n{const S=ps(i),l=c===i.name,v=i.node_name||i.node;return e.jsx(V,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:26:11",className:"dg-card",children:e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:27:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:29:15",className:"flex items-center gap-3",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:30:17",variant:"ghost",size:"icon",className:"h-6 w-6 text-[var(--dg-text-muted)]",onClick:()=>d(l?null:i.name),children:l?e.jsx(Qt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:31",className:"h-4 w-4"}):e.jsx(Zt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:69",className:"h-4 w-4"})}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:33:17",className:"font-mono text-sm text-[var(--dg-text-primary)]",children:i.name}),e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:34:17",style:{background:`${pt(i.status)}22`,color:pt(i.status),border:`1px solid ${pt(i.status)}44`},children:i.status||"Unknown"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:37:17",className:"text-xs text-[var(--dg-text-muted)]",children:e.jsx("button",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:38:19",className:"text-[var(--dg-blue)] hover:underline mr-2",onClick:()=>window.open(`/kubernetes/${t}/nodes/${v}`,"_blank"),children:v||"-"})}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:42:17",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:i.ip||i.pod_ip||"-"}),e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:43:17",className:"text-xs text-[var(--dg-text-muted)]",children:["重启 ",i.restart_count||0," 次"]}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:44:17",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(S.startTime||i.created_at)}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:45:17",className:"flex-1"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:46:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-[var(--dg-blue)]",onClick:()=>o(i),children:[e.jsx(kt,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:47:19",className:"h-3.5 w-3.5 mr-1"}),"日志"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:49:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-emerald-400",onClick:()=>a(i),children:[e.jsx(es,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:50:19",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:52:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-amber-400",onClick:()=>n(i),children:[e.jsx(ts,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:53:19",className:"h-3.5 w-3.5 mr-1"}),"文件"]})]}),l&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:58:17",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:[e.jsx(ms,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:59:19",pod:i}),i.containers&&i.containers.length>0&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:62:21",className:"mt-3 grid grid-cols-1 md:grid-cols-2 gap-2",children:i.containers.map((g,A)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:64:25",className:"p-2 rounded bg-[var(--dg-bg-tertiary)] text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:65:27",className:"flex items-center justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:66:29",className:"font-medium text-[var(--dg-text-primary)]",children:g.name}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:67:29",className:g.ready?"text-emerald-400":"text-[var(--dg-text-muted)]",children:g.ready?"Ready":"Pending"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:69:27",className:"text-[var(--dg-text-muted)] mt-1",children:g.image}),g.resources&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:71:29",className:"mt-1 flex gap-3",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:72:31",children:["CPU: ",g.resources?.requests?.cpu||"0","/",g.resources?.limits?.cpu||"-"," m"]}),e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:73:31",children:["内存: ",g.resources?.requests?.memory||"0","/",g.resources?.limits?.memory||"-"]})]})]},A))})]})]})},i.name)})})}function Us({services:t,ingresses:s,loading:o}){return o==="services"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:11:12",className:"flex items-center justify-center py-12",children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:11:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:14:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:16:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:17:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:18:11",className:"h-4 w-4 text-[var(--dg-blue)]"}),"关联 Service"]}),t.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:21:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Service(Deployment 选择器未关联任何 Service)"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:23:11",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:24:13",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:25:15",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:26:17",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:27:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:28:19",className:"text-[var(--dg-text-muted)]",children:"类型"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:29:19",className:"text-[var(--dg-text-muted)]",children:"ClusterIP"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:30:19",className:"text-[var(--dg-text-muted)]",children:"端口"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:31:19",className:"text-[var(--dg-text-muted)]",children:"Selector"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:34:15",children:t.map(a=>e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:36:19",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:37:21",className:"font-medium text-[var(--dg-text-primary)]",children:a.name}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:38:21",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:38:32",variant:"outline",className:"text-xs",children:a.type})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:39:21",className:"font-mono text-sm text-[var(--dg-text-muted)]",children:a.clusterIP}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:40:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.ports.join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:41:21",className:"text-xs text-[var(--dg-text-muted)]",children:Object.entries(a.selector).map(([n,c])=>e.jsxs("code",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:43:25",className:"mr-1 bg-[var(--dg-bg-tertiary)] px-1 rounded",children:[n,"=",c]},n))})]},a.name))})]})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:55:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:56:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Ds,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:57:11",className:"h-4 w-4 text-[var(--dg-purple)]"}),"关联 Ingress"]}),s.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:60:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Ingress"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:62:11",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:63:13",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:64:15",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:65:17",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:66:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:67:19",className:"text-[var(--dg-text-muted)]",children:"Class"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:68:19",className:"text-[var(--dg-text-muted)]",children:"Host"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:69:19",className:"text-[var(--dg-text-muted)]",children:"路径"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:72:15",children:s.map(a=>e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:74:19",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:75:21",className:"font-medium text-[var(--dg-text-primary)]",children:a.name}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:76:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.className}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:77:21",className:"text-sm text-[var(--dg-text-muted)]",children:a.hosts.join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:78:21",className:"text-xs text-[var(--dg-text-muted)]",children:a.rules.flatMap(n=>(n.http?.paths||n.paths||[]).map(c=>c.path||"/")).join(", ")})]},a.name))})]})})]})]})}function Ys({events:t,loading:s}){return s==="events"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:12:12",className:"flex items-center justify-center py-12",children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:12:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):t.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:15:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无事件"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:18:5",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:19:7",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:20:9",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:21:11",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:22:13",className:"text-[var(--dg-text-muted)] w-16",children:"类型"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:23:13",className:"text-[var(--dg-text-muted)] w-24",children:"原因"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:24:13",className:"text-[var(--dg-text-muted)]",children:"消息"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:25:13",className:"text-[var(--dg-text-muted)] w-20",children:"来源"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:26:13",className:"text-[var(--dg-text-muted)] w-10",children:"次数"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:27:13",className:"text-[var(--dg-text-muted)] w-40",children:"最后时间"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:30:9",children:t.map((o,a)=>e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:32:13",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:33:15",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:34:17",variant:"outline",className:o.type==="Warning"?"text-[var(--dg-yellow)] border-[var(--dg-yellow)]/30":"text-[var(--dg-text-muted)] border-[var(--dg-border)]",children:o.type})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:38:15",className:"text-sm text-[var(--dg-text-secondary)]",children:o.reason}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:39:15",className:"text-sm text-[var(--dg-text-primary)] max-w-md whitespace-normal break-words",children:o.message}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:40:15",className:"text-xs text-[var(--dg-text-muted)]",children:o.source}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:41:15",className:"text-sm text-[var(--dg-text-muted)]",children:o.count}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:42:15",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(o.lastTimestamp)})]},a))})]})})}function Js({hpas:t,cronHpas:s,loading:o,replicas:a}){return o==="scale"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:12:12",className:"flex items-center justify-center py-12",children:e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:12:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:16:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:18:7",className:"flex items-center gap-2 px-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:19:9",className:"text-sm text-[var(--dg-text-muted)]",children:"当前副本:"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:20:9",className:"text-sm font-bold text-[var(--dg-text-primary)]",children:a}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:21:9",className:"text-xs text-[var(--dg-text-muted)]",children:"(可通过 Tab 栏右侧 +/- 手动调整)"})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:25:7",className:"dg-card",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:9",className:"pb-2",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:38",className:"text-sm flex items-center gap-2",children:[e.jsx(ss,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:93",className:"h-4 w-4 text-[var(--dg-orange)]"}),"HPA — 水平自动伸缩"]})}),e.jsx(F,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:27:9",children:t.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:29:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 HPA — ",e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:30:25",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 HPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:33:13",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:34:15",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:35:17",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:36:19",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:37:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:38:21",className:"text-[var(--dg-text-muted)]",children:"最小/最大"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:39:21",className:"text-[var(--dg-text-muted)]",children:"指标"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:40:21",className:"text-[var(--dg-text-muted)]",children:"当前负载"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:41:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:44:17",children:t.map((n,c)=>{const d=n.spec?.minReplicas??n.minReplicas??1,i=n.spec?.maxReplicas??n.maxReplicas??10,S=n.spec?.metrics||n.metrics||[],l=n.status?.currentReplicas??n.currentReplicas??0,A=(n.status?.conditions||n.conditions||[]).find(b=>b.type==="AbleToScale")?.status==="True";return e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:54:23",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:55:25",className:"font-medium text-[var(--dg-text-primary)]",children:n.name||n.metadata?.name}),e.jsxs(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:56:25",className:"text-sm text-[var(--dg-text-secondary)] font-mono",children:[d," → ",i]}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:57:25",className:"text-xs text-[var(--dg-text-muted)]",children:S.map((b,E)=>{const f=b.resource||b.object?.metric?.name||"",w=b.resource?.target?.averageUtilization||b.resource?.target?.averageValue||b.resource?.target?.type||"-";return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:61:36",children:[f?.name||f,": ",w,b.resource?.target?.averageUtilization?"%":""]},E)})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:64:25",className:"text-sm font-mono text-[var(--dg-text-secondary)]",children:l}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:65:25",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:66:27",className:A?"bg-[var(--dg-green)]/20 text-[var(--dg-green)]":"bg-[var(--dg-red)]/20 text-[var(--dg-red)]",children:A?"正常":"异常"})})]},n.name||c)})})]})})})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:81:7",className:"dg-card",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:9",className:"pb-2",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:38",className:"text-sm flex items-center gap-2",children:[e.jsx(ns,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:93",className:"h-4 w-4 text-[var(--dg-blue)]"}),"CronHPA — 定时伸缩"]})}),e.jsx(F,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:83:9",children:s.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:85:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 CronHPA — ",e.jsx(u,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:86:29",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 CronHPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:89:13",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:90:15",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:91:17",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:92:19",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:93:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:94:21",className:"text-[var(--dg-text-muted)]",children:"目标副本"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:95:21",className:"text-[var(--dg-text-muted)]",children:"调度规则"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:96:21",className:"text-[var(--dg-text-muted)]",children:"时区"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:97:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:100:17",children:s.map((n,c)=>{const d=n.spec?.jobs||n.jobs||[],i=n.spec?.timezone||"UTC";return e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:105:23",className:"border-[var(--dg-border)]",children:[e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:106:25",className:"font-medium text-[var(--dg-text-primary)]",children:n.name||n.metadata?.name}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:107:25",className:"text-sm text-[var(--dg-text-secondary)]",children:d.map(S=>S.targetSize||S.targetReplicas||"?").join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:110:25",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:d.map(S=>S.schedule||"?").join(", ")}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:111:25",className:"text-xs text-[var(--dg-text-muted)]",children:i}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:112:25",children:e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:113:27",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)]",children:"已启用"})})]},n.name||c)})})]})})})]})]})}function Ks({revisions:t,rollbackLoading:s,onRollback:o}){return t.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:12:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无历史版本"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:15:5",className:"overflow-x-auto",children:e.jsxs(Ie,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:16:7",children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:17:9",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:18:11",className:"border-[var(--dg-border)]",children:[e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:19:13",className:"text-[var(--dg-text-muted)] w-24",children:"Revision"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:20:13",className:"text-[var(--dg-text-muted)]",children:"镜像"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:21:13",className:"text-[var(--dg-text-muted)] w-24",children:"状态"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:22:13",className:"text-[var(--dg-text-muted)] w-40",children:"更新时间"}),e.jsx(K,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:23:13",className:"text-[var(--dg-text-muted)] w-24",children:"操作"})]})}),e.jsx(Le,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:26:9",children:t.map((a,n)=>{const c=a.revision??a.revision_number??a.number??n+1,d=n===0;return e.jsxs(Ne,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:31:15",className:"border-[var(--dg-border)]",children:[e.jsxs(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:32:17",className:"font-mono text-[var(--dg-text-primary)]",children:["#",c]}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:33:17",className:"text-xs font-mono text-[var(--dg-text-muted)] max-w-[300px] truncate",children:a.image||a.images?.[0]||"-"}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:34:17",children:d?e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:36:23",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)] border-[var(--dg-green)]/30",children:"当前"}):e.jsx(te,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:37:23",variant:"outline",className:"text-[var(--dg-text-muted)]",children:"历史"})}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:39:17",className:"text-xs text-[var(--dg-text-muted)]",children:Ve(a.created_at||a.time)}),e.jsx(X,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:40:17",children:e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:41:19",variant:"ghost",size:"sm",className:"h-7 text-amber-400",disabled:d||s!==null,onClick:()=>o(a),children:[s===c?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:53",className:"h-3 w-3 animate-spin mr-1"}):e.jsx(Ps,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:105",className:"h-3 w-3 mr-1"}),"回滚"]})})]},c)})})]})})}function Xs(t){const{clusterCode:s,namespace:o,deployment:a,pods:n,revisions:c,onRefresh:d}=t,{toast:i}=Te(),S=nt(),[l,v]=p.useState("pods"),[g,A]=p.useState(null),[b,E]=p.useState(null),[f,w]=p.useState(a?.replicas||0),[_,I]=p.useState(!1),[Z,q]=p.useState([]),[Q,$]=p.useState([]),[U,Y]=p.useState([]),[P,z]=p.useState(""),[x,H]=p.useState([]),[G,M]=p.useState([]),ee=a?.ready_replicas??a?.readyReplicas??0,le=a?.replicas??0,ke=ee===le&&le>0;p.useEffect(()=>{l==="services"&&(z("services"),Promise.all([ce.getNamespaceServices(s,o).catch(()=>[]),ce.getNamespaceIngresses(s,o).catch(()=>[])]).then(([r,h])=>{const N=R=>Array.isArray(R)?R:R?.list||R?.items||R?.data||[],O=N(r),B=N(h),J=a?.spec?.selector?.matchLabels||a?.spec?.template?.metadata?.labels||{},de=O.filter(R=>{const ae=R.spec?.selector||R.selector||{};return Object.keys(ae).length===0?!1:Object.entries(ae).every(([fe,Se])=>J[fe]===Se)}).map(R=>({name:R.name||R.metadata?.name,type:R.spec?.type||R.type||"ClusterIP",clusterIP:R.spec?.clusterIP||R.cluster_ip||"",ports:(R.spec?.ports||R.ports||[]).map(ae=>`${ae.port}${ae.targetPort?":"+ae.targetPort:""}/${ae.protocol||"TCP"}`),selector:R.spec?.selector||R.selector||{},age:R.age||""})),Ce=new Set(de.map(R=>R.name)),pe=B.filter(R=>(R.spec?.rules||R.rules||[]).some(fe=>(fe.http?.paths||fe.paths||[]).some(Se=>{const C=Se.backend?.service?.name||Se.backendService||"";return Ce.has(C)}))).map(R=>({name:R.name||R.metadata?.name,className:R.spec?.ingressClassName||R.ingressClass||"-",hosts:(R.spec?.rules||R.rules||[]).map(ae=>ae.host).filter(Boolean),rules:R.spec?.rules||R.rules||[],age:R.age||""}));q(de),$(pe)}).catch(()=>{}).finally(()=>z("")))},[l,s,o,a]),p.useEffect(()=>{l==="events"&&(z("events"),ce.getEvents(s,o,void 0).then(r=>{const h=Array.isArray(r)?r:r?.list||r?.items||r?.data||[],N=a?.name||"",O=h.filter(B=>{const J=String(B.object||"");if(!N||!J)return!1;if(J.endsWith(`/${N}`))return!0;const de=J.split("/").pop()||"";return de===N||de.startsWith(`${N}-`)}).map(B=>({type:B.type||"Normal",reason:B.reason||"",message:B.message||"",source:B.object||B.source?.component||B.sourceComponent||"-",firstTimestamp:B.first_time||B.firstTimestamp||B.first_timestamp||"",lastTimestamp:B.last_time||B.lastTimestamp||B.last_timestamp||"",count:B.count||1}));Y(O)}).catch(()=>{}).finally(()=>z("")))},[l,s,o,a?.name]),p.useEffect(()=>{l==="scale"&&(z("scale"),Promise.all([ce.getHPAs(s,o).catch(()=>[]),Promise.resolve([])]).then(([r])=>{const N=(B=>Array.isArray(B)?B:B?.list||B?.items||B?.data||[])(r),O=a?.name||"";H(N.filter(B=>(B.scaleTargetRef?.name||B.targetRef?.name||"")===O)),M([])}).catch(()=>{}).finally(()=>z("")))},[l,s,o,a?.name]);const ge=async r=>{const h=r.revision??r.revision_number??r.number;if(await S({title:"回滚版本",description:`确认回滚到修订版本 #${h}?`,confirmText:"回滚",variant:"destructive"})){E(h);try{await ce.rollbackDeployment(s,o,a.name,Number(h)),i({title:"回滚已下发",description:`正在回滚到 #${h}`}),d()}catch(O){i({title:"回滚失败",description:O?.message||String(O),variant:"destructive"})}finally{E(null)}}},m=async()=>{I(!0);try{await ce.scaleDeployment(s,o,a.name,f),i({title:"伸缩已提交",description:`副本数 → ${f}`}),d()}catch(r){i({title:"伸缩失败",description:r?.message||String(r),variant:"destructive"})}finally{I(!1)}},k=[{key:"pods",label:"容器组",icon:Fe,count:n.length},{key:"services",label:"访问方式",icon:Ae,count:Z.length},{key:"events",label:"事件",icon:ss,count:U.length},{key:"scale",label:"容器伸缩",icon:oe},{key:"history",label:"历史版本",icon:As,count:c.length}];return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:184:5",className:"space-y-4",children:[e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentView.tsx:186:7",className:"dg-card",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentView.tsx:187:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:188:11",className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 text-sm",children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:189:13",label:"状态",value:e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:190:15",style:{background:`${ke?we.green:we.orange}22`,color:ke?we.green:we.orange,border:`1px solid ${ke?we.green:we.orange}44`},children:ke?"Running":"Updating"})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:194:13",label:"副本",value:e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:194:41",className:"font-mono",children:[ee,"/",le]})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:195:13",label:"策略",value:a?.strategy||"RollingUpdate"}),n[0]&&e.jsxs(e.Fragment,{children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:198:17",label:"所在节点",value:e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:199:19",className:"text-[var(--dg-blue)] hover:underline",onClick:()=>window.open(`/kubernetes/${s}/nodes/${n[0].node_name||n[0].node}`,"_blank"),children:n[0].node_name||n[0].node||"-"})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:203:17",label:"容器组 IP",value:e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:203:49",className:"font-mono",children:n[0].ip||n[0].pod_ip||"-"})})]}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:206:13",label:"创建时间",value:Ve(a?.created_at||a?.creationTimestamp)})]}),n[0]&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:209:13",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:e.jsx(ms,{"code-path":"src/components/kubernetes/DeploymentView.tsx:210:15",pod:n[0]})})]})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:217:7",className:"flex items-center gap-0.5 border-b border-[var(--dg-border)] overflow-x-auto",children:[k.map(r=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:219:11",className:`flex items-center gap-1.5 px-4 py-2.5 text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${l===r.key?"border-[var(--dg-blue)] text-[var(--dg-blue)]":"border-transparent text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"}`,onClick:()=>v(r.key),children:[e.jsx(r.icon,{"code-path":"src/components/kubernetes/DeploymentView.tsx:228:13",className:"h-4 w-4"}),r.label,r.key==="pods"&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentView.tsx:230:34",className:"ml-1 text-[10px] px-1.5 py-0 bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]",children:r.count})]},r.key)),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:233:9",className:"ml-auto flex items-center gap-1 pr-2 shrink-0",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:234:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:_||f<=0,onClick:()=>w(r=>Math.max(0,r-1)),children:e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentView.tsx:237:13",className:"h-4 w-4"})}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentView.tsx:239:11",type:"number",min:0,value:f,onChange:r=>w(Math.max(0,Number(r.target.value))),className:"w-16 h-7 text-center text-sm font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:244:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:_,onClick:()=>w(r=>r+1),children:e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentView.tsx:247:13",className:"h-4 w-4"})}),f!==le&&e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentView.tsx:250:13",size:"sm",className:"h-7 text-xs bg-[var(--dg-blue)] hover:bg-[var(--dg-blue-hover)]",disabled:_,onClick:m,children:_?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentView.tsx:252:31",className:"h-3 w-3 animate-spin"}):"应用"})]})]}),l==="pods"&&e.jsx(qs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:259:26",...t,expandedPod:g,setExpandedPod:A}),l==="services"&&e.jsx(Us,{"code-path":"src/components/kubernetes/DeploymentView.tsx:260:30",services:Z,ingresses:Q,loading:P,namespace:o}),l==="events"&&e.jsx(Ys,{"code-path":"src/components/kubernetes/DeploymentView.tsx:261:28",events:U,loading:P}),l==="scale"&&e.jsx(Js,{"code-path":"src/components/kubernetes/DeploymentView.tsx:263:9",hpas:x,cronHpas:G,loading:P,replicas:le}),l==="history"&&e.jsx(Ks,{"code-path":"src/components/kubernetes/DeploymentView.tsx:270:29",revisions:c,rollbackLoading:b,onRollback:ge})]})}async function rt(t,s,o,a){const n=await Es(a);await ce.updateResourceYaml(t,s,"deployments",o,n)}function Xe(t){return!t||typeof t!="object"?[]:Object.entries(t).map(([s,o])=>({key:s,value:String(o)}))}function Re(t){const s={};for(const{key:o,value:a}of t){const n=o.trim();n&&(s[n]=a)}return s}function Qs({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),[i,S]=p.useState(!1),[l,v]=p.useState(!a),[g,A]=p.useState(a||{}),[b,E]=p.useState(1),[f,w]=p.useState([]),[_,I]=p.useState([]),[Z,q]=p.useState([]),[Q,$]=p.useState([]);p.useEffect(()=>{const r=a;if(!r){v(!1);return}A(r),E(r?.spec?.replicas??1),w(Xe(r?.metadata?.labels)),I(Xe(r?.metadata?.annotations)),q(Xe(r?.spec?.selector?.matchLabels)),$(Xe(r?.spec?.template?.metadata?.labels)),v(!1)},[a]);const U=(r,h)=>{w(N=>N.map((O,B)=>B===r?{...O,...h}:O))},Y=()=>w(r=>[...r,{key:"",value:""}]),P=r=>w(h=>h.filter((N,O)=>O!==r)),z=(r,h)=>{I(N=>N.map((O,B)=>B===r?{...O,...h}:O))},x=()=>I(r=>[...r,{key:"",value:""}]),H=r=>I(h=>h.filter((N,O)=>O!==r)),G=(r,h)=>{q(N=>N.map((O,B)=>B===r?{...O,...h}:O))},M=()=>q(r=>[...r,{key:"",value:""}]),ee=r=>q(h=>h.filter((N,O)=>O!==r)),le=(r,h)=>{$(N=>N.map((O,B)=>B===r?{...O,...h}:O))},ke=()=>$(r=>[...r,{key:"",value:""}]),ge=r=>$(h=>h.filter((N,O)=>O!==r)),m=()=>{const r=Re(Z);$(h=>{const N={...Re(h),...r};return Object.entries(N).map(([O,B])=>({key:O,value:B}))}),d({title:"已同步",description:"Selector 标签已合并到 Pod 模板标签"})},k=async()=>{S(!0);try{const r=JSON.parse(JSON.stringify(g));r.spec=r.spec||{},r.spec.replicas=b;const h=Re(f);r.metadata=r.metadata||{},r.metadata.labels=Object.keys(h).length>0?h:void 0;const N=Re(_);r.metadata.annotations=Object.keys(N).length>0?N:void 0;const O=Re(Z);Object.keys(O).length>0&&(r.spec.selector=r.spec.selector||{},r.spec.selector.matchLabels=O);const B=Re(Q);r.spec.template=r.spec.template||{},r.spec.template.metadata=r.spec.template.metadata||{},Object.keys(B).length>0?r.spec.template.metadata.labels=B:delete r.spec.template.metadata.labels,await rt(t,s,o,r),d({title:"基本信息已保存",description:`${o} 更新已提交`}),n(r)}catch(r){d({title:"保存失败",description:r?.message||String(r),variant:"destructive"})}finally{S(!1)}};return l?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:130:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:131:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:132:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:133:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:150:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:152:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:153:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:154:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ts,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:155:13",className:"h-4 w-4 text-blue-400"}),"副本数 (Replicas)"]})}),e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:159:9",className:"pt-0",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:160:11",className:"flex items-center gap-3",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:161:13",type:"number",min:0,value:b,onChange:r=>E(Math.max(0,Number(r.target.value)||0)),className:"w-32 bg-slate-800 border-slate-700 text-slate-200"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:168:13",className:"text-xs text-slate-500",children:"期望运行的 Pod 实例数量"})]})})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:174:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:175:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:176:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(os,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:177:13",className:"h-4 w-4 text-slate-500"}),"基本标识(只读)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:181:9",className:"pt-0 grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:182:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:183:13",className:"text-slate-400 text-xs",children:"名称 (name)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:184:13",value:o,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:187:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:188:13",className:"text-slate-400 text-xs",children:"命名空间 (namespace)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:189:13",value:s,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:196:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:197:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:198:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:199:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:200:15",className:"h-4 w-4 text-emerald-400"}),"标签 (Labels)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:202:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:f.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:204:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:Y,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:205:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:209:9",className:"pt-0 space-y-1.5",children:[f.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:210:35",className:"text-[11px] text-slate-600",children:"无标签"}),f.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:212:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:213:15",value:r.key,placeholder:"app",onChange:N=>U(h,{key:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:216:15",value:r.value,placeholder:"nginx",onChange:N=>U(h,{value:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:219:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>P(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:220:48",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:227:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:228:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:229:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:230:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:231:15",className:"h-4 w-4 text-amber-400"}),"选择器 (Selector)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:233:15",variant:"outline",className:"border-amber-700/50 text-amber-500 text-[10px]",children:"⚠️ 需与模板标签一致"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:235:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:M,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:236:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:240:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:241:11",className:"text-[11px] text-amber-500/70 mb-1",children:"Selector 决定哪些 Pod 归属此 Deployment。修改时必须确保与 Pod Template Labels 匹配,否则 Deployment 将无法管理 Pod。"}),Z.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:242:43",className:"text-[11px] text-slate-600",children:"无选择器"}),Z.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:244:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:245:15",value:r.key,placeholder:"app",onChange:N=>G(h,{key:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:248:15",value:r.value,placeholder:"nginx",onChange:N=>G(h,{value:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:251:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>ee(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:252:51",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:259:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:260:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:261:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:262:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:263:15",className:"h-4 w-4 text-cyan-400"}),"Pod 模板标签 (template.metadata.labels)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:266:13",className:"flex gap-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:267:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:m,children:"从 Selector 同步"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:270:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:ke,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:271:17",className:"h-3 w-3 mr-1"}),"新增"]})]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:276:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:277:11",className:"text-[11px] text-slate-600 mb-1",children:"Pod 模板标签必须包含 Selector 全部键值,否则 Deployment 无法管理 Pod"}),Q.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:278:43",className:"text-[11px] text-slate-600",children:"无模板标签"}),Q.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:280:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:281:15",value:r.key,placeholder:"app",onChange:N=>le(h,{key:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:284:15",value:r.value,placeholder:"nginx",onChange:N=>le(h,{value:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:287:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>ge(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:288:56",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:295:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:296:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:297:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:298:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(kt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:299:15",className:"h-4 w-4 text-purple-400"}),"注解 (Annotations)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:301:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:_.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:303:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:x,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:304:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:308:9",className:"pt-0 space-y-1.5",children:[_.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:309:40",className:"text-[11px] text-slate-600",children:"无注解"}),_.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:311:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:312:15",value:r.key,placeholder:"deployment.kubernetes.io/revision",onChange:N=>z(h,{key:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:315:15",value:r.value,placeholder:"1",onChange:N=>z(h,{value:N.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:318:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>H(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:319:53",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:326:7",className:"sticky bottom-0 bg-slate-950/80 backdrop-blur border-t border-slate-800 p-3 flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:327:9",className:"text-[11px] text-slate-500",children:["保存将通过 ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:328:17",className:"text-slate-400",children:"PUT application/yaml"})," 提交(自动剥离 status/managedFields 等只读字段)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:330:9",className:"flex gap-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:331:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:332:11",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:k,children:[i?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:333:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:333:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:141:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:142:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}function zt(t){const s=n=>{if(!n)return null;let c="none";return n.httpGet?c="httpGet":n.tcpSocket?c="tcpSocket":n.exec&&(c="exec"),{type:c,httpPath:n.httpGet?.path||"",httpPort:n.httpGet?.port??"",httpHost:n.httpGet?.host||"",tcpPort:n.tcpSocket?.port??"",execCommand:Array.isArray(n.exec?.command)?n.exec.command.join(` -`):n.exec?.command||"",initialDelaySeconds:n.initialDelaySeconds,periodSeconds:n.periodSeconds,timeoutSeconds:n.timeoutSeconds,successThreshold:n.successThreshold,failureThreshold:n.failureThreshold}},o=n=>{if(!n)return{type:"none"};let c="none";return n.exec?c="exec":n.httpGet?c="httpGet":n.tcpSocket&&(c="tcpSocket"),{type:c,execCommand:Array.isArray(n.exec?.command)?n.exec.command.join(` -`):"",httpPath:n.httpGet?.path||"",httpPort:n.httpGet?.port??"",tcpPort:n.tcpSocket?.port??""}},a=t.securityContext;return{name:t.name||"",image:t.image||"",imagePullPolicy:t.imagePullPolicy||"",command:Array.isArray(t.command)?t.command:[],args:Array.isArray(t.args)?t.args:[],workingDir:t.workingDir||"",env:(Array.isArray(t.env)?t.env:[]).map(n=>({name:n.name||"",value:n.value??""})),ports:(Array.isArray(t.ports)?t.ports:[]).map(n=>({name:n.name||"",containerPort:n.containerPort??"",protocol:n.protocol||"TCP"})),resources:{requests:t.resources?.requests||{},limits:t.resources?.limits||{}},livenessProbe:s(t.livenessProbe),readinessProbe:s(t.readinessProbe),startupProbe:s(t.startupProbe),lifecycle:t.lifecycle?{postStart:t.lifecycle.postStart?o(t.lifecycle.postStart):void 0,preStop:t.lifecycle.preStop?o(t.lifecycle.preStop):void 0}:null,securityContext:a?{runAsUser:a.runAsUser,runAsGroup:a.runAsGroup,runAsNonRoot:a.runAsNonRoot,privileged:a.privileged,readOnlyRootFilesystem:a.readOnlyRootFilesystem,allowPrivilegeEscalation:a.allowPrivilegeEscalation,capabilitiesAdd:a.capabilities?.add||[],capabilitiesDrop:a.capabilities?.drop||[]}:null,volumeMounts:(Array.isArray(t.volumeMounts)?t.volumeMounts:[]).map(n=>({name:n.name||"",mountPath:n.mountPath||"",subPath:n.subPath||"",readOnly:n.readOnly||!1}))}}function $t(t=""){return{name:t,image:"",imagePullPolicy:"IfNotPresent",command:[],args:[],workingDir:"",env:[],ports:[],resources:{},livenessProbe:null,readinessProbe:null,startupProbe:null,lifecycle:null,securityContext:null,volumeMounts:[]}}function ht(t){if(!t||t.type==="none"||!t.type)return;const s={};if(t.type==="httpGet")s.httpGet={},t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=typeof t.httpPort=="number"?t.httpPort:Number(t.httpPort)),t.httpHost&&(s.httpGet.host=t.httpHost);else if(t.type==="tcpSocket")s.tcpSocket={},t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=typeof t.tcpPort=="number"?t.tcpPort:Number(t.tcpPort));else if(t.type==="exec"){const o=(t.execCommand||"").split(` -`).map(a=>a.trim()).filter(Boolean);o.length&&(s.exec={command:o})}return t.initialDelaySeconds!=null&&(s.initialDelaySeconds=t.initialDelaySeconds),t.periodSeconds!=null&&(s.periodSeconds=t.periodSeconds),t.timeoutSeconds!=null&&(s.timeoutSeconds=t.timeoutSeconds),t.successThreshold!=null&&(s.successThreshold=t.successThreshold),t.failureThreshold!=null&&(s.failureThreshold=t.failureThreshold),Object.keys(s).length>0?s:void 0}function Wt(t){if(!(!t||t.type==="none"||!t.type)){if(t.type==="exec"){const s=(t.execCommand||"").split(` -`).map(o=>o.trim()).filter(Boolean);return s.length?{exec:{command:s}}:void 0}if(t.type==="httpGet"){const s={httpGet:{}};return t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=Number(t.httpPort)),s}if(t.type==="tcpSocket"){const s={tcpSocket:{}};return t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=Number(t.tcpPort)),s}}}function Gt(t){const s={name:t.name};t.image&&(s.image=t.image),t.imagePullPolicy&&(s.imagePullPolicy=t.imagePullPolicy),t.workingDir&&(s.workingDir=t.workingDir),t.command.length>0&&(s.command=t.command),t.args.length>0&&(s.args=t.args),t.env.length>0&&(s.env=t.env.filter(l=>l.name.trim()).map(l=>{const v={name:l.name};return l.value!=null&&(v.value=l.value),v})),t.ports.length>0&&(s.ports=t.ports.filter(l=>l.containerPort!=="").map(l=>{const v={containerPort:typeof l.containerPort=="number"?l.containerPort:Number(l.containerPort)};return l.name&&(v.name=l.name),l.protocol&&(v.protocol=l.protocol),v}));const o=t.resources.requests,a=t.resources.limits,n=o&&Object.values(o).some(l=>l&&l.trim()),c=a&&Object.values(a).some(l=>l&&l.trim());(n||c)&&(s.resources={},n&&(s.resources.requests={},o.cpu?.trim()&&(s.resources.requests.cpu=o.cpu),o.memory?.trim()&&(s.resources.requests.memory=o.memory)),c&&(s.resources.limits={},a.cpu?.trim()&&(s.resources.limits.cpu=a.cpu),a.memory?.trim()&&(s.resources.limits.memory=a.memory)));const d=ht(t.livenessProbe);d&&(s.livenessProbe=d);const i=ht(t.readinessProbe);i&&(s.readinessProbe=i);const S=ht(t.startupProbe);if(S&&(s.startupProbe=S),t.lifecycle){const l={},v=Wt(t.lifecycle.postStart);v&&(l.postStart=v);const g=Wt(t.lifecycle.preStop);g&&(l.preStop=g),Object.keys(l).length>0&&(s.lifecycle=l)}if(t.securityContext){const l=t.securityContext,v={};l.runAsUser!==""&&l.runAsUser!=null&&(v.runAsUser=Number(l.runAsUser)),l.runAsGroup!==""&&l.runAsGroup!=null&&(v.runAsGroup=Number(l.runAsGroup)),l.runAsNonRoot!=null&&(v.runAsNonRoot=l.runAsNonRoot),l.privileged!=null&&(v.privileged=l.privileged),l.readOnlyRootFilesystem!=null&&(v.readOnlyRootFilesystem=l.readOnlyRootFilesystem),l.allowPrivilegeEscalation!=null&&(v.allowPrivilegeEscalation=l.allowPrivilegeEscalation);const g=(l.capabilitiesAdd||[]).filter(Boolean),A=(l.capabilitiesDrop||[]).filter(Boolean);(g.length||A.length)&&(v.capabilities={},g.length&&(v.capabilities.add=g),A.length&&(v.capabilities.drop=A)),Object.keys(v).length>0&&(s.securityContext=v)}return t.volumeMounts.length>0&&(s.volumeMounts=t.volumeMounts.filter(l=>l.name.trim()&&l.mountPath.trim()).map(l=>{const v={name:l.name,mountPath:l.mountPath};return l.subPath&&(v.subPath=l.subPath),l.readOnly&&(v.readOnly=!0),v})),s}function Vt(t){return t.join(` -`)}function Ft(t){return t.split(` -`).map(s=>s.trim()).filter(Boolean)}function Zs({container:t,onUpdate:s}){const o=t,a="flex items-center gap-1.5 text-xs font-semibold text-slate-300 mb-2";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:36:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:37:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:38:11",className:"text-slate-400 text-xs",children:"容器名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:39:11",value:o.name,onChange:n=>s({name:n.target.value}),placeholder:"my-app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:43:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:44:11",className:"text-slate-400 text-xs",children:"容器镜像"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:45:11",value:o.image,onChange:n=>s({image:n.target.value}),placeholder:"nginx:1.25",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:49:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:50:11",className:"text-slate-400 text-xs",children:"镜像拉取策略"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:51:11",value:o.imagePullPolicy||"__none",onValueChange:n=>s({imagePullPolicy:n==="__none"?"":n}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:52:13",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",children:e.jsx(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:53:15"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:55:13",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:56:15",value:"__none",className:"text-slate-400",children:"不设置(默认 IfNotPresent)"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:57:15",value:"Always",className:"text-slate-200",children:"Always"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:58:15",value:"IfNotPresent",className:"text-slate-200",children:"IfNotPresent"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:59:15",value:"Never",className:"text-slate-200",children:"Never"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:63:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:64:11",className:"text-slate-400 text-xs",children:"工作目录 (workingDir)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:65:11",value:o.workingDir||"",onChange:n=>s({workingDir:n.target.value}),placeholder:"/app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:72:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:73:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:74:11",className:"text-slate-400 text-xs",children:"启动命令 (command) — 每行一个"}),e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:75:11",value:Vt(o.command),placeholder:`/bin/sh --c`,onChange:n=>s({command:Ft(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:79:9",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:80:11",className:"text-slate-400 text-xs",children:"启动参数 (args) — 每行一个"}),e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:81:11",value:Vt(o.args),placeholder:`--config=/etc/app.yaml ---debug`,onChange:n=>s({args:Ft(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:88:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:89:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:11",className:a,children:[e.jsx(es,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:39",className:"h-3.5 w-3.5 text-cyan-400"})," 环境变量"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:91:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({env:[...o.env,{name:"",value:""}]}),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:93:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:96:9",className:"space-y-1.5",children:[o.env.map((n,c)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:98:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:99:15",value:n.name,placeholder:"KEY",onChange:d=>{const i=[...o.env];i[c]={...n,name:d.target.value},s({env:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:102:15",value:n.value||"",placeholder:"value",onChange:d=>{const i=[...o.env];i[c]={...n,value:d.target.value},s({env:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:105:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({env:o.env.filter((d,i)=>i!==c)}),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:107:17",className:"h-3.5 w-3.5"})})]},c)),o.env.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:111:34",className:"text-[11px] text-slate-600",children:"无环境变量"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:116:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:117:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:11",className:a,children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:39",className:"h-3.5 w-3.5 text-indigo-400"})," 端口"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:119:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({ports:[...o.ports,{name:"",containerPort:"",protocol:"TCP"}]}),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:121:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:124:9",className:"space-y-1.5",children:[o.ports.map((n,c)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:126:13",className:"grid grid-cols-[1fr_1fr_100px_auto] gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:127:15",value:n.name||"",placeholder:"http",onChange:d=>{const i=[...o.ports];i[c]={...n,name:d.target.value},s({ports:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:130:15",type:"number",value:n.containerPort,placeholder:"8080",onChange:d=>{const i=[...o.ports];i[c]={...n,containerPort:d.target.value},s({ports:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:133:15",value:n.protocol||"TCP",onValueChange:d=>{const i=[...o.ports];i[c]={...n,protocol:d},s({ports:i})},children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:134:17",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",children:e.jsx(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:135:19"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:137:17",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:138:19",value:"TCP",className:"text-slate-200",children:"TCP"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:139:19",value:"UDP",className:"text-slate-200",children:"UDP"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:140:19",value:"SCTP",className:"text-slate-200",children:"SCTP"})]})]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:143:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({ports:o.ports.filter((d,i)=>i!==c)}),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:145:17",className:"h-3.5 w-3.5"})})]},c)),o.ports.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:149:36",className:"text-[11px] text-slate-600",children:"无端口暴露"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:154:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:155:9",className:a,children:[e.jsx(Hs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:155:37",className:"h-3.5 w-3.5 text-amber-400"})," 资源 (requests / limits)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:156:9",className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:157:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:158:13",className:"text-[11px] text-slate-500",children:"CPU 请求"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:159:13",value:o.resources.requests?.cpu||"",placeholder:"100m",onChange:n=>s({resources:{...o.resources,requests:{...o.resources.requests,cpu:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:163:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:164:13",className:"text-[11px] text-slate-500",children:"CPU 上限"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:165:13",value:o.resources.limits?.cpu||"",placeholder:"500m",onChange:n=>s({resources:{...o.resources,limits:{...o.resources.limits,cpu:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:169:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:170:13",className:"text-[11px] text-slate-500",children:"内存请求"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:171:13",value:o.resources.requests?.memory||"",placeholder:"128Mi",onChange:n=>s({resources:{...o.resources,requests:{...o.resources.requests,memory:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:175:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:176:13",className:"text-[11px] text-slate-500",children:"内存上限"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:177:13",value:o.resources.limits?.memory||"",placeholder:"512Mi",onChange:n=>s({resources:{...o.resources,limits:{...o.resources.limits,memory:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:185:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:186:9",className:a,children:[e.jsx(Ms,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:186:37",className:"h-3.5 w-3.5 text-rose-400"})," 健康检查 (Probes)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:187:9",className:"space-y-2",children:["livenessProbe","readinessProbe","startupProbe"].map(n=>e.jsx(en,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:189:13",label:{livenessProbe:"存活探针 (liveness)",readinessProbe:"就绪探针 (readiness)",startupProbe:"启动探针 (startup)"}[n],probe:o[n],onChange:c=>s({[n]:c})},n))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:199:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:200:9",className:a,children:[e.jsx(as,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:200:37",className:"h-3.5 w-3.5 text-yellow-400"})," 生命周期回调 (Lifecycle)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:201:9",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(qt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:202:11",label:"启动后 (postStart)",handler:o.lifecycle?.postStart,onChange:n=>s({lifecycle:{...o.lifecycle,postStart:n}})}),e.jsx(qt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:204:11",label:"终止前 (preStop)",handler:o.lifecycle?.preStop,onChange:n=>s({lifecycle:{...o.lifecycle,preStop:n}})})]}),!o.lifecycle&&e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:208:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px] mt-1",onClick:()=>s({lifecycle:{postStart:{type:"none"},preStop:{type:"none"}}}),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:210:13",className:"h-3 w-3 mr-1"}),"启用生命周期回调"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:216:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:217:9",className:a,children:[e.jsx(rs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:217:37",className:"h-3.5 w-3.5 text-emerald-400"})," 安全上下文 (SecurityContext)"]}),o.securityContext?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:219:11",className:"space-y-2 border border-slate-800 rounded-md p-3 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:220:13",className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:221:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:222:17",className:"text-[11px] text-slate-500",children:"runAsUser"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:223:17",type:"number",value:o.securityContext.runAsUser??"",placeholder:"1000",onChange:n=>s({securityContext:{...o.securityContext,runAsUser:n.target.value===""?void 0:Number(n.target.value)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:227:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:228:17",className:"text-[11px] text-slate-500",children:"runAsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:229:17",type:"number",value:o.securityContext.runAsGroup??"",placeholder:"1000",onChange:n=>s({securityContext:{...o.securityContext,runAsGroup:n.target.value===""?void 0:Number(n.target.value)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:233:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:234:17",className:"text-[11px] text-slate-500",children:"Capabilities Add (逗号分隔)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:235:17",value:(o.securityContext.capabilitiesAdd||[]).join(","),placeholder:"NET_ADMIN",onChange:n=>s({securityContext:{...o.securityContext,capabilitiesAdd:n.target.value.split(",").map(c=>c.trim()).filter(Boolean)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:239:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:240:17",className:"text-[11px] text-slate-500",children:"Capabilities Drop (逗号分隔)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:241:17",value:(o.securityContext.capabilitiesDrop||[]).join(","),placeholder:"ALL",onChange:n=>s({securityContext:{...o.securityContext,capabilitiesDrop:n.target.value.split(",").map(c=>c.trim()).filter(Boolean)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:246:13",className:"flex items-center gap-4 flex-wrap",children:[e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:247:15",label:"runAsNonRoot",value:!!o.securityContext.runAsNonRoot,onChange:n=>s({securityContext:{...o.securityContext,runAsNonRoot:n}})}),e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:249:15",label:"privileged",value:!!o.securityContext.privileged,onChange:n=>s({securityContext:{...o.securityContext,privileged:n}})}),e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:251:15",label:"readOnlyRootFilesystem",value:!!o.securityContext.readOnlyRootFilesystem,onChange:n=>s({securityContext:{...o.securityContext,readOnlyRootFilesystem:n}})}),e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:253:15",label:"allowPrivilegeEscalation",value:o.securityContext.allowPrivilegeEscalation??!1,onChange:n=>s({securityContext:{...o.securityContext,allowPrivilegeEscalation:n}})})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:256:13",size:"sm",variant:"ghost",className:"h-6 text-red-400 text-[11px]",onClick:()=>s({securityContext:null}),children:[e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:258:15",className:"h-3 w-3 mr-1"}),"移除安全上下文"]})]}):e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:262:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({securityContext:{runAsNonRoot:!1,privileged:!1}}),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:264:13",className:"h-3 w-3 mr-1"}),"启用安全上下文"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:270:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:271:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:272:11",className:a,children:[e.jsx(Bs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:272:39",className:"h-3.5 w-3.5 text-teal-400"})," 卷挂载 (VolumeMounts)"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:273:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({volumeMounts:[...o.volumeMounts,{name:"",mountPath:"",subPath:"",readOnly:!1}]}),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:275:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:278:9",className:"space-y-1.5",children:[o.volumeMounts.map((n,c)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:280:13",className:"grid grid-cols-[1fr_1fr_1fr_60px_auto] gap-2 items-center",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:281:15",value:n.name,placeholder:"volume 名称",onChange:d=>{const i=[...o.volumeMounts];i[c]={...n,name:d.target.value},s({volumeMounts:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:284:15",value:n.mountPath,placeholder:"/data",onChange:d=>{const i=[...o.volumeMounts];i[c]={...n,mountPath:d.target.value},s({volumeMounts:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:287:15",value:n.subPath||"",placeholder:"subPath (可选)",onChange:d=>{const i=[...o.volumeMounts];i[c]={...n,subPath:d.target.value},s({volumeMounts:i})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs("label",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:290:15",className:"flex items-center gap-1 text-[10px] text-slate-500 cursor-pointer",children:[e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:291:17",checked:!!n.readOnly,onCheckedChange:d=>{const i=[...o.volumeMounts];i[c]={...n,readOnly:d},s({volumeMounts:i})}}),"RO"]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:295:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({volumeMounts:o.volumeMounts.filter((d,i)=>i!==c)}),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:297:17",className:"h-3.5 w-3.5"})})]},c)),o.volumeMounts.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:301:43",className:"text-[11px] text-slate-600",children:"无卷挂载"})]})]})]})}function en({label:t,probe:s,onChange:o}){const a=!!s,n=s||{type:"httpGet"},c=d=>o({...n,...d});return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:315:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:316:7",className:"flex items-center justify-between mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:317:9",className:"text-xs text-slate-300 font-medium",children:t}),e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:318:9",checked:a,onCheckedChange:d=>o(d?{type:"httpGet",httpPath:"/",httpPort:8080,initialDelaySeconds:10,periodSeconds:10}:null)})]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:323:11",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:324:13",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:325:13",value:n.type||"httpGet",onValueChange:d=>c({type:d}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:326:15",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:327:17"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:329:15",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:330:17",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:331:17",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:332:17",value:"exec",className:"text-slate-200",children:"Exec 命令"})]})]})]}),n.type==="httpGet"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:337:13",className:"grid grid-cols-3 gap-2 mb-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:338:15",value:n.httpPath||"",placeholder:"/healthz",onChange:d=>c({httpPath:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:341:15",type:"number",value:n.httpPort??"",placeholder:"8080",onChange:d=>c({httpPort:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:344:15",value:n.httpHost||"",placeholder:"host (可选)",onChange:d=>c({httpHost:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),n.type==="tcpSocket"&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:350:13",className:"mb-2",children:e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:351:15",type:"number",value:n.tcpPort??"",placeholder:"端口",onChange:d=>c({tcpPort:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})}),n.type==="exec"&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:357:13",className:"mb-2",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:358:15",value:n.execCommand||"",placeholder:"每行一个命令片段,如:\\ncat\\n/tmp/healthy",onChange:d=>c({execCommand:d.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[50px]"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:363:11",className:"grid grid-cols-5 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:364:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:365:15",className:"text-[10px] text-slate-500",children:"延迟(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:366:15",type:"number",value:n.initialDelaySeconds??"",placeholder:"10",onChange:d=>c({initialDelaySeconds:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:370:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:371:15",className:"text-[10px] text-slate-500",children:"间隔(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:372:15",type:"number",value:n.periodSeconds??"",placeholder:"10",onChange:d=>c({periodSeconds:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:376:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:377:15",className:"text-[10px] text-slate-500",children:"超时(s)"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:378:15",type:"number",value:n.timeoutSeconds??"",placeholder:"1",onChange:d=>c({timeoutSeconds:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:382:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:383:15",className:"text-[10px] text-slate-500",children:"成功"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:384:15",type:"number",value:n.successThreshold??"",placeholder:"1",onChange:d=>c({successThreshold:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:388:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:389:15",className:"text-[10px] text-slate-500",children:"失败"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:390:15",type:"number",value:n.failureThreshold??"",placeholder:"3",onChange:d=>c({failureThreshold:d.target.value===""?void 0:Number(d.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]})]})]})]})}function qt({label:t,handler:s,onChange:o}){const a=s||{type:"none"},n=!a.type||a.type==="none"?"__none":a.type;return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:406:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:407:7",className:"text-xs text-slate-300 font-medium block mb-2",children:t}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:408:7",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:409:9",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:410:9",value:n,onValueChange:c=>o({...a,type:c==="__none"?"none":c}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:411:11",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:412:13"})}),e.jsxs(Ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:414:11",className:"bg-slate-900 border-slate-700",children:[e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:415:13",value:"__none",className:"text-slate-400",children:"不设置"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:416:13",value:"exec",className:"text-slate-200",children:"Exec 命令"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:417:13",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ve,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:418:13",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"})]})]})]}),a.type==="exec"&&e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:423:9",value:a.execCommand||"",placeholder:"每行一个命令片段",onChange:c=>o({...a,execCommand:c.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[50px]"}),a.type==="httpGet"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:428:9",className:"grid grid-cols-2 gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:429:11",value:a.httpPath||"",placeholder:"/shutdown",onChange:c=>o({...a,httpPath:c.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:432:11",type:"number",value:a.httpPort??"",placeholder:"8080",onChange:c=>o({...a,httpPort:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),a.type==="tcpSocket"&&e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:438:9",type:"number",value:a.tcpPort??"",placeholder:"端口",onChange:c=>o({...a,tcpPort:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]})}function Qe({label:t,value:s,onChange:o}){return e.jsxs("label",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:448:5",className:"flex items-center gap-1.5 cursor-pointer",children:[e.jsx(Nt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:449:7",checked:s,onCheckedChange:o}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:450:7",className:"text-[11px] text-slate-400 font-mono",children:t})]})}function Ut({title:t,description:s,icon:o,containers:a,accentColor:n,onAdd:c,onRemove:d,onUpdate:i,onDuplicate:S}){const l=nt(),[v,g]=p.useState(new Set([0])),A=f=>{g(w=>{const _=new Set(w);return _.has(f)?_.delete(f):_.add(f),_})},b=n==="blue"?"border-blue-500/30":"border-purple-500/30",E=n==="blue"?"bg-blue-500/5":"bg-purple-500/5";return e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:37:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:38:7",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:39:9",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:40:11",className:"flex items-center gap-2",children:[o,e.jsx(xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:42:13",className:"text-sm text-slate-200",children:t}),e.jsx(te,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:43:13",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:a.length})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:45:11",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:c,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:46:13",className:"h-3 w-3 mr-1"}),"新增容器"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:49:9",className:"text-[11px] text-slate-600",children:s})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:51:7",className:"pt-0 space-y-3",children:[a.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:53:11",className:"text-center py-6 text-slate-600 text-xs",children:"暂无容器,点击「新增容器」添加"}),a.map((f,w)=>{const _=v.has(w)||a.length===1;return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:58:13",className:`rounded-lg border ${b} overflow-hidden`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:60:15",className:`flex items-center justify-between px-3 py-2 ${E} cursor-pointer`,onClick:()=>A(w),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:61:17",className:"flex items-center gap-2",children:[_?e.jsx(Qt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:62:29",className:"h-4 w-4 text-slate-500"}):e.jsx(Zt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:62:82",className:"h-4 w-4 text-slate-500"}),e.jsx(Fe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:63:19",className:`h-4 w-4 ${n==="blue"?"text-blue-400":"text-purple-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:64:19",className:"text-sm font-mono text-slate-200 font-semibold",children:f.name||"(未命名)"}),f.image&&e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:65:31",className:"text-[10px] text-slate-500 font-mono truncate max-w-[300px]",children:f.image})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:67:17",className:"flex items-center gap-1",onClick:I=>I.stopPropagation(),children:[S&&e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:69:21",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-500 hover:text-slate-300",title:"复制",onClick:()=>S(w),children:e.jsx(cs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:71:23",className:"h-3.5 w-3.5"})}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:74:19",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",title:"删除",onClick:async()=>{await l({title:"删除容器",description:`确认删除容器「${f.name}」?`,confirmText:"删除",variant:"destructive"})&&d(w)},children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:84:21",className:"h-3.5 w-3.5"})})]})]}),_&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:90:17",className:"p-3 space-y-4 bg-slate-950/30",children:e.jsx(Zs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:91:19",container:f,onUpdate:I=>i(w,I)})})]},w)})]})]})}function tn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),[i,S]=p.useState(!1),[l,v]=p.useState(!a),[g,A]=p.useState(a||{}),[b,E]=p.useState([]),[f,w]=p.useState([]),[_,I]=p.useState([]);p.useEffect(()=>{if(!a){v(!1);return}A(a);const x=a?.spec?.template?.spec||{};E((Array.isArray(x.containers)?x.containers:[]).map(zt)),w((Array.isArray(x.initContainers)?x.initContainers:[]).map(zt)),I((Array.isArray(x.imagePullSecrets)?x.imagePullSecrets:[]).map(H=>H.name||"")),v(!1)},[a]);const Z=(x,H)=>{E(G=>G.map((M,ee)=>ee===x?{...M,...H}:M))},q=()=>{E(x=>[...x,$t(`container-${x.length+1}`)])},Q=x=>{E(H=>H.filter((G,M)=>M!==x))},$=x=>{E(H=>{const G=JSON.parse(JSON.stringify(H[x]));G.name=`${G.name}-copy`;const M=[...H];return M.splice(x+1,0,G),M})},U=(x,H)=>{w(G=>G.map((M,ee)=>ee===x?{...M,...H}:M))},Y=()=>{w(x=>[...x,$t(`init-${x.length+1}`)])},P=x=>{w(H=>H.filter((G,M)=>M!==x))},z=async()=>{for(const x of[...f,...b]){if(!x.name.trim()){d({title:"保存失败",description:"容器名称不能为空",variant:"destructive"});return}if(!x.image.trim()){d({title:"保存失败",description:`容器 ${x.name} 的镜像不能为空`,variant:"destructive"});return}}S(!0);try{const x=JSON.parse(JSON.stringify(g));x.spec=x.spec||{},x.spec.template=x.spec.template||{},x.spec.template.spec=x.spec.template.spec||{},x.spec.template.spec.containers=b.map(Gt),x.spec.template.spec.initContainers=f.length>0?f.map(Gt):void 0,x.spec.template.spec.imagePullSecrets=_.filter(H=>H.trim()).length>0?_.filter(H=>H.trim()).map(H=>({name:H})):void 0,await rt(t,s,o,x),d({title:"容器配置已保存",description:`${o} 更新已提交`}),n(x)}catch(x){d({title:"保存失败",description:x?.message||String(x),variant:"destructive"})}finally{S(!1)}};return l?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:112:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:113:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:114:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:115:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:131:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:133:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:134:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:135:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Rs,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:136:13",className:"h-4 w-4 text-amber-400"}),"镜像拉取凭证 (imagePullSecrets)",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:138:13",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:"Pod 级别"})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:141:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:142:11",className:"flex items-center gap-2 flex-wrap",children:[_.map((x,H)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:144:15",className:"flex items-center gap-1 bg-slate-800 rounded px-2 py-1",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:145:17",className:"text-xs text-slate-300 font-mono",children:x}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:146:17",onClick:()=>I(G=>G.filter((M,ee)=>ee!==H)),className:"text-red-400 hover:text-red-300 ml-1",children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:147:68",className:"h-3 w-3"})})]},H)),_.length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:150:47",className:"text-[11px] text-slate-600",children:"无"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:152:11",className:"flex gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:153:13",placeholder:"输入 Secret 名称后回车",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",onKeyDown:x=>{if(x.key==="Enter"){const H=x.target.value.trim();H&&(I(G=>[...G,H]),x.target.value="")}}}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:160:13",size:"sm",variant:"outline",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:()=>I(x=>[...x,""]),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:162:15",className:"h-3 w-3 mr-1"}),"新增"]})]})]})]}),e.jsx(Ut,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:169:7",title:"初始化容器",description:"在主容器启动前按顺序执行的容器,用于初始化环境",icon:e.jsx(ls,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:172:15",className:"h-4 w-4 text-purple-400"}),containers:f,accentColor:"purple",onAdd:Y,onRemove:P,onUpdate:U}),e.jsx(Ut,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:181:7",title:"工作容器",description:"Deployment 运行的主容器,定义应用进程及其运行时配置",icon:e.jsx(Fe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:184:15",className:"h-4 w-4 text-blue-400"}),containers:b,accentColor:"blue",onAdd:q,onRemove:Q,onUpdate:Z,onDuplicate:$}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:194:7",className:"sticky bottom-0 bg-slate-950/80 backdrop-blur border-t border-slate-800 p-3 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:195:9",className:"text-[11px] text-slate-500",children:["共 ",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:196:13",className:"text-slate-300 font-semibold",children:f.length})," 个初始化容器 +",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:197:11",className:"text-slate-300 font-semibold ml-1",children:b.length})," 个工作容器"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:199:9",className:"flex gap-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:200:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:201:11",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:z,children:[i?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:202:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:202:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:122:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:123:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}function sn(t=""){return{volume:{name:"",type:"emptyDir"},containerName:t,mountPath:"",subPath:"",readOnly:!1}}const nn=["kube-api-access-","default-token-","kube-"];function yt(t){if(!t||typeof t!="object")return!1;const s=String(t.name||"");return nn.some(o=>s.startsWith(o))?!0:!!(t.projected||t.downwardAPI||t.csi||t.ephemeral)}function Yt(t){const s=t?.trim();if(!s)return;if(s.startsWith("["))try{const a=JSON.parse(s);if(Array.isArray(a))return a.filter(n=>n?.key&&n?.path)}catch{}const o=s.split(",").map(a=>a.trim()).filter(Boolean).map(a=>{const n=a.indexOf(":");return n<=0?null:{key:a.slice(0,n).trim(),path:a.slice(n+1).trim()}}).filter(Boolean);return o.length?o:void 0}function on(t){if(!t||typeof t!="object")return{name:"",type:"emptyDir"};const s=t.name||"";return t.persistentVolumeClaim?{name:s,type:"persistentVolumeClaim",pvcName:t.persistentVolumeClaim.claimName||"",pvcReadOnly:!!t.persistentVolumeClaim.readOnly}:t.nfs?{name:s,type:"nfs",nfsServer:t.nfs.server||"",nfsPath:t.nfs.path||"",nfsReadOnly:!!t.nfs.readOnly}:t.configMap?{name:s,type:"configMap",configMapName:t.configMap.name||"",cmItems:t.configMap.items?JSON.stringify(t.configMap.items):""}:t.secret?{name:s,type:"secret",secretName:t.secret.secretName||"",secItems:t.secret.items?JSON.stringify(t.secret.items):""}:t.hostPath?{name:s,type:"hostPath",path:t.hostPath.path||"",pathType:t.hostPath.type||""}:t.emptyDir!=null?{name:s,type:"emptyDir",medium:t.emptyDir.medium||"",sizeLimit:t.emptyDir.sizeLimit||""}:yt(t)?{name:s,type:"custom",_raw:t}:{name:s,type:"custom",_raw:t}}function xs(t){if(t.type==="custom"&&t._raw)return JSON.parse(JSON.stringify(t._raw));const s=t.name?.trim();if(!s)return null;const o={name:s};switch(t.type){case"emptyDir":{const a={};t.medium?.trim()&&(a.medium=t.medium.trim()),t.sizeLimit?.trim()&&(a.sizeLimit=t.sizeLimit.trim()),o.emptyDir=a;break}case"hostPath":{const a={path:t.path?.trim()||"/"};t.pathType?.trim()&&(a.type=t.pathType.trim()),o.hostPath=a;break}case"configMap":{const a=t.configMapName?.trim();if(!a)return null;const n={name:a},c=Yt(t.cmItems);c&&(n.items=c),o.configMap=n;break}case"secret":{const a=t.secretName?.trim();if(!a)return null;const n={secretName:a},c=Yt(t.secItems);c&&(n.items=c),o.secret=n;break}case"persistentVolumeClaim":{const a=t.pvcName?.trim();if(!a)return null;const n={claimName:a};t.pvcReadOnly&&(n.readOnly=!0),o.persistentVolumeClaim=n;break}case"nfs":{const a=t.nfsServer?.trim(),n=t.nfsPath?.trim();if(!a||!n)return null;const c={server:a,path:n};t.nfsReadOnly&&(c.readOnly=!0),o.nfs=c;break}default:return null}return o}function an(t,s){return{containerName:t,volumeName:s.name||"",mountPath:s.mountPath||"",subPath:s.subPath||"",readOnly:!!s.readOnly}}function rn(t){if(!t.volumeName?.trim()||!t.mountPath?.trim())return null;const s={name:t.volumeName.trim(),mountPath:t.mountPath.trim()};return t.subPath?.trim()&&(s.subPath=t.subPath.trim()),t.readOnly&&(s.readOnly=!0),s}const cn=["/var/run/secrets/kubernetes.io/serviceaccount"];function hs(t,s){if(!t)return!1;if(s.has(t.name))return!0;const o=t.mountPath||"";return cn.some(a=>o.startsWith(a))}function ln(t){const s=t?.spec?.template?.spec||{},o=Array.isArray(s.volumes)?s.volumes:[],a=o.filter(yt),n=o.filter(l=>!yt(l)),c=[...Array.isArray(s.containers)?s.containers:[],...Array.isArray(s.initContainers)?s.initContainers:[]],d=c.map(l=>l.name||"(unnamed)"),i=new Set(a.map(l=>l.name)),S=[];for(const l of c){const v=l.name||"(unnamed)",g=Array.isArray(l.volumeMounts)?l.volumeMounts:[];for(const A of g)hs(A,i)||S.push(an(v,A))}return{volumes:n.map(on),mounts:S,containers:d,passthroughVolumes:a}}function dn(t){const{volumes:s,mounts:o,containers:a,passthroughVolumes:n}=ln(t),c=a.find(i=>i!=="(unnamed)")||a[0]||"";return{entries:s.map(i=>{const l=o.filter(v=>v.volumeName===i.name)[0];return{volume:i,containerName:l?.containerName||c,mountPath:l?.mountPath||"",subPath:l?.subPath||"",readOnly:l?.readOnly??!1}}),containers:a,passthroughVolumes:n}}function pn(t){const s=t.map(a=>a.volume),o=t.filter(a=>a.volume.name.trim()&&a.mountPath.trim()).map(a=>({containerName:a.containerName,volumeName:a.volume.name.trim(),mountPath:a.mountPath.trim(),subPath:a.subPath.trim(),readOnly:a.readOnly}));return{volumes:s,mounts:o}}function mn(t,s,o,a){const n=JSON.parse(JSON.stringify(t));n.spec=n.spec||{},n.spec.template=n.spec.template||{},n.spec.template.spec=n.spec.template.spec||{};const c=n.spec.template.spec,d=s.map(xs).filter(Boolean),i=[...a,...d];i.length>0?c.volumes=i:delete c.volumes;const S=new Set(a.map(v=>v.name)),l=v=>{const g=v.name||"(unnamed)",b=(Array.isArray(v.volumeMounts)?v.volumeMounts:[]).filter(w=>hs(w,S)),E=o.filter(w=>w.containerName===g).map(rn).filter(Boolean),f=[...b,...E];f.length>0?v.volumeMounts=f:delete v.volumeMounts};return(c.containers||[]).forEach(l),(c.initContainers||[]).forEach(l),n}const Jt=[{key:"persistentVolumeClaim",label:"存储卷声明",icon:et,color:"text-emerald-400"},{key:"emptyDir",label:"临时目录",icon:Is,color:"text-slate-400"},{key:"hostPath",label:"HostPath",icon:ts,color:"text-amber-400"},{key:"nfs",label:"NFS",icon:jt,color:"text-purple-400"},{key:"configMap",label:"配置字典",icon:Os,color:"text-blue-400"},{key:"secret",label:"密文",icon:os,color:"text-rose-400"}];function xn({vol:t,onChange:s}){return t.type==="persistentVolumeClaim"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:44:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:45:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"PVC 名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:46:9",value:t.pvcName||"",onChange:o=>s({pvcName:o.target.value}),placeholder:"如 data-pvc",className:"h-7 flex-1 min-w-[160px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:48:9",className:"flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer whitespace-nowrap",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:49:11",type:"checkbox",checked:!!t.pvcReadOnly,onChange:o=>s({pvcReadOnly:o.target.checked}),className:"accent-blue-500"}),"卷只读"]})]}):t.type==="emptyDir"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:57:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:58:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"介质"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:59:9",value:t.medium||"",onChange:o=>s({medium:o.target.value}),className:"h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:61:11",value:"",children:"默认磁盘"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:62:11",value:"Memory",children:"Memory"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:64:9",value:t.sizeLimit||"",onChange:o=>s({sizeLimit:o.target.value}),placeholder:"sizeLimit 如 512Mi",className:"h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}):t.type==="hostPath"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:71:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:72:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"主机路径"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:73:9",value:t.path||"",onChange:o=>s({path:o.target.value}),placeholder:"/data/app",className:"h-7 flex-1 min-w-[160px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:75:9",value:t.pathType||"Directory",onChange:o=>s({pathType:o.target.value}),className:"h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:77:11",value:"Directory",children:"Directory"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:78:11",value:"File",children:"File"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:79:11",value:"",children:"默认"})]})]}):t.type==="nfs"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:86:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:87:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"NFS"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:88:9",value:t.nfsServer||"",onChange:o=>s({nfsServer:o.target.value}),placeholder:"Server IP",className:"h-7 w-36 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:90:9",value:t.nfsPath||"",onChange:o=>s({nfsPath:o.target.value}),placeholder:"/export/path",className:"h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}):t.type==="configMap"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:97:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:98:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"ConfigMap"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:99:9",value:t.configMapName||"",onChange:o=>s({configMapName:o.target.value}),placeholder:"ConfigMap 名称",className:"h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:101:9",value:t.cmItems||"",onChange:o=>s({cmItems:o.target.value}),placeholder:"key:path(可选)",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}):t.type==="secret"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:108:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:109:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"Secret"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:110:9",value:t.secretName||"",onChange:o=>s({secretName:o.target.value}),placeholder:"Secret 名称",className:"h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:112:9",value:t.secItems||"",onChange:o=>s({secItems:o.target.value}),placeholder:"key:path(可选)",className:"h-7 w-40 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}):null}function hn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),[i,S]=p.useState(!1),[l,v]=p.useState(!a),[g,A]=p.useState(a||{}),[b,E]=p.useState([]),[f,w]=p.useState([]),[_,I]=p.useState([]);p.useEffect(()=>{if(!a){v(!1);return}A(a);const P=dn(a);E(P.entries),w(P.containers),I(P.passthroughVolumes),v(!1)},[a]);const Z=f.find(P=>P!=="(unnamed)")||f[0]||"",q=(P,z)=>E(x=>x.map((H,G)=>G===P?{...H,...z}:H)),Q=(P,z)=>E(x=>x.map((H,G)=>G===P?{...H,volume:{...H.volume,...z}}:H)),$=()=>E(P=>[...P,sn(Z)]),U=P=>E(z=>z.filter((x,H)=>H!==P)),Y=async()=>{for(const P of b){if(!P.volume.name.trim()){d({title:"请填写数据卷名称",variant:"destructive"});return}if(!xs(P.volume)){d({title:"数据卷配置不完整",description:`请补全「${P.volume.name}」的类型必填项`,variant:"destructive"});return}if(!P.mountPath.trim()){d({title:"请填写挂载路径",description:`数据卷「${P.volume.name}」需指定挂载到容器的路径`,variant:"destructive"});return}}S(!0);try{const{volumes:P,mounts:z}=pn(b),x=mn(g,P,z,_);await rt(t,s,o,x),d({title:"存储配置已保存",description:`${o} 更新已提交`}),n(x)}catch(P){d({title:"保存失败",description:P?.message||String(P),variant:"destructive"})}finally{S(!1)}};return l?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:180:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:181:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:182:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:183:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:198:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:199:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:200:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:201:11",className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:202:13",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:203:15",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(et,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:204:17",className:"h-4 w-4 text-emerald-400"}),"数据卷",e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:206:17",variant:"outline",className:"border-slate-700 text-slate-400",children:b.length})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:208:15",className:"text-[11px] text-slate-500 mt-1",children:"定义数据卷,并将其挂载到工作负载的容器中"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:210:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs shrink-0",onClick:$,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:211:15",className:"h-3 w-3 mr-1"}),"添加数据卷"]})]})}),e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:215:9",className:"pt-0 space-y-4",children:b.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:217:13",className:"text-center py-10 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(et,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:218:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"未配置数据卷,点击「添加数据卷」开始"]}):b.map((P,z)=>{const x=P.volume,H=Jt.find(M=>M.key===x.type),G=H?.icon||Ls;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:226:15",className:"bg-slate-950/60 border border-slate-800 rounded-lg overflow-hidden",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:228:17",className:"p-3 space-y-2.5 border-b border-slate-800/80",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:229:19",className:"flex items-center gap-2 flex-wrap",children:[e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:230:21",className:`h-4 w-4 ${H?.color||"text-slate-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:231:21",className:"text-xs text-slate-400 shrink-0",children:"数据卷名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:232:21",value:x.name,onChange:M=>{const ee=M.target.value,le={name:ee};x.type==="configMap"&&!x.configMapName&&(le.configMapName=ee),x.type==="secret"&&!x.secretName&&(le.secretName=ee),x.type==="persistentVolumeClaim"&&!x.pvcName&&(le.pvcName=ee),Q(z,le)},placeholder:"如 config / uploads / data",className:"h-8 w-40 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"}),e.jsxs($e,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:245:21",value:x.type,onValueChange:M=>Q(z,{type:M}),children:[e.jsx(We,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:246:23",className:"h-8 w-[128px] bg-slate-800 border-slate-700 text-xs text-slate-300",children:e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:247:25",children:H?.label||x.type})}),e.jsx(Ge,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:249:23",children:Jt.map(M=>e.jsx(ve,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:251:27",value:M.key,children:M.label},M.key))})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:255:21",size:"icon",variant:"ghost",className:"h-8 w-8 text-red-400 ml-auto",onClick:()=>U(z),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:256:23",className:"h-4 w-4"})})]}),e.jsx(xn,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:259:19",vol:x,onChange:M=>Q(z,M)})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:263:17",className:"px-3 py-2.5 bg-slate-900/40 space-y-2",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:264:19",className:"text-[11px] text-slate-500 flex items-center gap-1.5",children:[e.jsx(Fe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:265:21",className:"h-3.5 w-3.5 text-blue-400"}),"将上述数据卷挂载到容器"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:268:19",className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:269:21",value:P.containerName,onChange:M=>q(z,{containerName:M.target.value}),className:"h-8 min-w-[120px] bg-slate-800 border border-slate-700 rounded-md text-sm text-slate-200 px-2 font-medium",children:[f.length===0&&e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:274:51",value:"",children:"(无容器)"}),f.map(M=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:275:47",value:M,children:M},M))]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:277:21",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:278:23",type:"button",onClick:()=>q(z,{readOnly:!0}),className:`px-2.5 py-1 rounded text-xs font-medium transition-all ${P.readOnly?"bg-amber-500/20 text-amber-300":"text-slate-500 hover:text-slate-300"}`,children:"只读"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:282:23",type:"button",onClick:()=>q(z,{readOnly:!1}),className:`px-2.5 py-1 rounded text-xs font-medium transition-all ${P.readOnly?"text-slate-500 hover:text-slate-300":"bg-blue-500/20 text-blue-300"}`,children:"读写"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:287:21",value:P.mountPath,onChange:M=>q(z,{mountPath:M.target.value}),placeholder:"挂载路径 /app/data",className:"h-8 flex-1 min-w-[180px] bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:294:19",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:295:21",className:"text-[11px] text-slate-500 shrink-0",children:"子路径 subPath"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:296:21",value:P.subPath,onChange:M=>q(z,{subPath:M.target.value}),placeholder:"如 config.yaml(挂载单文件时填写)",className:"h-7 flex-1 max-w-md bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]})]},z)})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:310:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:311:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:312:9",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:Y,children:[i?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:313:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:313:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:191:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:192:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式。"})})}const un=[{key:"nodeName",label:"节点名称"},{key:"nodeSelector",label:"标签选择器"},{key:"nodeAffinity",label:"节点亲和性"}];function bn({scheduleMode:t,onScheduleModeChange:s,nodeName:o,onNodeNameChange:a,availableNodes:n,nodesLoading:c,labelSelectorKv:d,onAddLabelSelector:i,onRemoveLabelSelector:S,onUpdateLabelSelector:l,nodeLabels:v}){return e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:54:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:55:7",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:56:9",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:57:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(jt,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:58:13",className:"h-4 w-4 text-emerald-400"}),"调度 (Scheduling)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:60:11",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:un.map(g=>e.jsx("button",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:62:15",onClick:()=>s(g.key),className:`px-2.5 py-1 rounded text-[10px] font-medium transition-all ${t===g.key?"bg-emerald-500/20 text-emerald-300 shadow-sm":"text-slate-400 hover:text-slate-300"}`,children:g.label},g.key))})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:76:9",className:"text-xs text-slate-500 mt-1",children:[t==="nodeName"&&"Pod 将直接调度到指定节点",t==="nodeSelector"&&"Pod 将调度到匹配标签的节点",t==="nodeAffinity"&&"通过亲和性规则控制 Pod 调度到指定节点"]})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:82:7",className:"pt-0",children:[t==="nodeName"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:84:11",className:"space-y-2",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:85:13",className:"text-slate-400 text-xs",children:"请选择节点"}),c?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:87:15",className:"flex items-center gap-1 text-slate-500 text-xs",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:88:17",className:"h-3 w-3 animate-spin"}),"加载节点列表..."]}):e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:91:15",value:o,onChange:g=>a(g.target.value),className:"h-8 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:96:17",value:"",children:"(不指定)"}),n.map(g=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:98:19",value:g.name,children:[g.name," ",g.ip?`(${g.ip})`:""]},g.name))]}),o&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:105:15",className:"text-[10px] text-slate-500",children:["已选择: ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:106:22",className:"bg-slate-800 px-1 py-0.5 rounded text-emerald-400",children:o})]})]}),t==="nodeSelector"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:113:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:114:13",className:"flex items-center justify-between",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:115:15",className:"text-slate-400 text-xs",children:"请选择标签"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:116:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:i,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:117:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),d.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:121:15",className:"text-xs text-slate-600 italic",children:"未配置标签选择器"}):d.map((g,A)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:124:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:125:19",value:g.key,onChange:b=>l(A,{key:b.target.value,value:""}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:130:21",value:"",children:"选择标签"}),Object.entries(v).map(([b,E])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:132:23",value:b,children:[b," (",E.length,")"]},b))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:135:19",value:g.value,onChange:b=>l(A,{value:b.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!g.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:141:21",value:"",children:"选择值"}),(v[g.key]||[]).map(b=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:143:23",value:b,children:b},b))]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:146:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>S(A),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:152:21",className:"h-3 w-3"})})]},A))]}),t==="nodeAffinity"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:161:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:162:13",className:"flex items-center justify-between",children:[e.jsxs(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:163:15",className:"text-slate-400 text-xs",children:["请选择标签 ",e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:164:23",className:"text-slate-600",children:"(生成 requiredDuringScheduling 规则)"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:166:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:i,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:167:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),d.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:171:15",className:"text-xs text-slate-600 italic",children:"未配置亲和性规则"}):d.map((g,A)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:174:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:175:19",value:g.key,onChange:b=>l(A,{key:b.target.value,value:""}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:180:21",value:"",children:"选择标签"}),Object.entries(v).map(([b,E])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:182:23",value:b,children:[b," (",E.length,")"]},b))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:185:19",value:g.value,onChange:b=>l(A,{value:b.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!g.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:191:21",value:"",children:"选择值"}),(v[g.key]||[]).map(b=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:193:23",value:b,children:b},b))]}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:196:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>S(A),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:202:21",className:"h-3 w-3"})})]},A))]})]})]})}function yn({dnsNameservers:t,onDnsNameserversChange:s,dnsSearches:o,onDnsSearchesChange:a,dnsOptions:n,onDnsOptionsChange:c,hostAliases:d,onHostAliasesChange:i}){const S=()=>c([...n,{name:"",value:""}]),l=(E,f)=>c(n.map((w,_)=>_===E?{...w,...f}:w)),v=E=>c(n.filter((f,w)=>w!==E)),g=()=>i([...d,{ip:"",hostnames:""}]),A=(E,f)=>i(d.map((w,_)=>_===E?{...w,...f}:w)),b=E=>i(d.filter((f,w)=>w!==E));return e.jsxs(e.Fragment,{children:[e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:53:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:54:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:55:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(_s,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:56:13",className:"h-4 w-4 text-indigo-400"}),"DNS 配置 (dnsConfig)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:59:9",className:"pt-0 space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:60:11",className:"text-[11px] text-slate-500",children:["提示:dnsConfig 通常与 ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:61:30",className:"text-slate-400",children:"dnsPolicy: None"})," 搭配使用。每行一个值。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:63:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:64:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:65:15",className:"text-slate-500 text-xs",children:"nameservers(每行一个 IP)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:66:15",value:t,onChange:E=>s(E.target.value),placeholder:`8.8.8.8 -114.114.114.114`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:74:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:75:15",className:"text-slate-500 text-xs",children:"searches(搜索域,每行一个)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:76:15",value:o,onChange:E=>a(E.target.value),placeholder:`svc.cluster.local -cluster.local`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:85:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:86:13",className:"flex items-center justify-between mb-1",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:87:15",className:"text-slate-400 text-xs",children:"options(DNS 选项)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:88:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:S,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:89:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),n.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:93:15",className:"text-xs text-slate-600 italic",children:"未配置"}):n.map((E,f)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:96:17",className:"flex items-center gap-2 mb-1.5",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:97:19",value:E.name,onChange:w=>l(f,{name:w.target.value}),placeholder:"ndots",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:103:19",className:"text-slate-600",children:":"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:104:19",value:E.value,onChange:w=>l(f,{value:w.target.value}),placeholder:"5(可留空)",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:110:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>v(f),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:111:21",className:"h-3 w-3"})})]},f))]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:120:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:121:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:122:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(zs,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:123:13",className:"h-4 w-4 text-amber-400"}),"主机别名 (hostAliases)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:126:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:127:11",className:"flex items-center justify-between mb-1",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:128:13",className:"text-slate-400 text-xs",children:"IP → 主机名映射(注入 Pod 的 /etc/hosts)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:129:13",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:g,children:[e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:130:15",className:"h-3 w-3 mr-1"}),"添加"]})]}),d.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:134:13",className:"text-xs text-slate-600 italic",children:"未配置"}):d.map((E,f)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:137:15",className:"flex items-center gap-2",children:[e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:138:17",value:E.ip,onChange:w=>A(f,{ip:w.target.value}),placeholder:"10.10.10.72",className:"w-40 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:144:17",className:"text-slate-600",children:"→"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:145:17",value:E.hostnames,onChange:w=>A(f,{hostnames:w.target.value}),placeholder:"gitlab.local, registry.local",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:151:17",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>b(f),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:152:19",className:"h-3 w-3"})})]},f))]})]})]})}function vn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),[i,S]=p.useState(!1),[l,v]=p.useState(!a),[g,A]=p.useState(a||{}),[b,E]=p.useState("RollingUpdate"),[f,w]=p.useState("25%"),[_,I]=p.useState("25%"),[Z,q]=p.useState("10"),[Q,$]=p.useState("600"),[U,Y]=p.useState("nodeSelector"),[P,z]=p.useState(""),[x,H]=p.useState([]),[G,M]=p.useState(!1),[ee,le]=p.useState([]),[ke,ge]=p.useState({}),[m,k]=p.useState([]),[r,h]=p.useState("ClusterFirst"),[N,O]=p.useState("Always"),[B,J]=p.useState("default-scheduler"),[de,Ce]=p.useState("30"),[pe,R]=p.useState(""),[ae,fe]=p.useState(""),[Se,C]=p.useState(""),[be,De]=p.useState(""),[je,He]=p.useState(!1),[ct,qe]=p.useState(!1),[lt,Ue]=p.useState(!1),[Pe,ft]=p.useState(!1),[St,Et]=p.useState(!1),[wt,Ct]=p.useState([]),[Dt,Pt]=p.useState(""),[At,Tt]=p.useState(""),[Ht,Mt]=p.useState([]);p.useEffect(()=>{const j=a;if(!j){v(!1);return}A(j);const D=j?.spec||{},W=D?.template?.spec||{},se=D.strategy||{};E(se.type||"RollingUpdate");const re=se.rollingUpdate||{};w(String(re.maxSurge??"25%")),I(String(re.maxUnavailable??"25%")),q(D.revisionHistoryLimit!=null?String(D.revisionHistoryLimit):"10"),$(D.progressDeadlineSeconds!=null?String(D.progressDeadlineSeconds):"600");const ye=W.nodeSelector||{},_e=Object.entries(ye).map(([ie,Bt])=>({key:ie,value:String(Bt)}));le(_e),z(W.nodeName||""),W.nodeName?Y("nodeName"):W.affinity?.nodeAffinity?Y("nodeAffinity"):_e.length>0&&Y("nodeSelector"),t&&(M(!0),ce.getClusterNodes(t).then(ie=>{const Rt=(Array.isArray(ie)?ie:ie?.items||ie?.list||[]).map(Je=>{const Me=Je.metadata||{},Ke=Je.status||{},ks=(Array.isArray(Ke.addresses)?Ke.addresses:[]).find(gs=>gs.type==="InternalIP")?.address||"";return{name:Me.name||"",ip:ks,labels:Me.labels||{}}});H(Rt);const ze={};for(const Je of Rt)for(const[Me,Ke]of Object.entries(Je.labels)){const it=String(Ke);ze[Me]||(ze[Me]=[]),ze[Me].includes(it)||ze[Me].push(it)}ge(ze)}).catch(()=>{}).finally(()=>M(!1)));const Ye=Array.isArray(W.tolerations)?W.tolerations:[];k(Ye.map(ie=>({key:ie.key||"",operator:ie.operator||"Equal",value:ie.value||"",effect:ie.effect||"",tolerationSeconds:ie.tolerationSeconds!=null?String(ie.tolerationSeconds):""}))),h(W.dnsPolicy||"ClusterFirst"),O(W.restartPolicy||"Always"),J(W.schedulerName||"default-scheduler"),Ce(W.terminationGracePeriodSeconds!=null?String(W.terminationGracePeriodSeconds):"30"),R(W.serviceAccountName||"");const Ee=W.securityContext||{};fe(Ee.fsGroup!=null?String(Ee.fsGroup):""),C(Ee.runAsUser!=null?String(Ee.runAsUser):""),De(Ee.runAsGroup!=null?String(Ee.runAsGroup):""),He(!!Ee.runAsNonRoot),qe(!!W.hostNetwork),Ue(!!W.hostIPC),ft(!!W.hostPID),Et(!!W.shareProcessNamespace);const L=Array.isArray(W.hostAliases)?W.hostAliases:[];Ct(L.map(ie=>({ip:ie.ip||"",hostnames:Array.isArray(ie.hostnames)?ie.hostnames.join(", "):""})));const ne=W.dnsConfig||{};Pt(Array.isArray(ne.nameservers)?ne.nameservers.join(` -`):""),Tt(Array.isArray(ne.searches)?ne.searches.join(` -`):"");const dt=Array.isArray(ne.options)?ne.options:[];Mt(dt.map(ie=>({name:ie.name||"",value:ie.value||""}))),v(!1)},[a]);const us=()=>le(j=>[...j,{key:"",value:""}]),bs=j=>le(D=>D.filter((W,se)=>se!==j)),ys=(j,D)=>le(W=>W.map((se,re)=>re===j?{...se,...D}:se)),vs=async()=>{S(!0);try{const j=JSON.parse(JSON.stringify(g));j.spec=j.spec||{},j.spec.template=j.spec.template||{},j.spec.template.spec=j.spec.template.spec||{};const D=j.spec.template.spec;if(j.spec.strategy={type:b},b==="RollingUpdate"&&(j.spec.strategy.rollingUpdate={maxSurge:f,maxUnavailable:_}),Z&&(j.spec.revisionHistoryLimit=Number(Z)),Q&&(j.spec.progressDeadlineSeconds=Number(Q)),U==="nodeName"&&P.trim())D.nodeName=P.trim(),delete D.nodeSelector,D.affinity&&delete D.affinity.nodeAffinity;else if(U==="nodeSelector"){const L={};for(const{key:ne,value:dt}of ee){const ie=ne.trim();ie&&(L[ie]=dt)}Object.keys(L).length>0?D.nodeSelector=L:delete D.nodeSelector,D.nodeName&&delete D.nodeName,D.affinity&&delete D.affinity.nodeAffinity}else if(U==="nodeAffinity"){const L=ee.filter(ne=>ne.key.trim()).map(ne=>({key:ne.key.trim(),operator:"In",values:[ne.value]}));L.length>0?(D.affinity=D.affinity||{},D.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:L}]}}):D.affinity&&delete D.affinity.nodeAffinity,delete D.nodeSelector,D.nodeName&&delete D.nodeName}const W=m.filter(L=>L.key||L.operator==="Exists").map(L=>{const ne={};return L.key&&(ne.key=L.key),L.operator&&(ne.operator=L.operator),L.value&&L.operator!=="Exists"&&(ne.value=L.value),L.effect&&(ne.effect=L.effect),L.tolerationSeconds&&L.effect==="NoExecute"&&(ne.tolerationSeconds=Number(L.tolerationSeconds)),ne});W.length>0?D.tolerations=W:delete D.tolerations,r&&(D.dnsPolicy=r),N&&(D.restartPolicy=N),B&&(D.schedulerName=B),de&&(D.terminationGracePeriodSeconds=Number(de)),pe&&(D.serviceAccountName=pe);const se={};ae&&(se.fsGroup=Number(ae)),Se&&(se.runAsUser=Number(Se)),be&&(se.runAsGroup=Number(be)),je&&(se.runAsNonRoot=!0),Object.keys(se).length>0?D.securityContext=se:delete D.securityContext,ct?D.hostNetwork=!0:delete D.hostNetwork,lt?D.hostIPC=!0:delete D.hostIPC,Pe?D.hostPID=!0:delete D.hostPID,St?D.shareProcessNamespace=!0:delete D.shareProcessNamespace;const re=wt.filter(L=>L.ip.trim()).map(L=>({ip:L.ip.trim(),hostnames:L.hostnames.split(/[,\s]+/).map(ne=>ne.trim()).filter(Boolean)})).filter(L=>L.hostnames.length>0);re.length>0?D.hostAliases=re:delete D.hostAliases;const ye={},_e=Dt.split(` -`).map(L=>L.trim()).filter(Boolean);_e.length>0&&(ye.nameservers=_e);const Ye=At.split(` -`).map(L=>L.trim()).filter(Boolean);Ye.length>0&&(ye.searches=Ye);const Ee=Ht.filter(L=>L.name.trim()).map(L=>{const ne={name:L.name.trim()};return L.value.trim()&&(ne.value=L.value.trim()),ne});Ee.length>0&&(ye.options=Ee),Object.keys(ye).length>0?D.dnsConfig=ye:delete D.dnsConfig,await rt(t,s,o,j),d({title:"高级设置已保存",description:`${o} 更新已提交`}),n(j)}catch(j){d({title:"保存失败",description:j?.message||String(j),variant:"destructive"})}finally{S(!1)}};return l?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:322:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:323:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:324:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:325:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):a?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:342:5",className:"space-y-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:344:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:345:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:346:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:347:13",className:"h-4 w-4 text-blue-400"}),"更新策略 (Strategy)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:350:9",className:"pt-0 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:351:11",className:"flex items-center gap-4",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:352:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:353:15",type:"radio",checked:b==="RollingUpdate",onChange:()=>E("RollingUpdate"),className:"accent-blue-500"}),"RollingUpdate(滚动更新)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:357:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:358:15",type:"radio",checked:b==="Recreate",onChange:()=>E("Recreate"),className:"accent-blue-500"}),"Recreate(重建)"]})]}),b==="RollingUpdate"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:364:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:365:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:366:17",className:"text-slate-500 text-xs",children:"maxSurge(整数或百分比,超出期望副本数)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:367:17",value:f,onChange:j=>w(j.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:370:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:371:17",className:"text-slate-500 text-xs",children:"maxUnavailable(整数或百分比,不可用上限)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:372:17",value:_,onChange:j=>I(j.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:381:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:382:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:383:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ns,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:384:13",className:"h-4 w-4 text-amber-400"}),"历史版本 & 进度"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:387:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:388:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:389:13",className:"text-slate-500 text-xs",children:"revisionHistoryLimit(保留 RS 历史)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:390:13",type:"number",value:Z,onChange:j=>q(j.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:393:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:394:13",className:"text-slate-500 text-xs",children:"progressDeadlineSeconds(升级超时秒数)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:395:13",type:"number",value:Q,onChange:j=>$(j.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:402:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:403:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:404:11",className:"flex items-center justify-between",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:405:13",className:"text-sm text-slate-200",children:"容忍 (Tolerations)"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:406:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>k(j=>[...j,{key:"",operator:"Equal",value:"",effect:"NoSchedule",tolerationSeconds:""}]),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:408:15",className:"h-3 w-3 mr-1"}),"添加"]})]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:412:9",className:"pt-0 space-y-2",children:[m.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:413:40",className:"text-xs text-slate-600",children:"未配置容忍"}),m.map((j,D)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:415:13",className:"grid grid-cols-[1fr_80px_1fr_100px_80px_auto] gap-2 items-center",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:416:15",value:j.key,placeholder:"key",onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,key:W.target.value}:re)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:418:15",value:j.operator,onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,operator:W.target.value}:re)),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:420:17",value:"Equal",children:"Equal"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:421:17",value:"Exists",children:"Exists"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:423:15",value:j.value,placeholder:"value",disabled:j.operator==="Exists",onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,value:W.target.value}:re)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:426:15",value:j.effect,onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,effect:W.target.value}:re)),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:428:17",value:"",children:"任意"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:429:17",value:"NoSchedule",children:"NoSchedule"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:430:17",value:"PreferNoSchedule",children:"PreferNoSchedule"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:431:17",value:"NoExecute",children:"NoExecute"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:433:15",value:j.tolerationSeconds,placeholder:"秒",disabled:j.effect!=="NoExecute",onChange:W=>k(se=>se.map((re,ye)=>ye===D?{...re,tolerationSeconds:W.target.value}:re)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:436:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400",onClick:()=>k(W=>W.filter((se,re)=>re!==D)),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:437:17",className:"h-3 w-3"})})]},D))]})]}),e.jsx(bn,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:444:7",scheduleMode:U,onScheduleModeChange:Y,nodeName:P,onNodeNameChange:z,availableNodes:x,nodesLoading:G,labelSelectorKv:ee,onAddLabelSelector:us,onRemoveLabelSelector:bs,onUpdateLabelSelector:ys,nodeLabels:ke}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:459:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:460:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:461:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ut,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:462:13",className:"h-4 w-4 text-slate-400"}),"Pod 级别"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:465:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:466:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:467:13",className:"text-slate-500 text-xs",children:"dnsPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:468:13",value:r,onChange:j=>h(j.target.value),className:"h-8 mt-1 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:470:15",value:"ClusterFirst",children:"ClusterFirst"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:471:15",value:"ClusterFirstWithHostNet",children:"ClusterFirstWithHostNet"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:472:15",value:"Default",children:"Default"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:473:15",value:"None",children:"None"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:476:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:477:13",className:"text-slate-500 text-xs",children:"restartPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:478:13",value:N,onChange:j=>O(j.target.value),className:"h-8 mt-1 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:480:15",value:"Always",children:"Always"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:481:15",value:"OnFailure",children:"OnFailure"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:482:15",value:"Never",children:"Never"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:485:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:486:13",className:"text-slate-500 text-xs",children:"schedulerName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:487:13",value:B,onChange:j=>J(j.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:490:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:491:13",className:"text-slate-500 text-xs",children:"terminationGracePeriodSeconds"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:492:13",type:"number",value:de,onChange:j=>Ce(j.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:495:11",className:"col-span-2",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:496:13",className:"text-slate-500 text-xs",children:"serviceAccountName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:497:13",value:pe,onChange:j=>R(j.target.value),placeholder:"default",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:504:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:505:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:506:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(rs,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:507:13",className:"h-4 w-4 text-rose-400"}),"Pod 安全上下文 (securityContext)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:510:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:511:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:512:13",className:"text-slate-500 text-xs",children:"fsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:513:13",type:"number",value:ae,onChange:j=>fe(j.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:516:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:517:13",className:"text-slate-500 text-xs",children:"runAsUser"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:518:13",type:"number",value:Se,onChange:j=>C(j.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:521:11",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:522:13",className:"text-slate-500 text-xs",children:"runAsGroup"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:523:13",type:"number",value:be,onChange:j=>De(j.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:526:11",className:"flex items-end pb-1",children:e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:527:13",className:"flex items-center gap-2 text-xs text-slate-400 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:528:15",type:"checkbox",checked:je,onChange:j=>He(j.target.checked),className:"accent-blue-500"}),"runAsNonRoot"]})})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:537:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:538:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:539:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:540:13",className:"h-4 w-4 text-cyan-400"}),"主机设置 (Host Namespace)"]})}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:543:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:544:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:545:13",type:"checkbox",checked:ct,onChange:j=>qe(j.target.checked),className:"accent-blue-500"}),"hostNetwork(共享主机网络命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:549:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:550:13",type:"checkbox",checked:lt,onChange:j=>Ue(j.target.checked),className:"accent-blue-500"}),"hostIPC(共享主机 IPC 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:554:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:555:13",type:"checkbox",checked:Pe,onChange:j=>ft(j.target.checked),className:"accent-blue-500"}),"hostPID(共享主机 PID 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:559:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:560:13",type:"checkbox",checked:St,onChange:j=>Et(j.target.checked),className:"accent-blue-500"}),"shareProcessNamespace(共享进程命名空间)"]})]})]}),e.jsx(yn,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:567:7",dnsNameservers:Dt,onDnsNameserversChange:Pt,dnsSearches:At,onDnsSearchesChange:Tt,dnsOptions:Ht,onDnsOptionsChange:Mt,hostAliases:wt,onHostAliasesChange:Ct}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:579:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:580:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:c,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:581:9",className:"bg-blue-600 hover:bg-blue-700",disabled:i,onClick:vs,children:[i?e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:582:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(ot,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:582:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]}):e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:333:7",className:"bg-slate-900 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:334:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}const kn=[{label:"HTTP",protocol:"TCP",port:8080,targetPort:8080,name:"http"},{label:"WebSocket",protocol:"TCP",port:8001,targetPort:8002,name:"ws"},{label:"gRPC",protocol:"TCP",port:8002,targetPort:8002,name:"grpc"}],Kt=t=>Array.isArray(t)?t:t?.list||t?.items||t?.data||[];function gn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const{toast:d}=Te(),i=nt(),[S,l]=p.useState(!0),[v,g]=p.useState([]),[A,b]=p.useState([]),[E,f]=p.useState({}),[w,_]=p.useState(null),[I,Z]=p.useState(null),[q,Q]=p.useState({name:"",type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),[$,U]=p.useState({name:"",className:"nginx",host:"",path:"/",pathType:"Prefix",svcPort:"80"}),Y=m=>{Q(k=>({...k,ports:[...k.ports,m?{name:m.name,port:String(m.port),targetPort:String(m.targetPort),protocol:m.protocol,nodePort:""}:{name:"",port:"",targetPort:"",protocol:"TCP",nodePort:""}]}))},P=(m,k,r)=>{Q(h=>({...h,ports:h.ports.map((N,O)=>O===m?{...N,[k]:r}:N)}))},z=m=>{q.ports.length<=1||Q(k=>({...k,ports:k.ports.filter((r,h)=>h!==m)}))},x=p.useCallback(async()=>{l(!0);try{const m=a?.spec?.selector?.matchLabels||a?.selector||{};f(m);const[k,r]=await Promise.all([ce.getNamespaceServices(t,s).catch(()=>[]),ce.getNamespaceIngresses(t,s).catch(()=>[])]),h=Kt(k),N=Kt(r),O=h.map(J=>{const de=J.spec||{},Ce=Array.isArray(de.ports)?de.ports.map(pe=>({port:pe.port,targetPort:pe.targetPort,protocol:pe.protocol||"TCP",nodePort:pe.nodePort,name:pe.name})):Array.isArray(J.portList)?J.portList.map(pe=>({port:pe.port,targetPort:pe.targetPort,protocol:pe.protocol||"TCP",nodePort:pe.nodePort,name:pe.name})):[];return{name:J.name||J.metadata?.name||"",type:de.type||J.type||"ClusterIP",clusterIP:de.clusterIP||J.cluster_ip||"",externalIP:Array.isArray(de.externalIPs)?de.externalIPs.join(","):"",ports:Ce,selector:de.selector||J.selector||{},age:J.age||J.created_at||"",raw:J}}),B=N.map(J=>{const de=J.spec||{},pe=(Array.isArray(de.rules)?de.rules:Array.isArray(J.rules)?J.rules:[]).map(R=>({host:R.host||"",paths:(R.http?.paths||R.paths||[]).map(ae=>({path:ae.path||"/",backend:{service:ae.backend?.service?.name||ae.backendService||"",port:ae.backend?.service?.port?.number||ae.backend?.service?.port?.name||ae.backendPort||""}}))}));return{name:J.name||J.metadata?.name||"",className:de.ingressClassName||J.ingressClass||"",hosts:pe.map(R=>R.host).filter(Boolean),rules:pe,raw:J}});g(O),b(B)}catch(m){console.error("M9 load error:",m)}finally{l(!1)}},[t,s,a]);p.useEffect(()=>{x()},[x]);const H=m=>Object.keys(m).length===0?!1:Object.entries(m).every(([k,r])=>E[k]===r),G=v.filter(m=>H(m.selector)),M=new Set(G.map(m=>m.name)),ee=A.filter(m=>m.rules.some(k=>k.paths.some(r=>M.has(r.backend.service)))),le=async()=>{const m=q.name.trim()||`${o}-svc`,k=q.ports.map(h=>{const N={name:h.name||"http",port:Number(h.port)||80,targetPort:/^\d+$/.test(String(h.targetPort))?Number(h.targetPort):h.targetPort,protocol:h.protocol||"TCP"};return q.type==="NodePort"&&h.nodePort&&(N.nodePort=Number(h.nodePort)),N}),r={apiVersion:"v1",kind:"Service",metadata:{name:m,namespace:s,labels:{app:o}},spec:{type:q.type,selector:E,ports:k}};try{const h=await It(r);await ce.applyYAML(t,h),d({title:"Service 已创建",description:m}),Z(null),x()}catch(h){d({title:"创建失败",description:h?.message||String(h),variant:"destructive"})}},ke=async()=>{const m=$.name.trim()||`${o}-ingress`,k=G[0]?.name||`${o}-svc`,r=Number($.svcPort)||80,h={apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:m,namespace:s,labels:{app:o}},spec:{ingressClassName:$.className||void 0,rules:[{host:$.host||void 0,http:{paths:[{path:$.path||"/",pathType:$.pathType||"Prefix",backend:{service:{name:k,port:{number:r}}}}]}}]}};$.className||delete h.spec.ingressClassName;try{const N=await It(h);await ce.applyYAML(t,N),d({title:"Ingress 已创建",description:m}),Z(null),x()}catch(N){d({title:"创建失败",description:N?.message||String(N),variant:"destructive"})}},ge=async(m,k)=>{if(await i({title:"删除资源",description:`确认删除 ${m==="service"?"Service":"Ingress"} 「${k}」?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{const h=m==="service"?"services":"ingresses";await ce.deleteResourceYaml(t,s,h,k),d({title:"已删除",description:`${m==="service"?"Service":"Ingress"} ${k} 已删除`}),x()}catch(h){d({title:"删除失败",description:h?.message||String(h),variant:"destructive"})}};return S?e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:291:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:292:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:293:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:294:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:301:5",className:"space-y-4",children:[e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:303:7",className:"bg-slate-900/50 border-slate-800",children:e.jsx(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:304:9",className:"p-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:305:11",className:"flex items-center gap-2 text-xs text-slate-400",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:306:13",className:"h-3.5 w-3.5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:307:13",children:"选择器:"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:308:13",className:"flex flex-wrap gap-1",children:[Object.entries(E).map(([m,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:310:17",className:"bg-slate-800 px-1.5 py-0.5 rounded text-slate-300 text-[11px]",children:[m,"=",k]},m)),Object.keys(E).length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:313:17",className:"text-slate-600 italic",children:"(无 selector)"})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:316:13",size:"sm",variant:"ghost",className:"h-6 ml-auto text-xs text-slate-400",onClick:x,children:[e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:317:15",className:"h-3 w-3 mr-1"}),"刷新"]})]})})}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:324:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:325:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:326:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:327:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:328:15",className:"h-4 w-4 text-blue-400"}),"Services",e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:330:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[G.length," 个关联"]})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:332:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{Q({name:`${o}-svc`,type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),Z("service")},children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:337:15",className:"h-3 w-3 mr-1"}),"创建 Service"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:340:11",className:"text-xs text-slate-500 mt-1",children:"仅显示 selector 匹配此 Deployment 的关联 Service"})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:342:9",className:"pt-0",children:[G.length===0&&I!=="service"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:344:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:345:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无关联 Service"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:349:13",className:"space-y-2",children:G.map(m=>{const k=H(m.selector);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:353:19",className:`rounded-lg border p-3 ${k?"border-blue-700/50 bg-blue-950/20":"border-slate-800 bg-slate-950/30"}`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:354:21",className:"flex items-center gap-2 flex-wrap",children:[k?e.jsx(bt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:355:34",className:"h-4 w-4 text-blue-400"}):e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:355:86",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:356:23",className:"text-sm font-semibold text-slate-200",children:m.name}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:357:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:m.type}),k&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:358:35",className:"bg-blue-500/20 text-blue-300 border-blue-500/30 text-[10px]",children:"关联"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:359:23",className:"text-[11px] text-slate-500 ml-auto",children:m.clusterIP}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:360:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-emerald-400",onClick:()=>_({resource:"services",name:m.name}),children:[e.jsx(Lt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:362:25",className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:364:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Service",onClick:()=>ge("service",m.name),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:366:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:370:21",className:"mt-2 flex flex-wrap gap-1.5 text-[11px]",children:m.ports.map((r,h)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:372:25",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-300",children:[r.name&&e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:373:38",className:"text-slate-500",children:[r.name,": "]}),r.port,"→",r.targetPort,r.nodePort?`/NodePort:${r.nodePort}`:"","/",r.protocol]},h))}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:379:21",className:"mt-1 flex flex-wrap gap-1 text-[10px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:380:23",className:"text-slate-600",children:"selector:"}),Object.entries(m.selector).map(([r,h])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:382:25",className:"text-slate-500",children:[r,"=",h]},r))]})]},m.name)})}),I==="service"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:393:13",className:"mt-3 border border-blue-800/50 rounded-lg p-3 bg-blue-950/20 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:394:15",className:"text-xs font-semibold text-blue-300 flex items-center gap-1.5",children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:395:17",className:"h-3 w-3"}),"创建新 Service"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:399:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:400:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:401:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:402:19",value:q.name,onChange:m=>Q(k=>({...k,name:m.target.value})),placeholder:`${o}-svc`,className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:406:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:407:19",className:"text-slate-500 text-[11px]",children:"类型"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:408:19",value:q.type,onChange:m=>Q(k=>({...k,type:m.target.value})),className:"h-7 mt-0.5 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:410:21",value:"ClusterIP",children:"ClusterIP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:411:21",value:"NodePort",children:"NodePort"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:417:15",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:418:17",className:"text-slate-500 text-[11px] mb-1 block",children:"快速添加常用端口"}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:419:17",className:"flex gap-1.5",children:kn.map(m=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:421:21",onClick:()=>Y(m),className:`flex items-center gap-1 px-2 py-1 rounded text-[10px] font-medium - bg-slate-800 border border-slate-700 text-slate-300 hover:border-blue-500/50 hover:text-blue-300 transition-colors`,children:[e.jsx(as,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:424:23",className:"h-2.5 w-2.5"}),m.label,e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:426:23",className:"text-slate-500 text-[9px]",children:[m.protocol," ",m.port,":",m.targetPort]})]},m.name))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:433:15",className:"space-y-2",children:[e.jsxs(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:434:17",className:"text-slate-500 text-[11px]",children:["端口配置 ",e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:435:24",className:"text-slate-600",children:["(",q.ports.length," 个端口)"]})]}),q.ports.map((m,k)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:438:19",className:"flex items-center gap-1.5 p-2 rounded bg-slate-800/50 border border-slate-700/50",children:[e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:440:21",value:m.name,onChange:r=>P(k,"name",r.target.value),placeholder:"http",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:444:21",value:m.protocol,onChange:r=>P(k,"protocol",r.target.value),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 w-16",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:446:23",value:"TCP",children:"TCP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:447:23",value:"UDP",children:"UDP"})]}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:450:21",value:m.port,onChange:r=>P(k,"port",r.target.value),type:"number",placeholder:"port",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:453:21",className:"text-slate-600 text-[10px]",children:"→"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:454:21",value:m.targetPort,onChange:r=>P(k,"targetPort",r.target.value),type:"number",placeholder:"targetPort",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),q.type==="NodePort"&&e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:459:23",value:m.nodePort,onChange:r=>P(k,"nodePort",r.target.value),type:"number",placeholder:"30000-32767",className:"h-7 w-[80px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:464:21",size:"icon",variant:"ghost",className:"h-6 w-6 text-slate-500 hover:text-red-400",onClick:()=>z(k),disabled:q.ports.length<=1,children:e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:466:23",className:"h-3 w-3"})})]},k)),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:471:17",size:"sm",variant:"outline",className:"h-7 w-full border-dashed border-slate-700 text-slate-400 text-xs",onClick:()=>Y(),children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:473:19",className:"h-3 w-3 mr-1"}),"添加自定义端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:478:15",className:"text-[10px] text-slate-500 border-t border-slate-700/50 pt-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:479:17",className:"text-slate-600",children:"selector (自动检测): "}),Object.keys(E).length>0?Object.entries(E).map(([m,k])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:482:21",className:"bg-slate-800 px-1 py-0.5 rounded text-slate-400 ml-1",children:[m,"=",k]},m)):e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:485:19",className:"text-slate-600 italic",children:"未检测到"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:489:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:490:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>Z(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:491:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:le,children:"创建"})]})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:499:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:500:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:501:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:502:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:503:15",className:"h-4 w-4 text-purple-400"}),"Ingresses (应用路由)",e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:505:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[ee.length,"/",A.length]})]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:507:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{U(m=>({...m,name:`${o}-ingress`,svcPort:String(G[0]?.ports[0]?.port||80)})),Z("ingress")},children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:512:15",className:"h-3 w-3 mr-1"}),"创建 Ingress"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:515:11",className:"text-xs text-slate-500 mt-1",children:"backend 指向关联 Service 的 Ingress 自动高亮"})]}),e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:517:9",className:"pt-0",children:[A.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:519:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:520:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无 Ingress"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:524:13",className:"space-y-2",children:A.map(m=>{const k=ee.includes(m);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:528:19",className:`rounded-lg border p-3 ${k?"border-purple-700/50 bg-purple-950/20":"border-slate-800 bg-slate-950/30"}`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:529:21",className:"flex items-center gap-2 flex-wrap",children:[k?e.jsx(bt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:34",className:"h-4 w-4 text-purple-400"}):e.jsx(xt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:88",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:531:23",className:"text-sm font-semibold text-slate-200",children:m.name}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:532:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:m.className}),k&&e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:533:35",className:"bg-purple-500/20 text-purple-300 border-purple-500/30 text-[10px]",children:"关联"}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:534:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-emerald-400 ml-auto",onClick:()=>_({resource:"ingresses",name:m.name}),children:[e.jsx(Lt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:536:25",className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:538:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Ingress",onClick:()=>ge("ingress",m.name),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:540:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:544:21",className:"mt-2 space-y-1 text-[11px]",children:m.rules.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:546:25",className:"flex items-start gap-1.5",children:[e.jsx(jt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:547:27",className:"h-3 w-3 text-slate-500 mt-0.5"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:548:27",className:"text-slate-300",children:r.host||"*"}),r.paths.map((N,O)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:550:29",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-400",children:[N.path," → ",N.backend?.service,":",N.backend?.port]},O))]},h))})]},m.name)})}),I==="ingress"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:565:13",className:"mt-3 border border-purple-800/50 rounded-lg p-3 bg-purple-950/20 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:566:15",className:"text-xs font-semibold text-purple-300 flex items-center gap-1.5",children:[e.jsx(oe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:567:17",className:"h-3 w-3"}),"创建新 Ingress"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:569:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:570:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:571:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:572:19",value:$.name,onChange:m=>U(k=>({...k,name:m.target.value})),placeholder:`${o}-ingress`,className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:576:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:577:19",className:"text-slate-500 text-[11px]",children:"ingressClassName"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:578:19",value:$.className,onChange:m=>U(k=>({...k,className:m.target.value})),placeholder:"nginx",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:582:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:583:19",className:"text-slate-500 text-[11px]",children:"host (域名)"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:584:19",value:$.host,onChange:m=>U(k=>({...k,host:m.target.value})),placeholder:"app.example.com",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:588:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:589:19",className:"text-slate-500 text-[11px]",children:"path"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:590:19",value:$.path,onChange:m=>U(k=>({...k,path:m.target.value})),placeholder:"/",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:594:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:595:19",className:"text-slate-500 text-[11px]",children:"Service 端口"}),e.jsx(y,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:596:19",type:"number",value:$.svcPort,onChange:m=>U(k=>({...k,svcPort:m.target.value})),className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:600:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:601:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>Z(null),children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:602:17",size:"sm",className:"h-7 bg-purple-600 hover:bg-purple-700 text-xs",onClick:ke,children:"创建"})]})]})]})]}),w&&e.jsx(Fs,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:610:9",clusterCode:t,namespace:s,resource:w.resource,name:w.name,onClose:()=>_(null),onSaved:()=>{_(null),x()}}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:620:7",className:"flex justify-end gap-2 pt-2",children:e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:621:9",size:"sm",variant:"outline",className:"h-7 text-xs border-slate-700 text-slate-400",onClick:c,children:"返回查看"})})]})}function jn({clusterCode:t,namespace:s,deploymentName:o,manifest:a,onSaved:n,onCancel:c}){const[d,i]=p.useState("basic"),[S,l]=p.useState(a);p.useEffect(()=>{a&&l(a)},[a]);const v=b=>{b&&l(b),n()},g=[{key:"basic",label:"基本信息",icon:ut},{key:"containers",label:"容器信息",icon:Fe},{key:"storage",label:"存储挂载",icon:et},{key:"advanced",label:"高级设置",icon:ut},{key:"service",label:"服务/应用路由",icon:Ae}],A={clusterCode:t,namespace:s,deploymentName:o,manifest:S,onSaved:v,onCancel:c};return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:51:5",className:"space-y-4",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:52:7",className:"flex items-center gap-1 border-b border-slate-800 pb-px overflow-x-auto",children:g.map(b=>{const E=d===b.key,f=b.icon;return e.jsxs("button",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:57:13",onClick:()=>i(b.key),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 transition-colors whitespace-nowrap ${E?"border-blue-500 text-blue-400":"border-transparent text-slate-400 hover:text-slate-200"}`,children:[e.jsx(f,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:64:15",className:"h-3.5 w-3.5"}),b.label]},b.key)})}),d==="basic"&&e.jsx(Qs,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:71:33",...A}),d==="containers"&&e.jsx(tn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:72:38",...A}),d==="storage"&&e.jsx(hn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:73:35",...A}),d==="advanced"&&e.jsx(vn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:74:36",...A}),d==="service"&&e.jsx(gn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:75:35",...A})]})}function Nn({clusterCode:t,namespace:s,deploymentName:o}){const{toast:a}=Te(),n=vt(S=>S.token)||localStorage.getItem("token")||"",c=`${window.location.origin}/api/v1/clusters/${t}/namespaces/${s}/deployments/${o}/update-image`,d=`curl -X POST '${c}' \\ - -H 'Authorization: Bearer ${n?n.substring(0,16)+"...":"YOUR_TOKEN"}' \\ - -H 'Content-Type: application/json' \\ - -d '{"image": "harbor.example.com/app:v1.0", "container": "your-container-name"}'`,i=S=>{navigator.clipboard.writeText(S).then(()=>a({title:"已复制"})).catch(()=>{})};return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:28:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:29:7",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:30:9",className:"text-slate-400 text-sm",children:"Webhook URL"}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:31:9",className:"flex items-center gap-2 mt-1",children:[e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:32:11",className:"flex-1 text-xs text-slate-300 bg-slate-800 rounded px-3 py-2 break-all font-mono",children:c}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:33:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400 shrink-0",onClick:()=>i(c),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:36:7",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:37:9",className:"text-slate-400 text-sm",children:"curl 示例"}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:38:9",className:"relative mt-1",children:[e.jsx("pre",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:39:11",className:"text-xs text-slate-300 bg-slate-800 rounded p-3 overflow-x-auto font-mono whitespace-pre-wrap",children:d}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:40:11",variant:"outline",size:"sm",className:"absolute top-2 right-2 border-slate-700 text-slate-400",onClick:()=>i(d),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:43:7",className:"text-xs text-slate-500 space-y-1",children:[e.jsx("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:44:9",children:"• 使用 Bearer Token 认证(JWT 登录令牌)"}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:45:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:45:14",className:"text-slate-400",children:"image"})," 必填,指定新镜像地址"]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:46:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:46:14",className:"text-slate-400",children:"container"})," 可选,不填则更新第一个容器"]})]})]})}function Ze({title:t,children:s,onClose:o}){return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:14:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:o,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:15:7",className:"bg-slate-900 border border-slate-700 rounded-xl p-6 w-[460px] max-w-[90vw] shadow-2xl",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:16:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:17:11",className:"text-base font-bold text-slate-100",children:t}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:o,children:e.jsx(ds,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:100",className:"h-4 w-4"})})]}),s]})})}function fn({clusterCode:t,namespace:s,podName:o,containers:a,onClose:n}){const{toast:c}=Te(),[d,i]=p.useState(""),[S,l]=p.useState(200),[v,g]=p.useState(a[0]||""),[A,b]=p.useState(!1),[E,f]=p.useState(!1),w=async()=>{b(!0);try{const I=await ce.getPodLogs(t,s,o,S,v||void 0);i(I?.data?.logs||I?.logs||I||"无日志")}catch{i("获取日志失败")}finally{b(!1)}};p.useEffect(()=>{w()},[v,S]);const _=async()=>{f(!0);const I=vt.getState().token||"",Z="",q=v?`&container=${encodeURIComponent(v)}`:"",Q=`${Z}/api/v1/kubernetes/${t}/namespace/${s}/pods/${o}/logs?tail=${S}&stream=true${q}`;try{const U=(await fetch(Q,{headers:{Authorization:`Bearer ${I}`}})).body?.getReader();if(!U)return;const Y=new TextDecoder;let P="";for(;;){const{done:z,value:x}=await U.read();if(z)break;P+=Y.decode(x,{stream:!0}),i(P)}}catch{c({title:"流式日志连接中断",variant:"destructive"})}finally{f(!1)}};return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:64:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:n,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:65:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[90vw] max-w-4xl max-h-[80vh] flex flex-col",onClick:I=>I.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:66:9",className:"flex items-center justify-between p-3 border-b border-slate-700",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:67:11",className:"flex items-center gap-2",children:[e.jsx(kt,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:68:13",className:"h-4 w-4 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:69:13",className:"text-sm font-semibold text-slate-200",children:o}),v&&e.jsx(te,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:70:27",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:v})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:72:11",className:"flex items-center gap-2",children:[a.length>0&&e.jsx("select",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:74:15",value:v,onChange:I=>g(I.target.value),className:"bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2 py-1",children:a.map(I=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:76:38",value:I,children:I},I))}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:79:13",className:"text-[11px] text-slate-500",children:"最近"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:80:13",type:"number",value:S,onChange:I=>l(Number(I.target.value)||200),className:"w-16 h-7 bg-slate-800 border-slate-700 text-slate-200 text-xs"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:82:13",className:"text-[11px] text-slate-500",children:"行"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:83:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:w,disabled:A,children:A?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:84:26",className:"h-3 w-3 animate-spin"}):e.jsx(at,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:84:73",className:"h-3 w-3"})}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:86:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-emerald-400 text-xs",onClick:_,disabled:E,children:E?"流中...":"实时流"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:89:13",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:n,children:e.jsx(ds,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:89:102",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:92:9",className:"flex-1 overflow-auto p-3",children:e.jsx("pre",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:93:11",className:"bg-slate-950 rounded p-3 text-xs text-slate-300 font-mono whitespace-pre-wrap max-h-[60vh] overflow-auto",children:d||"无日志内容"})})]})})}function Sn({modal:t,deployment:s,namespace:o,deploymentName:a,newImage:n,setNewImage:c,scaleValue:d,setScaleValue:i,actionLoading:S,onClose:l,onUpdateImage:v,onScaleTo:g,onDelete:A}){return e.jsxs(e.Fragment,{children:[t?.kind==="image"&&e.jsx(Ze,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:45:9",title:"调整镜像版本",onClose:l,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:46:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:47:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:48:15",className:"text-slate-400 text-sm",children:"当前镜像"}),e.jsx("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:49:15",className:"text-xs text-slate-500 font-mono mt-1 bg-slate-800 rounded px-3 py-2",children:s.image||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:51:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:52:15",className:"text-slate-400 text-sm",children:"新镜像地址"}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:53:15",value:n,onChange:b=>c(b.target.value),placeholder:"harbor.example.com/app:v2.0",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:57:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:58:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:59:15",className:"bg-blue-600 hover:bg-blue-700",disabled:S==="image"||!n.trim(),onClick:v,children:S==="image"?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:60:46",className:"h-4 w-4 animate-spin"}):"更新镜像"})]})]})}),t?.kind==="scale"&&e.jsx(Ze,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:69:9",title:"伸缩 (Scale)",onClose:l,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:70:11",className:"space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:71:13",className:"text-xs text-slate-500",children:["当前副本: ",s.replicas||0]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:72:13",className:"flex items-center justify-center gap-3 py-3",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:73:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:S==="scale"||d<=0,onClick:()=>i(b=>Math.max(0,b-1)),children:e.jsx(gt,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:76:17",className:"h-4 w-4"})}),e.jsx(y,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:78:15",type:"number",min:0,value:d,onChange:b=>i(Math.max(0,Number(b.target.value))),className:"w-24 text-center text-lg font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:81:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:S==="scale",onClick:()=>i(b=>b+1),children:e.jsx(oe,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:84:17",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:87:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:88:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:89:15",className:"bg-blue-600 hover:bg-blue-700",disabled:S==="scale",onClick:g,children:S==="scale"?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:90:46",className:"h-4 w-4 animate-spin"}):"确认"})]})]})}),t?.kind==="delete"&&e.jsx(Ze,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:99:9",title:"删除 Deployment",onClose:l,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:100:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:101:13",className:"flex items-center gap-2 text-red-400",children:[e.jsx(is,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:102:15",className:"h-5 w-5"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:103:15",className:"font-semibold",children:"此操作不可撤销"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:105:13",className:"text-sm text-slate-400",children:["确认删除 Deployment ",e.jsxs("code",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:106:31",className:"text-slate-200 font-mono",children:[o,"/",a]}),"? 其管理的所有 Pod 将被一并回收。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:109:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:110:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsxs(u,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:111:15",variant:"destructive",disabled:S==="delete",onClick:A,children:[S==="delete"?e.jsx(ue,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:47",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(he,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:99",className:"h-4 w-4 mr-1"}),"确认删除"]})]})]})})]})}function En({clusterCode:t,namespace:s,deploymentName:o,mode:a,onBack:n,onModeChange:c}){const d=Xt(),{toast:i}=Te(),S=nt(),[l,v]=p.useState(null),[g,A]=p.useState(null),[b,E]=p.useState([]),[f,w]=p.useState([]),[_,I]=p.useState([]),[Z,q]=p.useState(!0),[Q,$]=p.useState(""),[U,Y]=p.useState(null),[P,z]=p.useState(""),[x,H]=p.useState(0),[G,M]=p.useState(null),[ee,le]=p.useState(null),ke=l?.cluster_id||l?.clusterId||t,ge=C=>Array.isArray(C)?C:C?.list||C?.items||C?.data||[],m=p.useCallback(async()=>{q(!0);try{const[C,be,De,je]=await Promise.all([ce.getDeployment(t,s,o).catch(()=>null),ce.getNamespacePods(t,s).catch(()=>[]),ce.getReplicaSets(t,s).catch(()=>[]),ce.getDeploymentRevisions(t,s,o).catch(()=>[])]),He=C||(Array.isArray(C)?C[0]:null);v(He),H(He?.replicas||0),z(He?.image||"");const qe=ge(be).filter(Pe=>Pe.namespace===s&&(Pe.name||"").startsWith(o));E(qe);const Ue=ge(De).filter(Pe=>Pe.namespace===s&&(Pe.owner_deployment===o||(Pe.name||"").startsWith(o)));w(Ue),I(ge(je))}catch(C){console.error("加载详情失败:",C)}finally{q(!1)}},[t,s,o]),k=p.useCallback(async()=>{try{const C=await ce.getResourceYaml(t,s,"deployments",o),{parseEditableManifest:be}=await js(async()=>{const{parseEditableManifest:je}=await import("./PodFileBrowser-Bs6KRfHw.js").then(He=>He.k);return{parseEditableManifest:je}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])),{manifest:De}=await be(C);A(De||l)}catch(C){console.warn("加载 manifest 失败(编辑功能降级):",C),A(l)}},[t,s,o,l]);p.useEffect(()=>{m()},[m]),p.useEffect(()=>{a==="edit"&&!g&&k()},[a,g,k]);const r=async()=>{$("scale");try{await ce.scaleDeployment(t,s,o,x),i({title:"伸缩成功",description:`副本数已设置为 ${x}`}),Y(null),m()}catch(C){i({title:"操作失败",description:C?.message||String(C),variant:"destructive"})}finally{$("")}},h=async()=>{if(await S({title:"滚动重启",description:`确认滚动重启 Deployment "${o}"?`,confirmText:"重启"})){$("restart");try{await ce.restartDeployment(t,s,o),i({title:"重启指令已下发",description:"Deployment 正在滚动重启"}),setTimeout(m,1500)}catch(be){i({title:"重启失败",description:be?.message||String(be),variant:"destructive"})}finally{$("")}}},N=async()=>{const C=!!l?.paused,be=C?"恢复":"暂停";if(await S({title:`${be}滚动更新`,description:`确认${be} Deployment "${o}" 的滚动更新?`,confirmText:be})){$(C?"resume":"pause");try{C?await ce.resumeDeployment(t,s,o):await ce.pauseDeployment(t,s,o),i({title:`${be}成功`,description:`Deployment 滚动更新已${be}`}),setTimeout(m,1e3)}catch(je){i({title:`${be}失败`,description:je?.message||String(je),variant:"destructive"})}finally{$("")}}},O=()=>{Y({kind:"cicd"})},B=async()=>{if(P.trim()){$("image");try{await ce.updateDeploymentImage(t,s,o,P),i({title:"镜像更新成功",description:`正在滚动更新为 ${P}`}),Y(null),m()}catch(C){i({title:"更新失败",description:C?.message||String(C),variant:"destructive"})}finally{$("")}}},J=async()=>{$("delete");try{const C=vt.getState().token||"",De=`/api/v1/kubernetes/${t}/namespace/${s}/deployments/${o}`,je=await fetch(De,{method:"DELETE",headers:{Authorization:`Bearer ${C}`}});if(!je.ok)throw new Error(`HTTP ${je.status}`);i({title:"删除成功",description:`${o} 已删除`}),Y(null),setTimeout(()=>d(`/kubernetes/${t}/namespace/${s}/deployments`),800)}catch(C){i({title:"删除失败",description:C?.message||String(C),variant:"destructive"})}finally{$("")}},de=C=>Y({kind:"podLogs",pod:C.name}),Ce=C=>Y({kind:"podYaml",pod:C.name}),pe=C=>{M(C.name)},R=C=>{le(C.name)};if(Z)return e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:229:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:230:9",className:"p-12 text-center",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:231:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:232:11",className:"text-slate-500 mt-3",children:"加载中..."})]})});if(!l)return e.jsx(V,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:240:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(F,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:241:9",className:"p-12 text-center",children:[e.jsx($s,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:242:11",className:"h-8 w-8 mx-auto text-red-400"}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:243:11",className:"text-slate-400 mt-3",children:["未找到 Deployment: ",o]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:244:11",variant:"outline",className:"mt-4",onClick:n,children:"返回"})]})});const ae=l.ready_replicas||l.readyReplicas||0,fe=l.replicas||0,Se=ae===fe&&fe>0;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:256:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:258:7",className:"flex items-center justify-between gap-2 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:259:9",className:"flex items-center gap-3 min-w-0",children:[e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:260:11",variant:"ghost",size:"sm",className:"text-slate-400",onClick:n,children:[e.jsx(Ws,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:261:13",className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:263:11",className:"min-w-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:264:13",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:265:15",className:"text-xl font-bold text-slate-100 truncate",children:o}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:266:15",variant:"outline",className:"border-slate-700 text-slate-400",children:s}),e.jsx(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:267:15",variant:"outline",className:"border-slate-700 text-slate-400",children:"Deployment"}),e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:268:15",className:Se?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[Se?e.jsx(bt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:273:30",className:"h-3 w-3 mr-1"}):e.jsx(is,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:273:73",className:"h-3 w-3 mr-1"}),ae,"/",fe]}),l?.paused&&e.jsxs(te,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:277:17",className:"bg-orange-500/20 text-orange-400 border-orange-500/30",children:[e.jsx(_t,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:278:19",className:"h-3 w-3 mr-1"}),"已暂停更新"]})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:282:13",className:"text-xs text-slate-500 mt-0.5 truncate",children:["镜像: ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:283:19",className:"text-slate-400",children:l.image||"-"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:288:9",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:290:11",className:"inline-flex rounded-md border border-slate-700 overflow-hidden",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:291:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="view"?"bg-slate-700 text-slate-100":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>c("view"),children:"查看"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:297:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="edit"?"bg-blue-600 text-white":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>c("edit"),children:"编辑"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:303:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${a==="yaml"?"bg-emerald-600 text-white":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>c("yaml"),children:"YAML"})]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:311:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400",onClick:m,title:"刷新",children:e.jsx(at,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:312:13",className:"h-4 w-4"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:316:11",className:"flex items-center gap-1.5",children:[e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:317:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:()=>Y({kind:"image"}),children:[e.jsx(Gs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:318:15",className:"h-3.5 w-3.5 mr-1"}),"调整镜像"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:320:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:h,children:[e.jsx(cs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:321:15",className:"h-3.5 w-3.5 mr-1"}),"重启"]}),e.jsx(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:323:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",disabled:!!Q,onClick:N,children:l?.paused?e.jsxs(e.Fragment,{children:[e.jsx(ls,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:330:21",className:"h-3.5 w-3.5 mr-1 text-green-400"}),"恢复"]}):e.jsxs(e.Fragment,{children:[e.jsx(_t,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:331:21",className:"h-3.5 w-3.5 mr-1 text-orange-400"}),"暂停"]})}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:334:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:O,children:[e.jsx(Vs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:335:15",className:"h-3.5 w-3.5 mr-1 text-purple-400"}),"CI/CD"]}),e.jsxs(u,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:337:13",variant:"outline",size:"sm",className:"border-slate-700 text-red-400 hover:bg-red-500/10",onClick:()=>Y({kind:"delete"}),children:[e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:338:15",className:"h-3.5 w-3.5 mr-1"}),"删除"]})]})]})]}),a==="view"?e.jsx(Xs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:346:9",clusterCode:t,namespace:s,deployment:l,pods:b,replicaSets:f,revisions:_,onRefresh:m,onShowPodLogs:de,onShowPodTerminal:pe,onShowPodYaml:Ce,onShowPodFileBrowser:R}):a==="yaml"?e.jsx(Ot,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:361:9",clusterCode:t,namespace:s,resource:"deployments",name:o,cleanBeforeEdit:!0,inline:!0,onSaved:m,onClose:()=>c("view")}):e.jsx(jn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:373:9",clusterCode:t,namespace:s,deploymentName:o,manifest:g,onSaved:()=>{k(),m()},onCancel:()=>c("view")}),U?.kind==="yaml"&&e.jsx(Ot,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:385:9",clusterCode:t,namespace:s,resource:"deployments",name:o,cleanBeforeEdit:!0,onClose:()=>Y(null),onSaved:m}),e.jsx(Sn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:396:7",modal:U,deployment:l,namespace:s,deploymentName:o,newImage:P,setNewImage:z,scaleValue:x,setScaleValue:H,actionLoading:Q,onClose:()=>Y(null),onUpdateImage:B,onScaleTo:r,onDelete:J}),U?.kind==="cicd"&&e.jsx(Ze,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:414:9",title:"CI/CD Webhook",onClose:()=>Y(null),children:e.jsx(Nn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:415:11",clusterCode:t,namespace:s,deploymentName:o})}),U?.kind==="podLogs"&&e.jsx(fn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:421:9",clusterCode:t,namespace:s,podName:U.pod,containers:(b.find(C=>C.name===U.pod)?.containers||[]).map(C=>C.name).filter(Boolean),onClose:()=>Y(null)}),e.jsx(ws,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:431:7",open:!!G,onOpenChange:C=>{C||M(null)},clusterId:ke,namespace:s,podName:G||"",containers:(b.find(C=>C.name===G)?.containers||[]).map(C=>C.name).filter(Boolean)}),e.jsx(Cs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:440:7",open:!!ee,onOpenChange:C=>{C||le(null)},clusterCode:t,namespace:s,podName:ee||"",containers:(b.find(C=>C.name===ee)?.containers||[]).map(C=>C.name).filter(Boolean)})]})}function Gn(){const t=Ns(),s=Xt(),o=t.clusterCode||"",a=t.namespace||"",n=t.name||"",c=t.mode==="edit"||t.mode==="yaml"?t.mode:"view",d=i=>{i!==c&&s(`/kubernetes/${o}/namespace/${a}/workload/${i}/Deployment/${n}`,{replace:!0})};return e.jsx(En,{"code-path":"src/components/kubernetes/DeploymentDetailPage.tsx:38:5",clusterCode:o,namespace:a,deploymentName:n,mode:c,onBack:()=>s(-1),onModeChange:d})}export{Gn as default}; diff --git a/backend/static/assets/DeploymentDetailPage-rkL4vpM2.js b/backend/static/assets/DeploymentDetailPage-rkL4vpM2.js new file mode 100644 index 0000000..82d4c4b --- /dev/null +++ b/backend/static/assets/DeploymentDetailPage-rkL4vpM2.js @@ -0,0 +1,20 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PodFileBrowser-CVjj8HxI.js","assets/vendor-codemirror-B1SGo4xl.js","assets/index-Bp-M7P_8.js","assets/vendor-icons-BWk-DH7F.js","assets/index-6V28XIIj.css","assets/use-toast-DNZLibQY.js","assets/index-BkulU9RM.js","assets/k8s-yaml-utils-4KZB_Bq_.js","assets/select-DbhcBWnH.js","assets/index-5FEebgvX.js","assets/vendor-xterm-20M9KZE1.js","assets/vendor-xterm-DXOU9pbP.css","assets/badge-B00SZHvE.js"])))=>i.map(i=>d[i]); +import{j as e,r as p}from"./vendor-codemirror-B1SGo4xl.js";import{B as b,f as ot,o as ft,i as es,ae as Cs,g as Es}from"./index-Bp-M7P_8.js";import{C as W,a as G,b as me,c as xe}from"./card-BHSBTtub.js";import{B as ne}from"./badge-B00SZHvE.js";import{k as X}from"./index-BkulU9RM.js";import{u as Te}from"./use-toast-DNZLibQY.js";import{p as ws,h as $t,Y as mt,P as Ds,a as Ps}from"./PodFileBrowser-CVjj8HxI.js";import{I as v}from"./input-Bnlm--la.js";import{S as Ce,e as As,f as at,a as Ts,s as xt}from"./k8s-yaml-utils-4KZB_Bq_.js";import{E as Hs,n as Ms}from"./EventTable-D9T7PrIy.js";import{Q as ts,f as ss,F as St,r as ns,H as os,o as Bs,L as be,N as Ae,E as Rs,A as as,b as rs,n as Is,k as $e,P as Q,aq as Os,s as Ct,b8 as Ls,aK as cs,b9 as ht,T as he,$ as rt,g as zs,ba as _s,a4 as ls,j as ds,am as $s,aU as is,bb as Ws,z as ps,R as We,D as Xe,b2 as Gs,h as Et,aW as Vs,aV as Fs,G as qs,M as Ys,p as kt,y as gt,d as Wt,J as ut,X as ms,l as xs,a as Us,m as Js,aD as Gt,bc as Ks,ar as Xs}from"./vendor-icons-BWk-DH7F.js";import{T as Le,a as ze,b as Ee,c as re,d as _e,e as ce}from"./table-u8V9iTZf.js";import{L as M}from"./label-NkONM5Mp.js";import{T as Qe}from"./textarea-BvOVhaCD.js";import{S as Ze,a as et,b as tt,c as st,d as ge}from"./select-DbhcBWnH.js";import{S as wt}from"./switch-CEwFnSNV.js";import{R as hs}from"./ResourceVisualEditor-B64kRCHd.js";import"./vendor-xterm-20M9KZE1.js";import"./index-5FEebgvX.js";function us(t){const s=t.conditions||t.pod_conditions||[],a=n=>s.find(l=>(l.type||l.Type)===n),o=n=>n?.lastTransitionTime||n?.LastTransitionTime||n?.last_transition_time;return{scheduled:o(a("PodScheduled")||{}),initialized:o(a("Initialized")||{}),containersReady:o(a("ContainersReady")||{}),ready:o(a("Ready")||{}),startTime:t.start_time||t.startTime}}function Be({label:t,value:s}){return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:25:5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:26:7",className:"text-xs text-[var(--dg-text-muted)] mb-1",children:t}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:27:7",className:"text-sm text-[var(--dg-text-primary)]",children:s})]})}function bs({pod:t}){const s=us(t),a=[{label:"已调度",ts:s.scheduled,color:Ce.blue},{label:"已初始化",ts:s.initialized,color:Ce.orange},{label:"容器已就绪",ts:s.containersReady,color:Ce.green},{label:"容器组已就绪",ts:s.ready,color:Ce.green}];return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:42:5",className:"flex items-center gap-2 overflow-x-auto",children:a.map((o,n)=>{const l=a[n-1],c=As(l?.ts,o.ts);return e.jsxs(p.Fragment,{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:47:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:48:13",className:"flex flex-col items-center min-w-[80px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:49:15",className:"h-2 w-2 rounded-full",style:{background:o.ts?o.color:"#334155"}}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:50:15",className:"text-[10px] mt-1 font-medium",style:{color:o.ts?o.color:"#475569"},children:o.label}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/helpers.tsx:51:15",className:"text-[9px] text-[var(--dg-text-muted)]",children:o.ts?at(o.ts):"-"})]}),n{const d=us(u),k=c===u.name,w=u.node_name||u.node;return e.jsx(W,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:26:11",className:"dg-card",children:e.jsxs(G,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:27:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:29:15",className:"flex items-center gap-3",children:[e.jsx(b,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:30:17",variant:"ghost",size:"icon",className:"h-6 w-6 text-[var(--dg-text-muted)]",onClick:()=>m(k?null:u.name),children:k?e.jsx(ts,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:31",className:"h-4 w-4"}):e.jsx(ss,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:31:69",className:"h-4 w-4"})}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:33:17",className:"font-mono text-sm text-[var(--dg-text-primary)]",children:u.name}),e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:34:17",style:{background:`${xt(u.status)}22`,color:xt(u.status),border:`1px solid ${xt(u.status)}44`},children:u.status||"Unknown"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:37:17",className:"text-xs text-[var(--dg-text-muted)]",children:e.jsx("button",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:38:19",className:"text-[var(--dg-blue)] hover:underline mr-2",onClick:()=>window.open(`/kubernetes/${t}/nodes/${w}`,"_blank"),children:w||"-"})}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:42:17",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:u.ip||u.pod_ip||"-"}),e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:43:17",className:"text-xs text-[var(--dg-text-muted)]",children:["重启 ",u.restart_count||0," 次"]}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:44:17",className:"text-xs text-[var(--dg-text-muted)]",children:at(d.startTime||u.created_at)}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:45:17",className:"flex-1"}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:46:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-[var(--dg-blue)]",onClick:()=>a(u),children:[e.jsx(St,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:47:19",className:"h-3.5 w-3.5 mr-1"}),"日志"]}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:49:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-emerald-400",onClick:()=>o(u),children:[e.jsx(ns,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:50:19",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:52:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-amber-400",onClick:()=>l(u),children:[e.jsx(os,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:53:19",className:"h-3.5 w-3.5 mr-1"}),"文件"]}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:55:17",variant:"ghost",size:"sm",className:"h-7 text-xs text-slate-400 hover:text-blue-400",onClick:()=>n(u),children:[e.jsx(Bs,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:56:19",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]}),k&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:61:17",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:[e.jsx(bs,{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:62:19",pod:u}),u.containers&&u.containers.length>0&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:65:21",className:"mt-3 grid grid-cols-1 md:grid-cols-2 gap-2",children:u.containers.map((E,y)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:67:25",className:"p-2 rounded bg-[var(--dg-bg-tertiary)] text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:68:27",className:"flex items-center justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:69:29",className:"font-medium text-[var(--dg-text-primary)]",children:E.name}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:70:29",className:E.ready?"text-emerald-400":"text-[var(--dg-text-muted)]",children:E.ready?"Ready":"Pending"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:72:27",className:"text-[var(--dg-text-muted)] mt-1",children:E.image}),E.resources&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:74:29",className:"mt-1 flex gap-3",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:75:31",children:["CPU: ",E.resources?.requests?.cpu||"0","/",E.resources?.limits?.cpu||"-"," m"]}),e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-view/PodsTab.tsx:76:31",children:["内存: ",E.resources?.requests?.memory||"0","/",E.resources?.limits?.memory||"-"]})]})]},y))})]})]})},u.name)})})}function Zs({services:t,ingresses:s,loading:a}){return a==="services"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:11:12",className:"flex items-center justify-center py-12",children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:11:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:14:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:16:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:17:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:18:11",className:"h-4 w-4 text-[var(--dg-blue)]"}),"关联 Service"]}),t.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:21:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Service(Deployment 选择器未关联任何 Service)"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:23:11",className:"overflow-x-auto",children:e.jsxs(Le,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:24:13",children:[e.jsx(ze,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:25:15",children:e.jsxs(Ee,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:26:17",className:"border-[var(--dg-border)]",children:[e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:27:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:28:19",className:"text-[var(--dg-text-muted)]",children:"类型"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:29:19",className:"text-[var(--dg-text-muted)]",children:"ClusterIP"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:30:19",className:"text-[var(--dg-text-muted)]",children:"端口"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:31:19",className:"text-[var(--dg-text-muted)]",children:"Selector"})]})}),e.jsx(_e,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:34:15",children:t.map(o=>e.jsxs(Ee,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:36:19",className:"border-[var(--dg-border)]",children:[e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:37:21",className:"font-medium text-[var(--dg-text-primary)]",children:o.name}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:38:21",children:e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:38:32",variant:"outline",className:"text-xs",children:o.type})}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:39:21",className:"font-mono text-sm text-[var(--dg-text-muted)]",children:o.clusterIP}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:40:21",className:"text-sm text-[var(--dg-text-muted)]",children:o.ports.join(", ")}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:41:21",className:"text-xs text-[var(--dg-text-muted)]",children:Object.entries(o.selector).map(([n,l])=>e.jsxs("code",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:43:25",className:"mr-1 bg-[var(--dg-bg-tertiary)] px-1 rounded",children:[n,"=",l]},n))})]},o.name))})]})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:55:7",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:56:9",className:"text-sm font-semibold text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[e.jsx(Rs,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:57:11",className:"h-4 w-4 text-[var(--dg-purple)]"}),"关联 Ingress"]}),s.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:60:11",className:"text-sm text-[var(--dg-text-muted)] py-4",children:"暂无匹配的 Ingress"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:62:11",className:"overflow-x-auto",children:e.jsxs(Le,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:63:13",children:[e.jsx(ze,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:64:15",children:e.jsxs(Ee,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:65:17",className:"border-[var(--dg-border)]",children:[e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:66:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:67:19",className:"text-[var(--dg-text-muted)]",children:"Class"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:68:19",className:"text-[var(--dg-text-muted)]",children:"Host"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:69:19",className:"text-[var(--dg-text-muted)]",children:"路径"})]})}),e.jsx(_e,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:72:15",children:s.map(o=>e.jsxs(Ee,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:74:19",className:"border-[var(--dg-border)]",children:[e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:75:21",className:"font-medium text-[var(--dg-text-primary)]",children:o.name}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:76:21",className:"text-sm text-[var(--dg-text-muted)]",children:o.className}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:77:21",className:"text-sm text-[var(--dg-text-muted)]",children:o.hosts.join(", ")}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/ServicesTab.tsx:78:21",className:"text-xs text-[var(--dg-text-muted)]",children:o.rules.flatMap(n=>(n.http?.paths||n.paths||[]).map(l=>l.path||"/")).join(", ")})]},o.name))})]})})]})]})}function en({events:t,loading:s}){return e.jsx(Hs,{"code-path":"src/components/kubernetes/deployment-view/EventsTab.tsx:7:5",events:t,loading:s,emptyText:"暂无事件"})}function tn({hpas:t,cronHpas:s,loading:a,replicas:o}){return a==="scale"?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:12:12",className:"flex items-center justify-center py-12",children:e.jsx(be,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:12:68",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:16:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:18:7",className:"flex items-center gap-2 px-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:19:9",className:"text-sm text-[var(--dg-text-muted)]",children:"当前副本:"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:20:9",className:"text-sm font-bold text-[var(--dg-text-primary)]",children:o}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:21:9",className:"text-xs text-[var(--dg-text-muted)]",children:"(可通过 Tab 栏右侧 +/- 手动调整)"})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:25:7",className:"dg-card",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:9",className:"pb-2",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:38",className:"text-sm flex items-center gap-2",children:[e.jsx(as,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:26:93",className:"h-4 w-4 text-[var(--dg-orange)]"}),"HPA — 水平自动伸缩"]})}),e.jsx(G,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:27:9",children:t.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:29:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 HPA — ",e.jsx(b,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:30:25",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 HPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:33:13",className:"overflow-x-auto",children:e.jsxs(Le,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:34:15",children:[e.jsx(ze,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:35:17",children:e.jsxs(Ee,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:36:19",className:"border-[var(--dg-border)]",children:[e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:37:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:38:21",className:"text-[var(--dg-text-muted)]",children:"最小/最大"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:39:21",className:"text-[var(--dg-text-muted)]",children:"指标"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:40:21",className:"text-[var(--dg-text-muted)]",children:"当前负载"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:41:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(_e,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:44:17",children:t.map((n,l)=>{const c=n.spec?.minReplicas??n.minReplicas??1,m=n.spec?.maxReplicas??n.maxReplicas??10,u=n.spec?.metrics||n.metrics||[],d=n.status?.currentReplicas??n.currentReplicas??0,E=(n.status?.conditions||n.conditions||[]).find(y=>y.type==="AbleToScale")?.status==="True";return e.jsxs(Ee,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:54:23",className:"border-[var(--dg-border)]",children:[e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:55:25",className:"font-medium text-[var(--dg-text-primary)]",children:n.name||n.metadata?.name}),e.jsxs(ce,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:56:25",className:"text-sm text-[var(--dg-text-secondary)] font-mono",children:[c," → ",m]}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:57:25",className:"text-xs text-[var(--dg-text-muted)]",children:u.map((y,S)=>{const C=y.resource||y.object?.metric?.name||"",D=y.resource?.target?.averageUtilization||y.resource?.target?.averageValue||y.resource?.target?.type||"-";return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:61:36",children:[C?.name||C,": ",D,y.resource?.target?.averageUtilization?"%":""]},S)})}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:64:25",className:"text-sm font-mono text-[var(--dg-text-secondary)]",children:d}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:65:25",children:e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:66:27",className:E?"bg-[var(--dg-green)]/20 text-[var(--dg-green)]":"bg-[var(--dg-red)]/20 text-[var(--dg-red)]",children:E?"正常":"异常"})})]},n.name||l)})})]})})})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:81:7",className:"dg-card",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:9",className:"pb-2",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:38",className:"text-sm flex items-center gap-2",children:[e.jsx(rs,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:82:93",className:"h-4 w-4 text-[var(--dg-blue)]"}),"CronHPA — 定时伸缩"]})}),e.jsx(G,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:83:9",children:s.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:85:13",className:"text-sm text-[var(--dg-text-muted)] py-4",children:["未关联 CronHPA — ",e.jsx(b,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:86:29",variant:"link",className:"h-auto p-0 text-[var(--dg-blue)] text-sm",children:"创建 CronHPA"})]}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:89:13",className:"overflow-x-auto",children:e.jsxs(Le,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:90:15",children:[e.jsx(ze,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:91:17",children:e.jsxs(Ee,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:92:19",className:"border-[var(--dg-border)]",children:[e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:93:21",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:94:21",className:"text-[var(--dg-text-muted)]",children:"目标副本"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:95:21",className:"text-[var(--dg-text-muted)]",children:"调度规则"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:96:21",className:"text-[var(--dg-text-muted)]",children:"时区"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:97:21",className:"text-[var(--dg-text-muted)]",children:"状态"})]})}),e.jsx(_e,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:100:17",children:s.map((n,l)=>{const c=n.spec?.jobs||n.jobs||[],m=n.spec?.timezone||"UTC";return e.jsxs(Ee,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:105:23",className:"border-[var(--dg-border)]",children:[e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:106:25",className:"font-medium text-[var(--dg-text-primary)]",children:n.name||n.metadata?.name}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:107:25",className:"text-sm text-[var(--dg-text-secondary)]",children:c.map(u=>u.targetSize||u.targetReplicas||"?").join(", ")}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:110:25",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:c.map(u=>u.schedule||"?").join(", ")}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:111:25",className:"text-xs text-[var(--dg-text-muted)]",children:m}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:112:25",children:e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-view/HPACronHPATab.tsx:113:27",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)]",children:"已启用"})})]},n.name||l)})})]})})})]})]})}function sn({revisions:t,rollbackLoading:s,onRollback:a}){return t.length===0?e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:12:12",className:"text-center text-[var(--dg-text-muted)] py-12",children:"暂无历史版本"}):e.jsx("div",{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:15:5",className:"overflow-x-auto",children:e.jsxs(Le,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:16:7",children:[e.jsx(ze,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:17:9",children:e.jsxs(Ee,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:18:11",className:"border-[var(--dg-border)]",children:[e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:19:13",className:"text-[var(--dg-text-muted)] w-24",children:"Revision"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:20:13",className:"text-[var(--dg-text-muted)]",children:"镜像"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:21:13",className:"text-[var(--dg-text-muted)] w-24",children:"状态"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:22:13",className:"text-[var(--dg-text-muted)] w-40",children:"更新时间"}),e.jsx(re,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:23:13",className:"text-[var(--dg-text-muted)] w-24",children:"操作"})]})}),e.jsx(_e,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:26:9",children:t.map((o,n)=>{const l=o.revision??o.revision_number??o.number??n+1,c=n===0;return e.jsxs(Ee,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:31:15",className:"border-[var(--dg-border)]",children:[e.jsxs(ce,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:32:17",className:"font-mono text-[var(--dg-text-primary)]",children:["#",l]}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:33:17",className:"text-xs font-mono text-[var(--dg-text-muted)] max-w-[300px] truncate",children:o.image||o.images?.[0]||"-"}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:34:17",children:c?e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:36:23",className:"bg-[var(--dg-green)]/20 text-[var(--dg-green)] border-[var(--dg-green)]/30",children:"当前"}):e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:37:23",variant:"outline",className:"text-[var(--dg-text-muted)]",children:"历史"})}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:39:17",className:"text-xs text-[var(--dg-text-muted)]",children:at(o.created_at||o.time)}),e.jsx(ce,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:40:17",children:e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:41:19",variant:"ghost",size:"sm",className:"h-7 text-amber-400",disabled:c||s!==null,onClick:()=>a(o),children:[s===l?e.jsx(be,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:53",className:"h-3 w-3 animate-spin mr-1"}):e.jsx(Is,{"code-path":"src/components/kubernetes/deployment-view/HistoryTab.tsx:42:105",className:"h-3 w-3 mr-1"}),"回滚"]})})]},l)})})]})})}function nn(t){const{clusterCode:s,namespace:a,deployment:o,pods:n,revisions:l,onRefresh:c}=t,{toast:m}=Te(),u=ot(),[d,k]=p.useState("pods"),[w,E]=p.useState(null),[y,S]=p.useState(null),[C,D]=p.useState(o?.replicas||0),[z,I]=p.useState(!1),[Y,U]=p.useState([]),[Z,_]=p.useState([]),[V,F]=p.useState([]),[J,ee]=p.useState(""),[g,O]=p.useState([]),[q,K]=p.useState([]),le=o?.ready_replicas??o?.readyReplicas??0,ue=o?.replicas??0,ke=le===ue&&ue>0;p.useEffect(()=>{d==="services"&&(ee("services"),Promise.all([X.getNamespaceServices(s,a).catch(()=>[]),X.getNamespaceIngresses(s,a).catch(()=>[])]).then(([r,h])=>{const j=R=>Array.isArray(R)?R:R?.list||R?.items||R?.data||[],N=j(r),P=j(h),H=o?.spec?.selector?.matchLabels||o?.spec?.template?.metadata?.labels||{},de=N.filter(R=>{const oe=R.spec?.selector||R.selector||{};return Object.keys(oe).length===0?!1:Object.entries(oe).every(([Ne,fe])=>H[Ne]===fe)}).map(R=>({name:R.name||R.metadata?.name,type:R.spec?.type||R.type||"ClusterIP",clusterIP:R.spec?.clusterIP||R.cluster_ip||"",ports:(R.spec?.ports||R.ports||[]).map(oe=>`${oe.port}${oe.targetPort?":"+oe.targetPort:""}/${oe.protocol||"TCP"}`),selector:R.spec?.selector||R.selector||{},age:R.age||""})),we=new Set(de.map(R=>R.name)),pe=P.filter(R=>(R.spec?.rules||R.rules||[]).some(Ne=>(Ne.http?.paths||Ne.paths||[]).some(fe=>{const A=fe.backend?.service?.name||fe.backendService||"";return we.has(A)}))).map(R=>({name:R.name||R.metadata?.name,className:R.spec?.ingressClassName||R.ingressClass||"-",hosts:(R.spec?.rules||R.rules||[]).map(oe=>oe.host).filter(Boolean),rules:R.spec?.rules||R.rules||[],age:R.age||""}));U(de),_(pe)}).catch(()=>{}).finally(()=>ee("")))},[d,s,a,o]),p.useEffect(()=>{d==="events"&&(ee("events"),X.getEvents(s,a,void 0).then(r=>{const h=Array.isArray(r)?r:r?.list||r?.items||r?.data||[],j=o?.name||"",N=h.filter(P=>{const H=String(P.object||"");if(!j||!H)return!1;if(H.endsWith(`/${j}`))return!0;const de=H.split("/").pop()||"";return de===j||de.startsWith(`${j}-`)}).map(P=>Ms(P));F(N)}).catch(()=>{}).finally(()=>ee("")))},[d,s,a,o?.name]),p.useEffect(()=>{d==="scale"&&(ee("scale"),Promise.all([X.getHPAs(s,a).catch(()=>[]),Promise.resolve([])]).then(([r])=>{const j=(P=>Array.isArray(P)?P:P?.list||P?.items||P?.data||[])(r),N=o?.name||"";O(j.filter(P=>(P.scaleTargetRef?.name||P.targetRef?.name||"")===N)),K([])}).catch(()=>{}).finally(()=>ee("")))},[d,s,a,o?.name]);const B=async r=>{const h=r.revision??r.revision_number??r.number;if(await u({title:"回滚版本",description:`确认回滚到修订版本 #${h}?`,confirmText:"回滚",variant:"destructive"})){S(h);try{await X.rollbackDeployment(s,a,o.name,Number(h)),m({title:"回滚已下发",description:`正在回滚到 #${h}`}),c()}catch(N){m({title:"回滚失败",description:N?.message||String(N),variant:"destructive"})}finally{S(null)}}},i=async()=>{I(!0);try{await X.scaleDeployment(s,a,o.name,C),m({title:"伸缩已提交",description:`副本数 → ${C}`}),c()}catch(r){m({title:"伸缩失败",description:r?.message||String(r),variant:"destructive"})}finally{I(!1)}},x=[{key:"pods",label:"容器组",icon:$e,count:n.length},{key:"services",label:"访问方式",icon:Ae,count:Y.length},{key:"events",label:"事件",icon:as,count:V.length},{key:"scale",label:"容器伸缩",icon:Q},{key:"history",label:"历史版本",icon:Os,count:l.length}];return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:177:5",className:"space-y-4",children:[e.jsx(W,{"code-path":"src/components/kubernetes/DeploymentView.tsx:179:7",className:"dg-card",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentView.tsx:180:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:181:11",className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 text-sm",children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:182:13",label:"状态",value:e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentView.tsx:183:15",style:{background:`${ke?Ce.green:Ce.orange}22`,color:ke?Ce.green:Ce.orange,border:`1px solid ${ke?Ce.green:Ce.orange}44`},children:ke?"Running":"Updating"})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:187:13",label:"副本",value:e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:187:41",className:"font-mono",children:[le,"/",ue]})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:188:13",label:"策略",value:o?.strategy||"RollingUpdate"}),n[0]&&e.jsxs(e.Fragment,{children:[e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:191:17",label:"所在节点",value:e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:192:19",className:"text-[var(--dg-blue)] hover:underline",onClick:()=>window.open(`/kubernetes/${s}/nodes/${n[0].node_name||n[0].node}`,"_blank"),children:n[0].node_name||n[0].node||"-"})}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:196:17",label:"容器组 IP",value:e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentView.tsx:196:49",className:"font-mono",children:n[0].ip||n[0].pod_ip||"-"})})]}),e.jsx(Be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:199:13",label:"创建时间",value:at(o?.created_at||o?.creationTimestamp)})]}),n[0]&&e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:202:13",className:"mt-3 pt-3 border-t border-[var(--dg-border)]",children:e.jsx(bs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:203:15",pod:n[0]})})]})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:210:7",className:"flex items-center gap-0.5 border-b border-[var(--dg-border)] overflow-x-auto",children:[x.map(r=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentView.tsx:212:11",className:`flex items-center gap-1.5 px-4 py-2.5 text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${d===r.key?"border-[var(--dg-blue)] text-[var(--dg-blue)]":"border-transparent text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"}`,onClick:()=>k(r.key),children:[e.jsx(r.icon,{"code-path":"src/components/kubernetes/DeploymentView.tsx:221:13",className:"h-4 w-4"}),r.label,r.key==="pods"&&e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentView.tsx:223:34",className:"ml-1 text-[10px] px-1.5 py-0 bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-muted)]",children:r.count})]},r.key)),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentView.tsx:226:9",className:"ml-auto flex items-center gap-1 pr-2 shrink-0",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentView.tsx:227:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:z||C<=0,onClick:()=>D(r=>Math.max(0,r-1)),children:e.jsx(Ct,{"code-path":"src/components/kubernetes/DeploymentView.tsx:230:13",className:"h-4 w-4"})}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentView.tsx:232:11",type:"number",min:0,value:C,onChange:r=>D(Math.max(0,Number(r.target.value))),className:"w-16 h-7 text-center text-sm font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentView.tsx:237:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",disabled:z,onClick:()=>D(r=>r+1),children:e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentView.tsx:240:13",className:"h-4 w-4"})}),C!==ue&&e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentView.tsx:243:13",size:"sm",className:"h-7 text-xs bg-[var(--dg-blue)] hover:bg-[var(--dg-blue-hover)]",disabled:z,onClick:i,children:z?e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentView.tsx:245:31",className:"h-3 w-3 animate-spin"}):"应用"})]})]}),d==="pods"&&e.jsx(Qs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:252:26",...t,expandedPod:w,setExpandedPod:E}),d==="services"&&e.jsx(Zs,{"code-path":"src/components/kubernetes/DeploymentView.tsx:253:30",services:Y,ingresses:Z,loading:J,namespace:a}),d==="events"&&e.jsx(en,{"code-path":"src/components/kubernetes/DeploymentView.tsx:254:28",events:V,loading:J}),d==="scale"&&e.jsx(tn,{"code-path":"src/components/kubernetes/DeploymentView.tsx:256:9",hpas:g,cronHpas:q,loading:J,replicas:ue}),d==="history"&&e.jsx(sn,{"code-path":"src/components/kubernetes/DeploymentView.tsx:263:29",revisions:l,rollbackLoading:y,onRollback:B})]})}async function ct(t,s,a,o){const n=await ws(o);await X.updateResourceYaml(t,s,"deployments",a,n)}function Ue(t){return!t||typeof t!="object"?[]:Object.entries(t).map(([s,a])=>({key:s,value:String(a)}))}function Re(t){const s={};for(const{key:a,value:o}of t){const n=a.trim();n&&(s[n]=o)}return s}function on({clusterCode:t,namespace:s,deploymentName:a,manifest:o,onSaved:n,onCancel:l}){const{toast:c}=Te(),[m,u]=p.useState(!1),[d,k]=p.useState(!o),[w,E]=p.useState(o||{}),[y,S]=p.useState(1),[C,D]=p.useState([]),[z,I]=p.useState([]),[Y,U]=p.useState([]),[Z,_]=p.useState([]);p.useEffect(()=>{const r=o;if(!r){k(!1);return}E(r),S(r?.spec?.replicas??1),D(Ue(r?.metadata?.labels)),I(Ue(r?.metadata?.annotations)),U(Ue(r?.spec?.selector?.matchLabels)),_(Ue(r?.spec?.template?.metadata?.labels)),k(!1)},[o]);const V=(r,h)=>{D(j=>j.map((N,P)=>P===r?{...N,...h}:N))},F=()=>D(r=>[...r,{key:"",value:""}]),J=r=>D(h=>h.filter((j,N)=>N!==r)),ee=(r,h)=>{I(j=>j.map((N,P)=>P===r?{...N,...h}:N))},g=()=>I(r=>[...r,{key:"",value:""}]),O=r=>I(h=>h.filter((j,N)=>N!==r)),q=(r,h)=>{U(j=>j.map((N,P)=>P===r?{...N,...h}:N))},K=()=>U(r=>[...r,{key:"",value:""}]),le=r=>U(h=>h.filter((j,N)=>N!==r)),ue=(r,h)=>{_(j=>j.map((N,P)=>P===r?{...N,...h}:N))},ke=()=>_(r=>[...r,{key:"",value:""}]),B=r=>_(h=>h.filter((j,N)=>N!==r)),i=()=>{const r=Re(Y);_(h=>{const j={...Re(h),...r};return Object.entries(j).map(([N,P])=>({key:N,value:P}))}),c({title:"已同步",description:"Selector 标签已合并到 Pod 模板标签"})},x=async()=>{u(!0);try{const r=JSON.parse(JSON.stringify(w));r.spec=r.spec||{},r.spec.replicas=y;const h=Re(C);r.metadata=r.metadata||{},r.metadata.labels=Object.keys(h).length>0?h:void 0;const j=Re(z);r.metadata.annotations=Object.keys(j).length>0?j:void 0;const N=Re(Y);Object.keys(N).length>0&&(r.spec.selector=r.spec.selector||{},r.spec.selector.matchLabels=N);const P=Re(Z);r.spec.template=r.spec.template||{},r.spec.template.metadata=r.spec.template.metadata||{},Object.keys(P).length>0?r.spec.template.metadata.labels=P:delete r.spec.template.metadata.labels,await ct(t,s,a,r),c({title:"基本信息已保存",description:`${a} 更新已提交`}),n(r)}catch(r){c({title:"保存失败",description:r?.message||String(r),variant:"destructive"})}finally{u(!1)}};return d?e.jsx(W,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:130:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:131:9",className:"p-12 text-center",children:[e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:132:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:133:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):o?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:150:5",className:"space-y-4",children:[e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:152:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:153:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:154:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ls,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:155:13",className:"h-4 w-4 text-blue-400"}),"副本数 (Replicas)"]})}),e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:159:9",className:"pt-0",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:160:11",className:"flex items-center gap-3",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:161:13",type:"number",min:0,value:y,onChange:r=>S(Math.max(0,Number(r.target.value)||0)),className:"w-32 bg-slate-800 border-slate-700 text-slate-200"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:168:13",className:"text-xs text-slate-500",children:"期望运行的 Pod 实例数量"})]})})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:174:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:175:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:176:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(cs,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:177:13",className:"h-4 w-4 text-slate-500"}),"基本标识(只读)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:181:9",className:"pt-0 grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:182:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:183:13",className:"text-slate-400 text-xs",children:"名称 (name)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:184:13",value:a,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:187:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:188:13",className:"text-slate-400 text-xs",children:"命名空间 (namespace)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:189:13",value:s,readOnly:!0,className:"mt-1 bg-slate-950 border-slate-800 text-slate-500 font-mono text-sm cursor-not-allowed"})]})]})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:196:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:197:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:198:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:199:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ht,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:200:15",className:"h-4 w-4 text-emerald-400"}),"标签 (Labels)",e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:202:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:C.length})]}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:204:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:F,children:[e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:205:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:209:9",className:"pt-0 space-y-1.5",children:[C.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:210:35",className:"text-[11px] text-slate-600",children:"无标签"}),C.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:212:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:213:15",value:r.key,placeholder:"app",onChange:j=>V(h,{key:j.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:216:15",value:r.value,placeholder:"nginx",onChange:j=>V(h,{value:j.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:219:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>J(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:220:48",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:227:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:228:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:229:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:230:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ht,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:231:15",className:"h-4 w-4 text-amber-400"}),"选择器 (Selector)",e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:233:15",variant:"outline",className:"border-amber-700/50 text-amber-500 text-[10px]",children:"⚠️ 需与模板标签一致"})]}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:235:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:K,children:[e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:236:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:240:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:241:11",className:"text-[11px] text-amber-500/70 mb-1",children:"Selector 决定哪些 Pod 归属此 Deployment。修改时必须确保与 Pod Template Labels 匹配,否则 Deployment 将无法管理 Pod。"}),Y.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:242:43",className:"text-[11px] text-slate-600",children:"无选择器"}),Y.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:244:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:245:15",value:r.key,placeholder:"app",onChange:j=>q(h,{key:j.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:248:15",value:r.value,placeholder:"nginx",onChange:j=>q(h,{value:j.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:251:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>le(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:252:51",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:259:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:260:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:261:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:262:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ht,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:263:15",className:"h-4 w-4 text-cyan-400"}),"Pod 模板标签 (template.metadata.labels)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:266:13",className:"flex gap-1",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:267:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:i,children:"从 Selector 同步"}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:270:15",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:ke,children:[e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:271:17",className:"h-3 w-3 mr-1"}),"新增"]})]})]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:276:9",className:"pt-0 space-y-1.5",children:[e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:277:11",className:"text-[11px] text-slate-600 mb-1",children:"Pod 模板标签必须包含 Selector 全部键值,否则 Deployment 无法管理 Pod"}),Z.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:278:43",className:"text-[11px] text-slate-600",children:"无模板标签"}),Z.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:280:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:281:15",value:r.key,placeholder:"app",onChange:j=>ue(h,{key:j.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:284:15",value:r.value,placeholder:"nginx",onChange:j=>ue(h,{value:j.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:287:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>B(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:288:56",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:295:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:296:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:297:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:298:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(St,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:299:15",className:"h-4 w-4 text-purple-400"}),"注解 (Annotations)",e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:301:15",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:z.length})]}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:303:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:g,children:[e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:304:15",className:"h-3 w-3 mr-1"}),"新增"]})]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:308:9",className:"pt-0 space-y-1.5",children:[z.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:309:40",className:"text-[11px] text-slate-600",children:"无注解"}),z.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:311:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:312:15",value:r.key,placeholder:"deployment.kubernetes.io/revision",onChange:j=>ee(h,{key:j.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:315:15",value:r.value,placeholder:"1",onChange:j=>ee(h,{value:j.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:318:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300",onClick:()=>O(h),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:319:53",className:"h-3.5 w-3.5"})})]},h))]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:326:7",className:"sticky bottom-0 bg-slate-950/80 backdrop-blur border-t border-slate-800 p-3 flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:327:9",className:"text-[11px] text-slate-500",children:["保存将通过 ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:328:17",className:"text-slate-400",children:"PUT application/yaml"})," 提交(自动剥离 status/managedFields 等只读字段)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:330:9",className:"flex gap-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:331:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:332:11",className:"bg-blue-600 hover:bg-blue-700",disabled:m,onClick:x,children:[m?e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:333:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(rt,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:333:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(W,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:141:7",className:"bg-slate-900 border-slate-800",children:e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditBasic.tsx:142:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}function Vt(t){const s=n=>{if(!n)return null;let l="none";return n.httpGet?l="httpGet":n.tcpSocket?l="tcpSocket":n.exec&&(l="exec"),{type:l,httpPath:n.httpGet?.path||"",httpPort:n.httpGet?.port??"",httpHost:n.httpGet?.host||"",tcpPort:n.tcpSocket?.port??"",execCommand:Array.isArray(n.exec?.command)?n.exec.command.join(` +`):n.exec?.command||"",initialDelaySeconds:n.initialDelaySeconds,periodSeconds:n.periodSeconds,timeoutSeconds:n.timeoutSeconds,successThreshold:n.successThreshold,failureThreshold:n.failureThreshold}},a=n=>{if(!n)return{type:"none"};let l="none";return n.exec?l="exec":n.httpGet?l="httpGet":n.tcpSocket&&(l="tcpSocket"),{type:l,execCommand:Array.isArray(n.exec?.command)?n.exec.command.join(` +`):"",httpPath:n.httpGet?.path||"",httpPort:n.httpGet?.port??"",tcpPort:n.tcpSocket?.port??""}},o=t.securityContext;return{name:t.name||"",image:t.image||"",imagePullPolicy:t.imagePullPolicy||"",command:Array.isArray(t.command)?t.command:[],args:Array.isArray(t.args)?t.args:[],workingDir:t.workingDir||"",env:(Array.isArray(t.env)?t.env:[]).map(n=>({name:n.name||"",value:n.value??""})),ports:(Array.isArray(t.ports)?t.ports:[]).map(n=>({name:n.name||"",containerPort:n.containerPort??"",protocol:n.protocol||"TCP"})),resources:{requests:t.resources?.requests||{},limits:t.resources?.limits||{}},livenessProbe:s(t.livenessProbe),readinessProbe:s(t.readinessProbe),startupProbe:s(t.startupProbe),lifecycle:t.lifecycle?{postStart:t.lifecycle.postStart?a(t.lifecycle.postStart):void 0,preStop:t.lifecycle.preStop?a(t.lifecycle.preStop):void 0}:null,securityContext:o?{runAsUser:o.runAsUser,runAsGroup:o.runAsGroup,runAsNonRoot:o.runAsNonRoot,privileged:o.privileged,readOnlyRootFilesystem:o.readOnlyRootFilesystem,allowPrivilegeEscalation:o.allowPrivilegeEscalation,capabilitiesAdd:o.capabilities?.add||[],capabilitiesDrop:o.capabilities?.drop||[]}:null,volumeMounts:(Array.isArray(t.volumeMounts)?t.volumeMounts:[]).map(n=>({name:n.name||"",mountPath:n.mountPath||"",subPath:n.subPath||"",readOnly:n.readOnly||!1}))}}function Ft(t=""){return{name:t,image:"",imagePullPolicy:"IfNotPresent",command:[],args:[],workingDir:"",env:[],ports:[],resources:{},livenessProbe:null,readinessProbe:null,startupProbe:null,lifecycle:null,securityContext:null,volumeMounts:[]}}function bt(t){if(!t||t.type==="none"||!t.type)return;const s={};if(t.type==="httpGet")s.httpGet={},t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=typeof t.httpPort=="number"?t.httpPort:Number(t.httpPort)),t.httpHost&&(s.httpGet.host=t.httpHost);else if(t.type==="tcpSocket")s.tcpSocket={},t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=typeof t.tcpPort=="number"?t.tcpPort:Number(t.tcpPort));else if(t.type==="exec"){const a=(t.execCommand||"").split(` +`).map(o=>o.trim()).filter(Boolean);a.length&&(s.exec={command:a})}return t.initialDelaySeconds!=null&&(s.initialDelaySeconds=t.initialDelaySeconds),t.periodSeconds!=null&&(s.periodSeconds=t.periodSeconds),t.timeoutSeconds!=null&&(s.timeoutSeconds=t.timeoutSeconds),t.successThreshold!=null&&(s.successThreshold=t.successThreshold),t.failureThreshold!=null&&(s.failureThreshold=t.failureThreshold),Object.keys(s).length>0?s:void 0}function qt(t){if(!(!t||t.type==="none"||!t.type)){if(t.type==="exec"){const s=(t.execCommand||"").split(` +`).map(a=>a.trim()).filter(Boolean);return s.length?{exec:{command:s}}:void 0}if(t.type==="httpGet"){const s={httpGet:{}};return t.httpPath&&(s.httpGet.path=t.httpPath),t.httpPort!==""&&t.httpPort!=null&&(s.httpGet.port=Number(t.httpPort)),s}if(t.type==="tcpSocket"){const s={tcpSocket:{}};return t.tcpPort!==""&&t.tcpPort!=null&&(s.tcpSocket.port=Number(t.tcpPort)),s}}}function Yt(t){const s={name:t.name};t.image&&(s.image=t.image),t.imagePullPolicy&&(s.imagePullPolicy=t.imagePullPolicy),t.workingDir&&(s.workingDir=t.workingDir),t.command.length>0&&(s.command=t.command),t.args.length>0&&(s.args=t.args),t.env.length>0&&(s.env=t.env.filter(d=>d.name.trim()).map(d=>{const k={name:d.name};return d.value!=null&&(k.value=d.value),k})),t.ports.length>0&&(s.ports=t.ports.filter(d=>d.containerPort!=="").map(d=>{const k={containerPort:typeof d.containerPort=="number"?d.containerPort:Number(d.containerPort)};return d.name&&(k.name=d.name),d.protocol&&(k.protocol=d.protocol),k}));const a=t.resources.requests,o=t.resources.limits,n=a&&Object.values(a).some(d=>d&&d.trim()),l=o&&Object.values(o).some(d=>d&&d.trim());(n||l)&&(s.resources={},n&&(s.resources.requests={},a.cpu?.trim()&&(s.resources.requests.cpu=a.cpu),a.memory?.trim()&&(s.resources.requests.memory=a.memory)),l&&(s.resources.limits={},o.cpu?.trim()&&(s.resources.limits.cpu=o.cpu),o.memory?.trim()&&(s.resources.limits.memory=o.memory)));const c=bt(t.livenessProbe);c&&(s.livenessProbe=c);const m=bt(t.readinessProbe);m&&(s.readinessProbe=m);const u=bt(t.startupProbe);if(u&&(s.startupProbe=u),t.lifecycle){const d={},k=qt(t.lifecycle.postStart);k&&(d.postStart=k);const w=qt(t.lifecycle.preStop);w&&(d.preStop=w),Object.keys(d).length>0&&(s.lifecycle=d)}if(t.securityContext){const d=t.securityContext,k={};d.runAsUser!==""&&d.runAsUser!=null&&(k.runAsUser=Number(d.runAsUser)),d.runAsGroup!==""&&d.runAsGroup!=null&&(k.runAsGroup=Number(d.runAsGroup)),d.runAsNonRoot!=null&&(k.runAsNonRoot=d.runAsNonRoot),d.privileged!=null&&(k.privileged=d.privileged),d.readOnlyRootFilesystem!=null&&(k.readOnlyRootFilesystem=d.readOnlyRootFilesystem),d.allowPrivilegeEscalation!=null&&(k.allowPrivilegeEscalation=d.allowPrivilegeEscalation);const w=(d.capabilitiesAdd||[]).filter(Boolean),E=(d.capabilitiesDrop||[]).filter(Boolean);(w.length||E.length)&&(k.capabilities={},w.length&&(k.capabilities.add=w),E.length&&(k.capabilities.drop=E)),Object.keys(k).length>0&&(s.securityContext=k)}return t.volumeMounts.length>0&&(s.volumeMounts=t.volumeMounts.filter(d=>d.name.trim()&&d.mountPath.trim()).map(d=>{const k={name:d.name,mountPath:d.mountPath};return d.subPath&&(k.subPath=d.subPath),d.readOnly&&(k.readOnly=!0),k})),s}function Ut(t){return t.join(` +`)}function Jt(t){return t.split(` +`).map(s=>s.trim()).filter(Boolean)}function an({container:t,onUpdate:s}){const a=t,o="flex items-center gap-1.5 text-xs font-semibold text-slate-300 mb-2";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:36:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:37:9",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:38:11",className:"text-slate-400 text-xs",children:"容器名称"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:39:11",value:a.name,onChange:n=>s({name:n.target.value}),placeholder:"my-app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:43:9",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:44:11",className:"text-slate-400 text-xs",children:"容器镜像"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:45:11",value:a.image,onChange:n=>s({image:n.target.value}),placeholder:"nginx:1.25",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:49:9",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:50:11",className:"text-slate-400 text-xs",children:"镜像拉取策略"}),e.jsxs(Ze,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:51:11",value:a.imagePullPolicy||"__none",onValueChange:n=>s({imagePullPolicy:n==="__none"?"":n}),children:[e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:52:13",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:53:15"})}),e.jsxs(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:55:13",className:"bg-slate-900 border-slate-700",children:[e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:56:15",value:"__none",className:"text-slate-400",children:"不设置(默认 IfNotPresent)"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:57:15",value:"Always",className:"text-slate-200",children:"Always"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:58:15",value:"IfNotPresent",className:"text-slate-200",children:"IfNotPresent"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:59:15",value:"Never",className:"text-slate-200",children:"Never"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:63:9",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:64:11",className:"text-slate-400 text-xs",children:"工作目录 (workingDir)"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:65:11",value:a.workingDir||"",onChange:n=>s({workingDir:n.target.value}),placeholder:"/app",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:72:7",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:73:9",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:74:11",className:"text-slate-400 text-xs",children:"启动命令 (command) — 每行一个"}),e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:75:11",value:Ut(a.command),placeholder:`/bin/sh +-c`,onChange:n=>s({command:Jt(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:79:9",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:80:11",className:"text-slate-400 text-xs",children:"启动参数 (args) — 每行一个"}),e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:81:11",value:Ut(a.args),placeholder:`--config=/etc/app.yaml +--debug`,onChange:n=>s({args:Jt(n.target.value)}),className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[60px]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:88:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:89:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:11",className:o,children:[e.jsx(ns,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:90:39",className:"h-3.5 w-3.5 text-cyan-400"})," 环境变量"]}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:91:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({env:[...a.env,{name:"",value:""}]}),children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:93:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:96:9",className:"space-y-1.5",children:[a.env.map((n,l)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:98:13",className:"grid grid-cols-[1fr_1.4fr_auto] gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:99:15",value:n.name,placeholder:"KEY",onChange:c=>{const m=[...a.env];m[l]={...n,name:c.target.value},s({env:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:102:15",value:n.value||"",placeholder:"value",onChange:c=>{const m=[...a.env];m[l]={...n,value:c.target.value},s({env:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:105:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({env:a.env.filter((c,m)=>m!==l)}),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:107:17",className:"h-3.5 w-3.5"})})]},l)),a.env.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:111:34",className:"text-[11px] text-slate-600",children:"无环境变量"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:116:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:117:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:11",className:o,children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:118:39",className:"h-3.5 w-3.5 text-indigo-400"})," 端口"]}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:119:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({ports:[...a.ports,{name:"",containerPort:"",protocol:"TCP"}]}),children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:121:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:124:9",className:"space-y-1.5",children:[a.ports.map((n,l)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:126:13",className:"grid grid-cols-[1fr_1fr_100px_auto] gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:127:15",value:n.name||"",placeholder:"http",onChange:c=>{const m=[...a.ports];m[l]={...n,name:c.target.value},s({ports:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:130:15",type:"number",value:n.containerPort,placeholder:"8080",onChange:c=>{const m=[...a.ports];m[l]={...n,containerPort:c.target.value},s({ports:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs(Ze,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:133:15",value:n.protocol||"TCP",onValueChange:c=>{const m=[...a.ports];m[l]={...n,protocol:c},s({ports:m})},children:[e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:134:17",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:135:19"})}),e.jsxs(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:137:17",className:"bg-slate-900 border-slate-700",children:[e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:138:19",value:"TCP",className:"text-slate-200",children:"TCP"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:139:19",value:"UDP",className:"text-slate-200",children:"UDP"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:140:19",value:"SCTP",className:"text-slate-200",children:"SCTP"})]})]}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:143:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({ports:a.ports.filter((c,m)=>m!==l)}),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:145:17",className:"h-3.5 w-3.5"})})]},l)),a.ports.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:149:36",className:"text-[11px] text-slate-600",children:"无端口暴露"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:154:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:155:9",className:o,children:[e.jsx(zs,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:155:37",className:"h-3.5 w-3.5 text-amber-400"})," 资源 (requests / limits)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:156:9",className:"grid grid-cols-2 md:grid-cols-4 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:157:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:158:13",className:"text-[11px] text-slate-500",children:"CPU 请求"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:159:13",value:a.resources.requests?.cpu||"",placeholder:"100m",onChange:n=>s({resources:{...a.resources,requests:{...a.resources.requests,cpu:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:163:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:164:13",className:"text-[11px] text-slate-500",children:"CPU 上限"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:165:13",value:a.resources.limits?.cpu||"",placeholder:"500m",onChange:n=>s({resources:{...a.resources,limits:{...a.resources.limits,cpu:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:169:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:170:13",className:"text-[11px] text-slate-500",children:"内存请求"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:171:13",value:a.resources.requests?.memory||"",placeholder:"128Mi",onChange:n=>s({resources:{...a.resources,requests:{...a.resources.requests,memory:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:175:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:176:13",className:"text-[11px] text-slate-500",children:"内存上限"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:177:13",value:a.resources.limits?.memory||"",placeholder:"512Mi",onChange:n=>s({resources:{...a.resources,limits:{...a.resources.limits,memory:n.target.value}}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:185:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:186:9",className:o,children:[e.jsx(_s,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:186:37",className:"h-3.5 w-3.5 text-rose-400"})," 健康检查 (Probes)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:187:9",className:"space-y-2",children:["livenessProbe","readinessProbe","startupProbe"].map(n=>e.jsx(rn,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:189:13",label:{livenessProbe:"存活探针 (liveness)",readinessProbe:"就绪探针 (readiness)",startupProbe:"启动探针 (startup)"}[n],probe:a[n],onChange:l=>s({[n]:l})},n))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:199:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:200:9",className:o,children:[e.jsx(ls,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:200:37",className:"h-3.5 w-3.5 text-yellow-400"})," 生命周期回调 (Lifecycle)"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:201:9",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(Kt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:202:11",label:"启动后 (postStart)",handler:a.lifecycle?.postStart,onChange:n=>s({lifecycle:{...a.lifecycle,postStart:n}})}),e.jsx(Kt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:204:11",label:"终止前 (preStop)",handler:a.lifecycle?.preStop,onChange:n=>s({lifecycle:{...a.lifecycle,preStop:n}})})]}),!a.lifecycle&&e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:208:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px] mt-1",onClick:()=>s({lifecycle:{postStart:{type:"none"},preStop:{type:"none"}}}),children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:210:13",className:"h-3 w-3 mr-1"}),"启用生命周期回调"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:216:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:217:9",className:o,children:[e.jsx(ds,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:217:37",className:"h-3.5 w-3.5 text-emerald-400"})," 安全上下文 (SecurityContext)"]}),a.securityContext?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:219:11",className:"space-y-2 border border-slate-800 rounded-md p-3 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:220:13",className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:221:15",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:222:17",className:"text-[11px] text-slate-500",children:"runAsUser"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:223:17",type:"number",value:a.securityContext.runAsUser??"",placeholder:"1000",onChange:n=>s({securityContext:{...a.securityContext,runAsUser:n.target.value===""?void 0:Number(n.target.value)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:227:15",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:228:17",className:"text-[11px] text-slate-500",children:"runAsGroup"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:229:17",type:"number",value:a.securityContext.runAsGroup??"",placeholder:"1000",onChange:n=>s({securityContext:{...a.securityContext,runAsGroup:n.target.value===""?void 0:Number(n.target.value)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:233:15",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:234:17",className:"text-[11px] text-slate-500",children:"Capabilities Add (逗号分隔)"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:235:17",value:(a.securityContext.capabilitiesAdd||[]).join(","),placeholder:"NET_ADMIN",onChange:n=>s({securityContext:{...a.securityContext,capabilitiesAdd:n.target.value.split(",").map(l=>l.trim()).filter(Boolean)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:239:15",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:240:17",className:"text-[11px] text-slate-500",children:"Capabilities Drop (逗号分隔)"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:241:17",value:(a.securityContext.capabilitiesDrop||[]).join(","),placeholder:"ALL",onChange:n=>s({securityContext:{...a.securityContext,capabilitiesDrop:n.target.value.split(",").map(l=>l.trim()).filter(Boolean)}}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:246:13",className:"flex items-center gap-4 flex-wrap",children:[e.jsx(Je,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:247:15",label:"runAsNonRoot",value:!!a.securityContext.runAsNonRoot,onChange:n=>s({securityContext:{...a.securityContext,runAsNonRoot:n}})}),e.jsx(Je,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:249:15",label:"privileged",value:!!a.securityContext.privileged,onChange:n=>s({securityContext:{...a.securityContext,privileged:n}})}),e.jsx(Je,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:251:15",label:"readOnlyRootFilesystem",value:!!a.securityContext.readOnlyRootFilesystem,onChange:n=>s({securityContext:{...a.securityContext,readOnlyRootFilesystem:n}})}),e.jsx(Je,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:253:15",label:"allowPrivilegeEscalation",value:a.securityContext.allowPrivilegeEscalation??!1,onChange:n=>s({securityContext:{...a.securityContext,allowPrivilegeEscalation:n}})})]}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:256:13",size:"sm",variant:"ghost",className:"h-6 text-red-400 text-[11px]",onClick:()=>s({securityContext:null}),children:[e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:258:15",className:"h-3 w-3 mr-1"}),"移除安全上下文"]})]}):e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:262:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({securityContext:{runAsNonRoot:!1,privileged:!1}}),children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:264:13",className:"h-3 w-3 mr-1"}),"启用安全上下文"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:270:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:271:9",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:272:11",className:o,children:[e.jsx($s,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:272:39",className:"h-3.5 w-3.5 text-teal-400"})," 卷挂载 (VolumeMounts)"]}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:273:11",size:"sm",variant:"outline",className:"h-6 border-slate-700 text-slate-300 text-[11px]",onClick:()=>s({volumeMounts:[...a.volumeMounts,{name:"",mountPath:"",subPath:"",readOnly:!1}]}),children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:275:13",className:"h-3 w-3 mr-1"}),"新增"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:278:9",className:"space-y-1.5",children:[a.volumeMounts.map((n,l)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:280:13",className:"grid grid-cols-[1fr_1fr_1fr_60px_auto] gap-2 items-center",children:[e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:281:15",value:n.name,placeholder:"volume 名称",onChange:c=>{const m=[...a.volumeMounts];m[l]={...n,name:c.target.value},s({volumeMounts:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:284:15",value:n.mountPath,placeholder:"/data",onChange:c=>{const m=[...a.volumeMounts];m[l]={...n,mountPath:c.target.value},s({volumeMounts:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:287:15",value:n.subPath||"",placeholder:"subPath (可选)",onChange:c=>{const m=[...a.volumeMounts];m[l]={...n,subPath:c.target.value},s({volumeMounts:m})},className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-8"}),e.jsxs("label",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:290:15",className:"flex items-center gap-1 text-[10px] text-slate-500 cursor-pointer",children:[e.jsx(wt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:291:17",checked:!!n.readOnly,onCheckedChange:c=>{const m=[...a.volumeMounts];m[l]={...n,readOnly:c},s({volumeMounts:m})}}),"RO"]}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:295:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400",onClick:()=>s({volumeMounts:a.volumeMounts.filter((c,m)=>m!==l)}),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:297:17",className:"h-3.5 w-3.5"})})]},l)),a.volumeMounts.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:301:43",className:"text-[11px] text-slate-600",children:"无卷挂载"})]})]})]})}function rn({label:t,probe:s,onChange:a}){const o=!!s,n=s||{type:"httpGet"},l=c=>a({...n,...c});return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:315:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:316:7",className:"flex items-center justify-between mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:317:9",className:"text-xs text-slate-300 font-medium",children:t}),e.jsx(wt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:318:9",checked:o,onCheckedChange:c=>a(c?{type:"httpGet",httpPath:"/",httpPort:8080,initialDelaySeconds:10,periodSeconds:10}:null)})]}),o&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:323:11",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:324:13",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs(Ze,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:325:13",value:n.type||"httpGet",onValueChange:c=>l({type:c}),children:[e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:326:15",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:327:17"})}),e.jsxs(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:329:15",className:"bg-slate-900 border-slate-700",children:[e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:330:17",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:331:17",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:332:17",value:"exec",className:"text-slate-200",children:"Exec 命令"})]})]})]}),n.type==="httpGet"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:337:13",className:"grid grid-cols-3 gap-2 mb-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:338:15",value:n.httpPath||"",placeholder:"/healthz",onChange:c=>l({httpPath:c.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:341:15",type:"number",value:n.httpPort??"",placeholder:"8080",onChange:c=>l({httpPort:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:344:15",value:n.httpHost||"",placeholder:"host (可选)",onChange:c=>l({httpHost:c.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),n.type==="tcpSocket"&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:350:13",className:"mb-2",children:e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:351:15",type:"number",value:n.tcpPort??"",placeholder:"端口",onChange:c=>l({tcpPort:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})}),n.type==="exec"&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:357:13",className:"mb-2",children:e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:358:15",value:n.execCommand||"",placeholder:"每行一个命令片段,如:\\ncat\\n/tmp/healthy",onChange:c=>l({execCommand:c.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[50px]"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:363:11",className:"grid grid-cols-5 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:364:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:365:15",className:"text-[10px] text-slate-500",children:"延迟(s)"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:366:15",type:"number",value:n.initialDelaySeconds??"",placeholder:"10",onChange:c=>l({initialDelaySeconds:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:370:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:371:15",className:"text-[10px] text-slate-500",children:"间隔(s)"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:372:15",type:"number",value:n.periodSeconds??"",placeholder:"10",onChange:c=>l({periodSeconds:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:376:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:377:15",className:"text-[10px] text-slate-500",children:"超时(s)"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:378:15",type:"number",value:n.timeoutSeconds??"",placeholder:"1",onChange:c=>l({timeoutSeconds:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:382:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:383:15",className:"text-[10px] text-slate-500",children:"成功"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:384:15",type:"number",value:n.successThreshold??"",placeholder:"1",onChange:c=>l({successThreshold:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:388:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:389:15",className:"text-[10px] text-slate-500",children:"失败"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:390:15",type:"number",value:n.failureThreshold??"",placeholder:"3",onChange:c=>l({failureThreshold:c.target.value===""?void 0:Number(c.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]})]})]})]})}function Kt({label:t,handler:s,onChange:a}){const o=s||{type:"none"},n=!o.type||o.type==="none"?"__none":o.type;return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:406:5",className:"border border-slate-800 rounded-md p-2.5 bg-slate-950/30",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:407:7",className:"text-xs text-slate-300 font-medium block mb-2",children:t}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:408:7",className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:409:9",className:"text-[10px] text-slate-500 w-8",children:"类型"}),e.jsxs(Ze,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:410:9",value:n,onValueChange:l=>a({...o,type:l==="__none"?"none":l}),children:[e.jsx(et,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:411:11",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-7 flex-1",children:e.jsx(tt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:412:13"})}),e.jsxs(st,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:414:11",className:"bg-slate-900 border-slate-700",children:[e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:415:13",value:"__none",className:"text-slate-400",children:"不设置"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:416:13",value:"exec",className:"text-slate-200",children:"Exec 命令"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:417:13",value:"httpGet",className:"text-slate-200",children:"HTTP GET"}),e.jsx(ge,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:418:13",value:"tcpSocket",className:"text-slate-200",children:"TCP Socket"})]})]})]}),o.type==="exec"&&e.jsx(Qe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:423:9",value:o.execCommand||"",placeholder:"每行一个命令片段",onChange:l=>a({...o,execCommand:l.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs min-h-[50px]"}),o.type==="httpGet"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:428:9",className:"grid grid-cols-2 gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:429:11",value:o.httpPath||"",placeholder:"/shutdown",onChange:l=>a({...o,httpPath:l.target.value}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:432:11",type:"number",value:o.httpPort??"",placeholder:"8080",onChange:l=>a({...o,httpPort:l.target.value===""?void 0:Number(l.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]}),o.type==="tcpSocket"&&e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:438:9",type:"number",value:o.tcpPort??"",placeholder:"端口",onChange:l=>a({...o,tcpPort:l.target.value===""?void 0:Number(l.target.value)}),className:"bg-slate-800 border-slate-700 text-slate-200 font-mono text-xs h-7"})]})}function Je({label:t,value:s,onChange:a}){return e.jsxs("label",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:448:5",className:"flex items-center gap-1.5 cursor-pointer",children:[e.jsx(wt,{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:449:7",checked:s,onCheckedChange:a}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerEditor.tsx:450:7",className:"text-[11px] text-slate-400 font-mono",children:t})]})}function Xt({title:t,description:s,icon:a,containers:o,accentColor:n,onAdd:l,onRemove:c,onUpdate:m,onDuplicate:u}){const d=ot(),[k,w]=p.useState(new Set([0])),E=C=>{w(D=>{const z=new Set(D);return z.has(C)?z.delete(C):z.add(C),z})},y=n==="blue"?"border-blue-500/30":"border-purple-500/30",S=n==="blue"?"bg-blue-500/5":"bg-purple-500/5";return e.jsxs(W,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:37:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:38:7",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:39:9",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:40:11",className:"flex items-center gap-2",children:[a,e.jsx(xe,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:42:13",className:"text-sm text-slate-200",children:t}),e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:43:13",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:o.length})]}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:45:11",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:l,children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:46:13",className:"h-3 w-3 mr-1"}),"新增容器"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:49:9",className:"text-[11px] text-slate-600",children:s})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:51:7",className:"pt-0 space-y-3",children:[o.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:53:11",className:"text-center py-6 text-slate-600 text-xs",children:"暂无容器,点击「新增容器」添加"}),o.map((C,D)=>{const z=k.has(D)||o.length===1;return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:58:13",className:`rounded-lg border ${y} overflow-hidden`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:60:15",className:`flex items-center justify-between px-3 py-2 ${S} cursor-pointer`,onClick:()=>E(D),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:61:17",className:"flex items-center gap-2",children:[z?e.jsx(ts,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:62:29",className:"h-4 w-4 text-slate-500"}):e.jsx(ss,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:62:82",className:"h-4 w-4 text-slate-500"}),e.jsx($e,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:63:19",className:`h-4 w-4 ${n==="blue"?"text-blue-400":"text-purple-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:64:19",className:"text-sm font-mono text-slate-200 font-semibold",children:C.name||"(未命名)"}),C.image&&e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:65:31",className:"text-[10px] text-slate-500 font-mono truncate max-w-[300px]",children:C.image})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:67:17",className:"flex items-center gap-1",onClick:I=>I.stopPropagation(),children:[u&&e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:69:21",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-500 hover:text-slate-300",title:"复制",onClick:()=>u(D),children:e.jsx(is,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:71:23",className:"h-3.5 w-3.5"})}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:74:19",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",title:"删除",onClick:async()=>{await d({title:"删除容器",description:`确认删除容器「${C.name}」?`,confirmText:"删除",variant:"destructive"})&&c(D)},children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:84:21",className:"h-3.5 w-3.5"})})]})]}),z&&e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:90:17",className:"p-3 space-y-4 bg-slate-950/30",children:e.jsx(an,{"code-path":"src/components/kubernetes/deployment-edit/ContainerGroupSection.tsx:91:19",container:C,onUpdate:I=>m(D,I)})})]},D)})]})]})}function cn({clusterCode:t,namespace:s,deploymentName:a,manifest:o,onSaved:n,onCancel:l}){const{toast:c}=Te(),[m,u]=p.useState(!1),[d,k]=p.useState(!o),[w,E]=p.useState(o||{}),[y,S]=p.useState([]),[C,D]=p.useState([]),[z,I]=p.useState([]);p.useEffect(()=>{if(!o){k(!1);return}E(o);const g=o?.spec?.template?.spec||{};S((Array.isArray(g.containers)?g.containers:[]).map(Vt)),D((Array.isArray(g.initContainers)?g.initContainers:[]).map(Vt)),I((Array.isArray(g.imagePullSecrets)?g.imagePullSecrets:[]).map(O=>O.name||"")),k(!1)},[o]);const Y=(g,O)=>{S(q=>q.map((K,le)=>le===g?{...K,...O}:K))},U=()=>{S(g=>[...g,Ft(`container-${g.length+1}`)])},Z=g=>{S(O=>O.filter((q,K)=>K!==g))},_=g=>{S(O=>{const q=JSON.parse(JSON.stringify(O[g]));q.name=`${q.name}-copy`;const K=[...O];return K.splice(g+1,0,q),K})},V=(g,O)=>{D(q=>q.map((K,le)=>le===g?{...K,...O}:K))},F=()=>{D(g=>[...g,Ft(`init-${g.length+1}`)])},J=g=>{D(O=>O.filter((q,K)=>K!==g))},ee=async()=>{for(const g of[...C,...y]){if(!g.name.trim()){c({title:"保存失败",description:"容器名称不能为空",variant:"destructive"});return}if(!g.image.trim()){c({title:"保存失败",description:`容器 ${g.name} 的镜像不能为空`,variant:"destructive"});return}}u(!0);try{const g=JSON.parse(JSON.stringify(w));g.spec=g.spec||{},g.spec.template=g.spec.template||{},g.spec.template.spec=g.spec.template.spec||{},g.spec.template.spec.containers=y.map(Yt),g.spec.template.spec.initContainers=C.length>0?C.map(Yt):void 0,g.spec.template.spec.imagePullSecrets=z.filter(O=>O.trim()).length>0?z.filter(O=>O.trim()).map(O=>({name:O})):void 0,await ct(t,s,a,g),c({title:"容器配置已保存",description:`${a} 更新已提交`}),n(g)}catch(g){c({title:"保存失败",description:g?.message||String(g),variant:"destructive"})}finally{u(!1)}};return d?e.jsx(W,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:112:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:113:9",className:"p-12 text-center",children:[e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:114:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:115:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):o?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:131:5",className:"space-y-4",children:[e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:133:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:134:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:135:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ws,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:136:13",className:"h-4 w-4 text-amber-400"}),"镜像拉取凭证 (imagePullSecrets)",e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:138:13",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px]",children:"Pod 级别"})]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:141:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:142:11",className:"flex items-center gap-2 flex-wrap",children:[z.map((g,O)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:144:15",className:"flex items-center gap-1 bg-slate-800 rounded px-2 py-1",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:145:17",className:"text-xs text-slate-300 font-mono",children:g}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:146:17",onClick:()=>I(q=>q.filter((K,le)=>le!==O)),className:"text-red-400 hover:text-red-300 ml-1",children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:147:68",className:"h-3 w-3"})})]},O)),z.length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:150:47",className:"text-[11px] text-slate-600",children:"无"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:152:11",className:"flex gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:153:13",placeholder:"输入 Secret 名称后回车",className:"bg-slate-800 border-slate-700 text-slate-200 text-xs h-8",onKeyDown:g=>{if(g.key==="Enter"){const O=g.target.value.trim();O&&(I(q=>[...q,O]),g.target.value="")}}}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:160:13",size:"sm",variant:"outline",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:()=>I(g=>[...g,""]),children:[e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:162:15",className:"h-3 w-3 mr-1"}),"新增"]})]})]})]}),e.jsx(Xt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:169:7",title:"初始化容器",description:"在主容器启动前按顺序执行的容器,用于初始化环境",icon:e.jsx(ps,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:172:15",className:"h-4 w-4 text-purple-400"}),containers:C,accentColor:"purple",onAdd:F,onRemove:J,onUpdate:V}),e.jsx(Xt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:181:7",title:"工作容器",description:"Deployment 运行的主容器,定义应用进程及其运行时配置",icon:e.jsx($e,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:184:15",className:"h-4 w-4 text-blue-400"}),containers:y,accentColor:"blue",onAdd:U,onRemove:Z,onUpdate:Y,onDuplicate:_}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:194:7",className:"sticky bottom-0 bg-slate-950/80 backdrop-blur border-t border-slate-800 p-3 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:195:9",className:"text-[11px] text-slate-500",children:["共 ",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:196:13",className:"text-slate-300 font-semibold",children:C.length})," 个初始化容器 +",e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:197:11",className:"text-slate-300 font-semibold ml-1",children:y.length})," 个工作容器"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:199:9",className:"flex gap-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:200:11",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:201:11",className:"bg-blue-600 hover:bg-blue-700",disabled:m,onClick:ee,children:[m?e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:202:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(rt,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:202:75",className:"h-4 w-4 mr-1"}),"保存"]})]})]})]}):e.jsx(W,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:122:7",className:"bg-slate-900 border-slate-800",children:e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditContainers.tsx:123:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}function yt(t){const s=Array.isArray(t)?t:t?.list||t?.data||[];return Array.isArray(s)?s.map(a=>String(a?.name||"")).filter(Boolean).sort():[]}function vt({label:t,value:s,options:a,loading:o,onChange:n,onRefresh:l,onCreate:c}){const m=s&&!a.includes(s);return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:36:5",className:"flex items-center gap-2 flex-wrap flex-1 min-w-0",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:37:7",className:"text-[10px] text-slate-500 w-20 shrink-0",children:t}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:38:7",value:s||"",onChange:u=>n(u.target.value),disabled:o,className:"h-7 flex-1 min-w-[160px] max-w-xs bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2 font-mono",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:44:9",value:"",disabled:!0,children:a.length===0?"暂无资源":"请选择"}),m&&e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:45:20",value:s,children:[s,"(未在集群中找到)"]}),a.map(u=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:46:29",value:u,children:u},u))]}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:48:7",type:"button",size:"sm",variant:"outline",className:"h-7 px-2 border-slate-700 text-slate-400 text-xs",onClick:l,disabled:o,children:o?e.jsx(be,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:49:20",className:"h-3 w-3 animate-spin"}):e.jsx(We,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:49:67",className:"h-3 w-3"})}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:51:7",type:"button",size:"sm",variant:"outline",className:"h-7 px-2 border-slate-700 text-blue-400 text-xs",onClick:c,children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:52:9",className:"h-3 w-3 mr-0.5"}),"新建"]}),a.length===0&&!m&&e.jsxs("span",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:55:9",className:"text-[10px] text-amber-400/90",children:["命名空间内暂无",t,",请先新建"]})]})}function ln({vol:t,resources:s,resourcesLoading:a,onChange:o,onRefreshResources:n,onCreateResource:l}){return t.type==="persistentVolumeClaim"?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:75:7",className:"space-y-2",children:[e.jsx(vt,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:76:9",label:"PVC 关联",value:t.pvcName||"",options:s.pvcs,loading:a,onChange:c=>o({pvcName:c}),onRefresh:n,onCreate:()=>l("pvcs")}),e.jsxs("label",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:85:9",className:"flex items-center gap-1.5 text-xs text-slate-400 cursor-pointer whitespace-nowrap pl-[88px]",children:[e.jsx("input",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:86:11",type:"checkbox",checked:!!t.pvcReadOnly,onChange:c=>o({pvcReadOnly:c.target.checked}),className:"accent-blue-500"}),"卷只读"]})]}):t.type==="emptyDir"?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:94:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:95:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"介质"}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:96:9",value:t.medium||"",onChange:c=>o({medium:c.target.value}),className:"h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:98:11",value:"",children:"默认磁盘"}),e.jsx("option",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:99:11",value:"Memory",children:"Memory"})]}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:101:9",value:t.sizeLimit||"",onChange:c=>o({sizeLimit:c.target.value}),placeholder:"sizeLimit 如 512Mi",className:"h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}):t.type==="hostPath"?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:108:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:109:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"主机路径"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:110:9",value:t.path||"",onChange:c=>o({path:c.target.value}),placeholder:"/data/app",className:"h-7 flex-1 min-w-[160px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:112:9",value:t.pathType||"Directory",onChange:c=>o({pathType:c.target.value}),className:"h-7 w-28 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:114:11",value:"Directory",children:"Directory"}),e.jsx("option",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:115:11",value:"File",children:"File"}),e.jsx("option",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:116:11",value:"",children:"默认"})]})]}):t.type==="nfs"?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:123:7",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:124:9",className:"text-[10px] text-slate-500 w-20 shrink-0",children:"NFS"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:125:9",value:t.nfsServer||"",onChange:c=>o({nfsServer:c.target.value}),placeholder:"Server IP",className:"h-7 w-36 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:127:9",value:t.nfsPath||"",onChange:c=>o({nfsPath:c.target.value}),placeholder:"/export/path",className:"h-7 flex-1 min-w-[120px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}):t.type==="configMap"?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:134:7",className:"space-y-2",children:[e.jsx(vt,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:135:9",label:"ConfigMap",value:t.configMapName||"",options:s.configMaps,loading:a,onChange:c=>o({configMapName:c}),onRefresh:n,onCreate:()=>l("configmaps")}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:144:9",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:145:11",className:"text-[10px] text-slate-500 shrink-0",children:"键映射"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:146:11",value:t.cmItems||"",onChange:c=>o({cmItems:c.target.value}),placeholder:"key:path(可选,挂载子项)",className:"h-7 flex-1 max-w-md bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]}):t.type==="secret"?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:154:7",className:"space-y-2",children:[e.jsx(vt,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:155:9",label:"Secret",value:t.secretName||"",options:s.secrets,loading:a,onChange:c=>o({secretName:c}),onRefresh:n,onCreate:()=>l("secrets")}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:164:9",className:"flex items-center gap-2 pl-[88px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:165:11",className:"text-[10px] text-slate-500 shrink-0",children:"键映射"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:166:11",value:t.secItems||"",onChange:c=>o({secItems:c.target.value}),placeholder:"key:path(可选,挂载子项)",className:"h-7 flex-1 max-w-md bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]}):t.type==="custom"?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-storage-fields.tsx:173:12",className:"text-[11px] text-amber-400/80",children:"未识别卷类型,保存时将保留原始 YAML 结构"}):null}function nt(t=""){return{containerName:t,mountPath:"",subPath:"",readOnly:!1}}function dn(t=""){return{volume:{name:"",type:"emptyDir"},mounts:[nt(t)]}}const pn=["kube-api-access-","default-token-","kube-"];function jt(t){if(!t||typeof t!="object")return!1;const s=String(t.name||"");return pn.some(a=>s.startsWith(a))?!0:!!(t.projected||t.downwardAPI||t.csi||t.ephemeral)}function Qt(t){const s=t?.trim();if(!s)return;if(s.startsWith("["))try{const o=JSON.parse(s);if(Array.isArray(o))return o.filter(n=>n?.key&&n?.path)}catch{}const a=s.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{const n=o.indexOf(":");return n<=0?null:{key:o.slice(0,n).trim(),path:o.slice(n+1).trim()}}).filter(Boolean);return a.length?a:void 0}function mn(t){if(!t||typeof t!="object")return{name:"",type:"emptyDir"};const s=t.name||"";return t.persistentVolumeClaim?{name:s,type:"persistentVolumeClaim",pvcName:t.persistentVolumeClaim.claimName||"",pvcReadOnly:!!t.persistentVolumeClaim.readOnly}:t.nfs?{name:s,type:"nfs",nfsServer:t.nfs.server||"",nfsPath:t.nfs.path||"",nfsReadOnly:!!t.nfs.readOnly}:t.configMap?{name:s,type:"configMap",configMapName:t.configMap.name||"",cmItems:t.configMap.items?JSON.stringify(t.configMap.items):""}:t.secret?{name:s,type:"secret",secretName:t.secret.secretName||"",secItems:t.secret.items?JSON.stringify(t.secret.items):""}:t.hostPath?{name:s,type:"hostPath",path:t.hostPath.path||"",pathType:t.hostPath.type||""}:t.emptyDir!=null?{name:s,type:"emptyDir",medium:t.emptyDir.medium||"",sizeLimit:t.emptyDir.sizeLimit||""}:jt(t)?{name:s,type:"custom",_raw:t}:{name:s,type:"custom",_raw:t}}function ys(t){if(t.type==="custom"&&t._raw)return JSON.parse(JSON.stringify(t._raw));const s=t.name?.trim();if(!s)return null;const a={name:s};switch(t.type){case"emptyDir":{const o={};t.medium?.trim()&&(o.medium=t.medium.trim()),t.sizeLimit?.trim()&&(o.sizeLimit=t.sizeLimit.trim()),a.emptyDir=o;break}case"hostPath":{const o={path:t.path?.trim()||"/"};t.pathType?.trim()&&(o.type=t.pathType.trim()),a.hostPath=o;break}case"configMap":{const o=t.configMapName?.trim();if(!o)return null;const n={name:o},l=Qt(t.cmItems);l&&(n.items=l),a.configMap=n;break}case"secret":{const o=t.secretName?.trim();if(!o)return null;const n={secretName:o},l=Qt(t.secItems);l&&(n.items=l),a.secret=n;break}case"persistentVolumeClaim":{const o=t.pvcName?.trim();if(!o)return null;const n={claimName:o};t.pvcReadOnly&&(n.readOnly=!0),a.persistentVolumeClaim=n;break}case"nfs":{const o=t.nfsServer?.trim(),n=t.nfsPath?.trim();if(!o||!n)return null;const l={server:o,path:n};t.nfsReadOnly&&(l.readOnly=!0),a.nfs=l;break}default:return null}return a}function xn(t,s){return{containerName:t,volumeName:s.name||"",mountPath:s.mountPath||"",subPath:s.subPath||"",readOnly:!!s.readOnly}}function hn(t){if(!t.volumeName?.trim()||!t.mountPath?.trim())return null;const s={name:t.volumeName.trim(),mountPath:t.mountPath.trim()};return t.subPath?.trim()&&(s.subPath=t.subPath.trim()),t.readOnly&&(s.readOnly=!0),s}const un=["/var/run/secrets/kubernetes.io/serviceaccount"];function vs(t,s){if(!t)return!1;if(s.has(t.name))return!0;const a=t.mountPath||"";return un.some(o=>a.startsWith(o))}function bn(t){const s=t?.spec?.template?.spec||{},a=Array.isArray(s.volumes)?s.volumes:[],o=a.filter(jt),n=a.filter(d=>!jt(d)),l=[...Array.isArray(s.containers)?s.containers:[],...Array.isArray(s.initContainers)?s.initContainers:[]],c=l.map(d=>d.name||"(unnamed)"),m=new Set(o.map(d=>d.name)),u=[];for(const d of l){const k=d.name||"(unnamed)",w=Array.isArray(d.volumeMounts)?d.volumeMounts:[];for(const E of w)vs(E,m)||u.push(xn(k,E))}return{volumes:n.map(mn),mounts:u,containers:c,passthroughVolumes:o}}function yn(t){const{volumes:s,mounts:a,containers:o,passthroughVolumes:n}=bn(t),l=o.find(m=>m!=="(unnamed)")||o[0]||"";return{entries:s.map(m=>{const u=a.filter(d=>d.volumeName===m.name);return{volume:m,mounts:u.length>0?u.map(d=>({containerName:d.containerName,mountPath:d.mountPath,subPath:d.subPath,readOnly:d.readOnly})):[nt(l)]}}),containers:o,passthroughVolumes:n}}function vn(t){const s=t.map(o=>o.volume),a=[];for(const o of t){const n=o.volume.name.trim();if(n)for(const l of o.mounts)l.mountPath.trim()&&a.push({containerName:l.containerName,volumeName:n,mountPath:l.mountPath.trim(),subPath:l.subPath.trim(),readOnly:l.readOnly})}return{volumes:s,mounts:a}}function kn(t,s,a,o){const n=JSON.parse(JSON.stringify(t));n.spec=n.spec||{},n.spec.template=n.spec.template||{},n.spec.template.spec=n.spec.template.spec||{};const l=n.spec.template.spec,c=s.map(ys).filter(Boolean),m=[...o,...c];m.length>0?l.volumes=m:delete l.volumes;const u=new Set(o.map(k=>k.name)),d=k=>{const w=k.name||"(unnamed)",y=(Array.isArray(k.volumeMounts)?k.volumeMounts:[]).filter(D=>vs(D,u)),S=a.filter(D=>D.containerName===w).map(hn).filter(Boolean),C=[...y,...S];C.length>0?k.volumeMounts=C:delete k.volumeMounts};return(l.containers||[]).forEach(d),(l.initContainers||[]).forEach(d),n}const Nt=[{key:"persistentVolumeClaim",label:"存储卷声明",icon:Xe,color:"text-emerald-400"},{key:"emptyDir",label:"临时目录(EmptyDir)",icon:Gs,color:"text-slate-400"},{key:"hostPath",label:"HostPath",icon:os,color:"text-amber-400"},{key:"nfs",label:"NFS",icon:Et,color:"text-purple-400"},{key:"configMap",label:"配置字典",icon:Vs,color:"text-blue-400"},{key:"secret",label:"密文",icon:cs,color:"text-rose-400"}],gn=new Set(Nt.map(t=>t.key));function jn({clusterCode:t,namespace:s,deploymentName:a,manifest:o,onSaved:n,onCancel:l}){const{toast:c}=Te(),[m,u]=p.useState(!1),[d,k]=p.useState(!o),[w,E]=p.useState(o||{}),[y,S]=p.useState([]),[C,D]=p.useState([]),[z,I]=p.useState([]),[Y,U]=p.useState({configMaps:[],secrets:[],pvcs:[]}),[Z,_]=p.useState(!1),[V,F]=p.useState(null),J=p.useCallback(async()=>{if(!(!t||!s)){_(!0);try{const[B,i,x]=await Promise.all([X.getNamespaceConfigMaps(t,s).catch(()=>[]),X.getNamespaceSecrets(t,s).catch(()=>[]),X.getPVCs(t,s).catch(()=>[])]);U({configMaps:yt(B),secrets:yt(i),pvcs:yt(x)})}finally{_(!1)}}},[t,s]);p.useEffect(()=>{J()},[J]),p.useEffect(()=>{if(!o){k(!1);return}E(o);const B=yn(o);S(B.entries),D(B.containers),I(B.passthroughVolumes),k(!1)},[o]);const ee=C.find(B=>B!=="(unnamed)")||C[0]||"",g=(B,i)=>S(x=>x.map((r,h)=>h===B?{...r,volume:{...r.volume,...i}}:r)),O=(B,i,x)=>S(r=>r.map((h,j)=>j!==B?h:{...h,mounts:h.mounts.map((N,P)=>P===i?{...N,...x}:N)})),q=B=>S(i=>i.map((x,r)=>r!==B?x:{...x,mounts:[...x.mounts,nt(ee)]})),K=(B,i)=>S(x=>x.map((r,h)=>{if(h!==B)return r;const j=r.mounts.filter((N,P)=>P!==i);return{...r,mounts:j.length>0?j:[nt(ee)]}})),le=()=>S(B=>[...B,dn(ee)]),ue=B=>S(i=>i.filter((x,r)=>r!==B)),ke=async()=>{for(const B of y){if(!B.volume.name.trim()){c({title:"请填写数据卷名称",variant:"destructive"});return}if(!ys(B.volume)){const x=B.volume.type==="configMap"?"请选择 ConfigMap":B.volume.type==="secret"?"请选择 Secret":B.volume.type==="persistentVolumeClaim"?"请选择 PVC":"的类型必填项";c({title:"数据卷配置不完整",description:`请为「${B.volume.name}」${x}`,variant:"destructive"});return}if(B.mounts.filter(x=>x.mountPath.trim()).length===0){c({title:"请填写挂载路径",description:`数据卷「${B.volume.name}」需至少挂载到一个容器`,variant:"destructive"});return}}u(!0);try{const{volumes:B,mounts:i}=vn(y),x=kn(w,B,i,z);await ct(t,s,a,x),c({title:"存储配置已保存",description:`${a} 更新已提交`}),n(x)}catch(B){c({title:"保存失败",description:B?.message||String(B),variant:"destructive"})}finally{u(!1)}};return d?e.jsx(W,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:164:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:165:9",className:"p-12 text-center",children:[e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:166:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:167:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):o?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:182:5",className:"space-y-4",children:[V&&e.jsx(hs,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:184:9",clusterCode:t,namespace:s,resource:V,name:"",isCreate:!0,onClose:()=>F(null),onSaved:()=>{J(),F(null)}}),e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:194:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:195:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:196:11",className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:197:13",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:198:15",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Xe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:199:17",className:"h-4 w-4 text-emerald-400"}),"数据卷",e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:201:17",variant:"outline",className:"border-slate-700 text-slate-400",children:y.length})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:203:15",className:"text-[11px] text-slate-500 mt-1",children:"定义数据卷,并将其挂载到工作负载的容器中"})]}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:205:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs shrink-0",onClick:le,children:[e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:206:15",className:"h-3 w-3 mr-1"}),"添加数据卷"]})]})}),e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:210:9",className:"pt-0 space-y-4",children:y.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:212:13",className:"text-center py-10 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(Xe,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:213:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"未配置数据卷,点击「添加数据卷」开始"]}):y.map((B,i)=>{const x=B.volume,r=Nt.find(N=>N.key===x.type),h=r?.icon||Fs,j=gn.has(x.type)?x.type:"emptyDir";return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:222:15",className:"bg-slate-950/60 border border-slate-800 rounded-lg",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:224:17",className:"p-3 space-y-2.5 border-b border-slate-800/80",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:225:19",className:"flex items-center gap-2 flex-wrap",children:[e.jsx(h,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:226:21",className:`h-4 w-4 ${r?.color||"text-slate-400"}`}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:227:21",className:"text-xs text-slate-400 shrink-0",children:"数据卷名称"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:228:21",value:x.name,onChange:N=>{const P=N.target.value,H={name:P};x.type==="configMap"&&!x.configMapName&&(H.configMapName=P),x.type==="secret"&&!x.secretName&&(H.secretName=P),x.type==="persistentVolumeClaim"&&!x.pvcName&&(H.pvcName=P),g(i,H)},placeholder:"如 app-logs / fluent-bit-config",className:"h-8 w-44 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"}),e.jsx("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:242:21",value:j,onChange:N=>{const P=N.target.value,H={type:P};P==="configMap"&&Y.configMaps.length===1&&(H.configMapName=Y.configMaps[0]),P==="secret"&&Y.secrets.length===1&&(H.secretName=Y.secrets[0]),P==="persistentVolumeClaim"&&Y.pvcs.length===1&&(H.pvcName=Y.pvcs[0]),g(i,H)},className:"h-8 min-w-[168px] bg-slate-800 border border-slate-700 rounded-md text-xs text-slate-300 px-2",children:Nt.map(N=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:255:25",value:N.key,children:N.label},N.key))}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:258:21",size:"icon",variant:"ghost",className:"h-8 w-8 text-red-400 ml-auto",onClick:()=>ue(i),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:259:23",className:"h-4 w-4"})})]}),e.jsx(ln,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:262:19",vol:x,resources:Y,resourcesLoading:Z,onChange:N=>{const P=y[i]?.volume,H={};P&&!P.name.trim()&&(N.configMapName&&(H.name=N.configMapName),N.secretName&&(H.name=N.secretName),N.pvcName&&(H.name=N.pvcName)),g(i,{...N,...H})},onRefreshResources:J,onCreateResource:F})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:282:17",className:"px-3 py-2.5 bg-slate-900/40 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:283:19",className:"flex items-center justify-between gap-2",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:284:21",className:"text-[11px] text-slate-500 flex items-center gap-1.5",children:[e.jsx($e,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:285:23",className:"h-3.5 w-3.5 text-blue-400"}),"将上述数据卷挂载到容器"]}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:288:21",size:"sm",variant:"ghost",className:"h-6 px-2 text-[11px] text-slate-400 hover:text-slate-200",onClick:()=>q(i),children:[e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:289:23",className:"h-3 w-3 mr-0.5"}),"添加挂载"]})]}),B.mounts.map((N,P)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:293:21",className:"space-y-2 rounded-md border border-slate-800/60 bg-slate-950/40 p-2.5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:294:23",className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:295:25",value:N.containerName,onChange:H=>O(i,P,{containerName:H.target.value}),className:"h-8 min-w-[140px] max-w-[280px] bg-slate-800 border border-slate-700 rounded-md text-sm text-slate-200 px-2 font-medium truncate",children:[C.length===0&&e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:300:55",value:"",children:"(无容器)"}),C.map(H=>e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:301:51",value:H,children:H},H))]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:303:25",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:304:27",type:"button",onClick:()=>O(i,P,{readOnly:!0}),className:`px-2.5 py-1 rounded text-xs font-medium transition-all ${N.readOnly?"bg-amber-500/20 text-amber-300":"text-slate-500 hover:text-slate-300"}`,children:"只读"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:308:27",type:"button",onClick:()=>O(i,P,{readOnly:!1}),className:`px-2.5 py-1 rounded text-xs font-medium transition-all ${N.readOnly?"text-slate-500 hover:text-slate-300":"bg-blue-500/20 text-blue-300"}`,children:"读写"})]}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:313:25",value:N.mountPath,onChange:H=>O(i,P,{mountPath:H.target.value}),placeholder:"挂载路径 /bitcloud/app/.../logs",className:"h-8 flex-1 min-w-[200px] bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"}),B.mounts.length>1&&e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:320:27",size:"icon",variant:"ghost",className:"h-8 w-8 text-red-400/70 shrink-0",onClick:()=>K(i,P),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:321:29",className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:325:23",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:326:25",className:"text-[11px] text-slate-500 shrink-0",children:"子路径 subPath"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:327:25",value:N.subPath,onChange:H=>O(i,P,{subPath:H.target.value}),placeholder:"如 config.yaml(挂载单文件时填写)",className:"h-7 flex-1 max-w-md bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]},P))]})]},i)})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:343:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:344:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:345:9",className:"bg-blue-600 hover:bg-blue-700",disabled:m,onClick:ke,children:[m?e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:346:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(rt,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:346:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]}):e.jsx(W,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:175:7",className:"bg-slate-900 border-slate-800",children:e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditStorage.tsx:176:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式。"})})}const Nn=[{key:"nodeName",label:"节点名称"},{key:"nodeSelector",label:"标签选择器"},{key:"nodeAffinity",label:"节点亲和性"}];function fn({scheduleMode:t,onScheduleModeChange:s,nodeName:a,onNodeNameChange:o,availableNodes:n,nodesLoading:l,labelSelectorKv:c,onAddLabelSelector:m,onRemoveLabelSelector:u,onUpdateLabelSelector:d,nodeLabels:k}){return e.jsxs(W,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:54:5",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:55:7",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:56:9",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:57:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Et,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:58:13",className:"h-4 w-4 text-emerald-400"}),"调度 (Scheduling)"]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:60:11",className:"flex items-center gap-1 bg-slate-800 rounded-lg p-0.5 border border-slate-700",children:Nn.map(w=>e.jsx("button",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:62:15",onClick:()=>s(w.key),className:`px-2.5 py-1 rounded text-[10px] font-medium transition-all ${t===w.key?"bg-emerald-500/20 text-emerald-300 shadow-sm":"text-slate-400 hover:text-slate-300"}`,children:w.label},w.key))})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:76:9",className:"text-xs text-slate-500 mt-1",children:[t==="nodeName"&&"Pod 将直接调度到指定节点",t==="nodeSelector"&&"Pod 将调度到匹配标签的节点",t==="nodeAffinity"&&"通过亲和性规则控制 Pod 调度到指定节点"]})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:82:7",className:"pt-0",children:[t==="nodeName"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:84:11",className:"space-y-2",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:85:13",className:"text-slate-400 text-xs",children:"请选择节点"}),l?e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:87:15",className:"flex items-center gap-1 text-slate-500 text-xs",children:[e.jsx(be,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:88:17",className:"h-3 w-3 animate-spin"}),"加载节点列表..."]}):e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:91:15",value:a,onChange:w=>o(w.target.value),className:"h-8 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:96:17",value:"",children:"(不指定)"}),n.map(w=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:98:19",value:w.name,children:[w.name," ",w.ip?`(${w.ip})`:""]},w.name))]}),a&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:105:15",className:"text-[10px] text-slate-500",children:["已选择: ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:106:22",className:"bg-slate-800 px-1 py-0.5 rounded text-emerald-400",children:a})]})]}),t==="nodeSelector"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:113:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:114:13",className:"flex items-center justify-between",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:115:15",className:"text-slate-400 text-xs",children:"请选择标签"}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:116:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:m,children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:117:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),c.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:121:15",className:"text-xs text-slate-600 italic",children:"未配置标签选择器"}):c.map((w,E)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:124:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:125:19",value:w.key,onChange:y=>d(E,{key:y.target.value,value:""}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:130:21",value:"",children:"选择标签"}),Object.entries(k).map(([y,S])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:132:23",value:y,children:[y," (",S.length,")"]},y))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:135:19",value:w.value,onChange:y=>d(E,{value:y.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!w.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:141:21",value:"",children:"选择值"}),(k[w.key]||[]).map(y=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:143:23",value:y,children:y},y))]}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:146:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>u(E),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:152:21",className:"h-3 w-3"})})]},E))]}),t==="nodeAffinity"&&e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:161:11",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:162:13",className:"flex items-center justify-between",children:[e.jsxs(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:163:15",className:"text-slate-400 text-xs",children:["请选择标签 ",e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:164:23",className:"text-slate-600",children:"(生成 requiredDuringScheduling 规则)"})]}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:166:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:m,children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:167:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),c.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:171:15",className:"text-xs text-slate-600 italic",children:"未配置亲和性规则"}):c.map((w,E)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:174:17",className:"flex items-center gap-2",children:[e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:175:19",value:w.key,onChange:y=>d(E,{key:y.target.value,value:""}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:180:21",value:"",children:"选择标签"}),Object.entries(k).map(([y,S])=>e.jsxs("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:182:23",value:y,children:[y," (",S.length,")"]},y))]}),e.jsxs("select",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:185:19",value:w.value,onChange:y=>d(E,{value:y.target.value}),className:"flex-1 h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5",disabled:!w.key,children:[e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:191:21",value:"",children:"选择值"}),(k[w.key]||[]).map(y=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:193:23",value:y,children:y},y))]}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:196:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>u(E),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/SchedulingSection.tsx:202:21",className:"h-3 w-3"})})]},E))]})]})]})}function Sn({dnsNameservers:t,onDnsNameserversChange:s,dnsSearches:a,onDnsSearchesChange:o,dnsOptions:n,onDnsOptionsChange:l,hostAliases:c,onHostAliasesChange:m}){const u=()=>l([...n,{name:"",value:""}]),d=(S,C)=>l(n.map((D,z)=>z===S?{...D,...C}:D)),k=S=>l(n.filter((C,D)=>D!==S)),w=()=>m([...c,{ip:"",hostnames:""}]),E=(S,C)=>m(c.map((D,z)=>z===S?{...D,...C}:D)),y=S=>m(c.filter((C,D)=>D!==S));return e.jsxs(e.Fragment,{children:[e.jsxs(W,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:53:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:54:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:55:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(qs,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:56:13",className:"h-4 w-4 text-indigo-400"}),"DNS 配置 (dnsConfig)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:59:9",className:"pt-0 space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:60:11",className:"text-[11px] text-slate-500",children:["提示:dnsConfig 通常与 ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:61:30",className:"text-slate-400",children:"dnsPolicy: None"})," 搭配使用。每行一个值。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:63:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:64:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:65:15",className:"text-slate-500 text-xs",children:"nameservers(每行一个 IP)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:66:15",value:t,onChange:S=>s(S.target.value),placeholder:`8.8.8.8 +114.114.114.114`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:74:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:75:15",className:"text-slate-500 text-xs",children:"searches(搜索域,每行一个)"}),e.jsx("textarea",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:76:15",value:a,onChange:S=>o(S.target.value),placeholder:`svc.cluster.local +cluster.local`,rows:3,className:"w-full mt-1 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 font-mono p-2 resize-y"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:85:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:86:13",className:"flex items-center justify-between mb-1",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:87:15",className:"text-slate-400 text-xs",children:"options(DNS 选项)"}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:88:15",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:u,children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:89:17",className:"h-3 w-3 mr-1"}),"添加"]})]}),n.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:93:15",className:"text-xs text-slate-600 italic",children:"未配置"}):n.map((S,C)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:96:17",className:"flex items-center gap-2 mb-1.5",children:[e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:97:19",value:S.name,onChange:D=>d(C,{name:D.target.value}),placeholder:"ndots",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:103:19",className:"text-slate-600",children:":"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:104:19",value:S.value,onChange:D=>d(C,{value:D.target.value}),placeholder:"5(可留空)",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:110:19",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>k(C),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:111:21",className:"h-3 w-3"})})]},C))]})]})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:120:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:121:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:122:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ys,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:123:13",className:"h-4 w-4 text-amber-400"}),"主机别名 (hostAliases)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:126:9",className:"pt-0 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:127:11",className:"flex items-center justify-between mb-1",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:128:13",className:"text-slate-400 text-xs",children:"IP → 主机名映射(注入 Pod 的 /etc/hosts)"}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:129:13",size:"sm",variant:"ghost",className:"h-6 text-xs text-slate-400",onClick:w,children:[e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:130:15",className:"h-3 w-3 mr-1"}),"添加"]})]}),c.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:134:13",className:"text-xs text-slate-600 italic",children:"未配置"}):c.map((S,C)=>e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:137:15",className:"flex items-center gap-2",children:[e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:138:17",value:S.ip,onChange:D=>E(C,{ip:D.target.value}),placeholder:"10.10.10.72",className:"w-40 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:144:17",className:"text-slate-600",children:"→"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:145:17",value:S.hostnames,onChange:D=>E(C,{hostnames:D.target.value}),placeholder:"gitlab.local, registry.local",className:"flex-1 h-7 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:151:17",size:"icon",variant:"ghost",className:"h-6 w-6 text-red-400",onClick:()=>y(C),children:e.jsx(he,{"code-path":"src/components/kubernetes/deployment-edit-advanced/DnsHostSection.tsx:152:19",className:"h-3 w-3"})})]},C))]})]})]})}function Cn({clusterCode:t,namespace:s,deploymentName:a,manifest:o,onSaved:n,onCancel:l}){const{toast:c}=Te(),[m,u]=p.useState(!1),[d,k]=p.useState(!o),[w,E]=p.useState(o||{}),[y,S]=p.useState("RollingUpdate"),[C,D]=p.useState("25%"),[z,I]=p.useState("25%"),[Y,U]=p.useState("10"),[Z,_]=p.useState("600"),[V,F]=p.useState("nodeSelector"),[J,ee]=p.useState(""),[g,O]=p.useState([]),[q,K]=p.useState(!1),[le,ue]=p.useState([]),[ke,B]=p.useState({}),[i,x]=p.useState([]),[r,h]=p.useState("ClusterFirst"),[j,N]=p.useState("Always"),[P,H]=p.useState("default-scheduler"),[de,we]=p.useState("30"),[pe,R]=p.useState(""),[oe,Ne]=p.useState(""),[fe,A]=p.useState(""),[ye,De]=p.useState(""),[je,He]=p.useState(!1),[lt,Ge]=p.useState(!1),[dt,Ve]=p.useState(!1),[Pe,Dt]=p.useState(!1),[Pt,At]=p.useState(!1),[Tt,Ht]=p.useState([]),[Mt,Bt]=p.useState(""),[Rt,It]=p.useState(""),[Ot,Lt]=p.useState([]);p.useEffect(()=>{const f=o;if(!f){k(!1);return}E(f);const T=f?.spec||{},$=T?.template?.spec||{},te=T.strategy||{};S(te.type||"RollingUpdate");const ae=te.rollingUpdate||{};D(String(ae.maxSurge??"25%")),I(String(ae.maxUnavailable??"25%")),U(T.revisionHistoryLimit!=null?String(T.revisionHistoryLimit):"10"),_(T.progressDeadlineSeconds!=null?String(T.progressDeadlineSeconds):"600");const ve=$.nodeSelector||{},Ie=Object.entries(ve).map(([ie,zt])=>({key:ie,value:String(zt)}));ue(Ie),ee($.nodeName||""),$.nodeName?F("nodeName"):$.affinity?.nodeAffinity?F("nodeAffinity"):Ie.length>0&&F("nodeSelector"),t&&(K(!0),X.getClusterNodes(t).then(ie=>{const _t=(Array.isArray(ie)?ie:ie?.items||ie?.list||[]).map(qe=>{const Me=qe.metadata||{},Ye=qe.status||{},fs=(Array.isArray(Ye.addresses)?Ye.addresses:[]).find(Ss=>Ss.type==="InternalIP")?.address||"";return{name:Me.name||"",ip:fs,labels:Me.labels||{}}});O(_t);const Oe={};for(const qe of _t)for(const[Me,Ye]of Object.entries(qe.labels)){const pt=String(Ye);Oe[Me]||(Oe[Me]=[]),Oe[Me].includes(pt)||Oe[Me].push(pt)}B(Oe)}).catch(()=>{}).finally(()=>K(!1)));const Fe=Array.isArray($.tolerations)?$.tolerations:[];x(Fe.map(ie=>({key:ie.key||"",operator:ie.operator||"Equal",value:ie.value||"",effect:ie.effect||"",tolerationSeconds:ie.tolerationSeconds!=null?String(ie.tolerationSeconds):""}))),h($.dnsPolicy||"ClusterFirst"),N($.restartPolicy||"Always"),H($.schedulerName||"default-scheduler"),we($.terminationGracePeriodSeconds!=null?String($.terminationGracePeriodSeconds):"30"),R($.serviceAccountName||"");const Se=$.securityContext||{};Ne(Se.fsGroup!=null?String(Se.fsGroup):""),A(Se.runAsUser!=null?String(Se.runAsUser):""),De(Se.runAsGroup!=null?String(Se.runAsGroup):""),He(!!Se.runAsNonRoot),Ge(!!$.hostNetwork),Ve(!!$.hostIPC),Dt(!!$.hostPID),At(!!$.shareProcessNamespace);const L=Array.isArray($.hostAliases)?$.hostAliases:[];Ht(L.map(ie=>({ip:ie.ip||"",hostnames:Array.isArray(ie.hostnames)?ie.hostnames.join(", "):""})));const se=$.dnsConfig||{};Bt(Array.isArray(se.nameservers)?se.nameservers.join(` +`):""),It(Array.isArray(se.searches)?se.searches.join(` +`):"");const it=Array.isArray(se.options)?se.options:[];Lt(it.map(ie=>({name:ie.name||"",value:ie.value||""}))),k(!1)},[o]);const ks=()=>ue(f=>[...f,{key:"",value:""}]),gs=f=>ue(T=>T.filter(($,te)=>te!==f)),js=(f,T)=>ue($=>$.map((te,ae)=>ae===f?{...te,...T}:te)),Ns=async()=>{u(!0);try{const f=JSON.parse(JSON.stringify(w));f.spec=f.spec||{},f.spec.template=f.spec.template||{},f.spec.template.spec=f.spec.template.spec||{};const T=f.spec.template.spec;if(f.spec.strategy={type:y},y==="RollingUpdate"&&(f.spec.strategy.rollingUpdate={maxSurge:C,maxUnavailable:z}),Y&&(f.spec.revisionHistoryLimit=Number(Y)),Z&&(f.spec.progressDeadlineSeconds=Number(Z)),V==="nodeName"&&J.trim())T.nodeName=J.trim(),delete T.nodeSelector,T.affinity&&delete T.affinity.nodeAffinity;else if(V==="nodeSelector"){const L={};for(const{key:se,value:it}of le){const ie=se.trim();ie&&(L[ie]=it)}Object.keys(L).length>0?T.nodeSelector=L:delete T.nodeSelector,T.nodeName&&delete T.nodeName,T.affinity&&delete T.affinity.nodeAffinity}else if(V==="nodeAffinity"){const L=le.filter(se=>se.key.trim()).map(se=>({key:se.key.trim(),operator:"In",values:[se.value]}));L.length>0?(T.affinity=T.affinity||{},T.affinity.nodeAffinity={requiredDuringSchedulingIgnoredDuringExecution:{nodeSelectorTerms:[{matchExpressions:L}]}}):T.affinity&&delete T.affinity.nodeAffinity,delete T.nodeSelector,T.nodeName&&delete T.nodeName}const $=i.filter(L=>L.key||L.operator==="Exists").map(L=>{const se={};return L.key&&(se.key=L.key),L.operator&&(se.operator=L.operator),L.value&&L.operator!=="Exists"&&(se.value=L.value),L.effect&&(se.effect=L.effect),L.tolerationSeconds&&L.effect==="NoExecute"&&(se.tolerationSeconds=Number(L.tolerationSeconds)),se});$.length>0?T.tolerations=$:delete T.tolerations,r&&(T.dnsPolicy=r),j&&(T.restartPolicy=j),P&&(T.schedulerName=P),de&&(T.terminationGracePeriodSeconds=Number(de)),pe&&(T.serviceAccountName=pe);const te={};oe&&(te.fsGroup=Number(oe)),fe&&(te.runAsUser=Number(fe)),ye&&(te.runAsGroup=Number(ye)),je&&(te.runAsNonRoot=!0),Object.keys(te).length>0?T.securityContext=te:delete T.securityContext,lt?T.hostNetwork=!0:delete T.hostNetwork,dt?T.hostIPC=!0:delete T.hostIPC,Pe?T.hostPID=!0:delete T.hostPID,Pt?T.shareProcessNamespace=!0:delete T.shareProcessNamespace;const ae=Tt.filter(L=>L.ip.trim()).map(L=>({ip:L.ip.trim(),hostnames:L.hostnames.split(/[,\s]+/).map(se=>se.trim()).filter(Boolean)})).filter(L=>L.hostnames.length>0);ae.length>0?T.hostAliases=ae:delete T.hostAliases;const ve={},Ie=Mt.split(` +`).map(L=>L.trim()).filter(Boolean);Ie.length>0&&(ve.nameservers=Ie);const Fe=Rt.split(` +`).map(L=>L.trim()).filter(Boolean);Fe.length>0&&(ve.searches=Fe);const Se=Ot.filter(L=>L.name.trim()).map(L=>{const se={name:L.name.trim()};return L.value.trim()&&(se.value=L.value.trim()),se});Se.length>0&&(ve.options=Se),Object.keys(ve).length>0?T.dnsConfig=ve:delete T.dnsConfig,await ct(t,s,a,f),c({title:"高级设置已保存",description:`${a} 更新已提交`}),n(f)}catch(f){c({title:"保存失败",description:f?.message||String(f),variant:"destructive"})}finally{u(!1)}};return d?e.jsx(W,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:322:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:323:9",className:"p-12 text-center",children:[e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:324:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:325:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):o?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:342:5",className:"space-y-4",children:[e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:344:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:345:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:346:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(We,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:347:13",className:"h-4 w-4 text-blue-400"}),"更新策略 (Strategy)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:350:9",className:"pt-0 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:351:11",className:"flex items-center gap-4",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:352:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:353:15",type:"radio",checked:y==="RollingUpdate",onChange:()=>S("RollingUpdate"),className:"accent-blue-500"}),"RollingUpdate(滚动更新)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:357:13",className:"flex items-center gap-1.5 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:358:15",type:"radio",checked:y==="Recreate",onChange:()=>S("Recreate"),className:"accent-blue-500"}),"Recreate(重建)"]})]}),y==="RollingUpdate"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:364:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:365:15",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:366:17",className:"text-slate-500 text-xs",children:"maxSurge(整数或百分比,超出期望副本数)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:367:17",value:C,onChange:f=>D(f.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:370:15",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:371:17",className:"text-slate-500 text-xs",children:"maxUnavailable(整数或百分比,不可用上限)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:372:17",value:z,onChange:f=>I(f.target.value),placeholder:"25%",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:381:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:382:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:383:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(rs,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:384:13",className:"h-4 w-4 text-amber-400"}),"历史版本 & 进度"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:387:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:388:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:389:13",className:"text-slate-500 text-xs",children:"revisionHistoryLimit(保留 RS 历史)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:390:13",type:"number",value:Y,onChange:f=>U(f.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:393:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:394:13",className:"text-slate-500 text-xs",children:"progressDeadlineSeconds(升级超时秒数)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:395:13",type:"number",value:Z,onChange:f=>_(f.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:402:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:403:9",className:"pb-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:404:11",className:"flex items-center justify-between",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:405:13",className:"text-sm text-slate-200",children:"容忍 (Tolerations)"}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:406:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>x(f=>[...f,{key:"",operator:"Equal",value:"",effect:"NoSchedule",tolerationSeconds:""}]),children:[e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:408:15",className:"h-3 w-3 mr-1"}),"添加"]})]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:412:9",className:"pt-0 space-y-2",children:[i.length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:413:40",className:"text-xs text-slate-600",children:"未配置容忍"}),i.map((f,T)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:415:13",className:"grid grid-cols-[1fr_80px_1fr_100px_80px_auto] gap-2 items-center",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:416:15",value:f.key,placeholder:"key",onChange:$=>x(te=>te.map((ae,ve)=>ve===T?{...ae,key:$.target.value}:ae)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:418:15",value:f.operator,onChange:$=>x(te=>te.map((ae,ve)=>ve===T?{...ae,operator:$.target.value}:ae)),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:420:17",value:"Equal",children:"Equal"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:421:17",value:"Exists",children:"Exists"})]}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:423:15",value:f.value,placeholder:"value",disabled:f.operator==="Exists",onChange:$=>x(te=>te.map((ae,ve)=>ve===T?{...ae,value:$.target.value}:ae)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:426:15",value:f.effect,onChange:$=>x(te=>te.map((ae,ve)=>ve===T?{...ae,effect:$.target.value}:ae)),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:428:17",value:"",children:"任意"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:429:17",value:"NoSchedule",children:"NoSchedule"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:430:17",value:"PreferNoSchedule",children:"PreferNoSchedule"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:431:17",value:"NoExecute",children:"NoExecute"})]}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:433:15",value:f.tolerationSeconds,placeholder:"秒",disabled:f.effect!=="NoExecute",onChange:$=>x(te=>te.map((ae,ve)=>ve===T?{...ae,tolerationSeconds:$.target.value}:ae)),className:"h-7 bg-slate-800 border-slate-700 text-xs font-mono"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:436:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400",onClick:()=>x($=>$.filter((te,ae)=>ae!==T)),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:437:17",className:"h-3 w-3"})})]},T))]})]}),e.jsx(fn,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:444:7",scheduleMode:V,onScheduleModeChange:F,nodeName:J,onNodeNameChange:ee,availableNodes:g,nodesLoading:q,labelSelectorKv:le,onAddLabelSelector:ks,onRemoveLabelSelector:gs,onUpdateLabelSelector:js,nodeLabels:ke}),e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:459:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:460:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:461:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(kt,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:462:13",className:"h-4 w-4 text-slate-400"}),"Pod 级别"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:465:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:466:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:467:13",className:"text-slate-500 text-xs",children:"dnsPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:468:13",value:r,onChange:f=>h(f.target.value),className:"h-8 mt-1 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:470:15",value:"ClusterFirst",children:"ClusterFirst"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:471:15",value:"ClusterFirstWithHostNet",children:"ClusterFirstWithHostNet"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:472:15",value:"Default",children:"Default"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:473:15",value:"None",children:"None"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:476:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:477:13",className:"text-slate-500 text-xs",children:"restartPolicy"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:478:13",value:j,onChange:f=>N(f.target.value),className:"h-8 mt-1 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:480:15",value:"Always",children:"Always"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:481:15",value:"OnFailure",children:"OnFailure"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:482:15",value:"Never",children:"Never"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:485:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:486:13",className:"text-slate-500 text-xs",children:"schedulerName"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:487:13",value:P,onChange:f=>H(f.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:490:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:491:13",className:"text-slate-500 text-xs",children:"terminationGracePeriodSeconds"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:492:13",type:"number",value:de,onChange:f=>we(f.target.value),className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:495:11",className:"col-span-2",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:496:13",className:"text-slate-500 text-xs",children:"serviceAccountName"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:497:13",value:pe,onChange:f=>R(f.target.value),placeholder:"default",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]})]})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:504:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:505:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:506:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ds,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:507:13",className:"h-4 w-4 text-rose-400"}),"Pod 安全上下文 (securityContext)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:510:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:511:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:512:13",className:"text-slate-500 text-xs",children:"fsGroup"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:513:13",type:"number",value:oe,onChange:f=>Ne(f.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:516:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:517:13",className:"text-slate-500 text-xs",children:"runAsUser"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:518:13",type:"number",value:fe,onChange:f=>A(f.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:521:11",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:522:13",className:"text-slate-500 text-xs",children:"runAsGroup"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:523:13",type:"number",value:ye,onChange:f=>De(f.target.value),placeholder:"1000",className:"h-8 mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:526:11",className:"flex items-end pb-1",children:e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:527:13",className:"flex items-center gap-2 text-xs text-slate-400 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:528:15",type:"checkbox",checked:je,onChange:f=>He(f.target.checked),className:"accent-blue-500"}),"runAsNonRoot"]})})]})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:537:7",className:"bg-slate-900 border-slate-800",children:[e.jsx(me,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:538:9",className:"pb-3",children:e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:539:11",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:540:13",className:"h-4 w-4 text-cyan-400"}),"主机设置 (Host Namespace)"]})}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:543:9",className:"pt-0 grid grid-cols-2 gap-3",children:[e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:544:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:545:13",type:"checkbox",checked:lt,onChange:f=>Ge(f.target.checked),className:"accent-blue-500"}),"hostNetwork(共享主机网络命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:549:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:550:13",type:"checkbox",checked:dt,onChange:f=>Ve(f.target.checked),className:"accent-blue-500"}),"hostIPC(共享主机 IPC 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:554:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:555:13",type:"checkbox",checked:Pe,onChange:f=>Dt(f.target.checked),className:"accent-blue-500"}),"hostPID(共享主机 PID 命名空间)"]}),e.jsxs("label",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:559:11",className:"flex items-center gap-2 text-xs text-slate-300 cursor-pointer",children:[e.jsx("input",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:560:13",type:"checkbox",checked:Pt,onChange:f=>At(f.target.checked),className:"accent-blue-500"}),"shareProcessNamespace(共享进程命名空间)"]})]})]}),e.jsx(Sn,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:567:7",dnsNameservers:Mt,onDnsNameserversChange:Bt,dnsSearches:Rt,onDnsSearchesChange:It,dnsOptions:Ot,onDnsOptionsChange:Lt,hostAliases:Tt,onHostAliasesChange:Ht}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:579:7",className:"flex justify-end gap-2 pt-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:580:9",variant:"outline",className:"border-slate-700 text-slate-400",onClick:l,children:"取消"}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:581:9",className:"bg-blue-600 hover:bg-blue-700",disabled:m,onClick:Ns,children:[m?e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:582:21",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(rt,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:582:73",className:"h-4 w-4 mr-1"}),"保存"]})]})]}):e.jsx(W,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:333:7",className:"bg-slate-900 border-slate-800",children:e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditAdvanced.tsx:334:9",className:"p-8 text-center text-slate-500",children:"未获取到 manifest 数据,请使用 YAML 编辑模式直接修改。"})})}const En=[{label:"HTTP",protocol:"TCP",port:8080,targetPort:8080,name:"http"},{label:"WebSocket",protocol:"TCP",port:8001,targetPort:8002,name:"ws"},{label:"gRPC",protocol:"TCP",port:8002,targetPort:8002,name:"grpc"}],Zt=t=>Array.isArray(t)?t:t?.list||t?.items||t?.data||[];function wn({clusterCode:t,namespace:s,deploymentName:a,manifest:o,onSaved:n,onCancel:l}){const{toast:c}=Te(),m=ot(),[u,d]=p.useState(!0),[k,w]=p.useState([]),[E,y]=p.useState([]),[S,C]=p.useState({}),[D,z]=p.useState(null),[I,Y]=p.useState(null),[U,Z]=p.useState({name:"",type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),[_,V]=p.useState({name:"",className:"nginx",host:"",path:"/",pathType:"Prefix",svcPort:"80"}),F=i=>{Z(x=>({...x,ports:[...x.ports,i?{name:i.name,port:String(i.port),targetPort:String(i.targetPort),protocol:i.protocol,nodePort:""}:{name:"",port:"",targetPort:"",protocol:"TCP",nodePort:""}]}))},J=(i,x,r)=>{Z(h=>({...h,ports:h.ports.map((j,N)=>N===i?{...j,[x]:r}:j)}))},ee=i=>{U.ports.length<=1||Z(x=>({...x,ports:x.ports.filter((r,h)=>h!==i)}))},g=p.useCallback(async()=>{d(!0);try{const i=o?.spec?.selector?.matchLabels||o?.selector||{};C(i);const[x,r]=await Promise.all([X.getNamespaceServices(t,s).catch(()=>[]),X.getNamespaceIngresses(t,s).catch(()=>[])]),h=Zt(x),j=Zt(r),N=h.map(H=>{const de=H.spec||{},we=Array.isArray(de.ports)?de.ports.map(pe=>({port:pe.port,targetPort:pe.targetPort,protocol:pe.protocol||"TCP",nodePort:pe.nodePort,name:pe.name})):Array.isArray(H.portList)?H.portList.map(pe=>({port:pe.port,targetPort:pe.targetPort,protocol:pe.protocol||"TCP",nodePort:pe.nodePort,name:pe.name})):[];return{name:H.name||H.metadata?.name||"",type:de.type||H.type||"ClusterIP",clusterIP:de.clusterIP||H.cluster_ip||"",externalIP:Array.isArray(de.externalIPs)?de.externalIPs.join(","):"",ports:we,selector:de.selector||H.selector||{},age:H.age||H.created_at||"",raw:H}}),P=j.map(H=>{const de=H.spec||{},pe=(Array.isArray(de.rules)?de.rules:Array.isArray(H.rules)?H.rules:[]).map(R=>({host:R.host||"",paths:(R.http?.paths||R.paths||[]).map(oe=>({path:oe.path||"/",backend:{service:oe.backend?.service?.name||oe.backendService||"",port:oe.backend?.service?.port?.number||oe.backend?.service?.port?.name||oe.backendPort||""}}))}));return{name:H.name||H.metadata?.name||"",className:de.ingressClassName||H.ingressClass||"",hosts:pe.map(R=>R.host).filter(Boolean),rules:pe,raw:H}});w(N),y(P)}catch(i){console.error("M9 load error:",i)}finally{d(!1)}},[t,s,o]);p.useEffect(()=>{g()},[g]);const O=i=>Object.keys(i).length===0?!1:Object.entries(i).every(([x,r])=>S[x]===r),q=k.filter(i=>O(i.selector)),K=new Set(q.map(i=>i.name)),le=E.filter(i=>i.rules.some(x=>x.paths.some(r=>K.has(r.backend.service)))),ue=async()=>{const i=U.name.trim()||`${a}-svc`,x=U.ports.map(h=>{const j={name:h.name||"http",port:Number(h.port)||80,targetPort:/^\d+$/.test(String(h.targetPort))?Number(h.targetPort):h.targetPort,protocol:h.protocol||"TCP"};return U.type==="NodePort"&&h.nodePort&&(j.nodePort=Number(h.nodePort)),j}),r={apiVersion:"v1",kind:"Service",metadata:{name:i,namespace:s,labels:{app:a}},spec:{type:U.type,selector:S,ports:x}};try{const h=await $t(r);await X.applyYAML(t,h),c({title:"Service 已创建",description:i}),Y(null),g()}catch(h){c({title:"创建失败",description:h?.message||String(h),variant:"destructive"})}},ke=async()=>{const i=_.name.trim()||`${a}-ingress`,x=q[0]?.name||`${a}-svc`,r=Number(_.svcPort)||80,h={apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:i,namespace:s,labels:{app:a}},spec:{ingressClassName:_.className||void 0,rules:[{host:_.host||void 0,http:{paths:[{path:_.path||"/",pathType:_.pathType||"Prefix",backend:{service:{name:x,port:{number:r}}}}]}}]}};_.className||delete h.spec.ingressClassName;try{const j=await $t(h);await X.applyYAML(t,j),c({title:"Ingress 已创建",description:i}),Y(null),g()}catch(j){c({title:"创建失败",description:j?.message||String(j),variant:"destructive"})}},B=async(i,x)=>{if(await m({title:"删除资源",description:`确认删除 ${i==="service"?"Service":"Ingress"} 「${x}」?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{const h=i==="service"?"services":"ingresses";await X.deleteResourceYaml(t,s,h,x),c({title:"已删除",description:`${i==="service"?"Service":"Ingress"} ${x} 已删除`}),g()}catch(h){c({title:"删除失败",description:h?.message||String(h),variant:"destructive"})}};return u?e.jsx(W,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:291:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:292:9",className:"p-12 text-center",children:[e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:293:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:294:11",className:"text-slate-500 mt-3 text-sm",children:"加载中..."})]})}):e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:301:5",className:"space-y-4",children:[e.jsx(W,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:303:7",className:"bg-slate-900/50 border-slate-800",children:e.jsx(G,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:304:9",className:"p-3",children:e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:305:11",className:"flex items-center gap-2 text-xs text-slate-400",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:306:13",className:"h-3.5 w-3.5 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:307:13",children:"选择器:"}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:308:13",className:"flex flex-wrap gap-1",children:[Object.entries(S).map(([i,x])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:310:17",className:"bg-slate-800 px-1.5 py-0.5 rounded text-slate-300 text-[11px]",children:[i,"=",x]},i)),Object.keys(S).length===0&&e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:313:17",className:"text-slate-600 italic",children:"(无 selector)"})]}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:316:13",size:"sm",variant:"ghost",className:"h-6 ml-auto text-xs text-slate-400",onClick:g,children:[e.jsx(We,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:317:15",className:"h-3 w-3 mr-1"}),"刷新"]})]})})}),e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:324:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:325:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:326:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:327:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:328:15",className:"h-4 w-4 text-blue-400"}),"Services",e.jsxs(ne,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:330:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[q.length," 个关联"]})]}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:332:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{Z({name:`${a}-svc`,type:"ClusterIP",ports:[{name:"http",port:"8080",targetPort:"8080",protocol:"TCP",nodePort:""}]}),Y("service")},children:[e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:337:15",className:"h-3 w-3 mr-1"}),"创建 Service"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:340:11",className:"text-xs text-slate-500 mt-1",children:"仅显示 selector 匹配此 Deployment 的关联 Service"})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:342:9",className:"pt-0",children:[q.length===0&&I!=="service"?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:344:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:345:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无关联 Service"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:349:13",className:"space-y-2",children:q.map(i=>{const x=O(i.selector);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:353:19",className:`rounded-lg border p-3 ${x?"border-blue-700/50 bg-blue-950/20":"border-slate-800 bg-slate-950/30"}`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:354:21",className:"flex items-center gap-2 flex-wrap",children:[x?e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:355:34",className:"h-4 w-4 text-blue-400"}):e.jsx(Ae,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:355:86",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:356:23",className:"text-sm font-semibold text-slate-200",children:i.name}),e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:357:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:i.type}),x&&e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:358:35",className:"bg-blue-500/20 text-blue-300 border-blue-500/30 text-[10px]",children:"关联"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:359:23",className:"text-[11px] text-slate-500 ml-auto",children:i.clusterIP}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:360:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-emerald-400",onClick:()=>z({resource:"services",name:i.name}),children:[e.jsx(Wt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:362:25",className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:364:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Service",onClick:()=>B("service",i.name),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:366:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:370:21",className:"mt-2 flex flex-wrap gap-1.5 text-[11px]",children:i.ports.map((r,h)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:372:25",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-300",children:[r.name&&e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:373:38",className:"text-slate-500",children:[r.name,": "]}),r.port,"→",r.targetPort,r.nodePort?`/NodePort:${r.nodePort}`:"","/",r.protocol]},h))}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:379:21",className:"mt-1 flex flex-wrap gap-1 text-[10px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:380:23",className:"text-slate-600",children:"selector:"}),Object.entries(i.selector).map(([r,h])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:382:25",className:"text-slate-500",children:[r,"=",h]},r))]})]},i.name)})}),I==="service"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:393:13",className:"mt-3 border border-blue-800/50 rounded-lg p-3 bg-blue-950/20 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:394:15",className:"text-xs font-semibold text-blue-300 flex items-center gap-1.5",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:395:17",className:"h-3 w-3"}),"创建新 Service"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:399:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:400:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:401:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:402:19",value:U.name,onChange:i=>Z(x=>({...x,name:i.target.value})),placeholder:`${a}-svc`,className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:406:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:407:19",className:"text-slate-500 text-[11px]",children:"类型"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:408:19",value:U.type,onChange:i=>Z(x=>({...x,type:i.target.value})),className:"h-7 mt-0.5 w-full bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:410:21",value:"ClusterIP",children:"ClusterIP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:411:21",value:"NodePort",children:"NodePort"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:417:15",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:418:17",className:"text-slate-500 text-[11px] mb-1 block",children:"快速添加常用端口"}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:419:17",className:"flex gap-1.5",children:En.map(i=>e.jsxs("button",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:421:21",onClick:()=>F(i),className:`flex items-center gap-1 px-2 py-1 rounded text-[10px] font-medium + bg-slate-800 border border-slate-700 text-slate-300 hover:border-blue-500/50 hover:text-blue-300 transition-colors`,children:[e.jsx(ls,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:424:23",className:"h-2.5 w-2.5"}),i.label,e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:426:23",className:"text-slate-500 text-[9px]",children:[i.protocol," ",i.port,":",i.targetPort]})]},i.name))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:433:15",className:"space-y-2",children:[e.jsxs(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:434:17",className:"text-slate-500 text-[11px]",children:["端口配置 ",e.jsxs("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:435:24",className:"text-slate-600",children:["(",U.ports.length," 个端口)"]})]}),U.ports.map((i,x)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:438:19",className:"flex items-center gap-1.5 p-2 rounded bg-slate-800/50 border border-slate-700/50",children:[e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:440:21",value:i.name,onChange:r=>J(x,"name",r.target.value),placeholder:"http",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsxs("select",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:444:21",value:i.protocol,onChange:r=>J(x,"protocol",r.target.value),className:"h-7 bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-1.5 w-16",children:[e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:446:23",value:"TCP",children:"TCP"}),e.jsx("option",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:447:23",value:"UDP",children:"UDP"})]}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:450:21",value:i.port,onChange:r=>J(x,"port",r.target.value),type:"number",placeholder:"port",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:453:21",className:"text-slate-600 text-[10px]",children:"→"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:454:21",value:i.targetPort,onChange:r=>J(x,"targetPort",r.target.value),type:"number",placeholder:"targetPort",className:"h-7 w-[72px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),U.type==="NodePort"&&e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:459:23",value:i.nodePort,onChange:r=>J(x,"nodePort",r.target.value),type:"number",placeholder:"30000-32767",className:"h-7 w-[80px] bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:464:21",size:"icon",variant:"ghost",className:"h-6 w-6 text-slate-500 hover:text-red-400",onClick:()=>ee(x),disabled:U.ports.length<=1,children:e.jsx(Ct,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:466:23",className:"h-3 w-3"})})]},x)),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:471:17",size:"sm",variant:"outline",className:"h-7 w-full border-dashed border-slate-700 text-slate-400 text-xs",onClick:()=>F(),children:[e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:473:19",className:"h-3 w-3 mr-1"}),"添加自定义端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:478:15",className:"text-[10px] text-slate-500 border-t border-slate-700/50 pt-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:479:17",className:"text-slate-600",children:"selector (自动检测): "}),Object.keys(S).length>0?Object.entries(S).map(([i,x])=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:482:21",className:"bg-slate-800 px-1 py-0.5 rounded text-slate-400 ml-1",children:[i,"=",x]},i)):e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:485:19",className:"text-slate-600 italic",children:"未检测到"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:489:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:490:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>Y(null),children:"取消"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:491:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:ue,children:"创建"})]})]})]})]}),e.jsxs(W,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:499:7",className:"bg-slate-900 border-slate-800",children:[e.jsxs(me,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:500:9",className:"pb-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:501:11",className:"flex items-center justify-between",children:[e.jsxs(xe,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:502:13",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(ut,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:503:15",className:"h-4 w-4 text-purple-400"}),"Ingresses (应用路由)",e.jsxs(ne,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:505:15",variant:"outline",className:"border-slate-700 text-slate-400",children:[le.length,"/",E.length]})]}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:507:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{V(i=>({...i,name:`${a}-ingress`,svcPort:String(q[0]?.ports[0]?.port||80)})),Y("ingress")},children:[e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:512:15",className:"h-3 w-3 mr-1"}),"创建 Ingress"]})]}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:515:11",className:"text-xs text-slate-500 mt-1",children:"backend 指向关联 Service 的 Ingress 自动高亮"})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:517:9",className:"pt-0",children:[E.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:519:13",className:"text-center py-6 text-slate-500 text-sm border border-dashed border-slate-800 rounded-lg",children:[e.jsx(ut,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:520:15",className:"h-8 w-8 mx-auto mb-2 text-slate-700"}),"当前命名空间暂无 Ingress"]}):e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:524:13",className:"space-y-2",children:E.map(i=>{const x=le.includes(i);return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:528:19",className:`rounded-lg border p-3 ${x?"border-purple-700/50 bg-purple-950/20":"border-slate-800 bg-slate-950/30"}`,children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:529:21",className:"flex items-center gap-2 flex-wrap",children:[x?e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:34",className:"h-4 w-4 text-purple-400"}):e.jsx(ut,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:530:88",className:"h-4 w-4 text-slate-500"}),e.jsx("span",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:531:23",className:"text-sm font-semibold text-slate-200",children:i.name}),e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:532:23",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:i.className}),x&&e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:533:35",className:"bg-purple-500/20 text-purple-300 border-purple-500/30 text-[10px]",children:"关联"}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:534:23",size:"sm",variant:"ghost",className:"h-6 text-xs text-emerald-400 ml-auto",onClick:()=>z({resource:"ingresses",name:i.name}),children:[e.jsx(Wt,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:536:25",className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:538:23",size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",title:"删除 Ingress",onClick:()=>B("ingress",i.name),children:e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:540:25",className:"h-3 w-3"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:544:21",className:"mt-2 space-y-1 text-[11px]",children:i.rules.map((r,h)=>e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:546:25",className:"flex items-start gap-1.5",children:[e.jsx(Et,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:547:27",className:"h-3 w-3 text-slate-500 mt-0.5"}),e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:548:27",className:"text-slate-300",children:r.host||"*"}),r.paths.map((j,N)=>e.jsxs("code",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:550:29",className:"bg-slate-800/60 px-1.5 py-0.5 rounded text-slate-400",children:[j.path," → ",j.backend?.service,":",j.backend?.port]},N))]},h))})]},i.name)})}),I==="ingress"&&e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:565:13",className:"mt-3 border border-purple-800/50 rounded-lg p-3 bg-purple-950/20 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:566:15",className:"text-xs font-semibold text-purple-300 flex items-center gap-1.5",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:567:17",className:"h-3 w-3"}),"创建新 Ingress"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:569:15",className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:570:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:571:19",className:"text-slate-500 text-[11px]",children:"名称"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:572:19",value:_.name,onChange:i=>V(x=>({...x,name:i.target.value})),placeholder:`${a}-ingress`,className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:576:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:577:19",className:"text-slate-500 text-[11px]",children:"ingressClassName"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:578:19",value:_.className,onChange:i=>V(x=>({...x,className:i.target.value})),placeholder:"nginx",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:582:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:583:19",className:"text-slate-500 text-[11px]",children:"host (域名)"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:584:19",value:_.host,onChange:i=>V(x=>({...x,host:i.target.value})),placeholder:"app.example.com",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:588:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:589:19",className:"text-slate-500 text-[11px]",children:"path"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:590:19",value:_.path,onChange:i=>V(x=>({...x,path:i.target.value})),placeholder:"/",className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:594:17",children:[e.jsx(M,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:595:19",className:"text-slate-500 text-[11px]",children:"Service 端口"}),e.jsx(v,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:596:19",type:"number",value:_.svcPort,onChange:i=>V(x=>({...x,svcPort:i.target.value})),className:"h-7 mt-0.5 bg-slate-800 border-slate-700 text-slate-300 text-xs font-mono"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:600:15",className:"flex justify-end gap-2 pt-1",children:[e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:601:17",size:"sm",variant:"ghost",className:"h-7 text-xs text-slate-400",onClick:()=>Y(null),children:"取消"}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:602:17",size:"sm",className:"h-7 bg-purple-600 hover:bg-purple-700 text-xs",onClick:ke,children:"创建"})]})]})]})]}),D&&e.jsx(hs,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:610:9",clusterCode:t,namespace:s,resource:D.resource,name:D.name,onClose:()=>z(null),onSaved:()=>{z(null),g()}}),e.jsx("div",{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:620:7",className:"flex justify-end gap-2 pt-2",children:e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentEditService.tsx:621:9",size:"sm",variant:"outline",className:"h-7 text-xs border-slate-700 text-slate-400",onClick:l,children:"返回查看"})})]})}function Dn({clusterCode:t,namespace:s,deploymentName:a,manifest:o,onSaved:n,onCancel:l}){const[c,m]=p.useState("basic"),[u,d]=p.useState(o);p.useEffect(()=>{o&&d(o)},[o]);const k=y=>{y&&d(y),n()},w=[{key:"basic",label:"基本信息",icon:kt},{key:"containers",label:"容器信息",icon:$e},{key:"storage",label:"存储挂载",icon:Xe},{key:"advanced",label:"高级设置",icon:kt},{key:"service",label:"服务/应用路由",icon:Ae}],E={clusterCode:t,namespace:s,deploymentName:a,manifest:u,onSaved:k,onCancel:l};return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:51:5",className:"space-y-4",children:[e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:52:7",className:"flex items-center gap-1 border-b border-slate-800 pb-px overflow-x-auto",children:w.map(y=>{const S=c===y.key,C=y.icon;return e.jsxs("button",{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:57:13",onClick:()=>m(y.key),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium border-b-2 transition-colors whitespace-nowrap ${S?"border-blue-500 text-blue-400":"border-transparent text-slate-400 hover:text-slate-200"}`,children:[e.jsx(C,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:64:15",className:"h-3.5 w-3.5"}),y.label]},y.key)})}),c==="basic"&&e.jsx(on,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:71:33",...E}),c==="containers"&&e.jsx(cn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:72:38",...E}),c==="storage"&&e.jsx(jn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:73:35",...E}),c==="advanced"&&e.jsx(Cn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:74:36",...E}),c==="service"&&e.jsx(wn,{"code-path":"src/components/kubernetes/deployment-workload/EditModeContainer.tsx:75:35",...E})]})}function Pn({clusterCode:t,namespace:s,deploymentName:a}){const{toast:o}=Te(),n=ft(u=>u.token)||localStorage.getItem("token")||"",l=`${window.location.origin}/api/v1/clusters/${t}/namespaces/${s}/deployments/${a}/update-image`,c=`curl -X POST '${l}' \\ + -H 'Authorization: Bearer ${n?n.substring(0,16)+"...":"YOUR_TOKEN"}' \\ + -H 'Content-Type: application/json' \\ + -d '{"image": "harbor.example.com/app:v1.0", "container": "your-container-name"}'`,m=u=>{navigator.clipboard.writeText(u).then(()=>o({title:"已复制"})).catch(()=>{})};return e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:28:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:29:7",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:30:9",className:"text-slate-400 text-sm",children:"Webhook URL"}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:31:9",className:"flex items-center gap-2 mt-1",children:[e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:32:11",className:"flex-1 text-xs text-slate-300 bg-slate-800 rounded px-3 py-2 break-all font-mono",children:l}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:33:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400 shrink-0",onClick:()=>m(l),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:36:7",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:37:9",className:"text-slate-400 text-sm",children:"curl 示例"}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:38:9",className:"relative mt-1",children:[e.jsx("pre",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:39:11",className:"text-xs text-slate-300 bg-slate-800 rounded p-3 overflow-x-auto font-mono whitespace-pre-wrap",children:c}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:40:11",variant:"outline",size:"sm",className:"absolute top-2 right-2 border-slate-700 text-slate-400",onClick:()=>m(c),children:"复制"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:43:7",className:"text-xs text-slate-500 space-y-1",children:[e.jsx("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:44:9",children:"• 使用 Bearer Token 认证(JWT 登录令牌)"}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:45:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:45:14",className:"text-slate-400",children:"image"})," 必填,指定新镜像地址"]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:46:9",children:["• ",e.jsx("code",{"code-path":"src/components/kubernetes/deployment-workload/CICDWebhookContent.tsx:46:14",className:"text-slate-400",children:"container"})," 可选,不填则更新第一个容器"]})]})]})}function Ke({title:t,children:s,onClose:a}){return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:14:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:a,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:15:7",className:"bg-slate-900 border border-slate-700 rounded-xl p-6 w-[460px] max-w-[90vw] shadow-2xl",onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:16:9",className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:17:11",className:"text-base font-bold text-slate-100",children:t}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:a,children:e.jsx(ms,{"code-path":"src/components/kubernetes/deployment-workload/ModalShell.tsx:18:100",className:"h-4 w-4"})})]}),s]})})}function An({clusterCode:t,namespace:s,podName:a,containers:o,onClose:n}){const{toast:l}=Te(),[c,m]=p.useState(""),[u,d]=p.useState(200),[k,w]=p.useState(o[0]||""),[E,y]=p.useState(!1),[S,C]=p.useState(!1),D=async()=>{y(!0);try{const I=await X.getPodLogs(t,s,a,u,k||void 0);m(I?.data?.logs||I?.logs||I||"无日志")}catch{m("获取日志失败")}finally{y(!1)}};p.useEffect(()=>{D()},[k,u]);const z=async()=>{C(!0);const I=ft.getState().token||"",Y="",U=k?`&container=${encodeURIComponent(k)}`:"",Z=`${Y}/api/v1/kubernetes/${t}/namespace/${s}/pods/${a}/logs?tail=${u}&stream=true${U}`;try{const V=(await fetch(Z,{headers:{Authorization:`Bearer ${I}`}})).body?.getReader();if(!V)return;const F=new TextDecoder;let J="";for(;;){const{done:ee,value:g}=await V.read();if(ee)break;J+=F.decode(g,{stream:!0}),m(J)}}catch{l({title:"流式日志连接中断",variant:"destructive"})}finally{C(!1)}};return e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:64:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:n,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:65:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[90vw] max-w-4xl max-h-[80vh] flex flex-col",onClick:I=>I.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:66:9",className:"flex items-center justify-between p-3 border-b border-slate-700",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:67:11",className:"flex items-center gap-2",children:[e.jsx(St,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:68:13",className:"h-4 w-4 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:69:13",className:"text-sm font-semibold text-slate-200",children:a}),k&&e.jsx(ne,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:70:27",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:k})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:72:11",className:"flex items-center gap-2",children:[o.length>0&&e.jsx("select",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:74:15",value:k,onChange:I=>w(I.target.value),className:"bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2 py-1",children:o.map(I=>e.jsx("option",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:76:38",value:I,children:I},I))}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:79:13",className:"text-[11px] text-slate-500",children:"最近"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:80:13",type:"number",value:u,onChange:I=>d(Number(I.target.value)||200),className:"w-16 h-7 bg-slate-800 border-slate-700 text-slate-200 text-xs"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:82:13",className:"text-[11px] text-slate-500",children:"行"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:83:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:D,disabled:E,children:E?e.jsx(be,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:84:26",className:"h-3 w-3 animate-spin"}):e.jsx(We,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:84:73",className:"h-3 w-3"})}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:86:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-emerald-400 text-xs",onClick:z,disabled:S,children:S?"流中...":"实时流"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:89:13",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:n,children:e.jsx(ms,{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:89:102",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:92:9",className:"flex-1 overflow-auto p-3",children:e.jsx("pre",{"code-path":"src/components/kubernetes/deployment-workload/PodLogsModal.tsx:93:11",className:"bg-slate-950 rounded p-3 text-xs text-slate-300 font-mono whitespace-pre-wrap max-h-[60vh] overflow-auto",children:c||"无日志内容"})})]})})}function Tn({modal:t,deployment:s,namespace:a,deploymentName:o,newImage:n,setNewImage:l,scaleValue:c,setScaleValue:m,actionLoading:u,onClose:d,onUpdateImage:k,onScaleTo:w,onDelete:E}){return e.jsxs(e.Fragment,{children:[t?.kind==="image"&&e.jsx(Ke,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:45:9",title:"调整镜像版本",onClose:d,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:46:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:47:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:48:15",className:"text-slate-400 text-sm",children:"当前镜像"}),e.jsx("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:49:15",className:"text-xs text-slate-500 font-mono mt-1 bg-slate-800 rounded px-3 py-2",children:s.image||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:51:13",children:[e.jsx(M,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:52:15",className:"text-slate-400 text-sm",children:"新镜像地址"}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:53:15",value:n,onChange:y=>l(y.target.value),placeholder:"harbor.example.com/app:v2.0",className:"mt-1 bg-slate-800 border-slate-700 text-slate-200 text-sm font-mono"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:57:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:58:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:d,children:"取消"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:59:15",className:"bg-blue-600 hover:bg-blue-700",disabled:u==="image"||!n.trim(),onClick:k,children:u==="image"?e.jsx(be,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:60:46",className:"h-4 w-4 animate-spin"}):"更新镜像"})]})]})}),t?.kind==="scale"&&e.jsx(Ke,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:69:9",title:"伸缩 (Scale)",onClose:d,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:70:11",className:"space-y-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:71:13",className:"text-xs text-slate-500",children:["当前副本: ",s.replicas||0]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:72:13",className:"flex items-center justify-center gap-3 py-3",children:[e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:73:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:u==="scale"||c<=0,onClick:()=>m(y=>Math.max(0,y-1)),children:e.jsx(Ct,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:76:17",className:"h-4 w-4"})}),e.jsx(v,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:78:15",type:"number",min:0,value:c,onChange:y=>m(Math.max(0,Number(y.target.value))),className:"w-24 text-center text-lg font-bold bg-slate-800 border-slate-700 text-slate-200"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:81:15",variant:"outline",size:"icon",className:"border-slate-700 text-slate-300",disabled:u==="scale",onClick:()=>m(y=>y+1),children:e.jsx(Q,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:84:17",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:87:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:88:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:d,children:"取消"}),e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:89:15",className:"bg-blue-600 hover:bg-blue-700",disabled:u==="scale",onClick:w,children:u==="scale"?e.jsx(be,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:90:46",className:"h-4 w-4 animate-spin"}):"确认"})]})]})}),t?.kind==="delete"&&e.jsx(Ke,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:99:9",title:"删除 Deployment",onClose:d,children:e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:100:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:101:13",className:"flex items-center gap-2 text-red-400",children:[e.jsx(xs,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:102:15",className:"h-5 w-5"}),e.jsx("span",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:103:15",className:"font-semibold",children:"此操作不可撤销"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:105:13",className:"text-sm text-slate-400",children:["确认删除 Deployment ",e.jsxs("code",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:106:31",className:"text-slate-200 font-mono",children:[a,"/",o]}),"? 其管理的所有 Pod 将被一并回收。"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:109:13",className:"flex justify-end gap-2 pt-2",children:[e.jsx(b,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:110:15",variant:"outline",className:"border-slate-700 text-slate-400",onClick:d,children:"取消"}),e.jsxs(b,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:111:15",variant:"destructive",disabled:u==="delete",onClick:E,children:[u==="delete"?e.jsx(be,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:47",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(he,{"code-path":"src/components/kubernetes/deployment-workload/ActionModals.tsx:112:99",className:"h-4 w-4 mr-1"}),"确认删除"]})]})]})})]})}function Hn({clusterCode:t,namespace:s,deploymentName:a,mode:o,onBack:n,onModeChange:l}){const c=es(),{toast:m}=Te(),u=ot(),[d,k]=p.useState(null),[w,E]=p.useState(null),[y,S]=p.useState([]),[C,D]=p.useState([]),[z,I]=p.useState([]),[Y,U]=p.useState(!0),[Z,_]=p.useState(""),[V,F]=p.useState(null),[J,ee]=p.useState(""),[g,O]=p.useState(0),[q,K]=p.useState(null),[le,ue]=p.useState(null),ke=d?.cluster_id||d?.clusterId||t,B=A=>Array.isArray(A)?A:A?.list||A?.items||A?.data||[],i=p.useCallback(async()=>{U(!0);try{const[A,ye,De,je]=await Promise.all([X.getDeployment(t,s,a).catch(()=>null),X.getNamespacePods(t,s).catch(()=>[]),X.getReplicaSets(t,s).catch(()=>[]),X.getDeploymentRevisions(t,s,a).catch(()=>[])]),He=A||(Array.isArray(A)?A[0]:null);k(He),O(He?.replicas||0),ee(He?.image||"");const Ge=B(ye).filter(Pe=>Pe.namespace===s&&(Pe.name||"").startsWith(a));S(Ge);const Ve=B(De).filter(Pe=>Pe.namespace===s&&(Pe.owner_deployment===a||(Pe.name||"").startsWith(a)));D(Ve),I(B(je))}catch(A){console.error("加载详情失败:",A)}finally{U(!1)}},[t,s,a]),x=p.useCallback(async()=>{try{const A=await X.getResourceYaml(t,s,"deployments",a),{parseEditableManifest:ye}=await Cs(async()=>{const{parseEditableManifest:je}=await import("./PodFileBrowser-CVjj8HxI.js").then(He=>He.k);return{parseEditableManifest:je}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),{manifest:De}=await ye(A);E(De||d)}catch(A){console.warn("加载 manifest 失败(编辑功能降级):",A),E(d)}},[t,s,a,d]);p.useEffect(()=>{i()},[i]),p.useEffect(()=>{o==="edit"&&!w&&x()},[o,w,x]);const r=async()=>{_("scale");try{await X.scaleDeployment(t,s,a,g),m({title:"伸缩成功",description:`副本数已设置为 ${g}`}),F(null),i()}catch(A){m({title:"操作失败",description:A?.message||String(A),variant:"destructive"})}finally{_("")}},h=async()=>{if(await u({title:"滚动重启",description:`确认滚动重启 Deployment "${a}"?`,confirmText:"重启"})){_("restart");try{await X.restartDeployment(t,s,a),m({title:"重启指令已下发",description:"Deployment 正在滚动重启"}),setTimeout(i,1500)}catch(ye){m({title:"重启失败",description:ye?.message||String(ye),variant:"destructive"})}finally{_("")}}},j=async()=>{const A=!!d?.paused,ye=A?"恢复":"暂停";if(await u({title:`${ye}滚动更新`,description:`确认${ye} Deployment "${a}" 的滚动更新?`,confirmText:ye})){_(A?"resume":"pause");try{A?await X.resumeDeployment(t,s,a):await X.pauseDeployment(t,s,a),m({title:`${ye}成功`,description:`Deployment 滚动更新已${ye}`}),setTimeout(i,1e3)}catch(je){m({title:`${ye}失败`,description:je?.message||String(je),variant:"destructive"})}finally{_("")}}},N=()=>{F({kind:"cicd"})},P=async()=>{if(J.trim()){_("image");try{await X.updateDeploymentImage(t,s,a,J),m({title:"镜像更新成功",description:`正在滚动更新为 ${J}`}),F(null),i()}catch(A){m({title:"更新失败",description:A?.message||String(A),variant:"destructive"})}finally{_("")}}},H=async()=>{_("delete");try{const A=ft.getState().token||"",De=`/api/v1/kubernetes/${t}/namespace/${s}/deployments/${a}`,je=await fetch(De,{method:"DELETE",headers:{Authorization:`Bearer ${A}`}});if(!je.ok)throw new Error(`HTTP ${je.status}`);m({title:"删除成功",description:`${a} 已删除`}),F(null),setTimeout(()=>c(`/kubernetes/${t}/namespace/${s}/deployments`),800)}catch(A){m({title:"删除失败",description:A?.message||String(A),variant:"destructive"})}finally{_("")}},de=A=>F({kind:"podLogs",pod:A.name}),we=A=>F({kind:"podYaml",pod:A.name}),pe=A=>{K(A.name)},R=A=>{ue(A.name)};if(Y)return e.jsx(W,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:229:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:230:9",className:"p-12 text-center",children:[e.jsx(be,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:231:11",className:"h-6 w-6 animate-spin mx-auto text-slate-500"}),e.jsx("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:232:11",className:"text-slate-500 mt-3",children:"加载中..."})]})});if(!d)return e.jsx(W,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:240:7",className:"bg-slate-900 border-slate-800",children:e.jsxs(G,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:241:9",className:"p-12 text-center",children:[e.jsx(Us,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:242:11",className:"h-8 w-8 mx-auto text-red-400"}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:243:11",className:"text-slate-400 mt-3",children:["未找到 Deployment: ",a]}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:244:11",variant:"outline",className:"mt-4",onClick:n,children:"返回"})]})});const oe=d.ready_replicas||d.readyReplicas||0,Ne=d.replicas||0,fe=oe===Ne&&Ne>0;return e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:256:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:258:7",className:"flex items-center justify-between gap-2 flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:259:9",className:"flex items-center gap-3 min-w-0",children:[e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:260:11",variant:"ghost",size:"sm",className:"text-slate-400",onClick:n,children:[e.jsx(Js,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:261:13",className:"h-4 w-4 mr-1"}),"返回"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:263:11",className:"min-w-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:264:13",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:265:15",className:"text-xl font-bold text-slate-100 truncate",children:a}),e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:266:15",variant:"outline",className:"border-slate-700 text-slate-400",children:s}),e.jsx(ne,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:267:15",variant:"outline",className:"border-slate-700 text-slate-400",children:"Deployment"}),e.jsxs(ne,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:268:15",className:fe?"bg-emerald-500/20 text-emerald-400 border-emerald-500/30":"bg-amber-500/20 text-amber-400 border-amber-500/30",children:[fe?e.jsx(gt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:273:30",className:"h-3 w-3 mr-1"}):e.jsx(xs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:273:73",className:"h-3 w-3 mr-1"}),oe,"/",Ne]}),d?.paused&&e.jsxs(ne,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:277:17",className:"bg-orange-500/20 text-orange-400 border-orange-500/30",children:[e.jsx(Gt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:278:19",className:"h-3 w-3 mr-1"}),"已暂停更新"]})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:282:13",className:"text-xs text-slate-500 mt-0.5 truncate",children:["镜像: ",e.jsx("code",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:283:19",className:"text-slate-400",children:d.image||"-"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:288:9",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:290:11",className:"inline-flex rounded-md border border-slate-700 overflow-hidden",children:[e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:291:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${o==="view"?"bg-slate-700 text-slate-100":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>l("view"),children:"查看"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:297:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${o==="edit"?"bg-blue-600 text-white":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>l("edit"),children:"编辑"}),e.jsx("button",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:303:13",className:`px-3 py-1.5 text-xs font-medium transition-colors ${o==="yaml"?"bg-emerald-600 text-white":"bg-transparent text-slate-400 hover:text-slate-200"}`,onClick:()=>l("yaml"),children:"YAML"})]}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:311:11",variant:"outline",size:"sm",className:"border-slate-700 text-slate-400",onClick:i,title:"刷新",children:e.jsx(We,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:312:13",className:"h-4 w-4"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:316:11",className:"flex items-center gap-1.5",children:[e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:317:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:()=>F({kind:"image"}),children:[e.jsx(Ks,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:318:15",className:"h-3.5 w-3.5 mr-1"}),"调整镜像"]}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:320:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:h,children:[e.jsx(is,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:321:15",className:"h-3.5 w-3.5 mr-1"}),"重启"]}),e.jsx(b,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:323:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",disabled:!!Z,onClick:j,children:d?.paused?e.jsxs(e.Fragment,{children:[e.jsx(ps,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:330:21",className:"h-3.5 w-3.5 mr-1 text-green-400"}),"恢复"]}):e.jsxs(e.Fragment,{children:[e.jsx(Gt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:331:21",className:"h-3.5 w-3.5 mr-1 text-orange-400"}),"暂停"]})}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:334:13",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:N,children:[e.jsx(Xs,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:335:15",className:"h-3.5 w-3.5 mr-1 text-purple-400"}),"CI/CD"]}),e.jsxs(b,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:337:13",variant:"outline",size:"sm",className:"border-slate-700 text-red-400 hover:bg-red-500/10",onClick:()=>F({kind:"delete"}),children:[e.jsx(he,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:338:15",className:"h-3.5 w-3.5 mr-1"}),"删除"]})]})]})]}),o==="view"?e.jsx(nn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:346:9",clusterCode:t,namespace:s,deployment:d,pods:y,replicaSets:C,revisions:z,onRefresh:i,onShowPodLogs:de,onShowPodTerminal:pe,onShowPodYaml:we,onShowPodFileBrowser:R}):o==="yaml"?e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:361:9",clusterCode:t,namespace:s,resource:"deployments",name:a,inline:!0,onSaved:i,onClose:()=>l("view")}):e.jsx(Dn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:372:9",clusterCode:t,namespace:s,deploymentName:a,manifest:w,onSaved:()=>{x(),i()},onCancel:()=>l("view")}),V?.kind==="yaml"&&e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:384:9",clusterCode:t,namespace:s,resource:"deployments",name:a,onClose:()=>F(null),onSaved:i}),e.jsx(Tn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:394:7",modal:V,deployment:d,namespace:s,deploymentName:a,newImage:J,setNewImage:ee,scaleValue:g,setScaleValue:O,actionLoading:Z,onClose:()=>F(null),onUpdateImage:P,onScaleTo:r,onDelete:H}),V?.kind==="cicd"&&e.jsx(Ke,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:412:9",title:"CI/CD Webhook",onClose:()=>F(null),children:e.jsx(Pn,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:413:11",clusterCode:t,namespace:s,deploymentName:a})}),V?.kind==="podYaml"&&e.jsx(mt,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:419:9",clusterCode:t,namespace:s,resource:"pods",name:V.pod,readOnly:!0,onClose:()=>F(null)}),V?.kind==="podLogs"&&e.jsx(An,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:431:9",clusterCode:t,namespace:s,podName:V.pod,containers:(y.find(A=>A.name===V.pod)?.containers||[]).map(A=>A.name).filter(Boolean),onClose:()=>F(null)}),e.jsx(Ds,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:441:7",open:!!q,onOpenChange:A=>{A||K(null)},clusterId:ke,namespace:s,podName:q||"",containers:(y.find(A=>A.name===q)?.containers||[]).map(A=>A.name).filter(Boolean)}),e.jsx(Ps,{"code-path":"src/components/kubernetes/DeploymentWorkload.tsx:450:7",open:!!le,onOpenChange:A=>{A||ue(null)},clusterCode:t,namespace:s,podName:le||"",containers:(y.find(A=>A.name===le)?.containers||[]).map(A=>A.name).filter(Boolean)})]})}function Qn(){const t=Es(),s=es(),a=t.clusterCode||"",o=t.namespace||"",n=t.name||"",l=t.mode==="edit"||t.mode==="yaml"?t.mode:"view",c=m=>{m!==l&&s(`/kubernetes/${a}/namespace/${o}/workload/${m}/Deployment/${n}`,{replace:!0})};return e.jsx(Hn,{"code-path":"src/components/kubernetes/DeploymentDetailPage.tsx:38:5",clusterCode:a,namespace:o,deploymentName:n,mode:l,onBack:()=>s(-1),onModeChange:c})}export{Qn as default}; diff --git a/backend/static/assets/DomainManager-AazO_ekQ.js b/backend/static/assets/DomainManager-CzXUFLGH.js similarity index 97% rename from backend/static/assets/DomainManager-AazO_ekQ.js rename to backend/static/assets/DomainManager-CzXUFLGH.js index f043f0d..c72146b 100644 --- a/backend/static/assets/DomainManager-AazO_ekQ.js +++ b/backend/static/assets/DomainManager-CzXUFLGH.js @@ -1 +1 @@ -import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{B as m,D as U,a as A,b as H,c as X,d as q,e as J}from"./index-LZWfu62c.js";import{I as l}from"./input-BdDauX3U.js";import{L as d}from"./label-u-lNUbKh.js";import{C as j,a as M}from"./card-B-RtdR4H.js";import{B as h}from"./badge-B0F5ZNtn.js";import{c as u}from"./account-Dzyhyahe.js";import{R as E,P as L,S as K,G as k,C as P,a as V,b as W,c as O,T as Y,L as Z}from"./vendor-icons-Aso0-eeY.js";function le(){const[i,b]=n.useState([]),[N,v]=n.useState(!0),[g,B]=n.useState(""),[D,F]=n.useState("all"),[I,p]=n.useState(!1),[f,_]=n.useState(!1),[r,y]=n.useState(null),[a,t]=n.useState({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""}),T=()=>{y(null),t({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""})},R=()=>{T(),p(!0)},$=s=>{y(s);const c=o=>o?o.substring(0,10):"";t({name:s.name||"",registrar:s.registrar||"",status:s.status||"active",expire_date:c(s.expire_date||""),dns_provider:s.dns_provider||s.dnsProvider||"",record_count:String(s.record_count??s.recordCount??""),ssl_enabled:s.ssl_enabled??s.sslEnabled??!1,ssl_expire_date:c(s.ssl_expire_date||"")}),p(!0)},z=async()=>{if(a.name.trim())try{_(!0);const s={name:a.name.trim(),registrar:a.registrar.trim(),status:a.status,expire_date:a.expire_date,dns_provider:a.dns_provider.trim(),record_count:Number(a.record_count)||0,ssl_enabled:a.ssl_enabled,ssl_expire_date:a.ssl_expire_date};r?await u.updateDomain(r.id,s):await u.createDomain(s),p(!1),x()}catch(s){console.error(r?"更新域名失败:":"创建域名失败:",s)}finally{_(!1)}},x=async()=>{try{v(!0);const s=await u.getDomains();b(s?.list||[])}catch(s){console.error("加载域名列表失败:",s),b([])}finally{v(!1)}};n.useEffect(()=>{x()},[]);const G=async s=>{try{await u.deleteDomain(s),x()}catch(c){console.error("删除域名失败:",c)}},w=i.filter(s=>{const c=(s.name||"").toLowerCase().includes(g.toLowerCase())||(s.registrar||"").toLowerCase().includes(g.toLowerCase()),o=D==="all"||s.status===D;return c&&o});i.length,i.filter(s=>s.status==="active").length,i.filter(s=>s.status==="expired").length,i.filter(s=>s.status==="pending").length,i.filter(s=>s.ssl_enabled||s.sslEnabled).length;const Q=s=>s?Math.ceil((new Date(s).getTime()-Date.now())/(1e3*60*60*24)):1/0;return e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:162:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:164:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:165:9",children:[e.jsx("h1",{"code-path":"src/components/cloud/DomainManager.tsx:166:11",className:"text-2xl font-bold text-slate-100",children:"域名管理"}),e.jsx("p",{"code-path":"src/components/cloud/DomainManager.tsx:167:11",className:"text-slate-400 mt-1",children:"管理域名注册信息和DNS解析记录"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:169:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:170:11",variant:"outline",onClick:x,className:"border-slate-700 text-slate-300",children:[e.jsx(E,{"code-path":"src/components/cloud/DomainManager.tsx:171:13",className:`h-4 w-4 mr-2 ${N?"animate-spin":""}`}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:174:11",className:"bg-blue-600 hover:bg-blue-700",onClick:R,children:[e.jsx(L,{"code-path":"src/components/cloud/DomainManager.tsx:175:13",className:"h-4 w-4 mr-2"}),"添加域名"]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:182:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:183:9",className:"relative flex-1 max-w-md",children:[e.jsx(K,{"code-path":"src/components/cloud/DomainManager.tsx:184:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:185:11",placeholder:"搜索域名...",value:g,onChange:s=>B(s.target.value),className:"pl-10 bg-slate-800 border-slate-700 text-slate-100"})]}),e.jsxs("select",{"code-path":"src/components/cloud/DomainManager.tsx:192:9",value:D,onChange:s=>F(s.target.value),className:"px-3 py-2 bg-slate-800 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:197:11",value:"all",children:"全部状态"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:198:11",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:199:11",value:"expired",children:"已过期"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:200:11",value:"pending",children:"待审核"})]})]}),N?e.jsx(j,{"code-path":"src/components/cloud/DomainManager.tsx:206:9",className:"bg-slate-800 border-slate-700",children:e.jsxs(M,{"code-path":"src/components/cloud/DomainManager.tsx:207:11",className:"p-12 text-center text-slate-500",children:[e.jsx(E,{"code-path":"src/components/cloud/DomainManager.tsx:208:13",className:"h-6 w-6 animate-spin mx-auto mb-3"}),"加载中..."]})}):w.length===0?e.jsx(j,{"code-path":"src/components/cloud/DomainManager.tsx:213:9",className:"bg-slate-800 border-slate-700",children:e.jsx(M,{"code-path":"src/components/cloud/DomainManager.tsx:214:11",className:"p-12 text-center text-slate-500",children:"暂无域名数据"})}):e.jsx("div",{"code-path":"src/components/cloud/DomainManager.tsx:217:9",className:"space-y-3",children:w.map(s=>{const c=s.ssl_enabled||s.sslEnabled,o=s.expire_date||s.expireDate||"",C=s.ssl_expire_date||s.sslExpireDate||"",S=Q(o);return e.jsx(j,{"code-path":"src/components/cloud/DomainManager.tsx:224:15",className:"bg-slate-800 border-slate-700",children:e.jsx(M,{"code-path":"src/components/cloud/DomainManager.tsx:225:17",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:226:19",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:227:21",className:"flex items-center gap-4",children:[e.jsx("div",{"code-path":"src/components/cloud/DomainManager.tsx:228:23",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-blue-500 to-cyan-500 flex items-center justify-center",children:e.jsx(k,{"code-path":"src/components/cloud/DomainManager.tsx:229:25",className:"h-5 w-5 text-white"})}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:231:23",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:232:25",className:"flex items-center gap-2",children:[e.jsx("h3",{"code-path":"src/components/cloud/DomainManager.tsx:233:27",className:"font-medium text-slate-100 text-lg",children:s.name}),s.status==="active"&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:235:29",className:"bg-green-500/20 text-green-400 border-0",children:[e.jsx(P,{"code-path":"src/components/cloud/DomainManager.tsx:236:31",className:"h-3 w-3 mr-1"}),"正常"]}),s.status==="expired"&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:241:29",className:"bg-red-500/20 text-red-400 border-0",children:[e.jsx(V,{"code-path":"src/components/cloud/DomainManager.tsx:242:31",className:"h-3 w-3 mr-1"}),"已过期"]}),s.status==="pending"&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:247:29",className:"bg-yellow-500/20 text-yellow-400 border-0",children:[e.jsx(W,{"code-path":"src/components/cloud/DomainManager.tsx:248:31",className:"h-3 w-3 mr-1"}),"待审核"]}),c&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:253:29",className:"bg-cyan-500/20 text-cyan-400 border-0",children:[e.jsx(P,{"code-path":"src/components/cloud/DomainManager.tsx:254:31",className:"h-3 w-3 mr-1"}),"SSL"]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:259:25",className:"flex items-center gap-4 mt-1 text-sm text-slate-400",children:[e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:260:27",children:["注册商: ",s.registrar||"-"]}),e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:261:27",children:["DNS: ",s.dns_provider||s.dnsProvider||"-"]}),e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:262:27",children:["解析记录: ",s.record_count??s.recordCount??0,"条"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:266:21",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:267:23",className:"text-right",children:[e.jsx("p",{"code-path":"src/components/cloud/DomainManager.tsx:268:25",className:"text-sm text-slate-400",children:"到期时间"}),e.jsxs("p",{"code-path":"src/components/cloud/DomainManager.tsx:269:25",className:`text-sm font-medium ${S<30?"text-red-400":"text-slate-200"}`,children:[o?o.substring(0,10):"-",o&&` (${S}天)`,c&&C&&e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:272:29",className:"text-slate-500",children:[" · SSL: ",C.substring(0,10)]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:276:23",className:"flex items-center gap-1",children:[e.jsx(m,{"code-path":"src/components/cloud/DomainManager.tsx:277:25",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400",onClick:()=>$(s),children:e.jsx(O,{"code-path":"src/components/cloud/DomainManager.tsx:283:27",className:"h-4 w-4"})}),e.jsx(m,{"code-path":"src/components/cloud/DomainManager.tsx:285:25",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>G(s.id),children:e.jsx(Y,{"code-path":"src/components/cloud/DomainManager.tsx:291:27",className:"h-4 w-4"})})]})]})]})})},s.id)})}),e.jsx(U,{"code-path":"src/components/cloud/DomainManager.tsx:304:7",open:I,onOpenChange:p,children:e.jsxs(A,{"code-path":"src/components/cloud/DomainManager.tsx:305:9",className:"bg-slate-800 border-slate-700 text-slate-100 max-w-lg",children:[e.jsxs(H,{"code-path":"src/components/cloud/DomainManager.tsx:306:11",children:[e.jsxs(X,{"code-path":"src/components/cloud/DomainManager.tsx:307:13",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(k,{"code-path":"src/components/cloud/DomainManager.tsx:308:15",className:"h-5 w-5 text-blue-400"}),r?"编辑域名":"添加域名"]}),e.jsx(q,{"code-path":"src/components/cloud/DomainManager.tsx:311:13",className:"text-slate-400",children:r?"修改域名注册信息、DNS 配置和 SSL 证书状态":"录入域名信息,包括注册商、DNS 服务商和到期时间"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:316:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:317:13",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:318:15",className:"text-slate-300",children:"域名 *"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:319:15",placeholder:"example.com",value:a.name,onChange:s=>t({...a,name:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:327:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:328:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:329:17",className:"text-slate-300",children:"注册商"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:330:17",placeholder:"阿里云 / Cloudflare ...",value:a.registrar,onChange:s=>t({...a,registrar:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:337:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:338:17",className:"text-slate-300",children:"状态"}),e.jsxs("select",{"code-path":"src/components/cloud/DomainManager.tsx:339:17",value:a.status,onChange:s=>t({...a,status:s.target.value}),className:"w-full px-3 py-2 bg-slate-900 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:344:19",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:345:19",value:"expired",children:"已过期"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:346:19",value:"pending",children:"待审核"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:351:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:352:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:353:17",className:"text-slate-300",children:"到期时间"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:354:17",type:"date",value:a.expire_date,onChange:s=>t({...a,expire_date:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:361:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:362:17",className:"text-slate-300",children:"DNS 服务商"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:363:17",placeholder:"Cloudflare / DNSPod ...",value:a.dns_provider,onChange:s=>t({...a,dns_provider:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:372:13",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:373:15",className:"text-slate-300",children:"解析记录数"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:374:15",type:"number",placeholder:"0",value:a.record_count,onChange:s=>t({...a,record_count:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:383:13",className:"grid grid-cols-2 gap-4 items-end",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:384:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:385:17",className:"text-slate-300",children:"SSL 证书到期"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:386:17",type:"date",value:a.ssl_expire_date,onChange:s=>t({...a,ssl_expire_date:s.target.value}),disabled:!a.ssl_enabled,className:"bg-slate-900 border-slate-700 text-slate-100 disabled:opacity-40"})]}),e.jsxs("label",{"code-path":"src/components/cloud/DomainManager.tsx:394:15",className:"flex items-center gap-2 cursor-pointer pb-2",children:[e.jsx("input",{"code-path":"src/components/cloud/DomainManager.tsx:395:17",type:"checkbox",checked:a.ssl_enabled,onChange:s=>t({...a,ssl_enabled:s.target.checked}),className:"h-4 w-4 rounded border-slate-600 bg-slate-900 accent-cyan-500"}),e.jsx("span",{"code-path":"src/components/cloud/DomainManager.tsx:401:17",className:"text-slate-300 text-sm",children:"启用 SSL"})]})]})]}),e.jsxs(J,{"code-path":"src/components/cloud/DomainManager.tsx:406:11",children:[e.jsx(m,{"code-path":"src/components/cloud/DomainManager.tsx:407:13",variant:"outline",onClick:()=>p(!1),className:"border-slate-700 text-slate-300",children:"取消"}),e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:410:13",className:"bg-blue-600 hover:bg-blue-700",disabled:!a.name.trim()||f,onClick:z,children:[f?e.jsx(Z,{"code-path":"src/components/cloud/DomainManager.tsx:415:29",className:"h-4 w-4 mr-2 animate-spin"}):r?e.jsx(O,{"code-path":"src/components/cloud/DomainManager.tsx:415:97",className:"h-4 w-4 mr-2"}):e.jsx(L,{"code-path":"src/components/cloud/DomainManager.tsx:415:134",className:"h-4 w-4 mr-2"}),r?"保存修改":"创建域名"]})]})]})})]})}export{le as DomainManager}; +import{r as n,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{B as m,D as U,a as A,b as H,c as X,d as q,e as J}from"./index-Bp-M7P_8.js";import{I as l}from"./input-Bnlm--la.js";import{L as d}from"./label-NkONM5Mp.js";import{C as j,a as M}from"./card-BHSBTtub.js";import{B as h}from"./badge-B00SZHvE.js";import{c as u}from"./account-CeWzarwh.js";import{R as E,P as L,S as K,G as k,C as P,a as V,b as W,c as O,T as Y,L as Z}from"./vendor-icons-BWk-DH7F.js";function le(){const[i,b]=n.useState([]),[N,v]=n.useState(!0),[g,B]=n.useState(""),[D,F]=n.useState("all"),[I,p]=n.useState(!1),[f,_]=n.useState(!1),[r,y]=n.useState(null),[a,t]=n.useState({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""}),T=()=>{y(null),t({name:"",registrar:"",status:"active",expire_date:"",dns_provider:"",record_count:"",ssl_enabled:!1,ssl_expire_date:""})},R=()=>{T(),p(!0)},$=s=>{y(s);const c=o=>o?o.substring(0,10):"";t({name:s.name||"",registrar:s.registrar||"",status:s.status||"active",expire_date:c(s.expire_date||""),dns_provider:s.dns_provider||s.dnsProvider||"",record_count:String(s.record_count??s.recordCount??""),ssl_enabled:s.ssl_enabled??s.sslEnabled??!1,ssl_expire_date:c(s.ssl_expire_date||"")}),p(!0)},z=async()=>{if(a.name.trim())try{_(!0);const s={name:a.name.trim(),registrar:a.registrar.trim(),status:a.status,expire_date:a.expire_date,dns_provider:a.dns_provider.trim(),record_count:Number(a.record_count)||0,ssl_enabled:a.ssl_enabled,ssl_expire_date:a.ssl_expire_date};r?await u.updateDomain(r.id,s):await u.createDomain(s),p(!1),x()}catch(s){console.error(r?"更新域名失败:":"创建域名失败:",s)}finally{_(!1)}},x=async()=>{try{v(!0);const s=await u.getDomains();b(s?.list||[])}catch(s){console.error("加载域名列表失败:",s),b([])}finally{v(!1)}};n.useEffect(()=>{x()},[]);const G=async s=>{try{await u.deleteDomain(s),x()}catch(c){console.error("删除域名失败:",c)}},w=i.filter(s=>{const c=(s.name||"").toLowerCase().includes(g.toLowerCase())||(s.registrar||"").toLowerCase().includes(g.toLowerCase()),o=D==="all"||s.status===D;return c&&o});i.length,i.filter(s=>s.status==="active").length,i.filter(s=>s.status==="expired").length,i.filter(s=>s.status==="pending").length,i.filter(s=>s.ssl_enabled||s.sslEnabled).length;const Q=s=>s?Math.ceil((new Date(s).getTime()-Date.now())/(1e3*60*60*24)):1/0;return e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:162:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:164:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:165:9",children:[e.jsx("h1",{"code-path":"src/components/cloud/DomainManager.tsx:166:11",className:"text-2xl font-bold text-slate-100",children:"域名管理"}),e.jsx("p",{"code-path":"src/components/cloud/DomainManager.tsx:167:11",className:"text-slate-400 mt-1",children:"管理域名注册信息和DNS解析记录"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:169:9",className:"flex items-center gap-2",children:[e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:170:11",variant:"outline",onClick:x,className:"border-slate-700 text-slate-300",children:[e.jsx(E,{"code-path":"src/components/cloud/DomainManager.tsx:171:13",className:`h-4 w-4 mr-2 ${N?"animate-spin":""}`}),"刷新"]}),e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:174:11",className:"bg-blue-600 hover:bg-blue-700",onClick:R,children:[e.jsx(L,{"code-path":"src/components/cloud/DomainManager.tsx:175:13",className:"h-4 w-4 mr-2"}),"添加域名"]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:182:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:183:9",className:"relative flex-1 max-w-md",children:[e.jsx(K,{"code-path":"src/components/cloud/DomainManager.tsx:184:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:185:11",placeholder:"搜索域名...",value:g,onChange:s=>B(s.target.value),className:"pl-10 bg-slate-800 border-slate-700 text-slate-100"})]}),e.jsxs("select",{"code-path":"src/components/cloud/DomainManager.tsx:192:9",value:D,onChange:s=>F(s.target.value),className:"px-3 py-2 bg-slate-800 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:197:11",value:"all",children:"全部状态"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:198:11",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:199:11",value:"expired",children:"已过期"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:200:11",value:"pending",children:"待审核"})]})]}),N?e.jsx(j,{"code-path":"src/components/cloud/DomainManager.tsx:206:9",className:"bg-slate-800 border-slate-700",children:e.jsxs(M,{"code-path":"src/components/cloud/DomainManager.tsx:207:11",className:"p-12 text-center text-slate-500",children:[e.jsx(E,{"code-path":"src/components/cloud/DomainManager.tsx:208:13",className:"h-6 w-6 animate-spin mx-auto mb-3"}),"加载中..."]})}):w.length===0?e.jsx(j,{"code-path":"src/components/cloud/DomainManager.tsx:213:9",className:"bg-slate-800 border-slate-700",children:e.jsx(M,{"code-path":"src/components/cloud/DomainManager.tsx:214:11",className:"p-12 text-center text-slate-500",children:"暂无域名数据"})}):e.jsx("div",{"code-path":"src/components/cloud/DomainManager.tsx:217:9",className:"space-y-3",children:w.map(s=>{const c=s.ssl_enabled||s.sslEnabled,o=s.expire_date||s.expireDate||"",C=s.ssl_expire_date||s.sslExpireDate||"",S=Q(o);return e.jsx(j,{"code-path":"src/components/cloud/DomainManager.tsx:224:15",className:"bg-slate-800 border-slate-700",children:e.jsx(M,{"code-path":"src/components/cloud/DomainManager.tsx:225:17",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:226:19",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:227:21",className:"flex items-center gap-4",children:[e.jsx("div",{"code-path":"src/components/cloud/DomainManager.tsx:228:23",className:"w-10 h-10 rounded-lg bg-gradient-to-br from-blue-500 to-cyan-500 flex items-center justify-center",children:e.jsx(k,{"code-path":"src/components/cloud/DomainManager.tsx:229:25",className:"h-5 w-5 text-white"})}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:231:23",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:232:25",className:"flex items-center gap-2",children:[e.jsx("h3",{"code-path":"src/components/cloud/DomainManager.tsx:233:27",className:"font-medium text-slate-100 text-lg",children:s.name}),s.status==="active"&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:235:29",className:"bg-green-500/20 text-green-400 border-0",children:[e.jsx(P,{"code-path":"src/components/cloud/DomainManager.tsx:236:31",className:"h-3 w-3 mr-1"}),"正常"]}),s.status==="expired"&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:241:29",className:"bg-red-500/20 text-red-400 border-0",children:[e.jsx(V,{"code-path":"src/components/cloud/DomainManager.tsx:242:31",className:"h-3 w-3 mr-1"}),"已过期"]}),s.status==="pending"&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:247:29",className:"bg-yellow-500/20 text-yellow-400 border-0",children:[e.jsx(W,{"code-path":"src/components/cloud/DomainManager.tsx:248:31",className:"h-3 w-3 mr-1"}),"待审核"]}),c&&e.jsxs(h,{"code-path":"src/components/cloud/DomainManager.tsx:253:29",className:"bg-cyan-500/20 text-cyan-400 border-0",children:[e.jsx(P,{"code-path":"src/components/cloud/DomainManager.tsx:254:31",className:"h-3 w-3 mr-1"}),"SSL"]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:259:25",className:"flex items-center gap-4 mt-1 text-sm text-slate-400",children:[e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:260:27",children:["注册商: ",s.registrar||"-"]}),e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:261:27",children:["DNS: ",s.dns_provider||s.dnsProvider||"-"]}),e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:262:27",children:["解析记录: ",s.record_count??s.recordCount??0,"条"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:266:21",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:267:23",className:"text-right",children:[e.jsx("p",{"code-path":"src/components/cloud/DomainManager.tsx:268:25",className:"text-sm text-slate-400",children:"到期时间"}),e.jsxs("p",{"code-path":"src/components/cloud/DomainManager.tsx:269:25",className:`text-sm font-medium ${S<30?"text-red-400":"text-slate-200"}`,children:[o?o.substring(0,10):"-",o&&` (${S}天)`,c&&C&&e.jsxs("span",{"code-path":"src/components/cloud/DomainManager.tsx:272:29",className:"text-slate-500",children:[" · SSL: ",C.substring(0,10)]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:276:23",className:"flex items-center gap-1",children:[e.jsx(m,{"code-path":"src/components/cloud/DomainManager.tsx:277:25",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400",onClick:()=>$(s),children:e.jsx(O,{"code-path":"src/components/cloud/DomainManager.tsx:283:27",className:"h-4 w-4"})}),e.jsx(m,{"code-path":"src/components/cloud/DomainManager.tsx:285:25",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>G(s.id),children:e.jsx(Y,{"code-path":"src/components/cloud/DomainManager.tsx:291:27",className:"h-4 w-4"})})]})]})]})})},s.id)})}),e.jsx(U,{"code-path":"src/components/cloud/DomainManager.tsx:304:7",open:I,onOpenChange:p,children:e.jsxs(A,{"code-path":"src/components/cloud/DomainManager.tsx:305:9",className:"bg-slate-800 border-slate-700 text-slate-100 max-w-lg",children:[e.jsxs(H,{"code-path":"src/components/cloud/DomainManager.tsx:306:11",children:[e.jsxs(X,{"code-path":"src/components/cloud/DomainManager.tsx:307:13",className:"text-slate-100 flex items-center gap-2",children:[e.jsx(k,{"code-path":"src/components/cloud/DomainManager.tsx:308:15",className:"h-5 w-5 text-blue-400"}),r?"编辑域名":"添加域名"]}),e.jsx(q,{"code-path":"src/components/cloud/DomainManager.tsx:311:13",className:"text-slate-400",children:r?"修改域名注册信息、DNS 配置和 SSL 证书状态":"录入域名信息,包括注册商、DNS 服务商和到期时间"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:316:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:317:13",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:318:15",className:"text-slate-300",children:"域名 *"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:319:15",placeholder:"example.com",value:a.name,onChange:s=>t({...a,name:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:327:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:328:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:329:17",className:"text-slate-300",children:"注册商"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:330:17",placeholder:"阿里云 / Cloudflare ...",value:a.registrar,onChange:s=>t({...a,registrar:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:337:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:338:17",className:"text-slate-300",children:"状态"}),e.jsxs("select",{"code-path":"src/components/cloud/DomainManager.tsx:339:17",value:a.status,onChange:s=>t({...a,status:s.target.value}),className:"w-full px-3 py-2 bg-slate-900 border border-slate-700 rounded-md text-slate-100 text-sm",children:[e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:344:19",value:"active",children:"正常"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:345:19",value:"expired",children:"已过期"}),e.jsx("option",{"code-path":"src/components/cloud/DomainManager.tsx:346:19",value:"pending",children:"待审核"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:351:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:352:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:353:17",className:"text-slate-300",children:"到期时间"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:354:17",type:"date",value:a.expire_date,onChange:s=>t({...a,expire_date:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:361:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:362:17",className:"text-slate-300",children:"DNS 服务商"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:363:17",placeholder:"Cloudflare / DNSPod ...",value:a.dns_provider,onChange:s=>t({...a,dns_provider:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:372:13",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:373:15",className:"text-slate-300",children:"解析记录数"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:374:15",type:"number",placeholder:"0",value:a.record_count,onChange:s=>t({...a,record_count:s.target.value}),className:"bg-slate-900 border-slate-700 text-slate-100"})]}),e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:383:13",className:"grid grid-cols-2 gap-4 items-end",children:[e.jsxs("div",{"code-path":"src/components/cloud/DomainManager.tsx:384:15",className:"space-y-2",children:[e.jsx(d,{"code-path":"src/components/cloud/DomainManager.tsx:385:17",className:"text-slate-300",children:"SSL 证书到期"}),e.jsx(l,{"code-path":"src/components/cloud/DomainManager.tsx:386:17",type:"date",value:a.ssl_expire_date,onChange:s=>t({...a,ssl_expire_date:s.target.value}),disabled:!a.ssl_enabled,className:"bg-slate-900 border-slate-700 text-slate-100 disabled:opacity-40"})]}),e.jsxs("label",{"code-path":"src/components/cloud/DomainManager.tsx:394:15",className:"flex items-center gap-2 cursor-pointer pb-2",children:[e.jsx("input",{"code-path":"src/components/cloud/DomainManager.tsx:395:17",type:"checkbox",checked:a.ssl_enabled,onChange:s=>t({...a,ssl_enabled:s.target.checked}),className:"h-4 w-4 rounded border-slate-600 bg-slate-900 accent-cyan-500"}),e.jsx("span",{"code-path":"src/components/cloud/DomainManager.tsx:401:17",className:"text-slate-300 text-sm",children:"启用 SSL"})]})]})]}),e.jsxs(J,{"code-path":"src/components/cloud/DomainManager.tsx:406:11",children:[e.jsx(m,{"code-path":"src/components/cloud/DomainManager.tsx:407:13",variant:"outline",onClick:()=>p(!1),className:"border-slate-700 text-slate-300",children:"取消"}),e.jsxs(m,{"code-path":"src/components/cloud/DomainManager.tsx:410:13",className:"bg-blue-600 hover:bg-blue-700",disabled:!a.name.trim()||f,onClick:z,children:[f?e.jsx(Z,{"code-path":"src/components/cloud/DomainManager.tsx:415:29",className:"h-4 w-4 mr-2 animate-spin"}):r?e.jsx(O,{"code-path":"src/components/cloud/DomainManager.tsx:415:97",className:"h-4 w-4 mr-2"}):e.jsx(L,{"code-path":"src/components/cloud/DomainManager.tsx:415:134",className:"h-4 w-4 mr-2"}),r?"保存修改":"创建域名"]})]})]})})]})}export{le as DomainManager}; diff --git a/backend/static/assets/EventTable-D9T7PrIy.js b/backend/static/assets/EventTable-D9T7PrIy.js new file mode 100644 index 0000000..a688763 --- /dev/null +++ b/backend/static/assets/EventTable-D9T7PrIy.js @@ -0,0 +1 @@ +import{r as k,j as t}from"./vendor-codemirror-B1SGo4xl.js";import{B as f}from"./badge-B00SZHvE.js";import{T as N,a as y,b as p,c as o,d as $,e as r}from"./table-u8V9iTZf.js";import{f as _,a as K,e as C}from"./k8s-yaml-utils-4KZB_Bq_.js";import{L as S}from"./vendor-icons-BWk-DH7F.js";function z(e){const a=e.object_kind||e.objectKind||"",n=e.object_name||e.objectName||"",c=e.object||(a&&n?`${a}/${n}`:"")||"",d=e.first_time||e.firstTime||e.first_timestamp||e.firstTimestamp||"",i=e.last_time||e.lastTime||e.last_timestamp||e.lastTimestamp||"",x=e.event_time||e.eventTime||"",b=Number(e.count)>0?Number(e.count):1,l=e.source||e.source_component||e.sourceComponent||(e.source?.component?`${e.source.component}${e.source.host?`@${e.source.host}`:""}`:"")||"-";return{name:e.name||"",namespace:e.namespace||"",type:e.type||"Normal",reason:e.reason||"-",message:e.message||"-",object:c||"-",objectKind:a,objectName:n,source:l,count:b,firstTime:d||x,lastTime:i||x,eventTime:x}}function B(e){if(!e)return"";const a=Date.now()-new Date(e).getTime();if(a<0)return"";const n=Math.floor(a/6e4);if(n<1)return"刚刚";if(n<60)return`${n}分钟前`;const c=Math.floor(n/60);return c<24?`${c}小时前`:`${Math.floor(c/24)}天前`}function D(e,a,n){if(n<=1)return"-";const c=K(C(e,a));return c==="-"?`×${n}`:`${c} · ×${n}`}function j(e){return{absolute:_(e),relative:B(e)}}function q({events:e,loading:a=!1,emptyText:n="暂无事件",maxRows:c,showNamespace:d=!1}){const[i,x]=k.useState(null),b=a===!0||a==="events",l=c?e.slice(0,c):e,v=d?10:9;return t.jsxs("div",{"code-path":"src/components/kubernetes/EventTable.tsx:35:5",className:"overflow-x-auto",children:[t.jsxs(N,{"code-path":"src/components/kubernetes/EventTable.tsx:36:7",children:[t.jsx(y,{"code-path":"src/components/kubernetes/EventTable.tsx:37:9",children:t.jsxs(p,{"code-path":"src/components/kubernetes/EventTable.tsx:38:11",className:"border-[var(--dg-border)] hover:bg-transparent",children:[t.jsx(o,{"code-path":"src/components/kubernetes/EventTable.tsx:39:13",className:"text-[var(--dg-text-muted)] w-[148px]",children:"最后时间"}),t.jsx(o,{"code-path":"src/components/kubernetes/EventTable.tsx:40:13",className:"text-[var(--dg-text-muted)] w-[148px]",children:"首次时间"}),t.jsx(o,{"code-path":"src/components/kubernetes/EventTable.tsx:41:13",className:"text-[var(--dg-text-muted)] w-16 text-center",children:"次数"}),t.jsx(o,{"code-path":"src/components/kubernetes/EventTable.tsx:42:13",className:"text-[var(--dg-text-muted)] w-20",children:"重复"}),t.jsx(o,{"code-path":"src/components/kubernetes/EventTable.tsx:43:13",className:"text-[var(--dg-text-muted)] w-20",children:"类型"}),t.jsx(o,{"code-path":"src/components/kubernetes/EventTable.tsx:44:13",className:"text-[var(--dg-text-muted)] w-28",children:"原因"}),t.jsx(o,{"code-path":"src/components/kubernetes/EventTable.tsx:45:13",className:"text-[var(--dg-text-muted)] min-w-[120px]",children:"对象"}),d&&t.jsx(o,{"code-path":"src/components/kubernetes/EventTable.tsx:46:31",className:"text-[var(--dg-text-muted)] w-24",children:"命名空间"}),t.jsx(o,{"code-path":"src/components/kubernetes/EventTable.tsx:47:13",className:"text-[var(--dg-text-muted)] w-28",children:"来源"}),t.jsx(o,{"code-path":"src/components/kubernetes/EventTable.tsx:48:13",className:"text-[var(--dg-text-muted)] min-w-[200px]",children:"消息"})]})}),t.jsx($,{"code-path":"src/components/kubernetes/EventTable.tsx:51:9",children:b?t.jsx(p,{"code-path":"src/components/kubernetes/EventTable.tsx:53:13",children:t.jsx(r,{"code-path":"src/components/kubernetes/EventTable.tsx:54:15",colSpan:v,className:"text-center py-10",children:t.jsx(S,{"code-path":"src/components/kubernetes/EventTable.tsx:55:17",className:"h-5 w-5 animate-spin mx-auto text-[var(--dg-text-muted)]"})})}):l.length===0?t.jsx(p,{"code-path":"src/components/kubernetes/EventTable.tsx:59:13",children:t.jsx(r,{"code-path":"src/components/kubernetes/EventTable.tsx:60:15",colSpan:v,className:"text-center text-[var(--dg-text-muted)] py-10",children:n})}):l.map((s,g)=>{const u=`${s.name||s.object}-${g}`,m=i===u,E=s.type==="Warning",h=j(s.lastTime),T=j(s.firstTime);return t.jsxs(p,{"code-path":"src/components/kubernetes/EventTable.tsx:69:15",className:`border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-tertiary)]/40 ${m?"bg-[var(--dg-bg-tertiary)]/30":""}`,onClick:()=>x(m?null:u),children:[t.jsxs(r,{"code-path":"src/components/kubernetes/EventTable.tsx:74:17",className:"text-xs text-[var(--dg-text-muted)]",children:[t.jsx("div",{"code-path":"src/components/kubernetes/EventTable.tsx:75:19",children:h.absolute}),t.jsx("div",{"code-path":"src/components/kubernetes/EventTable.tsx:76:19",className:"text-[10px]",children:h.relative})]}),t.jsxs(r,{"code-path":"src/components/kubernetes/EventTable.tsx:78:17",className:"text-xs text-[var(--dg-text-muted)]",children:[t.jsx("div",{"code-path":"src/components/kubernetes/EventTable.tsx:79:19",children:T.absolute}),t.jsx("div",{"code-path":"src/components/kubernetes/EventTable.tsx:80:19",className:"text-[10px]",children:T.relative})]}),t.jsx(r,{"code-path":"src/components/kubernetes/EventTable.tsx:82:17",className:"text-sm text-center tabular-nums text-[var(--dg-text-secondary)]",children:s.count}),t.jsx(r,{"code-path":"src/components/kubernetes/EventTable.tsx:83:17",className:"text-xs text-[var(--dg-text-muted)]",children:D(s.firstTime,s.lastTime,s.count)}),t.jsx(r,{"code-path":"src/components/kubernetes/EventTable.tsx:84:17",children:t.jsx(f,{"code-path":"src/components/kubernetes/EventTable.tsx:85:19",variant:"outline",className:E?"text-[var(--dg-warning)] border-[var(--dg-warning)]/30 text-[10px]":"text-[var(--dg-text-muted)] border-[var(--dg-border)] text-[10px]",children:s.type})}),t.jsx(r,{"code-path":"src/components/kubernetes/EventTable.tsx:94:17",className:"text-xs font-medium text-[var(--dg-text-secondary)]",children:s.reason}),t.jsx(r,{"code-path":"src/components/kubernetes/EventTable.tsx:95:17",className:"text-xs font-mono text-[var(--dg-text-muted)]",children:s.objectKind?t.jsxs("span",{"code-path":"src/components/kubernetes/EventTable.tsx:97:21",children:[t.jsx("span",{"code-path":"src/components/kubernetes/EventTable.tsx:97:27",className:"text-[var(--dg-text-secondary)]",children:s.objectKind}),"/",s.objectName||s.object.split("/").pop()]}):s.object}),d&&t.jsx(r,{"code-path":"src/components/kubernetes/EventTable.tsx:100:35",className:"text-xs text-[var(--dg-text-muted)]",children:s.namespace||"-"}),t.jsx(r,{"code-path":"src/components/kubernetes/EventTable.tsx:101:17",className:"text-xs text-[var(--dg-text-muted)] font-mono",children:s.source}),t.jsxs(r,{"code-path":"src/components/kubernetes/EventTable.tsx:102:17",className:"text-xs text-[var(--dg-text-secondary)] max-w-[360px]",children:[t.jsx("div",{"code-path":"src/components/kubernetes/EventTable.tsx:103:19",className:`${m?"whitespace-normal break-words":"truncate"}`,title:m?void 0:s.message,children:s.message}),m&&s.name&&t.jsxs("div",{"code-path":"src/components/kubernetes/EventTable.tsx:107:21",className:"mt-1 pt-1 border-t border-[var(--dg-border)] text-[10px] text-[var(--dg-text-muted)]",children:["事件名: ",s.name]})]})]},u)})})]}),c&&e.length>c&&t.jsxs("div",{"code-path":"src/components/kubernetes/EventTable.tsx:118:9",className:"text-center py-2 text-xs text-[var(--dg-text-muted)] border-t border-[var(--dg-border)]",children:["仅显示前 ",c," 条,共 ",e.length," 条"]})]})}export{q as E,B as f,z as n}; diff --git a/backend/static/assets/EventsPage-CF9p9_2z.js b/backend/static/assets/EventsPage-CF9p9_2z.js new file mode 100644 index 0000000..b62cf90 --- /dev/null +++ b/backend/static/assets/EventsPage-CF9p9_2z.js @@ -0,0 +1 @@ +import{r as t,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as S,a as C}from"./card-BHSBTtub.js";import{g as Q,i as Y,L,B as Z}from"./index-Bp-M7P_8.js";import{S as j,a as P,b as N,c as f,d}from"./select-DbhcBWnH.js";import{k as y}from"./index-BkulU9RM.js";import{n as ee,f as se,E as te}from"./EventTable-D9T7PrIy.js";import{f as z,t as ne,R as ae,X as F,l as ce}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";import"./badge-B00SZHvE.js";import"./table-u8V9iTZf.js";import"./k8s-yaml-utils-4KZB_Bq_.js";function M({title:g,items:x,selected:m,onSelect:b,emptyText:l}){const k=Math.max(...x.map(o=>o.count),1);return e.jsx(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:27:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:28:7",className:"p-4",children:[e.jsx("h3",{"code-path":"src/components/kubernetes/EventsPage.tsx:29:9",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-3",children:g}),x.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:31:11",className:"text-xs text-[var(--dg-text-muted)] py-6 text-center",children:l||"暂无数据"}):e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:33:11",className:"space-y-1.5 max-h-[220px] overflow-y-auto pr-1",children:x.map(o=>{const h=m===o.name;return e.jsxs("button",{"code-path":"src/components/kubernetes/EventsPage.tsx:37:17",type:"button",className:`w-full flex items-center gap-2 rounded px-2 py-1.5 text-left transition-colors ${h?"bg-[var(--dg-bg-tertiary)]":"hover:bg-[var(--dg-bg-tertiary)]/60"}`,onClick:()=>b?.(h?"":o.name),children:[e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:45:19",className:"w-[88px] shrink-0 truncate text-xs text-[var(--dg-text-secondary)]",title:o.name,children:o.name}),e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:48:19",className:"flex-1 h-1.5 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:49:21",className:`h-full rounded-full ${h?"bg-[var(--dg-accent)]":"bg-[var(--dg-text-muted)]/50"}`,style:{width:`${o.count/k*100}%`}})}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:54:19",className:"w-8 text-right text-xs tabular-nums text-[var(--dg-text-muted)]",children:o.count})]},o.name)})})]})})}function w({label:g,value:x,hint:m}){return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:67:5",className:"px-4 py-3 border-r border-[var(--dg-border)] last:border-r-0",children:[e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:68:7",className:"text-xs text-[var(--dg-text-muted)]",children:g}),e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:69:7",className:"text-xl font-semibold tabular-nums text-[var(--dg-text-primary)] mt-0.5",children:x}),m&&e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:70:16",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5",children:m})]})}function ve(){const{clusterCode:g}=Q(),x=Y(),[m,b]=t.useState(!1),[l,k]=t.useState([]),[o,h]=t.useState([]),[U,X]=t.useState([]),[u,q]=t.useState("all"),[E,G]=t.useState("all"),[v,H]=t.useState("0"),[a,W]=t.useState(g||""),[r,D]=t.useState(null),[i,R]=t.useState(""),[p,T]=t.useState("");t.useEffect(()=>{y.getClusters().then(s=>{const c=s?.list||[];if(h(c),!a&&c.length>0){const n=c[0].code||String(c[0].id);W(n),x(`/kubernetes/${n}/events`,{replace:!0})}}).catch(()=>{})},[]),t.useEffect(()=>{a&&y.getNamespaces(a).then(s=>{X(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const _=t.useCallback(async()=>{if(a){b(!0);try{const s=u==="all"?void 0:u,c=E==="all"?void 0:E,n=await y.getEvents(a,s,c);k(Array.isArray(n)?n:n?.list||[])}catch{k([])}finally{b(!1)}}},[a,u,E]),$=t.useCallback(async()=>{if(a)try{const s=u==="all"?void 0:u,c=parseInt(v)||void 0,n=await y.getEventsSummary(a,s,c);D(n||null)}catch{D(null)}},[a,u,v]);t.useEffect(()=>{_()},[_]),t.useEffect(()=>{$()},[$]);const V=t.useMemo(()=>{let s=l.map(n=>ee(n));const c=parseInt(v,10);if(c>0){const n=Date.now()-c*3600*1e3;s=s.filter(I=>!I.lastTime||new Date(I.lastTime).getTime()>=n)}return i&&(s=s.filter(n=>n.reason===i)),p&&(s=s.filter(n=>n.objectKind===p||n.object.startsWith(`${p}/`))),s},[l,i,p,v]),J=t.useMemo(()=>l.filter(s=>s.type==="Warning").length,[l]),O=t.useMemo(()=>l.filter(s=>s.type==="Normal").length,[l]),A=t.useMemo(()=>(r?.by_reason||[]).map(s=>({name:s.reason||"Unknown",count:s.count})),[r]),K=t.useMemo(()=>(r?.by_namespace||[]).map(s=>({name:s.namespace||"",count:s.count})),[r]),B=t.useMemo(()=>(r?.by_kind||[]).map(s=>({name:s.kind||"Unknown",count:s.count})),[r]);return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:166:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:167:7",className:"flex items-center gap-2 text-sm text-[var(--dg-text-muted)]",children:[e.jsx(L,{"code-path":"src/components/kubernetes/EventsPage.tsx:168:9",to:"/kubernetes",className:"hover:text-[var(--dg-text-secondary)]",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(z,{"code-path":"src/components/kubernetes/EventsPage.tsx:171:13",className:"h-3 w-3"}),e.jsx(L,{"code-path":"src/components/kubernetes/EventsPage.tsx:172:13",to:`/kubernetes/${a}`,className:"hover:text-[var(--dg-text-secondary)]",children:a})]}),e.jsx(z,{"code-path":"src/components/kubernetes/EventsPage.tsx:175:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:176:9",className:"text-[var(--dg-text-secondary)]",children:"事件"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:179:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/EventsPage.tsx:180:9",className:"text-lg font-semibold text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(ne,{"code-path":"src/components/kubernetes/EventsPage.tsx:181:11",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),"事件中心"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:184:9",className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(j,{"code-path":"src/components/kubernetes/EventsPage.tsx:185:11",value:a,onValueChange:s=>{W(s),x(`/kubernetes/${s}/events`)},children:[e.jsx(P,{"code-path":"src/components/kubernetes/EventsPage.tsx:186:13",className:"w-40 h-8 text-xs",children:e.jsx(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:186:57"})}),e.jsx(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:187:13",children:o.map(s=>e.jsx(d,{"code-path":"src/components/kubernetes/EventsPage.tsx:189:17",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(j,{"code-path":"src/components/kubernetes/EventsPage.tsx:193:11",value:u,onValueChange:s=>{q(s),R(""),T("")},children:[e.jsx(P,{"code-path":"src/components/kubernetes/EventsPage.tsx:194:13",className:"w-36 h-8 text-xs",children:e.jsx(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:194:57",placeholder:"命名空间"})}),e.jsxs(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:195:13",children:[e.jsx(d,{"code-path":"src/components/kubernetes/EventsPage.tsx:196:15",value:"all",className:"text-xs",children:"所有命名空间"}),U.map(s=>e.jsx(d,{"code-path":"src/components/kubernetes/EventsPage.tsx:197:38",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(j,{"code-path":"src/components/kubernetes/EventsPage.tsx:200:11",value:v,onValueChange:H,children:[e.jsx(P,{"code-path":"src/components/kubernetes/EventsPage.tsx:201:13",className:"w-32 h-8 text-xs",children:e.jsx(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:201:57"})}),e.jsxs(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:202:13",children:[e.jsx(d,{"code-path":"src/components/kubernetes/EventsPage.tsx:203:15",value:"0",className:"text-xs",children:"全部时间"}),e.jsx(d,{"code-path":"src/components/kubernetes/EventsPage.tsx:204:15",value:"1",className:"text-xs",children:"近 1 小时"}),e.jsx(d,{"code-path":"src/components/kubernetes/EventsPage.tsx:205:15",value:"6",className:"text-xs",children:"近 6 小时"}),e.jsx(d,{"code-path":"src/components/kubernetes/EventsPage.tsx:206:15",value:"24",className:"text-xs",children:"近 24 小时"}),e.jsx(d,{"code-path":"src/components/kubernetes/EventsPage.tsx:207:15",value:"168",className:"text-xs",children:"近 7 天"})]})]}),e.jsxs(Z,{"code-path":"src/components/kubernetes/EventsPage.tsx:210:11",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{_(),$()},disabled:m,children:[e.jsx(ae,{"code-path":"src/components/kubernetes/EventsPage.tsx:211:13",className:`h-3 w-3 mr-1 ${m?"animate-spin":""}`}),"刷新"]})]})]}),e.jsx(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:218:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:219:9",className:"p-0",children:e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:220:11",className:"grid grid-cols-2 md:grid-cols-4",children:[e.jsx(w,{"code-path":"src/components/kubernetes/EventsPage.tsx:221:13",label:"事件总数",value:r?.total??l.length}),e.jsx(w,{"code-path":"src/components/kubernetes/EventsPage.tsx:222:13",label:"告警事件",value:r?.warning_count??J,hint:"Warning"}),e.jsx(w,{"code-path":"src/components/kubernetes/EventsPage.tsx:223:13",label:"正常事件",value:r?.normal_count??O,hint:"Normal"}),e.jsx(w,{"code-path":"src/components/kubernetes/EventsPage.tsx:224:13",label:"告警类型",value:A.length,hint:"不同 Reason"})]})})}),(i||p)&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:230:9",className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:231:11",className:"text-[var(--dg-text-muted)]",children:"筛选:"}),i&&e.jsxs("button",{"code-path":"src/components/kubernetes/EventsPage.tsx:233:13",type:"button",className:"inline-flex items-center gap-1 rounded border border-[var(--dg-border)] px-2 py-0.5 text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>R(""),children:["原因 ",i," ",e.jsx(F,{"code-path":"src/components/kubernetes/EventsPage.tsx:234:35",className:"h-3 w-3"})]}),p&&e.jsxs("button",{"code-path":"src/components/kubernetes/EventsPage.tsx:238:13",type:"button",className:"inline-flex items-center gap-1 rounded border border-[var(--dg-border)] px-2 py-0.5 text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>T(""),children:["类型 ",p," ",e.jsx(F,{"code-path":"src/components/kubernetes/EventsPage.tsx:239:33",className:"h-3 w-3"})]})]}),A.length>0&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:246:9",className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:247:11",title:"告警原因",items:A,selected:i,onSelect:R}),K.length>0&&e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:248:33",title:"命名空间",items:K}),B.length>0&&e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:250:13",title:"资源类型",items:B,selected:p,onSelect:T})]}),r?.recent_warnings?.length>0&&e.jsx(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:256:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] border-l-2 border-l-[var(--dg-warning)]",children:e.jsxs(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:257:11",className:"p-4",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/EventsPage.tsx:258:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-1.5",children:[e.jsx(ce,{"code-path":"src/components/kubernetes/EventsPage.tsx:259:15",className:"h-4 w-4 text-[var(--dg-warning)]"}),"最新告警 (",r.recent_warnings.length,")"]}),e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:262:13",className:"space-y-1",children:r.recent_warnings.map((s,c)=>e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:264:17",className:"text-xs py-1.5 px-2 rounded hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:265:19",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:266:21",className:"shrink-0 font-mono text-[var(--dg-warning)]",children:s.reason}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:267:21",className:"text-[var(--dg-text-muted)] font-mono truncate",children:s.object}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:268:21",className:"text-[var(--dg-text-muted)]",children:s.namespace}),s.source&&e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:269:34",className:"text-[var(--dg-text-muted)] font-mono",children:s.source}),e.jsxs("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:270:21",className:"text-[var(--dg-text-muted)]",children:["×",s.count]}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:271:21",className:"ml-auto text-[var(--dg-text-muted)]",children:se(s.last_time)})]}),e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:273:19",className:"text-[var(--dg-text-secondary)] truncate mt-0.5",title:s.message,children:s.message})]},c))})]})}),e.jsx(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:281:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:282:9",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:283:11",className:"flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:284:13",className:"text-sm text-[var(--dg-text-secondary)]",children:["事件列表 (",V.length,")"]}),e.jsxs(j,{"code-path":"src/components/kubernetes/EventsPage.tsx:285:13",value:E,onValueChange:G,children:[e.jsx(P,{"code-path":"src/components/kubernetes/EventsPage.tsx:286:15",className:"w-28 h-7 text-xs",children:e.jsx(N,{"code-path":"src/components/kubernetes/EventsPage.tsx:286:59"})}),e.jsxs(f,{"code-path":"src/components/kubernetes/EventsPage.tsx:287:15",children:[e.jsx(d,{"code-path":"src/components/kubernetes/EventsPage.tsx:288:17",value:"all",className:"text-xs",children:"所有类型"}),e.jsx(d,{"code-path":"src/components/kubernetes/EventsPage.tsx:289:17",value:"Warning",className:"text-xs",children:"Warning"}),e.jsx(d,{"code-path":"src/components/kubernetes/EventsPage.tsx:290:17",value:"Normal",className:"text-xs",children:"Normal"})]})]})]}),e.jsx(te,{"code-path":"src/components/kubernetes/EventsPage.tsx:294:11",events:V,loading:m,showNamespace:!0,maxRows:200})]})})]})}export{ve as default}; diff --git a/backend/static/assets/EventsPage-UFe_ZFfW.js b/backend/static/assets/EventsPage-UFe_ZFfW.js deleted file mode 100644 index 55c0240..0000000 --- a/backend/static/assets/EventsPage-UFe_ZFfW.js +++ /dev/null @@ -1 +0,0 @@ -import{r as s,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as M,a as W}from"./card-B-RtdR4H.js";import{g as ce,i as oe,L as q,B as de}from"./index-LZWfu62c.js";import{S,a as C,b as T,c as _,d as x}from"./select-4xU_9B3_.js";import{T as xe,a as le,b as L,c as v,d as me,e as i}from"./table-BPFYQwjr.js";import{k as $}from"./index-Z0O8nAcG.js";import{f as G,t as pe,R as J,X as O,l as ie}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function F({title:b,items:m,selected:p,onSelect:N,emptyText:l}){const f=Math.max(...m.map(d=>d.count),1);return e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:28:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(W,{"code-path":"src/components/kubernetes/EventsPage.tsx:29:7",className:"p-4",children:[e.jsx("h3",{"code-path":"src/components/kubernetes/EventsPage.tsx:30:9",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-3",children:b}),m.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:32:11",className:"text-xs text-[var(--dg-text-muted)] py-6 text-center",children:l||"暂无数据"}):e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:34:11",className:"space-y-1.5 max-h-[220px] overflow-y-auto pr-1",children:m.map(d=>{const k=p===d.name;return e.jsxs("button",{"code-path":"src/components/kubernetes/EventsPage.tsx:38:17",type:"button",className:`w-full flex items-center gap-2 rounded px-2 py-1.5 text-left transition-colors ${k?"bg-[var(--dg-bg-tertiary)]":"hover:bg-[var(--dg-bg-tertiary)]/60"}`,onClick:()=>N?.(k?"":d.name),children:[e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:46:19",className:"w-[88px] shrink-0 truncate text-xs text-[var(--dg-text-secondary)]",title:d.name,children:d.name}),e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:49:19",className:"flex-1 h-1.5 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:50:21",className:`h-full rounded-full ${k?"bg-[var(--dg-accent)]":"bg-[var(--dg-text-muted)]/50"}`,style:{width:`${d.count/f*100}%`}})}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:55:19",className:"w-8 text-right text-xs tabular-nums text-[var(--dg-text-muted)]",children:d.count})]},d.name)})})]})})}function R({label:b,value:m,hint:p}){return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:68:5",className:"px-4 py-3 border-r border-[var(--dg-border)] last:border-r-0",children:[e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:69:7",className:"text-xs text-[var(--dg-text-muted)]",children:b}),e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:70:7",className:"text-xl font-semibold tabular-nums text-[var(--dg-text-primary)] mt-0.5",children:m}),p&&e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:71:16",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5",children:p})]})}function Pe(){const{clusterCode:b}=ce(),m=oe(),[p,N]=s.useState(!1),[l,f]=s.useState([]),[d,k]=s.useState([]),[Q,Y]=s.useState([]),[u,Z]=s.useState("all"),[y,ee]=s.useState("all"),[E,te]=s.useState("0"),[r,H]=s.useState(b||""),[o,U]=s.useState(null),[g,A]=s.useState(""),[h,D]=s.useState(""),[se,ne]=s.useState(null);s.useEffect(()=>{$.getClusters().then(t=>{const a=t?.list||[];if(k(a),!r&&a.length>0){const n=a[0].code||String(a[0].id);H(n),m(`/kubernetes/${n}/events`,{replace:!0})}}).catch(()=>{})},[]),s.useEffect(()=>{r&&$.getNamespaces(r).then(t=>{Y(Array.isArray(t)?t:t?.list||t?.data||[])}).catch(()=>{})},[r]);const V=s.useCallback(async()=>{if(r){N(!0);try{const t=u==="all"?void 0:u,a=y==="all"?void 0:y,n=await $.getEvents(r,t,a);f(Array.isArray(n)?n:n?.list||[])}catch{f([])}finally{N(!1)}}},[r,u,y]),B=s.useCallback(async()=>{if(r)try{const t=u==="all"?void 0:u,a=parseInt(E)||void 0,n=await $.getEventsSummary(r,t,a);U(n||null)}catch{U(null)}},[r,u,E]);s.useEffect(()=>{V()},[V]),s.useEffect(()=>{B()},[B]);const j=s.useMemo(()=>{let t=l;const a=parseInt(E,10);if(a>0){const n=Date.now()-a*3600*1e3;t=t.filter(c=>{const P=c.last_time||c.lastTime||c.last_timestamp;return!P||new Date(P).getTime()>=n})}return g&&(t=t.filter(n=>n.reason===g)),h&&(t=t.filter(n=>(n.object||"").startsWith(`${h}/`))),t},[l,g,h,E]),ae=s.useMemo(()=>l.filter(t=>t.type==="Warning").length,[l]),re=s.useMemo(()=>l.filter(t=>t.type==="Normal").length,[l]),I=s.useMemo(()=>(o?.by_reason||[]).map(t=>({name:t.reason||"Unknown",count:t.count})),[o]),z=s.useMemo(()=>(o?.by_namespace||[]).map(t=>({name:t.namespace||"",count:t.count})),[o]),X=s.useMemo(()=>(o?.by_kind||[]).map(t=>({name:t.kind||"Unknown",count:t.count})),[o]),K=t=>t?t.replace("T"," ").substring(0,19):"-",w=t=>{if(!t)return"";const a=Date.now()-new Date(t).getTime();if(a<0)return"";const n=Math.floor(a/6e4);if(n<1)return"刚刚";if(n<60)return`${n}分钟前`;const c=Math.floor(n/60);return c<24?`${c}小时前`:`${Math.floor(c/24)}天前`};return e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:180:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:181:7",className:"flex items-center gap-2 text-sm text-[var(--dg-text-muted)]",children:[e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:182:9",to:"/kubernetes",className:"hover:text-[var(--dg-text-secondary)]",children:"集群"}),r&&e.jsxs(e.Fragment,{children:[e.jsx(G,{"code-path":"src/components/kubernetes/EventsPage.tsx:185:13",className:"h-3 w-3"}),e.jsx(q,{"code-path":"src/components/kubernetes/EventsPage.tsx:186:13",to:`/kubernetes/${r}`,className:"hover:text-[var(--dg-text-secondary)]",children:r})]}),e.jsx(G,{"code-path":"src/components/kubernetes/EventsPage.tsx:189:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:190:9",className:"text-[var(--dg-text-secondary)]",children:"事件"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:193:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/EventsPage.tsx:194:9",className:"text-lg font-semibold text-[var(--dg-text-primary)] flex items-center gap-2",children:[e.jsx(pe,{"code-path":"src/components/kubernetes/EventsPage.tsx:195:11",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),"事件中心"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:198:9",className:"flex items-center gap-2 flex-wrap",children:[e.jsxs(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:199:11",value:r,onValueChange:t=>{H(t),m(`/kubernetes/${t}/events`)},children:[e.jsx(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:200:13",className:"w-40 h-8 text-xs",children:e.jsx(T,{"code-path":"src/components/kubernetes/EventsPage.tsx:200:57"})}),e.jsx(_,{"code-path":"src/components/kubernetes/EventsPage.tsx:201:13",children:d.map(t=>e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:203:17",value:t.code||String(t.id),className:"text-xs",children:t.name||t.code},t.id))})]}),e.jsxs(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:207:11",value:u,onValueChange:t=>{Z(t),A(""),D("")},children:[e.jsx(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:208:13",className:"w-36 h-8 text-xs",children:e.jsx(T,{"code-path":"src/components/kubernetes/EventsPage.tsx:208:57",placeholder:"命名空间"})}),e.jsxs(_,{"code-path":"src/components/kubernetes/EventsPage.tsx:209:13",children:[e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:210:15",value:"all",className:"text-xs",children:"所有命名空间"}),Q.map(t=>e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:211:38",value:t,className:"text-xs",children:t},t))]})]}),e.jsxs(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:214:11",value:E,onValueChange:te,children:[e.jsx(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:215:13",className:"w-32 h-8 text-xs",children:e.jsx(T,{"code-path":"src/components/kubernetes/EventsPage.tsx:215:57"})}),e.jsxs(_,{"code-path":"src/components/kubernetes/EventsPage.tsx:216:13",children:[e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:217:15",value:"0",className:"text-xs",children:"全部时间"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:218:15",value:"1",className:"text-xs",children:"近 1 小时"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:219:15",value:"6",className:"text-xs",children:"近 6 小时"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:220:15",value:"24",className:"text-xs",children:"近 24 小时"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:221:15",value:"168",className:"text-xs",children:"近 7 天"})]})]}),e.jsxs(de,{"code-path":"src/components/kubernetes/EventsPage.tsx:224:11",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{V(),B()},disabled:p,children:[e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:225:13",className:`h-3 w-3 mr-1 ${p?"animate-spin":""}`}),"刷新"]})]})]}),e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:232:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(W,{"code-path":"src/components/kubernetes/EventsPage.tsx:233:9",className:"p-0",children:e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:234:11",className:"grid grid-cols-2 md:grid-cols-4",children:[e.jsx(R,{"code-path":"src/components/kubernetes/EventsPage.tsx:235:13",label:"事件总数",value:o?.total??l.length}),e.jsx(R,{"code-path":"src/components/kubernetes/EventsPage.tsx:236:13",label:"告警事件",value:o?.warning_count??ae,hint:"Warning"}),e.jsx(R,{"code-path":"src/components/kubernetes/EventsPage.tsx:237:13",label:"正常事件",value:o?.normal_count??re,hint:"Normal"}),e.jsx(R,{"code-path":"src/components/kubernetes/EventsPage.tsx:238:13",label:"告警类型",value:I.length,hint:"不同 Reason"})]})})}),(g||h)&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:244:9",className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:245:11",className:"text-[var(--dg-text-muted)]",children:"筛选:"}),g&&e.jsxs("button",{"code-path":"src/components/kubernetes/EventsPage.tsx:247:13",type:"button",className:"inline-flex items-center gap-1 rounded border border-[var(--dg-border)] px-2 py-0.5 text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>A(""),children:["原因 ",g," ",e.jsx(O,{"code-path":"src/components/kubernetes/EventsPage.tsx:248:35",className:"h-3 w-3"})]}),h&&e.jsxs("button",{"code-path":"src/components/kubernetes/EventsPage.tsx:252:13",type:"button",className:"inline-flex items-center gap-1 rounded border border-[var(--dg-border)] px-2 py-0.5 text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]",onClick:()=>D(""),children:["类型 ",h," ",e.jsx(O,{"code-path":"src/components/kubernetes/EventsPage.tsx:253:33",className:"h-3 w-3"})]})]}),I.length>0&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:260:9",className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsx(F,{"code-path":"src/components/kubernetes/EventsPage.tsx:261:11",title:"告警原因",items:I,selected:g,onSelect:A}),z.length>0&&e.jsx(F,{"code-path":"src/components/kubernetes/EventsPage.tsx:262:33",title:"命名空间",items:z}),X.length>0&&e.jsx(F,{"code-path":"src/components/kubernetes/EventsPage.tsx:264:13",title:"资源类型",items:X,selected:h,onSelect:D})]}),o?.recent_warnings?.length>0&&e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:270:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] border-l-2 border-l-[var(--dg-warning)]",children:e.jsxs(W,{"code-path":"src/components/kubernetes/EventsPage.tsx:271:11",className:"p-4",children:[e.jsxs("h3",{"code-path":"src/components/kubernetes/EventsPage.tsx:272:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-1.5",children:[e.jsx(ie,{"code-path":"src/components/kubernetes/EventsPage.tsx:273:15",className:"h-4 w-4 text-[var(--dg-warning)]"}),"最新告警 (",o.recent_warnings.length,")"]}),e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:276:13",className:"space-y-1",children:o.recent_warnings.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:278:17",className:"text-xs py-1.5 px-2 rounded hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:279:19",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:280:21",className:"shrink-0 font-mono text-[var(--dg-warning)]",children:t.reason}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:281:21",className:"text-[var(--dg-text-muted)] font-mono truncate",children:t.object}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:282:21",className:"text-[var(--dg-text-muted)]",children:t.namespace}),e.jsxs("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:283:21",className:"text-[var(--dg-text-muted)]",children:["×",t.count]}),e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:284:21",className:"ml-auto text-[var(--dg-text-muted)]",children:w(t.last_time)})]}),e.jsx("p",{"code-path":"src/components/kubernetes/EventsPage.tsx:286:19",className:"text-[var(--dg-text-secondary)] truncate mt-0.5",title:t.message,children:t.message})]},a))})]})}),e.jsx(M,{"code-path":"src/components/kubernetes/EventsPage.tsx:294:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(W,{"code-path":"src/components/kubernetes/EventsPage.tsx:295:9",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:296:11",className:"flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:297:13",className:"text-sm text-[var(--dg-text-secondary)]",children:["事件列表 (",j.length,")"]}),e.jsxs(S,{"code-path":"src/components/kubernetes/EventsPage.tsx:298:13",value:y,onValueChange:ee,children:[e.jsx(C,{"code-path":"src/components/kubernetes/EventsPage.tsx:299:15",className:"w-28 h-7 text-xs",children:e.jsx(T,{"code-path":"src/components/kubernetes/EventsPage.tsx:299:59"})}),e.jsxs(_,{"code-path":"src/components/kubernetes/EventsPage.tsx:300:15",children:[e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:301:17",value:"all",className:"text-xs",children:"所有类型"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:302:17",value:"Warning",className:"text-xs",children:"Warning"}),e.jsx(x,{"code-path":"src/components/kubernetes/EventsPage.tsx:303:17",value:"Normal",className:"text-xs",children:"Normal"})]})]})]}),e.jsxs(xe,{"code-path":"src/components/kubernetes/EventsPage.tsx:307:11",children:[e.jsx(le,{"code-path":"src/components/kubernetes/EventsPage.tsx:308:13",children:e.jsxs(L,{"code-path":"src/components/kubernetes/EventsPage.tsx:309:15",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:310:17",className:"text-[var(--dg-text-muted)] w-16",children:"类型"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:311:17",className:"text-[var(--dg-text-muted)] w-24",children:"原因"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:312:17",className:"text-[var(--dg-text-muted)]",children:"对象"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:313:17",className:"text-[var(--dg-text-muted)]",children:"消息"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:314:17",className:"text-[var(--dg-text-muted)] w-12",children:"次数"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:315:17",className:"text-[var(--dg-text-muted)] w-20",children:"命名空间"}),e.jsx(v,{"code-path":"src/components/kubernetes/EventsPage.tsx:316:17",className:"text-[var(--dg-text-muted)] w-40",children:"最后时间"})]})}),e.jsx(me,{"code-path":"src/components/kubernetes/EventsPage.tsx:319:13",children:j.length===0?e.jsx(L,{"code-path":"src/components/kubernetes/EventsPage.tsx:321:17",children:e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:322:19",colSpan:7,className:"text-center text-[var(--dg-text-muted)] py-8",children:p?e.jsx(J,{"code-path":"src/components/kubernetes/EventsPage.tsx:323:32",className:"h-4 w-4 animate-spin mx-auto"}):"暂无事件"})}):j.slice(0,200).map((t,a)=>{const n=`${t.name}-${a}`,c=se===n,P=t.type==="Warning";return e.jsxs(L,{"code-path":"src/components/kubernetes/EventsPage.tsx:331:19",className:`border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-tertiary)]/40 ${c?"bg-[var(--dg-bg-tertiary)]/30":""}`,onClick:()=>ne(c?null:n),children:[e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:336:21",children:e.jsx("span",{"code-path":"src/components/kubernetes/EventsPage.tsx:337:23",className:`text-xs font-medium ${P?"text-[var(--dg-warning)]":"text-[var(--dg-text-muted)]"}`,children:P?"Warning":"Normal"})}),e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:341:21",className:"text-xs text-[var(--dg-text-secondary)] font-medium",children:t.reason||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:342:21",className:"text-xs text-[var(--dg-text-muted)] font-mono",children:t.object||"-"}),e.jsxs(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:343:21",className:"text-xs text-[var(--dg-text-secondary)] max-w-[400px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:344:23",className:`truncate ${c?"whitespace-normal":""}`,title:c?void 0:t.message,children:t.message||"-"}),c&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:348:25",className:"mt-1 pt-1 border-t border-[var(--dg-border)] text-[10px] text-[var(--dg-text-muted)] space-y-0.5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:349:27",children:["首次: ",K(t.first_time)," (",w(t.first_time),")"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:350:27",children:["最后: ",K(t.last_time)," (",w(t.last_time),")"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:351:27",children:["名称: ",t.name]})]})]}),e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:355:21",className:"text-sm text-[var(--dg-text-muted)] text-center tabular-nums",children:t.count>1?t.count:1}),e.jsx(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:356:21",className:"text-xs text-[var(--dg-text-muted)]",children:t.namespace||"-"}),e.jsxs(i,{"code-path":"src/components/kubernetes/EventsPage.tsx:357:21",className:"text-xs text-[var(--dg-text-muted)]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:358:23",children:K(t.last_time)}),e.jsx("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:359:23",className:"text-[10px]",children:w(t.last_time)})]})]},n)})})]}),j.length>200&&e.jsxs("div",{"code-path":"src/components/kubernetes/EventsPage.tsx:367:13",className:"text-center py-2 text-xs text-[var(--dg-text-muted)] border-t border-[var(--dg-border)]",children:["仅显示前 200 条,共 ",j.length," 条"]})]})})]})}export{Pe as default}; diff --git a/backend/static/assets/GrafanaDashboard-Cwk6bt47.js b/backend/static/assets/GrafanaDashboard-Bv-280xT.js similarity index 98% rename from backend/static/assets/GrafanaDashboard-Cwk6bt47.js rename to backend/static/assets/GrafanaDashboard-Bv-280xT.js index 6f2bf64..d9f01cf 100644 --- a/backend/static/assets/GrafanaDashboard-Cwk6bt47.js +++ b/backend/static/assets/GrafanaDashboard-Bv-280xT.js @@ -1,3 +1,3 @@ -import{j as a,r as o}from"./vendor-codemirror-C7mXSpXt.js";import{B as D,o as za,D as oa,a as ra,b as na,c as da,d as ka,t as u,f as Ya,i as Qa,e as Na}from"./index-LZWfu62c.js";import{I as X}from"./input-BdDauX3U.js";import{B as O}from"./badge-B0F5ZNtn.js";import{C as U,b as ya,c as Ga,a as H}from"./card-B-RtdR4H.js";import{S as xa,a as pa,b as ba,c as ua,d as B}from"./select-4xU_9B3_.js";import{L}from"./label-u-lNUbKh.js";import{s as Wa}from"./server-BUAZv7ZV.js";import{d as ga}from"./grafana-DTc3taUi.js";import{z as Xa,p as as}from"./datasource-DuIT0c1H.js";import{a as fa}from"./agent-g0Vk8FYK.js";import{aa as ss,A as J,R as ca,L as aa,l as va,h as Q,aR as _a,aJ as $a,W as Za,Y as Fa,k as es,a4 as ta,g as Ta,r as ja,w as ts,aF as os,j as rs,v as ns,p as ds,z as cs,an as hs,ao as ms,_ as Ia,ar as is,aC as Pa,T as ls,I as xs,aS as ps,u as Ba,D as Oa,E as Ma,P as Aa}from"./vendor-icons-Aso0-eeY.js";import{z as bs,p as Sa}from"./metrics-Dj4l07HZ.js";import{S as Ea}from"./stat-strip-BPzU38xY.js";import{T as Ua,a as Ha,b as R,c as K}from"./tabs-kmtfM2I-.js";import{C as Da}from"./checkbox-DL3onEGv.js";import"./index-CYARH0Cq.js";function us(s){const e=[];for(let c=0;c<24;c++)e.push({time:new Date(Date.now()-(24-c)*36e5).toLocaleTimeString(),value:Math.random()*100});return e}function gs({panel:s}){const r=us();switch(s.type){case"stat":return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:24:9",className:"flex flex-col items-center justify-center h-full",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:25:11",className:"text-4xl font-bold text-blue-500",children:Math.floor(Math.random()*1e3)}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:26:11",className:"text-sm text-muted-foreground mt-2",children:s.options?.unit||"requests/s"}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:27:11",className:"flex items-center gap-1 mt-2 text-green-500 text-sm",children:[a.jsx(ss,{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:28:13",className:"w-4 h-4"}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:29:13",children:"+12.5%"})]})]});case"gauge":return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:35:9",className:"flex flex-col items-center justify-center h-full",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:36:11",className:"relative w-24 h-24",children:[a.jsxs("svg",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:37:13",className:"w-full h-full",viewBox:"0 0 100 100",children:[a.jsx("circle",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:38:15",cx:"50",cy:"50",r:"40",fill:"none",stroke:"#e5e7eb",strokeWidth:"10"}),a.jsx("circle",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:39:15",cx:"50",cy:"50",r:"40",fill:"none",stroke:"#3b82f6",strokeWidth:"10",strokeDasharray:`${Math.random()*251} 251`,transform:"rotate(-90 50 50)"})]}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:50:13",className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:51:15",className:"text-xl font-bold",children:[Math.floor(Math.random()*100),"%"]})})]}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:54:11",className:"text-sm text-muted-foreground mt-2",children:"CPU使用率"})]});default:return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:60:9",className:"h-full flex flex-col",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:61:11",className:"flex-1 flex items-end gap-1 px-2",children:r.map((e,c)=>a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:63:15",className:"flex-1 bg-blue-500 rounded-t",style:{height:`${e.value}%`,opacity:.3+c/r.length*.7}},c))}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:70:11",className:"flex justify-between text-xs text-muted-foreground px-2 pt-2",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:71:13",children:r[0].time}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:72:13",children:r[r.length-1].time})]})]})}}const fs=({dsUrl:s,dsUsername:r,dsPassword:e})=>{const[c,i]=o.useState(!1),[x,b]=o.useState(!1),[g,N]=o.useState([]),[w,m]=o.useState(""),[P,y]=o.useState(""),[z,v]=o.useState("cpu_usage"),[h,A]=o.useState("desc");o.useEffect(()=>{s&&r&&e&&W(s,r,e)},[s,r,e]);const W=async(n,l,S)=>{b(!0),y("");try{const j=await bs.connect(n,l,S);N(j.hosts||[]),m(j.version||""),i(!0)}catch(j){i(!1),y(j.message||"连接失败")}finally{b(!1)}},Z=()=>{s&&r&&e&&W(s,r,e)},F=n=>{z===n?A(l=>l==="asc"?"desc":"asc"):(v(n),A("desc"))},T=[...g].sort((n,l)=>{const S=n[z]??"",j=l[z]??"";return typeof S=="number"?h==="asc"?S-j:j-S:h==="asc"?String(S).localeCompare(String(j)):String(j).localeCompare(String(S))}),$=({f:n})=>z!==n?a.jsx($a,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:68:33",className:"w-3 h-3 text-slate-500"}):h==="asc"?a.jsx(Za,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:69:32",className:"w-3 h-3 text-blue-400"}):a.jsx(Fa,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:69:80",className:"w-3 h-3 text-blue-400"}),p=(n,l)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:73:5",className:"flex items-center gap-2 min-w-[90px]",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:74:7",className:"flex-1 h-2.5 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:75:9",className:`h-full rounded-full transition-all duration-500 ${n>=80?"bg-orange-500":"bg-blue-500"}`,style:{width:`${Math.min(n,100)}%`}})}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:77:7",className:`w-14 text-right text-xs font-mono tabular-nums ${n>=80?"text-orange-400":""}`,children:l})]}),f=n=>!n||n===0?"—":n>1e9?`${(n/1e9).toFixed(1)} GB/s`:n>1e6?`${(n/1e6).toFixed(1)} MB/s`:n>1e3?`${(n/1e3).toFixed(1)} KB/s`:`${n.toFixed(1)} B/s`;return!c&&!x&&!P?null:a.jsxs(U,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:92:5",className:"bg-[var(--dg-bg-secondary)] border-blue-500/20",children:[a.jsx(ya,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:93:7",className:"py-3 px-4 pb-2",children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:94:9",className:"flex items-center gap-2",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:95:11",className:"h-4 w-4 text-blue-400"}),a.jsx(Ga,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:96:11",className:"text-sm font-medium",children:"Zabbix 主机监控"}),w&&a.jsxs(O,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:97:23",className:"text-[10px] bg-blue-500/10 text-blue-400",children:["v",w]}),c&&a.jsxs("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:98:25",className:"text-[10px] text-[var(--dg-text-muted)] ml-2",children:[g.length," 台"]}),c&&a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:99:25",className:"ml-auto flex gap-1",children:a.jsxs(D,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:99:61",variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px]",onClick:Z,children:[a.jsx(ca,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:99:146",className:"w-3 h-3 mr-1"}),"刷新"]})})]})}),a.jsx(H,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:102:7",className:"px-4 pb-3 pt-0",children:x?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:103:21",className:"text-center py-12",children:[a.jsx(aa,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:103:56",className:"h-6 w-6 mx-auto mb-2 animate-spin text-blue-400"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:103:127",className:"text-xs text-[var(--dg-text-muted)]",children:"连接中…"})]}):P?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:104:20",className:"p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-xs text-red-400 flex items-start gap-2",children:[a.jsx(va,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:104:135",className:"h-4 w-4 mt-0.5"}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:104:179",children:P})]}):g.length===0?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:105:33",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[a.jsx(Q,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:105:95",className:"h-8 w-8 mx-auto mb-2 text-slate-600"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:105:153",className:"text-sm",children:"未找到被监控的 Zabbix 主机"})]}):a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:107:11",className:"overflow-x-auto rounded-lg border border-[var(--dg-border)]",children:a.jsxs("table",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:108:13",className:"w-full text-xs",children:[a.jsx("thead",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:109:15",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:a.jsx("tr",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:109:96",children:[{f:"hostname",l:"主机名"},{f:"cpu_usage",l:"CPU"},{f:"memory_usage",l:"内存"},{f:"disk_usage",l:"磁盘"},{f:"load5",l:"Load5"},{f:"net_in_bps",l:"流入"},{f:"net_out_bps",l:"流出"},{f:"problem_count",l:"问题"},{f:"uptime_days",l:"运行"}].map(({f:n,l})=>a.jsx("th",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:115:19",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] cursor-pointer hover:text-[var(--dg-text-primary)] select-none whitespace-nowrap",onClick:()=>F(n),children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:116:21",className:"flex items-center gap-1",children:[l,a.jsx($,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:116:65",f:n})]})},n))})}),a.jsx("tbody",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:118:15",children:T.map((n,l)=>a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:120:19",className:"border-b border-[var(--dg-border)] last:border-0 hover:bg-[var(--dg-bg-tertiary)]/50",children:[a.jsxs("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:21",className:"px-3 py-2.5 whitespace-nowrap",children:[a.jsxs(O,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:67",className:`text-[10px] ${n.available==="1"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400"}`,children:[a.jsx(_a,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:193",className:"w-3 h-3 mr-1"}),n.available==="1"?"UP":"DOWN"]})," ",a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:272",className:"font-medium text-[var(--dg-text-primary)] ml-1",children:n.name||n.hostname})]}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:122:21",className:"px-3 py-2.5",children:p(Number(n.cpu_usage||0),`${Number(n.cpu_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:123:21",className:"px-3 py-2.5",children:p(Number(n.memory_usage||0),`${Number(n.memory_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:124:21",className:"px-3 py-2.5",children:p(Number(n.disk_usage||0),`${Number(n.disk_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:125:21",className:"px-3 py-2.5 text-[var(--dg-text-secondary)]",children:n.load5>0?n.load5.toFixed(1):"—"}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:126:21",className:"px-3 py-2.5 font-mono text-[var(--dg-text-secondary)]",children:f(n.net_in_bps)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:127:21",className:"px-3 py-2.5 font-mono text-[var(--dg-text-secondary)]",children:f(n.net_out_bps)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:128:21",className:"px-3 py-2.5 text-center",children:a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:128:61",className:`font-mono font-bold ${n.problem_count>0?n.problem_count>2?"text-red-400":"text-amber-400":"text-emerald-400"}`,children:n.problem_count>0?a.jsxs(a.Fragment,{children:[a.jsx(va,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:128:230",className:"w-3 h-3 inline mr-1"}),n.problem_count]}):"0"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:129:21",className:"px-3 py-2.5 text-[var(--dg-text-secondary)]",children:n.uptime_days>0?`${n.uptime_days}d`:"—"})]},n.hostid||l))})]})})})]})},V=({val:s,label:r,color:e})=>{const c=Math.min(s,100);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:16:5",className:"flex items-center gap-1.5 min-w-[80px]",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:17:7",className:"flex-1 h-2 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:18:9",className:`h-full rounded-full ${e||"bg-purple-500"}`,style:{width:`${c}%`}})}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:20:7",className:"w-14 text-right text-[11px] font-mono text-[var(--dg-text-secondary)]",children:r})]})},js=s=>s?s>1e9?`${(s/1e9).toFixed(1)} GB`:s>1e6?`${(s/1e6).toFixed(1)} MB`:`${(s/1e3).toFixed(1)} KB`:"—",Ca=s=>s?s>1e9?`${(s/1e9).toFixed(1)} GB/s`:s>1e6?`${(s/1e6).toFixed(1)} MB/s`:s>1e3?`${(s/1e3).toFixed(1)} KB/s`:`${s.toFixed(1)} B/s`:"—";function Ds(s){return(s||[]).map(r=>{const e={...r.metric||{}};return r.value&&(e.value=r.value[1]),e})}const Ns=s=>a.jsx("svg",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:47:26",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...s,children:a.jsx("path",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:47:211",d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),vs=({d:s})=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:50:3",className:"space-y-4",children:[a.jsx(Ea,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:51:5",items:[{label:"Pods",value:s.podCount?.[0]?.value||0,color:"purple"},{label:"Deployments",value:s.deployCount?.[0]?.value||0,color:"blue"},{label:"Nodes",value:s.nodeCount?.[0]?.value||0,color:"emerald"},{label:"Namespaces",value:s.nsPods?.length||0,color:"amber"}]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:59:5",className:"rounded-lg bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] p-3 max-h-60 overflow-y-auto",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:60:7",className:"text-xs font-medium mb-2 flex items-center gap-1",children:[a.jsx(Ta,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:60:73",className:"w-3 h-3 text-purple-400"}),"节点 CPU / 内存利用率"]}),(s.nodeCPU||[]).map((r,e)=>{const c=(s.nodeMem||[]).find(i=>i.node===r.node);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:16",className:"flex items-center gap-3 text-[11px] mb-1.5",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:84",className:"w-28 truncate",title:r.node,children:r.node}),a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:146",val:Number(r.value||0),label:`${Number(r.value||0).toFixed(1)}%`}),a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:226",val:Number(c?.value||0),label:`${Number(c?.value||0).toFixed(1)}%`,color:"bg-blue-500"})]},e)})]})]}),ys=({d:s})=>a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:70:3",className:"overflow-x-auto rounded-lg border border-[var(--dg-border)]",children:a.jsxs("table",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:71:5",className:"w-full text-xs",children:[a.jsx("thead",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:7",className:"bg-[var(--dg-bg-tertiary)]",children:a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:53",children:[a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:57",className:"px-3 py-2 text-left",children:"节点"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:100",className:"px-3 py-2 text-left",children:"状态"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:143",className:"px-3 py-2 text-left",children:"CPU"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:187",className:"px-3 py-2 text-left",children:"内存"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:230",className:"px-3 py-2 text-left",children:"磁盘"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:273",className:"px-3 py-2 text-left",children:"流入"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:316",className:"px-3 py-2 text-left",children:"流出"})]})}),a.jsx("tbody",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:73:7",children:(s.nodes||[]).map((r,e)=>{const c=r.instance||r.exported_instance||"",i=(s.cpuUsage||[]).find(m=>m.instance===c),x=(s.memUsage||[]).find(m=>m.instance===c),b=(s.diskUsage||[]).find(m=>m.instance===c),g=(s.up||[]).find(m=>m.instance===c),N=(s.netRx||[]).find(m=>m.instance===c),w=(s.netTx||[]).find(m=>m.instance===c);return a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:82:18",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:83:13",className:"px-3 py-2 font-medium",children:r.nodename||c}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:84:13",className:"px-3 py-2",children:a.jsx(O,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:84:39",className:`text-[10px] ${g?.value===1?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400"}`,children:g?.value===1?"UP":"DOWN"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:85:13",className:"px-3 py-2",children:a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:85:39",val:Number(i?.value||0),label:`${Number(i?.value||0).toFixed(1)}%`})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:86:13",className:"px-3 py-2",children:a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:86:39",val:Number(x?.value||0),label:`${Number(x?.value||0).toFixed(1)}%`,color:"bg-blue-500"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:87:13",className:"px-3 py-2",children:a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:87:39",val:Number(b?.value||0),label:`${Number(b?.value||0).toFixed(1)}%`,color:"bg-amber-500"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:88:13",className:"px-3 py-2 font-mono text-[var(--dg-text-secondary)]",children:Ca(Number(N?.value||0))}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:89:13",className:"px-3 py-2 font-mono text-[var(--dg-text-secondary)]",children:Ca(Number(w?.value||0))})]},e)})})]})}),Gs=({d:s})=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:98:3",className:"space-y-4",children:[a.jsx(Ea,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:99:5",items:[{label:"Running",value:s.running?.[0]?.value||0,color:"emerald"},{label:"Pending",value:s.pending?.[0]?.value||0,color:"amber"}]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:5",className:"rounded-lg bg-[var(--dg-bg-primary)] p-3 max-h-40 overflow-y-auto",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:88",className:"text-xs font-medium mb-2",children:"CPU Top 10"}),(s.cpuTop||[]).map((r,e)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:186",className:"flex items-center gap-2 text-[11px] mb-1",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:252",className:"w-10 text-right text-[var(--dg-text-muted)]",children:e+1}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:326",className:"w-32 truncate",title:r.pod,children:r.pod}),a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:386",val:Number(r.value||0)*100,label:`${Number(r.value||0).toFixed(2)}c`,color:"bg-purple-500"})]},e))]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:5",className:"rounded-lg bg-[var(--dg-bg-primary)] p-3 max-h-40 overflow-y-auto",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:88",className:"text-xs font-medium mb-2",children:"内存 Top 10"}),(s.memTop||[]).map((r,e)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:185",className:"flex items-center gap-2 text-[11px] mb-1",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:251",className:"w-10 text-right text-[var(--dg-text-muted)]",children:e+1}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:325",className:"w-32 truncate",title:r.pod,children:r.pod}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:385",className:"ml-auto",children:js(Number(r.value||0))})]},e))]})]}),ws=({d:s})=>{const r=Number(s.heapUsed?.[0]?.value||0),e=Number(s.uptime?.[0]?.value||0);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:114:5",className:"grid grid-cols-5 gap-3",children:[a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:51",className:"p-3 text-center",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:92",className:"text-lg font-bold",children:e>86400?`${(e/86400).toFixed(1)}d`:`${(e/3600).toFixed(1)}h`}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:210",className:"text-[10px] text-[var(--dg-text-muted)]",children:"Uptime"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:51",className:"p-3 text-center",children:[a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:92",val:r,label:`${r.toFixed(1)}%`,color:r>80?"bg-orange-500":"bg-purple-500"}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:183",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:"Heap"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:51",className:"p-3 text-center",children:[a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:92",val:Number(s.nonHeapUsed?.[0]?.value||0),label:`${Number(s.nonHeapUsed?.[0]?.value||0).toFixed(1)}%`,color:"bg-blue-500"}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:228",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:"Non-Heap"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:51",className:"p-3 text-center",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:92",className:"text-lg font-bold text-emerald-400",children:s.threadCount?.[0]?.value||0}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:180",className:"text-[10px] text-[var(--dg-text-muted)]",children:"Threads"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:51",className:"p-3 text-center",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:92",className:"text-lg font-bold text-amber-400",children:Number(s.gcPause?.[0]?.value||0).toFixed(3)}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:193",className:"text-[10px] text-[var(--dg-text-muted)]",children:"GC Pause (s)"})]})})]})},Ps=({dsUrl:s})=>{const[r,e]=o.useState(!1),[c,i]=o.useState(!1),[x,b]=o.useState(0),[g,N]=o.useState(""),[w,m]=o.useState("kubernetes"),[P,y]=o.useState({}),[z,v]=o.useState({}),[h,A]=o.useState({}),[W,Z]=o.useState({});o.useEffect(()=>{s&&F(s)},[s]);const F=async p=>{i(!0),N("");try{const f=await Sa.connect(p);e(!0),b(f.targets||0),T(p)}catch(f){e(!1),N(f.message||"连接失败")}finally{i(!1)}},T=async p=>{for(const f of["kubernetes","node","pod","jvm"])try{const n=await Sa.dashboard(p,f),l={};for(const[S,j]of Object.entries(n||{}))l[S]=Array.isArray(j)?j:j?.data?.result?Ds(j.data.result):j;f==="kubernetes"&&y(l),f==="node"&&v(l),f==="pod"&&A(l),f==="jvm"&&Z(l)}catch{}},$=()=>{s&&F(s)};return!r&&!g?null:a.jsxs(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:167:5",className:"bg-[var(--dg-bg-secondary)] border-purple-500/20",children:[a.jsx(ya,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:168:7",className:"py-3 px-4 pb-2",children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:169:9",className:"flex items-center gap-2",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:170:11",className:"h-4 w-4 text-purple-400"}),a.jsx(Ga,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:171:11",className:"text-sm font-medium",children:"Prometheus 监控"}),r&&a.jsxs(O,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:172:25",className:"text-[10px] bg-purple-500/10 text-purple-400",children:[x," targets"]}),r&&a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:173:25",className:"ml-auto",children:a.jsxs(D,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:173:50",variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px]",onClick:$,children:[a.jsx(ca,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:173:135",className:"w-3 h-3 mr-1"}),"刷新"]})})]})}),a.jsx(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:176:7",className:"px-4 pb-3 pt-0",children:c?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:177:21",className:"text-center py-12",children:[a.jsx(aa,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:177:56",className:"h-6 w-6 mx-auto mb-2 animate-spin text-purple-400"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:177:129",className:"text-xs text-[var(--dg-text-muted)]",children:"连接中…"})]}):g?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:178:20",className:"p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-xs text-red-400",children:[a.jsx(va,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:178:112",className:"h-4 w-4 inline mr-1"}),g]}):a.jsxs(Ua,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:180:11",value:w,onValueChange:m,children:[a.jsxs(Ha,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:181:13",className:"bg-[var(--dg-bg-tertiary)] mb-3",children:[a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:182:15",value:"kubernetes",className:"text-xs",children:[a.jsx(es,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:182:67",className:"w-3 h-3 mr-1"}),"Kubernetes"]}),a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:183:15",value:"node",className:"text-xs",children:[a.jsx(Q,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:183:61",className:"w-3 h-3 mr-1"}),"Node"]}),a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:184:15",value:"pod",className:"text-xs",children:[a.jsx(Ns,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:184:60",className:"w-3 h-3 mr-1"}),"Pod"]}),a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:185:15",value:"jvm",className:"text-xs",children:[a.jsx(ta,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:185:60",className:"w-3 h-3 mr-1"}),"JVM"]})]}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:187:13",value:"kubernetes",children:a.jsx(vs,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:187:45",d:P})}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:188:13",value:"node",children:a.jsx(ys,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:188:39",d:z})}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:189:13",value:"pod",children:a.jsx(Gs,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:189:38",d:h})}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:190:13",value:"jvm",children:a.jsx(ws,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:190:38",d:W})})]})})]})};function As(s){return s?Array.isArray(s)?s:Array.isArray(s.list)?s.list:Array.isArray(s.items)?s.items:Array.isArray(s.data)?s.data:[]:[]}function Ss(){return typeof window<"u"&&window.location?{origin:window.location.origin,backend:`${window.location.protocol}//${window.location.hostname}:8080`}:{origin:"http://127.0.0.1",backend:"http://127.0.0.1:8080"}}function Cs({open:s,onOpenChange:r,server:e,onInstalled:c,onFailed:i}){const x=za(d=>d.token)||"",{origin:b,backend:g}=Ss(),[N,w]=o.useState(!1),[m,P]=o.useState(!1),[y,z]=o.useState(!1),[v,h]=o.useState("auto"),[A,W]=o.useState("root"),[Z,F]=o.useState(""),[T,$]=o.useState(""),[p,f]=o.useState("password"),n=e&&!e.has_auth,l=`curl -fsSL ${b}/agent/install.sh | bash -s -- --server ${g} --token ${x}`,S=()=>{const d=document.createElement("textarea");d.value=l,d.style.position="fixed",d.style.top="0",d.style.left="0",d.style.width="2em",d.style.height="2em",d.style.padding="0",d.style.border="none",d.style.outline="none",d.style.boxShadow="none",d.style.background="transparent",d.style.opacity="0",d.style.pointerEvents="none",d.style.zIndex="-1",d.style.fontSize="16px",d.contentEditable="true",d.readOnly=!0,document.body.appendChild(d),d.focus(),d.select(),d.setSelectionRange&&d.setSelectionRange(0,999999);let _=!1;try{_=document.execCommand("copy")}catch{}document.body.removeChild(d),_?(w(!0),u.success("安装命令已复制到剪贴板,粘贴到目标主机执行"),setTimeout(()=>w(!1),3e3)):(u.error("自动复制失败,请在下方手动全选复制 (Ctrl+A → Ctrl+C)"),P(!0))},j=`${b}/agent/aiops-agent-linux-amd64`,ha=[{icon:ns,title:"1. 下载二进制",commands:[`curl -fsSL ${j} -o /usr/local/bin/aiops-agent`]},{icon:ds,title:"2. 赋予执行权限",commands:["chmod +x /usr/local/bin/aiops-agent"]},{icon:Ta,title:"3. 创建 systemd 服务",commands:["cat > /etc/systemd/system/aiops-agent.service << 'EOF'","[Unit]","Description=AIOps Agent","After=network.target","","[Service]","Type=simple",`ExecStart=/usr/local/bin/aiops-agent --server ${g} --token ${x}`,"Restart=always","RestartSec=5","","[Install]","WantedBy=multi-user.target","EOF"]},{icon:cs,title:"4. 启动并设置开机自启",commands:["systemctl daemon-reload","systemctl enable --now aiops-agent","systemctl status aiops-agent"]}],I=async()=>{if(!(!e||!x)){if(n&&!Z&&!T){u.error("请填写 SSH 登录凭据(密码或密钥)");return}z(!0);try{const d=n?{username:A,password:Z,ssh_key:T,auth_type:p}:void 0;(await Wa.installAgent(e.id,x,d))?.installed||!1?(u.success(`${e.hostname} Agent 安装成功`),c?.(e.id),r(!1)):(u.warning(`${e.hostname}: Agent 安装命令已执行,但服务未检测到运行`),c?.(e.id),r(!1))}catch(d){const _=d?.message||"安装失败";u.error(`${e.hostname} ${_}`),i?.(e.id,_)}finally{z(!1)}}};return a.jsx(oa,{"code-path":"src/components/agent/AgentWizard.tsx:190:5",open:s,onOpenChange:r,children:a.jsxs(ra,{"code-path":"src/components/agent/AgentWizard.tsx:191:7",className:"max-w-2xl bg-slate-900 border-slate-800 text-slate-100",children:[a.jsxs(na,{"code-path":"src/components/agent/AgentWizard.tsx:192:9",children:[a.jsx(da,{"code-path":"src/components/agent/AgentWizard.tsx:193:11",className:"text-slate-100",children:e?`部署 Agent → ${e.hostname}`:"部署 Agent"}),a.jsx(ka,{"code-path":"src/components/agent/AgentWizard.tsx:196:11",className:"text-slate-400",children:e?`目标主机 ${e.hostname} (${e.ip}),选择安装方式:`:"在目标主机上执行以下命令即可完成 Agent 安装与注册"})]}),a.jsxs(Ua,{"code-path":"src/components/agent/AgentWizard.tsx:204:9",value:v,onValueChange:h,className:"w-full",children:[a.jsxs(Ha,{"code-path":"src/components/agent/AgentWizard.tsx:205:11",className:"bg-slate-800 border border-slate-700",children:[a.jsxs(R,{"code-path":"src/components/agent/AgentWizard.tsx:206:13",value:"auto",className:"data-[state=active]:bg-slate-700",children:[a.jsx(ja,{"code-path":"src/components/agent/AgentWizard.tsx:207:15",className:"h-4 w-4 mr-1.5"}),"安装Agent"]}),e&&a.jsxs(R,{"code-path":"src/components/agent/AgentWizard.tsx:211:15",value:"ssh",className:"data-[state=active]:bg-slate-700",children:[a.jsx(ta,{"code-path":"src/components/agent/AgentWizard.tsx:212:17",className:"h-4 w-4 mr-1.5"}),"SSH一键安装"]}),!e&&a.jsxs(R,{"code-path":"src/components/agent/AgentWizard.tsx:217:15",value:"ssh",className:"data-[state=active]:bg-slate-700 opacity-50 cursor-not-allowed",disabled:!0,children:[a.jsx(ta,{"code-path":"src/components/agent/AgentWizard.tsx:218:17",className:"h-4 w-4 mr-1.5"}),"SSH一键安装"]}),a.jsx(R,{"code-path":"src/components/agent/AgentWizard.tsx:222:13",value:"manual",className:"data-[state=active]:bg-slate-700",children:"手动安装"})]}),a.jsxs(K,{"code-path":"src/components/agent/AgentWizard.tsx:228:11",value:"auto",className:"mt-4 space-y-3",children:[a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:229:13",className:"text-sm text-slate-400",children:"在目标主机执行以下命令,Agent 将自动下载、安装并启动:"}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:232:13",className:"relative rounded-lg bg-slate-950 border border-slate-800 p-4",children:[a.jsx("pre",{"code-path":"src/components/agent/AgentWizard.tsx:233:15",className:"text-xs text-emerald-400 font-mono whitespace-pre-wrap break-all pr-10",children:l}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:236:15",size:"icon",variant:"ghost",onClick:S,className:"absolute top-2 right-2 h-8 w-8 text-slate-400 hover:text-slate-100 hover:bg-slate-800",title:"复制到剪贴板",children:N?a.jsx(ts,{"code-path":"src/components/agent/AgentWizard.tsx:243:27",className:"h-4 w-4 text-emerald-400"}):a.jsx(os,{"code-path":"src/components/agent/AgentWizard.tsx:243:76",className:"h-4 w-4"})})]}),m&&a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:249:15",className:"rounded-lg bg-amber-950/30 border border-amber-800/50 p-4",children:[a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:250:17",className:"text-xs text-amber-400 mb-2",children:"⚠️ 自动复制失败。请点击下方输入框全选 (Ctrl+A) 后复制 (Ctrl+C):"}),a.jsx("textarea",{"code-path":"src/components/agent/AgentWizard.tsx:253:17",readOnly:!0,value:l,className:"w-full h-24 bg-slate-950 border border-amber-800/30 text-emerald-400 font-mono text-xs p-3 rounded resize-none focus:outline-none focus:border-amber-600",onClick:d=>d.target.select()})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:261:13",className:"flex items-start gap-2 text-xs text-slate-500",children:[a.jsx(ja,{"code-path":"src/components/agent/AgentWizard.tsx:262:15",className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),a.jsxs("span",{"code-path":"src/components/agent/AgentWizard.tsx:263:15",children:["服务器地址已自动检测 — 安装脚本通过 Nginx 代理 (",b,"),Agent 直连后端 (",g,")。安装成功后将自动连接并开始上报指标。"]})]})]}),!e&&a.jsx(K,{"code-path":"src/components/agent/AgentWizard.tsx:271:13",value:"ssh",className:"mt-4 space-y-4",children:a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:272:15",className:"text-center py-12 text-slate-400",children:[a.jsx(Q,{"code-path":"src/components/agent/AgentWizard.tsx:273:17",className:"h-10 w-10 mx-auto mb-3 opacity-50"}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:274:17",className:"text-sm font-medium mb-1",children:"未选择目标主机"}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:275:17",className:"text-xs",children:"请先在主机列表中勾选一台主机,再点击「安装 Agent」打开此页面"})]})}),e&&a.jsxs(K,{"code-path":"src/components/agent/AgentWizard.tsx:281:13",value:"ssh",className:"mt-4 space-y-4",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:282:15",className:"rounded-lg bg-slate-950 border border-slate-800 p-4",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:283:17",className:"flex items-center gap-3 mb-3",children:[a.jsx(Q,{"code-path":"src/components/agent/AgentWizard.tsx:284:19",className:"h-5 w-5 text-blue-400"}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:285:19",children:[a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:286:21",className:"text-sm font-medium text-slate-200",children:e.hostname}),a.jsx("code",{"code-path":"src/components/agent/AgentWizard.tsx:287:21",className:"text-xs text-slate-400",children:e.ip})]})]}),n&&a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:293:19",className:"mb-4 p-3 rounded-lg bg-amber-950/30 border border-amber-800/40 space-y-3",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:294:21",className:"flex items-center gap-2 text-xs text-amber-300/80",children:[a.jsx(rs,{"code-path":"src/components/agent/AgentWizard.tsx:295:23",className:"h-3.5 w-3.5"}),a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:296:23",children:"该服务器未配置 SSH 凭据,请填写以下信息(首次连接成功后自动保存)"})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:298:21",className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:299:23",children:[a.jsx(L,{"code-path":"src/components/agent/AgentWizard.tsx:300:25",className:"text-xs text-slate-400",children:"用户名"}),a.jsx(X,{"code-path":"src/components/agent/AgentWizard.tsx:301:25",value:A,onChange:d=>W(d.target.value),placeholder:"root",className:"h-8 text-sm bg-slate-900 border-slate-700 text-slate-200 mt-1"})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:308:23",className:"flex items-end gap-1",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:309:25",className:"flex-1",children:[a.jsx(L,{"code-path":"src/components/agent/AgentWizard.tsx:310:27",className:"text-xs text-slate-400",children:"密码"}),a.jsx(X,{"code-path":"src/components/agent/AgentWizard.tsx:311:27",type:"password",value:Z,onChange:d=>{F(d.target.value),f("password")},placeholder:"******",className:"h-8 text-sm bg-slate-900 border-slate-700 text-slate-200 mt-1"})]}),a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:319:25",className:"text-xs text-slate-500 px-1 pb-1",children:"或"}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:320:25",variant:"ghost",size:"sm",onClick:()=>{f("key"),F("")},className:`text-xs h-7 px-2 ${p==="key"?"text-blue-400":"text-slate-500"}`,children:"密钥"})]})]}),p==="key"&&a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:328:23",children:[a.jsx(L,{"code-path":"src/components/agent/AgentWizard.tsx:329:25",className:"text-xs text-slate-400",children:"SSH 私钥(PEM 格式)"}),a.jsx("textarea",{"code-path":"src/components/agent/AgentWizard.tsx:330:25",value:T,onChange:d=>$(d.target.value),placeholder:`-----BEGIN OPENSSH PRIVATE KEY----- +import{j as a,r as o}from"./vendor-codemirror-B1SGo4xl.js";import{B as D,o as za,D as oa,a as ra,b as na,c as da,d as ka,t as u,f as Ya,i as Qa,e as Na}from"./index-Bp-M7P_8.js";import{I as X}from"./input-Bnlm--la.js";import{B as O}from"./badge-B00SZHvE.js";import{C as U,b as ya,c as Ga,a as H}from"./card-BHSBTtub.js";import{S as xa,a as pa,b as ba,c as ua,d as B}from"./select-DbhcBWnH.js";import{L}from"./label-NkONM5Mp.js";import{s as Wa}from"./server-B7EY-8NK.js";import{d as ga}from"./grafana-DTc3taUi.js";import{z as Xa,p as as}from"./datasource-B9nxnUtk.js";import{a as fa}from"./agent-BZUl25f5.js";import{aa as ss,A as J,R as ca,L as aa,l as va,h as Q,aO as _a,aJ as $a,W as Za,Y as Fa,k as es,a4 as ta,g as Ta,r as ja,w as ts,aF as os,j as rs,v as ns,p as ds,z as cs,an as hs,ao as ms,_ as Ia,ar as is,aC as Pa,T as ls,I as xs,aP as ps,u as Ba,D as Oa,E as Ma,P as Aa}from"./vendor-icons-BWk-DH7F.js";import{z as bs,p as Sa}from"./metrics-D_WSC7FH.js";import{S as Ea}from"./stat-strip-CSMyyoYr.js";import{T as Ua,a as Ha,b as R,c as K}from"./tabs-DbNlmoQJ.js";import{C as Da}from"./checkbox-Bsb-ZRm9.js";import"./index-5FEebgvX.js";function us(s){const e=[];for(let c=0;c<24;c++)e.push({time:new Date(Date.now()-(24-c)*36e5).toLocaleTimeString(),value:Math.random()*100});return e}function gs({panel:s}){const r=us();switch(s.type){case"stat":return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:24:9",className:"flex flex-col items-center justify-center h-full",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:25:11",className:"text-4xl font-bold text-blue-500",children:Math.floor(Math.random()*1e3)}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:26:11",className:"text-sm text-muted-foreground mt-2",children:s.options?.unit||"requests/s"}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:27:11",className:"flex items-center gap-1 mt-2 text-green-500 text-sm",children:[a.jsx(ss,{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:28:13",className:"w-4 h-4"}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:29:13",children:"+12.5%"})]})]});case"gauge":return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:35:9",className:"flex flex-col items-center justify-center h-full",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:36:11",className:"relative w-24 h-24",children:[a.jsxs("svg",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:37:13",className:"w-full h-full",viewBox:"0 0 100 100",children:[a.jsx("circle",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:38:15",cx:"50",cy:"50",r:"40",fill:"none",stroke:"#e5e7eb",strokeWidth:"10"}),a.jsx("circle",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:39:15",cx:"50",cy:"50",r:"40",fill:"none",stroke:"#3b82f6",strokeWidth:"10",strokeDasharray:`${Math.random()*251} 251`,transform:"rotate(-90 50 50)"})]}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:50:13",className:"absolute inset-0 flex items-center justify-center",children:a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:51:15",className:"text-xl font-bold",children:[Math.floor(Math.random()*100),"%"]})})]}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:54:11",className:"text-sm text-muted-foreground mt-2",children:"CPU使用率"})]});default:return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:60:9",className:"h-full flex flex-col",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:61:11",className:"flex-1 flex items-end gap-1 px-2",children:r.map((e,c)=>a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:63:15",className:"flex-1 bg-blue-500 rounded-t",style:{height:`${e.value}%`,opacity:.3+c/r.length*.7}},c))}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:70:11",className:"flex justify-between text-xs text-muted-foreground px-2 pt-2",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:71:13",children:r[0].time}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaPanelContent.tsx:72:13",children:r[r.length-1].time})]})]})}}const fs=({dsUrl:s,dsUsername:r,dsPassword:e})=>{const[c,i]=o.useState(!1),[x,b]=o.useState(!1),[g,N]=o.useState([]),[w,m]=o.useState(""),[P,y]=o.useState(""),[z,v]=o.useState("cpu_usage"),[h,A]=o.useState("desc");o.useEffect(()=>{s&&r&&e&&W(s,r,e)},[s,r,e]);const W=async(n,l,S)=>{b(!0),y("");try{const j=await bs.connect(n,l,S);N(j.hosts||[]),m(j.version||""),i(!0)}catch(j){i(!1),y(j.message||"连接失败")}finally{b(!1)}},Z=()=>{s&&r&&e&&W(s,r,e)},F=n=>{z===n?A(l=>l==="asc"?"desc":"asc"):(v(n),A("desc"))},T=[...g].sort((n,l)=>{const S=n[z]??"",j=l[z]??"";return typeof S=="number"?h==="asc"?S-j:j-S:h==="asc"?String(S).localeCompare(String(j)):String(j).localeCompare(String(S))}),$=({f:n})=>z!==n?a.jsx($a,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:68:33",className:"w-3 h-3 text-slate-500"}):h==="asc"?a.jsx(Za,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:69:32",className:"w-3 h-3 text-blue-400"}):a.jsx(Fa,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:69:80",className:"w-3 h-3 text-blue-400"}),p=(n,l)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:73:5",className:"flex items-center gap-2 min-w-[90px]",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:74:7",className:"flex-1 h-2.5 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:75:9",className:`h-full rounded-full transition-all duration-500 ${n>=80?"bg-orange-500":"bg-blue-500"}`,style:{width:`${Math.min(n,100)}%`}})}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:77:7",className:`w-14 text-right text-xs font-mono tabular-nums ${n>=80?"text-orange-400":""}`,children:l})]}),f=n=>!n||n===0?"—":n>1e9?`${(n/1e9).toFixed(1)} GB/s`:n>1e6?`${(n/1e6).toFixed(1)} MB/s`:n>1e3?`${(n/1e3).toFixed(1)} KB/s`:`${n.toFixed(1)} B/s`;return!c&&!x&&!P?null:a.jsxs(U,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:92:5",className:"bg-[var(--dg-bg-secondary)] border-blue-500/20",children:[a.jsx(ya,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:93:7",className:"py-3 px-4 pb-2",children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:94:9",className:"flex items-center gap-2",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:95:11",className:"h-4 w-4 text-blue-400"}),a.jsx(Ga,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:96:11",className:"text-sm font-medium",children:"Zabbix 主机监控"}),w&&a.jsxs(O,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:97:23",className:"text-[10px] bg-blue-500/10 text-blue-400",children:["v",w]}),c&&a.jsxs("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:98:25",className:"text-[10px] text-[var(--dg-text-muted)] ml-2",children:[g.length," 台"]}),c&&a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:99:25",className:"ml-auto flex gap-1",children:a.jsxs(D,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:99:61",variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px]",onClick:Z,children:[a.jsx(ca,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:99:146",className:"w-3 h-3 mr-1"}),"刷新"]})})]})}),a.jsx(H,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:102:7",className:"px-4 pb-3 pt-0",children:x?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:103:21",className:"text-center py-12",children:[a.jsx(aa,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:103:56",className:"h-6 w-6 mx-auto mb-2 animate-spin text-blue-400"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:103:127",className:"text-xs text-[var(--dg-text-muted)]",children:"连接中…"})]}):P?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:104:20",className:"p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-xs text-red-400 flex items-start gap-2",children:[a.jsx(va,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:104:135",className:"h-4 w-4 mt-0.5"}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:104:179",children:P})]}):g.length===0?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:105:33",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[a.jsx(Q,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:105:95",className:"h-8 w-8 mx-auto mb-2 text-slate-600"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:105:153",className:"text-sm",children:"未找到被监控的 Zabbix 主机"})]}):a.jsx("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:107:11",className:"overflow-x-auto rounded-lg border border-[var(--dg-border)]",children:a.jsxs("table",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:108:13",className:"w-full text-xs",children:[a.jsx("thead",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:109:15",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:a.jsx("tr",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:109:96",children:[{f:"hostname",l:"主机名"},{f:"cpu_usage",l:"CPU"},{f:"memory_usage",l:"内存"},{f:"disk_usage",l:"磁盘"},{f:"load5",l:"Load5"},{f:"net_in_bps",l:"流入"},{f:"net_out_bps",l:"流出"},{f:"problem_count",l:"问题"},{f:"uptime_days",l:"运行"}].map(({f:n,l})=>a.jsx("th",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:115:19",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] cursor-pointer hover:text-[var(--dg-text-primary)] select-none whitespace-nowrap",onClick:()=>F(n),children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:116:21",className:"flex items-center gap-1",children:[l,a.jsx($,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:116:65",f:n})]})},n))})}),a.jsx("tbody",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:118:15",children:T.map((n,l)=>a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:120:19",className:"border-b border-[var(--dg-border)] last:border-0 hover:bg-[var(--dg-bg-tertiary)]/50",children:[a.jsxs("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:21",className:"px-3 py-2.5 whitespace-nowrap",children:[a.jsxs(O,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:67",className:`text-[10px] ${n.available==="1"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400"}`,children:[a.jsx(_a,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:193",className:"w-3 h-3 mr-1"}),n.available==="1"?"UP":"DOWN"]})," ",a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:121:272",className:"font-medium text-[var(--dg-text-primary)] ml-1",children:n.name||n.hostname})]}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:122:21",className:"px-3 py-2.5",children:p(Number(n.cpu_usage||0),`${Number(n.cpu_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:123:21",className:"px-3 py-2.5",children:p(Number(n.memory_usage||0),`${Number(n.memory_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:124:21",className:"px-3 py-2.5",children:p(Number(n.disk_usage||0),`${Number(n.disk_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:125:21",className:"px-3 py-2.5 text-[var(--dg-text-secondary)]",children:n.load5>0?n.load5.toFixed(1):"—"}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:126:21",className:"px-3 py-2.5 font-mono text-[var(--dg-text-secondary)]",children:f(n.net_in_bps)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:127:21",className:"px-3 py-2.5 font-mono text-[var(--dg-text-secondary)]",children:f(n.net_out_bps)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:128:21",className:"px-3 py-2.5 text-center",children:a.jsx("span",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:128:61",className:`font-mono font-bold ${n.problem_count>0?n.problem_count>2?"text-red-400":"text-amber-400":"text-emerald-400"}`,children:n.problem_count>0?a.jsxs(a.Fragment,{children:[a.jsx(va,{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:128:230",className:"w-3 h-3 inline mr-1"}),n.problem_count]}):"0"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/ZabbixDashboard.tsx:129:21",className:"px-3 py-2.5 text-[var(--dg-text-secondary)]",children:n.uptime_days>0?`${n.uptime_days}d`:"—"})]},n.hostid||l))})]})})})]})},V=({val:s,label:r,color:e})=>{const c=Math.min(s,100);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:16:5",className:"flex items-center gap-1.5 min-w-[80px]",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:17:7",className:"flex-1 h-2 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:18:9",className:`h-full rounded-full ${e||"bg-purple-500"}`,style:{width:`${c}%`}})}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:20:7",className:"w-14 text-right text-[11px] font-mono text-[var(--dg-text-secondary)]",children:r})]})},js=s=>s?s>1e9?`${(s/1e9).toFixed(1)} GB`:s>1e6?`${(s/1e6).toFixed(1)} MB`:`${(s/1e3).toFixed(1)} KB`:"—",Ca=s=>s?s>1e9?`${(s/1e9).toFixed(1)} GB/s`:s>1e6?`${(s/1e6).toFixed(1)} MB/s`:s>1e3?`${(s/1e3).toFixed(1)} KB/s`:`${s.toFixed(1)} B/s`:"—";function Ds(s){return(s||[]).map(r=>{const e={...r.metric||{}};return r.value&&(e.value=r.value[1]),e})}const Ns=s=>a.jsx("svg",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:47:26",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",...s,children:a.jsx("path",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:47:211",d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"})}),vs=({d:s})=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:50:3",className:"space-y-4",children:[a.jsx(Ea,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:51:5",items:[{label:"Pods",value:s.podCount?.[0]?.value||0,color:"purple"},{label:"Deployments",value:s.deployCount?.[0]?.value||0,color:"blue"},{label:"Nodes",value:s.nodeCount?.[0]?.value||0,color:"emerald"},{label:"Namespaces",value:s.nsPods?.length||0,color:"amber"}]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:59:5",className:"rounded-lg bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] p-3 max-h-60 overflow-y-auto",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:60:7",className:"text-xs font-medium mb-2 flex items-center gap-1",children:[a.jsx(Ta,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:60:73",className:"w-3 h-3 text-purple-400"}),"节点 CPU / 内存利用率"]}),(s.nodeCPU||[]).map((r,e)=>{const c=(s.nodeMem||[]).find(i=>i.node===r.node);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:16",className:"flex items-center gap-3 text-[11px] mb-1.5",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:84",className:"w-28 truncate",title:r.node,children:r.node}),a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:146",val:Number(r.value||0),label:`${Number(r.value||0).toFixed(1)}%`}),a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:63:226",val:Number(c?.value||0),label:`${Number(c?.value||0).toFixed(1)}%`,color:"bg-blue-500"})]},e)})]})]}),ys=({d:s})=>a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:70:3",className:"overflow-x-auto rounded-lg border border-[var(--dg-border)]",children:a.jsxs("table",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:71:5",className:"w-full text-xs",children:[a.jsx("thead",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:7",className:"bg-[var(--dg-bg-tertiary)]",children:a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:53",children:[a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:57",className:"px-3 py-2 text-left",children:"节点"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:100",className:"px-3 py-2 text-left",children:"状态"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:143",className:"px-3 py-2 text-left",children:"CPU"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:187",className:"px-3 py-2 text-left",children:"内存"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:230",className:"px-3 py-2 text-left",children:"磁盘"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:273",className:"px-3 py-2 text-left",children:"流入"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:72:316",className:"px-3 py-2 text-left",children:"流出"})]})}),a.jsx("tbody",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:73:7",children:(s.nodes||[]).map((r,e)=>{const c=r.instance||r.exported_instance||"",i=(s.cpuUsage||[]).find(m=>m.instance===c),x=(s.memUsage||[]).find(m=>m.instance===c),b=(s.diskUsage||[]).find(m=>m.instance===c),g=(s.up||[]).find(m=>m.instance===c),N=(s.netRx||[]).find(m=>m.instance===c),w=(s.netTx||[]).find(m=>m.instance===c);return a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:82:18",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:83:13",className:"px-3 py-2 font-medium",children:r.nodename||c}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:84:13",className:"px-3 py-2",children:a.jsx(O,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:84:39",className:`text-[10px] ${g?.value===1?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400"}`,children:g?.value===1?"UP":"DOWN"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:85:13",className:"px-3 py-2",children:a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:85:39",val:Number(i?.value||0),label:`${Number(i?.value||0).toFixed(1)}%`})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:86:13",className:"px-3 py-2",children:a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:86:39",val:Number(x?.value||0),label:`${Number(x?.value||0).toFixed(1)}%`,color:"bg-blue-500"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:87:13",className:"px-3 py-2",children:a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:87:39",val:Number(b?.value||0),label:`${Number(b?.value||0).toFixed(1)}%`,color:"bg-amber-500"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:88:13",className:"px-3 py-2 font-mono text-[var(--dg-text-secondary)]",children:Ca(Number(N?.value||0))}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:89:13",className:"px-3 py-2 font-mono text-[var(--dg-text-secondary)]",children:Ca(Number(w?.value||0))})]},e)})})]})}),Gs=({d:s})=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:98:3",className:"space-y-4",children:[a.jsx(Ea,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:99:5",items:[{label:"Running",value:s.running?.[0]?.value||0,color:"emerald"},{label:"Pending",value:s.pending?.[0]?.value||0,color:"amber"}]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:5",className:"rounded-lg bg-[var(--dg-bg-primary)] p-3 max-h-40 overflow-y-auto",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:88",className:"text-xs font-medium mb-2",children:"CPU Top 10"}),(s.cpuTop||[]).map((r,e)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:186",className:"flex items-center gap-2 text-[11px] mb-1",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:252",className:"w-10 text-right text-[var(--dg-text-muted)]",children:e+1}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:326",className:"w-32 truncate",title:r.pod,children:r.pod}),a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:105:386",val:Number(r.value||0)*100,label:`${Number(r.value||0).toFixed(2)}c`,color:"bg-purple-500"})]},e))]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:5",className:"rounded-lg bg-[var(--dg-bg-primary)] p-3 max-h-40 overflow-y-auto",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:88",className:"text-xs font-medium mb-2",children:"内存 Top 10"}),(s.memTop||[]).map((r,e)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:185",className:"flex items-center gap-2 text-[11px] mb-1",children:[a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:251",className:"w-10 text-right text-[var(--dg-text-muted)]",children:e+1}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:325",className:"w-32 truncate",title:r.pod,children:r.pod}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:106:385",className:"ml-auto",children:js(Number(r.value||0))})]},e))]})]}),ws=({d:s})=>{const r=Number(s.heapUsed?.[0]?.value||0),e=Number(s.uptime?.[0]?.value||0);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:114:5",className:"grid grid-cols-5 gap-3",children:[a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:51",className:"p-3 text-center",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:92",className:"text-lg font-bold",children:e>86400?`${(e/86400).toFixed(1)}d`:`${(e/3600).toFixed(1)}h`}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:115:210",className:"text-[10px] text-[var(--dg-text-muted)]",children:"Uptime"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:51",className:"p-3 text-center",children:[a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:92",val:r,label:`${r.toFixed(1)}%`,color:r>80?"bg-orange-500":"bg-purple-500"}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:116:183",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:"Heap"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:51",className:"p-3 text-center",children:[a.jsx(V,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:92",val:Number(s.nonHeapUsed?.[0]?.value||0),label:`${Number(s.nonHeapUsed?.[0]?.value||0).toFixed(1)}%`,color:"bg-blue-500"}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:117:228",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:"Non-Heap"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:51",className:"p-3 text-center",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:92",className:"text-lg font-bold text-emerald-400",children:s.threadCount?.[0]?.value||0}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:118:180",className:"text-[10px] text-[var(--dg-text-muted)]",children:"Threads"})]})}),a.jsx(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:7",className:"bg-[var(--dg-bg-primary)]",children:a.jsxs(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:51",className:"p-3 text-center",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:92",className:"text-lg font-bold text-amber-400",children:Number(s.gcPause?.[0]?.value||0).toFixed(3)}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:119:193",className:"text-[10px] text-[var(--dg-text-muted)]",children:"GC Pause (s)"})]})})]})},Ps=({dsUrl:s})=>{const[r,e]=o.useState(!1),[c,i]=o.useState(!1),[x,b]=o.useState(0),[g,N]=o.useState(""),[w,m]=o.useState("kubernetes"),[P,y]=o.useState({}),[z,v]=o.useState({}),[h,A]=o.useState({}),[W,Z]=o.useState({});o.useEffect(()=>{s&&F(s)},[s]);const F=async p=>{i(!0),N("");try{const f=await Sa.connect(p);e(!0),b(f.targets||0),T(p)}catch(f){e(!1),N(f.message||"连接失败")}finally{i(!1)}},T=async p=>{for(const f of["kubernetes","node","pod","jvm"])try{const n=await Sa.dashboard(p,f),l={};for(const[S,j]of Object.entries(n||{}))l[S]=Array.isArray(j)?j:j?.data?.result?Ds(j.data.result):j;f==="kubernetes"&&y(l),f==="node"&&v(l),f==="pod"&&A(l),f==="jvm"&&Z(l)}catch{}},$=()=>{s&&F(s)};return!r&&!g?null:a.jsxs(U,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:167:5",className:"bg-[var(--dg-bg-secondary)] border-purple-500/20",children:[a.jsx(ya,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:168:7",className:"py-3 px-4 pb-2",children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:169:9",className:"flex items-center gap-2",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:170:11",className:"h-4 w-4 text-purple-400"}),a.jsx(Ga,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:171:11",className:"text-sm font-medium",children:"Prometheus 监控"}),r&&a.jsxs(O,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:172:25",className:"text-[10px] bg-purple-500/10 text-purple-400",children:[x," targets"]}),r&&a.jsx("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:173:25",className:"ml-auto",children:a.jsxs(D,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:173:50",variant:"ghost",size:"sm",className:"h-6 px-2 text-[10px]",onClick:$,children:[a.jsx(ca,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:173:135",className:"w-3 h-3 mr-1"}),"刷新"]})})]})}),a.jsx(H,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:176:7",className:"px-4 pb-3 pt-0",children:c?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:177:21",className:"text-center py-12",children:[a.jsx(aa,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:177:56",className:"h-6 w-6 mx-auto mb-2 animate-spin text-purple-400"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:177:129",className:"text-xs text-[var(--dg-text-muted)]",children:"连接中…"})]}):g?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:178:20",className:"p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-xs text-red-400",children:[a.jsx(va,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:178:112",className:"h-4 w-4 inline mr-1"}),g]}):a.jsxs(Ua,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:180:11",value:w,onValueChange:m,children:[a.jsxs(Ha,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:181:13",className:"bg-[var(--dg-bg-tertiary)] mb-3",children:[a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:182:15",value:"kubernetes",className:"text-xs",children:[a.jsx(es,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:182:67",className:"w-3 h-3 mr-1"}),"Kubernetes"]}),a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:183:15",value:"node",className:"text-xs",children:[a.jsx(Q,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:183:61",className:"w-3 h-3 mr-1"}),"Node"]}),a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:184:15",value:"pod",className:"text-xs",children:[a.jsx(Ns,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:184:60",className:"w-3 h-3 mr-1"}),"Pod"]}),a.jsxs(R,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:185:15",value:"jvm",className:"text-xs",children:[a.jsx(ta,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:185:60",className:"w-3 h-3 mr-1"}),"JVM"]})]}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:187:13",value:"kubernetes",children:a.jsx(vs,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:187:45",d:P})}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:188:13",value:"node",children:a.jsx(ys,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:188:39",d:z})}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:189:13",value:"pod",children:a.jsx(Gs,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:189:38",d:h})}),a.jsx(K,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:190:13",value:"jvm",children:a.jsx(ws,{"code-path":"src/components/monitor/dashboard/PrometheusDashboard.tsx:190:38",d:W})})]})})]})};function As(s){return s?Array.isArray(s)?s:Array.isArray(s.list)?s.list:Array.isArray(s.items)?s.items:Array.isArray(s.data)?s.data:[]:[]}function Ss(){return typeof window<"u"&&window.location?{origin:window.location.origin,backend:`${window.location.protocol}//${window.location.hostname}:8080`}:{origin:"http://127.0.0.1",backend:"http://127.0.0.1:8080"}}function Cs({open:s,onOpenChange:r,server:e,onInstalled:c,onFailed:i}){const x=za(d=>d.token)||"",{origin:b,backend:g}=Ss(),[N,w]=o.useState(!1),[m,P]=o.useState(!1),[y,z]=o.useState(!1),[v,h]=o.useState("auto"),[A,W]=o.useState("root"),[Z,F]=o.useState(""),[T,$]=o.useState(""),[p,f]=o.useState("password"),n=e&&!e.has_auth,l=`curl -fsSL ${b}/agent/install.sh | bash -s -- --server ${g} --token ${x}`,S=()=>{const d=document.createElement("textarea");d.value=l,d.style.position="fixed",d.style.top="0",d.style.left="0",d.style.width="2em",d.style.height="2em",d.style.padding="0",d.style.border="none",d.style.outline="none",d.style.boxShadow="none",d.style.background="transparent",d.style.opacity="0",d.style.pointerEvents="none",d.style.zIndex="-1",d.style.fontSize="16px",d.contentEditable="true",d.readOnly=!0,document.body.appendChild(d),d.focus(),d.select(),d.setSelectionRange&&d.setSelectionRange(0,999999);let _=!1;try{_=document.execCommand("copy")}catch{}document.body.removeChild(d),_?(w(!0),u.success("安装命令已复制到剪贴板,粘贴到目标主机执行"),setTimeout(()=>w(!1),3e3)):(u.error("自动复制失败,请在下方手动全选复制 (Ctrl+A → Ctrl+C)"),P(!0))},j=`${b}/agent/aiops-agent-linux-amd64`,ha=[{icon:ns,title:"1. 下载二进制",commands:[`curl -fsSL ${j} -o /usr/local/bin/aiops-agent`]},{icon:ds,title:"2. 赋予执行权限",commands:["chmod +x /usr/local/bin/aiops-agent"]},{icon:Ta,title:"3. 创建 systemd 服务",commands:["cat > /etc/systemd/system/aiops-agent.service << 'EOF'","[Unit]","Description=AIOps Agent","After=network.target","","[Service]","Type=simple",`ExecStart=/usr/local/bin/aiops-agent --server ${g} --token ${x}`,"Restart=always","RestartSec=5","","[Install]","WantedBy=multi-user.target","EOF"]},{icon:cs,title:"4. 启动并设置开机自启",commands:["systemctl daemon-reload","systemctl enable --now aiops-agent","systemctl status aiops-agent"]}],I=async()=>{if(!(!e||!x)){if(n&&!Z&&!T){u.error("请填写 SSH 登录凭据(密码或密钥)");return}z(!0);try{const d=n?{username:A,password:Z,ssh_key:T,auth_type:p}:void 0;(await Wa.installAgent(e.id,x,d))?.installed||!1?(u.success(`${e.hostname} Agent 安装成功`),c?.(e.id),r(!1)):(u.warning(`${e.hostname}: Agent 安装命令已执行,但服务未检测到运行`),c?.(e.id),r(!1))}catch(d){const _=d?.message||"安装失败";u.error(`${e.hostname} ${_}`),i?.(e.id,_)}finally{z(!1)}}};return a.jsx(oa,{"code-path":"src/components/agent/AgentWizard.tsx:190:5",open:s,onOpenChange:r,children:a.jsxs(ra,{"code-path":"src/components/agent/AgentWizard.tsx:191:7",className:"max-w-2xl bg-slate-900 border-slate-800 text-slate-100",children:[a.jsxs(na,{"code-path":"src/components/agent/AgentWizard.tsx:192:9",children:[a.jsx(da,{"code-path":"src/components/agent/AgentWizard.tsx:193:11",className:"text-slate-100",children:e?`部署 Agent → ${e.hostname}`:"部署 Agent"}),a.jsx(ka,{"code-path":"src/components/agent/AgentWizard.tsx:196:11",className:"text-slate-400",children:e?`目标主机 ${e.hostname} (${e.ip}),选择安装方式:`:"在目标主机上执行以下命令即可完成 Agent 安装与注册"})]}),a.jsxs(Ua,{"code-path":"src/components/agent/AgentWizard.tsx:204:9",value:v,onValueChange:h,className:"w-full",children:[a.jsxs(Ha,{"code-path":"src/components/agent/AgentWizard.tsx:205:11",className:"bg-slate-800 border border-slate-700",children:[a.jsxs(R,{"code-path":"src/components/agent/AgentWizard.tsx:206:13",value:"auto",className:"data-[state=active]:bg-slate-700",children:[a.jsx(ja,{"code-path":"src/components/agent/AgentWizard.tsx:207:15",className:"h-4 w-4 mr-1.5"}),"安装Agent"]}),e&&a.jsxs(R,{"code-path":"src/components/agent/AgentWizard.tsx:211:15",value:"ssh",className:"data-[state=active]:bg-slate-700",children:[a.jsx(ta,{"code-path":"src/components/agent/AgentWizard.tsx:212:17",className:"h-4 w-4 mr-1.5"}),"SSH一键安装"]}),!e&&a.jsxs(R,{"code-path":"src/components/agent/AgentWizard.tsx:217:15",value:"ssh",className:"data-[state=active]:bg-slate-700 opacity-50 cursor-not-allowed",disabled:!0,children:[a.jsx(ta,{"code-path":"src/components/agent/AgentWizard.tsx:218:17",className:"h-4 w-4 mr-1.5"}),"SSH一键安装"]}),a.jsx(R,{"code-path":"src/components/agent/AgentWizard.tsx:222:13",value:"manual",className:"data-[state=active]:bg-slate-700",children:"手动安装"})]}),a.jsxs(K,{"code-path":"src/components/agent/AgentWizard.tsx:228:11",value:"auto",className:"mt-4 space-y-3",children:[a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:229:13",className:"text-sm text-slate-400",children:"在目标主机执行以下命令,Agent 将自动下载、安装并启动:"}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:232:13",className:"relative rounded-lg bg-slate-950 border border-slate-800 p-4",children:[a.jsx("pre",{"code-path":"src/components/agent/AgentWizard.tsx:233:15",className:"text-xs text-emerald-400 font-mono whitespace-pre-wrap break-all pr-10",children:l}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:236:15",size:"icon",variant:"ghost",onClick:S,className:"absolute top-2 right-2 h-8 w-8 text-slate-400 hover:text-slate-100 hover:bg-slate-800",title:"复制到剪贴板",children:N?a.jsx(ts,{"code-path":"src/components/agent/AgentWizard.tsx:243:27",className:"h-4 w-4 text-emerald-400"}):a.jsx(os,{"code-path":"src/components/agent/AgentWizard.tsx:243:76",className:"h-4 w-4"})})]}),m&&a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:249:15",className:"rounded-lg bg-amber-950/30 border border-amber-800/50 p-4",children:[a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:250:17",className:"text-xs text-amber-400 mb-2",children:"⚠️ 自动复制失败。请点击下方输入框全选 (Ctrl+A) 后复制 (Ctrl+C):"}),a.jsx("textarea",{"code-path":"src/components/agent/AgentWizard.tsx:253:17",readOnly:!0,value:l,className:"w-full h-24 bg-slate-950 border border-amber-800/30 text-emerald-400 font-mono text-xs p-3 rounded resize-none focus:outline-none focus:border-amber-600",onClick:d=>d.target.select()})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:261:13",className:"flex items-start gap-2 text-xs text-slate-500",children:[a.jsx(ja,{"code-path":"src/components/agent/AgentWizard.tsx:262:15",className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),a.jsxs("span",{"code-path":"src/components/agent/AgentWizard.tsx:263:15",children:["服务器地址已自动检测 — 安装脚本通过 Nginx 代理 (",b,"),Agent 直连后端 (",g,")。安装成功后将自动连接并开始上报指标。"]})]})]}),!e&&a.jsx(K,{"code-path":"src/components/agent/AgentWizard.tsx:271:13",value:"ssh",className:"mt-4 space-y-4",children:a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:272:15",className:"text-center py-12 text-slate-400",children:[a.jsx(Q,{"code-path":"src/components/agent/AgentWizard.tsx:273:17",className:"h-10 w-10 mx-auto mb-3 opacity-50"}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:274:17",className:"text-sm font-medium mb-1",children:"未选择目标主机"}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:275:17",className:"text-xs",children:"请先在主机列表中勾选一台主机,再点击「安装 Agent」打开此页面"})]})}),e&&a.jsxs(K,{"code-path":"src/components/agent/AgentWizard.tsx:281:13",value:"ssh",className:"mt-4 space-y-4",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:282:15",className:"rounded-lg bg-slate-950 border border-slate-800 p-4",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:283:17",className:"flex items-center gap-3 mb-3",children:[a.jsx(Q,{"code-path":"src/components/agent/AgentWizard.tsx:284:19",className:"h-5 w-5 text-blue-400"}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:285:19",children:[a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:286:21",className:"text-sm font-medium text-slate-200",children:e.hostname}),a.jsx("code",{"code-path":"src/components/agent/AgentWizard.tsx:287:21",className:"text-xs text-slate-400",children:e.ip})]})]}),n&&a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:293:19",className:"mb-4 p-3 rounded-lg bg-amber-950/30 border border-amber-800/40 space-y-3",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:294:21",className:"flex items-center gap-2 text-xs text-amber-300/80",children:[a.jsx(rs,{"code-path":"src/components/agent/AgentWizard.tsx:295:23",className:"h-3.5 w-3.5"}),a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:296:23",children:"该服务器未配置 SSH 凭据,请填写以下信息(首次连接成功后自动保存)"})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:298:21",className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:299:23",children:[a.jsx(L,{"code-path":"src/components/agent/AgentWizard.tsx:300:25",className:"text-xs text-slate-400",children:"用户名"}),a.jsx(X,{"code-path":"src/components/agent/AgentWizard.tsx:301:25",value:A,onChange:d=>W(d.target.value),placeholder:"root",className:"h-8 text-sm bg-slate-900 border-slate-700 text-slate-200 mt-1"})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:308:23",className:"flex items-end gap-1",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:309:25",className:"flex-1",children:[a.jsx(L,{"code-path":"src/components/agent/AgentWizard.tsx:310:27",className:"text-xs text-slate-400",children:"密码"}),a.jsx(X,{"code-path":"src/components/agent/AgentWizard.tsx:311:27",type:"password",value:Z,onChange:d=>{F(d.target.value),f("password")},placeholder:"******",className:"h-8 text-sm bg-slate-900 border-slate-700 text-slate-200 mt-1"})]}),a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:319:25",className:"text-xs text-slate-500 px-1 pb-1",children:"或"}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:320:25",variant:"ghost",size:"sm",onClick:()=>{f("key"),F("")},className:`text-xs h-7 px-2 ${p==="key"?"text-blue-400":"text-slate-500"}`,children:"密钥"})]})]}),p==="key"&&a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:328:23",children:[a.jsx(L,{"code-path":"src/components/agent/AgentWizard.tsx:329:25",className:"text-xs text-slate-400",children:"SSH 私钥(PEM 格式)"}),a.jsx("textarea",{"code-path":"src/components/agent/AgentWizard.tsx:330:25",value:T,onChange:d=>$(d.target.value),placeholder:`-----BEGIN OPENSSH PRIVATE KEY----- ... -----END OPENSSH PRIVATE KEY-----`,rows:3,className:"w-full mt-1 bg-slate-900 border border-slate-700 text-slate-200 font-mono text-xs p-2 rounded-md resize-none"})]})]}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:342:17",className:"text-sm text-slate-400 mb-4",children:"通过 SSH 远程连接到目标主机,自动下载并安装 Agent,完成后立即启动运行。"}),a.jsx(D,{"code-path":"src/components/agent/AgentWizard.tsx:345:17",onClick:I,disabled:y,className:"w-full bg-blue-600 hover:bg-blue-700 text-white",children:y?a.jsxs(a.Fragment,{children:[a.jsx(aa,{"code-path":"src/components/agent/AgentWizard.tsx:352:23",className:"h-4 w-4 mr-2 animate-spin"}),"SSH 连接中,正在安装..."]}):a.jsxs(a.Fragment,{children:[a.jsx(ta,{"code-path":"src/components/agent/AgentWizard.tsx:357:23",className:"h-4 w-4 mr-2"}),n?"连接并安装 Agent(凭据将自动保存)":"一键安装 Agent"]})})]}),a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:363:15",className:"flex items-start gap-2 text-xs text-slate-500",children:[a.jsx(ja,{"code-path":"src/components/agent/AgentWizard.tsx:364:17",className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),a.jsxs("span",{"code-path":"src/components/agent/AgentWizard.tsx:365:17",children:["系统将通过 SSH 连接 ",e.ip,",执行安装脚本。请确保服务器 SSH 凭据已正确配置(编辑服务器可修改密码/密钥)。"]})]})]}),a.jsxs(K,{"code-path":"src/components/agent/AgentWizard.tsx:373:11",value:"manual",className:"mt-4 space-y-4",children:[a.jsx("div",{"code-path":"src/components/agent/AgentWizard.tsx:374:13",className:"max-h-[420px] overflow-y-auto space-y-3 pr-1",children:ha.map(d=>a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:376:17",className:"rounded-lg bg-slate-950 border border-slate-800 overflow-hidden",children:[a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:377:19",className:"flex items-center gap-2 px-4 py-2.5 bg-slate-800/50",children:[a.jsx(d.icon,{"code-path":"src/components/agent/AgentWizard.tsx:378:21",className:"h-4 w-4 text-blue-400"}),a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:379:21",className:"text-sm font-medium text-slate-200",children:d.title})]}),a.jsx("div",{"code-path":"src/components/agent/AgentWizard.tsx:381:19",className:"p-3 space-y-1",children:d.commands.map((_,sa)=>a.jsxs("div",{"code-path":"src/components/agent/AgentWizard.tsx:383:23",className:"flex items-start gap-2",children:[a.jsx("span",{"code-path":"src/components/agent/AgentWizard.tsx:384:25",className:"text-slate-600 font-mono text-xs select-none mt-0.5",children:"$"}),a.jsx("code",{"code-path":"src/components/agent/AgentWizard.tsx:385:25",className:"text-xs text-slate-300 font-mono whitespace-pre-wrap break-all flex-1",children:_})]},sa))})]},d.title))}),a.jsx("p",{"code-path":"src/components/agent/AgentWizard.tsx:394:13",className:"text-xs text-slate-500",children:"完成上述步骤后,Agent 将作为 systemd 服务运行并自动上报指标。"})]})]})]})})}const zs=[{id:"agent",label:"Agent 主机",icon:a.jsx(Q,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:51:43",className:"w-3.5 h-3.5"})},{id:"zabbix",label:"Zabbix",icon:a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:52:42",className:"w-3.5 h-3.5"})},{id:"prometheus",label:"Prometheus",icon:a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:53:50",className:"w-3.5 h-3.5"})},{id:"dashboard",label:"自定义",icon:a.jsx(Ia,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:54:42",className:"w-3.5 h-3.5"})}],ks=()=>{const s=Ya(),r=Qa(),[e,c]=o.useState([]),[i,x]=o.useState(!0),[b,g]=o.useState("cpu_usage"),[N,w]=o.useState("desc"),[m,P]=o.useState(1),[y,z]=o.useState(10),[v,h]=o.useState(new Set),[A,W]=o.useState(!1),[Z,F]=o.useState(null),[T,$]=o.useState(!1),[p,f]=o.useState("install"),[n,l]=o.useState(!1),[S,j]=o.useState(!1),[ha,I]=o.useState(new Set),[d,_]=o.useState(!1),sa=async()=>{if(await s({title:"批量卸载 Agent",description:`确定卸载选中的 ${ea.length} 台主机的 AIOps Agent?卸载将在后台异步执行。`,confirmText:"卸载",variant:"destructive"})){_(!0),I(new Set(ea));try{await fa.batchUninstall(ea),u.success(`已提交:批量卸载 ${ea.length} 台主机的 Agent,后台执行中,30秒后自动刷新`),h(new Set),setTimeout(()=>{q(),I(new Set)},3e4)}catch{u.error("提交失败"),I(new Set)}finally{_(!1)}}},wa=Math.max(1,Math.ceil(e.length/y)),q=async()=>{try{c(As(await fa.getLatest()))}catch{}finally{x(!1)}};o.useEffect(()=>{q();const t=setInterval(q,3e4);return()=>clearInterval(t)},[]);const La=t=>{b===t?w(C=>C==="asc"?"desc":"asc"):(g(t),w("desc"))},Ra=[...e].sort((t,C)=>{let G=t[b]??"",k=C[b]??"";return b==="agent_status"&&(G=t.agent_status||"",k=C.agent_status||""),typeof G=="number"?N==="asc"?G-k:k-G:N==="asc"?String(G).localeCompare(String(k)):String(k).localeCompare(String(G))}).slice((m-1)*y,m*y),Ka=({f:t})=>b!==t?a.jsx($a,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:106:54",className:"w-3 h-3 text-slate-500"}):N==="asc"?a.jsx(Za,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:106:122",className:"w-3 h-3 text-emerald-400"}):a.jsx(Fa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:106:173",className:"w-3 h-3 text-emerald-400"}),ma=(t,C)=>a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:108:5",className:"flex items-center gap-2 min-w-[90px]",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:108:59",className:"flex-1 h-2.5 rounded-full bg-[var(--dg-bg-tertiary)] overflow-hidden",children:a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:108:145",className:`h-full rounded-full transition-all duration-500 ${t>=80?"bg-orange-500":"bg-emerald-500"}`,style:{width:`${Math.min(t,100)}%`}})}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:108:310",className:`w-14 text-right text-xs font-mono tabular-nums ${t>=80?"text-orange-400":""}`,children:C})]}),Va=v.size===e.length&&e.length>0,ia=v.size>0,ea=[...v].map(Number).filter(t=>!isNaN(t)),Y=o.useMemo(()=>e.filter(t=>v.has(String(t.server_id))),[e,v]),M=o.useMemo(()=>Y.filter(t=>t.agent_status!=="online"),[Y]),E=o.useMemo(()=>Y.filter(t=>t.agent_status==="online"),[Y]),qa=()=>{l(!1),M.length>0&&E.length===0?f("install"):M.length===0&&E.length>0?f("upgrade"):f("install"),$(!0)},Ja=async()=>{if(!n){u.error("请先确认并勾选「我已知悉」");return}j(!0);const t=za.getState().token,C=Y.map(G=>G.server_id);I(new Set(C));try{if(p==="install"){if(!t){u.error("未登录");return}const G=M.map(la=>la.server_id);if(G.length===0){u.warning("所选主机均已安装 Agent,无需安装");return}const k=await Wa.batchInstallAgent(G,t);u.success(`已提交:批量安装 ${k?.total??G.length} 台主机的 Agent,后台执行中,30秒后自动刷新`),h(new Set),setTimeout(()=>{q(),I(new Set)},3e4)}else{const G=E.map(la=>la.server_id);if(G.length===0){u.warning("所选主机中没有在线 Agent,无法升级");return}const k=await fa.batchUpgrade(G);u.success(k?.message||`已提交:批量升级 ${G.length} 台主机的 Agent,后台执行中,30秒后自动刷新`),h(new Set),setTimeout(()=>{q(),I(new Set)},3e4)}$(!1)}catch{u.error("提交失败"),I(new Set)}finally{j(!1)}};return i?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:163:23",className:"text-center py-20 text-[var(--dg-text-muted)]",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:163:86",className:"h-6 w-6 mx-auto mb-2 animate-spin"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:163:144",className:"text-xs",children:"加载中…"})]}):e.length?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:166:5",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:168:7",className:"flex items-center gap-2 mb-3 flex-wrap",children:[ia&&a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:169:20",className:"text-xs text-[var(--dg-text-secondary)]",children:["已选 ",v.size," 项"]}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:170:9",className:"flex-1"}),a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:171:9",size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:()=>{const t=ia?e.find(C=>v.has(String(C.server_id))):null;F(t?{id:t.server_id,hostname:t.hostname,ip:t.ip,has_auth:t.has_auth}:null),W(!0)},children:[a.jsx(is,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:176:11",className:"w-3 h-3"}),"安装 Agent"]}),ia&&a.jsxs(a.Fragment,{children:[a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:180:13",size:"sm",variant:"outline",className:"h-7 text-xs gap-1 border-blue-500/30 text-blue-400 hover:bg-blue-500/10",onClick:qa,children:[a.jsx(Pa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:181:15",className:"w-3 h-3"}),"批量部署 (",v.size,")"]}),a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:183:13",size:"sm",variant:"outline",className:"h-7 text-xs gap-1 border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:sa,disabled:d,children:[a.jsx(ls,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:184:15",className:"w-3 h-3"}),"批量卸载 (",v.size,")"]})]}),a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:188:9",size:"sm",variant:"ghost",className:"h-7 text-xs gap-1",onClick:q,children:[a.jsx(ca,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:188:89",className:"w-3 h-3"}),"刷新"]})]}),a.jsx(Cs,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:191:7",open:A,onOpenChange:W,server:Z,onInstalled:()=>{u.success("Agent 安装成功"),W(!1),q()},onFailed:()=>u.error("安装失败")}),a.jsx(oa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:196:7",open:T,onOpenChange:t=>{t||($(!1),l(!1))},children:a.jsxs(ra,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:197:9",className:"max-w-2xl max-h-[85vh] overflow-auto bg-slate-900 border-slate-700 text-slate-100",children:[a.jsxs(na,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:198:11",children:[a.jsxs(da,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:199:13",className:"flex items-center gap-2 text-base",children:[a.jsx(Pa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:200:15",className:"w-5 h-5 text-blue-400"}),"批量部署 Agent"]}),a.jsxs(ka,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:203:13",className:"text-slate-400 text-xs",children:["选中 ",Y.length," 台主机(需安装: ",M.length,",待升级: ",E.length,")"]})]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:208:11",className:"space-y-4",children:[a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:210:13",className:"flex items-center gap-2 p-1 rounded-lg bg-slate-800 border border-slate-700 w-fit",children:["install","upgrade"].map(t=>a.jsx("button",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:212:17",disabled:t==="install"?M.length===0:E.length===0,onClick:()=>f(t),className:`px-4 py-1.5 rounded text-xs font-medium transition-colors disabled:opacity-30 disabled:cursor-not-allowed ${p===t?"bg-blue-600 text-white shadow-sm":"text-slate-400 hover:text-slate-200"}`,children:t==="install"?`⚡ 安装 (${M.length})`:`🔄 升级到最新版 (${E.length})`},t))}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:226:13",className:"rounded-md border border-slate-700 overflow-hidden",children:a.jsxs("table",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:227:15",className:"w-full text-xs",children:[a.jsx("thead",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:228:17",className:"bg-slate-800",children:a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:229:19",children:[a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:230:21",className:"px-3 py-2 text-left font-medium text-slate-400",children:"主机名"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:231:21",className:"px-3 py-2 text-left font-medium text-slate-400",children:"IP"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:232:21",className:"px-3 py-2 text-left font-medium text-slate-400",children:"状态"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:233:21",className:"px-3 py-2 text-left font-medium text-slate-400",children:"当前版本"}),a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:234:21",className:"px-3 py-2 text-left font-medium text-slate-400",children:"操作"})]})}),a.jsx("tbody",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:237:17",children:(p==="install"?M:E).map(t=>a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:239:21",className:"border-t border-slate-800 hover:bg-slate-800/50",children:[a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:240:23",className:"px-3 py-2 font-medium text-slate-200",children:t.hostname}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:241:23",className:"px-3 py-2 font-mono text-slate-400",children:t.ip}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:242:23",className:"px-3 py-2",children:t.agent_status==="online"?a.jsx(O,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:244:29",className:"text-[10px] bg-emerald-500/20 text-emerald-400",children:"在线"}):a.jsx(O,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:245:29",className:"text-[10px] bg-slate-500/20 text-slate-400",children:t.agent_status==="not_installed"?"未安装":t.agent_status||"离线"})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:249:23",className:"px-3 py-2 font-mono text-slate-400",children:t.agent_version||"—"}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:250:23",className:"px-3 py-2",children:a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:251:25",className:"text-blue-400 text-[11px]",children:p==="install"?"即将安装":"即将升级"})})]},t.server_id))})]})}),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:262:13",className:"rounded-md border border-amber-500/30 bg-amber-500/5 p-3 space-y-2",children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:263:15",className:"flex items-start gap-2",children:[a.jsx(xs,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:264:17",className:"w-4 h-4 text-amber-400 mt-0.5 shrink-0"}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:265:17",children:[a.jsxs("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:266:19",className:"text-xs font-medium text-amber-300 mb-1",children:[p==="install"?"本次安装":"本次升级",",主机监控探针将部署 AIOps Agent。AIOps Agent 是 AIOps 平台推出的新一代数据采集器,提供主机监控指标采集和可观测数据采集能力。"]}),a.jsxs("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:269:19",className:"text-[11px] text-amber-400/80 leading-relaxed",children:[p==="upgrade"&&"升级前请注意以下事项:",p==="install"&&"安装前请注意以下事项:"]}),a.jsxs("ul",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:273:19",className:"mt-1 space-y-0.5 text-[11px] text-slate-400 list-disc list-inside",children:[p==="upgrade"&&a.jsxs(a.Fragment,{children:[a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:276:25",children:"如果您的机器已经安装旧版 Agent,升级操作将停止旧版并替换为最新版本。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:277:25",children:"如果您的机器之前安装过 Agent 但已卸载,遗留有相关采集配置,本次升级可能导致配置重新生效。升级前请确保存量废弃配置已经移除。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:278:25",children:"如果您的机器采用自定义安装的 Agent(非 AIOps 提供的一键安装脚本),请不要直接使用批量升级。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:279:25",children:"批量升级前,请务必先单机灰度升级,确保升级成功且不影响业务后再操作。"})]}),p==="install"&&a.jsxs(a.Fragment,{children:[a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:284:25",children:"安装将自动检测目标主机架构(amd64/arm64),下载对应版本的 Agent 二进制并启动服务。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:285:25",children:"请确保目标主机的 SSH 端口(默认 22)可访问,且已关联有效的 SSH 凭据。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:286:25",children:"安装过程约 30-60 秒,期间目标主机 CPU 负载会短暂升高。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:287:25",children:"若安装失败,请检查目标主机的防火墙规则和 SSH 服务状态后重试。"})]}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:290:21",children:"操作不可回滚,请在操作前确认已备份关键配置。"}),a.jsx("li",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:291:21",children:"操作将在后台异步执行,您可以在「任务执行记录」中查看详细进度。"})]})]})]})}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:298:13",className:"flex items-center gap-2",children:[a.jsx(Da,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:299:15",id:"batch-ack",checked:n,onCheckedChange:t=>l(!!t)}),a.jsx("label",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:300:15",htmlFor:"batch-ack",className:"text-xs text-slate-300 cursor-pointer select-none",children:"我已知悉以上风险和注意事项"})]})]}),a.jsxs(Na,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:304:11",className:"gap-2",children:[a.jsx(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:305:13",variant:"outline",className:"border-slate-700 text-slate-300 h-8 text-xs",onClick:()=>{$(!1),l(!1)},children:"取消"}),a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:308:13",className:"bg-blue-600 hover:bg-blue-700 text-white h-8 text-xs gap-1",disabled:S||!n||(p==="install"?M.length===0:E.length===0),onClick:Ja,children:[S&&a.jsx(aa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:313:35",className:"w-3 h-3 animate-spin"}),p==="install"?"确认安装":"确认升级"]})]})]})}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:320:7",className:"overflow-x-auto rounded-lg border border-[var(--dg-border)]",children:[a.jsxs("table",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:321:9",className:"w-full text-xs",children:[a.jsx("thead",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:322:11",className:"bg-[var(--dg-bg-tertiary)] border-b",children:a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:322:66",children:[a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:323:13",className:"px-2 py-2 w-8",children:a.jsx(Da,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:324:15",checked:Va,onCheckedChange:t=>h(t?new Set(e.map(C=>String(C.server_id))):new Set)})}),["hostname","agent_version","agent_status","cpu_usage","mem_usage","disk_usage","region","ip"].map(t=>a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:327:15",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] cursor-pointer hover:text-[var(--dg-text-primary)] select-none whitespace-nowrap",onClick:()=>La(t),children:a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:328:17",className:"flex items-center gap-1",children:[{hostname:"主机名",agent_version:"Agent版本",agent_status:"状态",cpu_usage:"CPU",mem_usage:"内存",disk_usage:"磁盘",region:"区域",ip:"IP"}[t],a.jsx(Ka,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:328:188",f:t})]})},t)),a.jsx("th",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:331:13",className:"px-3 py-2 text-left font-medium text-[var(--dg-text-secondary)] whitespace-nowrap",children:"操作"})]})}),a.jsx("tbody",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:332:11",children:Ra.map((t,C)=>a.jsxs("tr",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:334:15",className:"border-b border-[var(--dg-border)] last:border-0 hover:bg-[var(--dg-bg-tertiary)]/50",children:[a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:335:17",className:"px-2 py-2.5",children:a.jsx(Da,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:336:19",checked:v.has(String(t.server_id)),onCheckedChange:G=>{const k=new Set(v);G?k.add(String(t.server_id)):k.delete(String(t.server_id)),h(k)}})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:342:17",className:"px-3 py-2.5 font-medium text-[var(--dg-text-primary)]",children:t.hostname}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:343:17",className:"px-3 py-2.5 font-mono text-[var(--dg-text-secondary)]",children:ha.has(t.server_id)?a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:345:21",className:"inline-flex items-center gap-1 text-blue-400",children:[a.jsx(aa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:346:23",className:"w-3 h-3 animate-spin"}),a.jsx("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:347:23",className:"text-[10px]",children:"部署中"})]}):t.agent_version||"—"}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:353:17",className:"px-3 py-2.5",children:t.agent_status==="online"?a.jsxs(O,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:353:72",className:"text-[10px] bg-emerald-500/20 text-emerald-400",children:[a.jsx(_a,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:353:138",className:"w-3 h-3 mr-1"}),"在线"]}):t.agent_status==="not_installed"?a.jsx(O,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:353:214",className:"text-[10px] bg-amber-500/20 text-amber-400",children:"未安装"}):a.jsxs(O,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:353:288",className:"text-[10px] bg-slate-500/10 text-slate-400",children:[a.jsx(ps,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:353:350",className:"w-3 h-3 mr-1"}),"离线"]})}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:354:17",className:"px-3 py-2.5",children:ma(Number(t.cpu_usage||0),`${Number(t.cpu_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:355:17",className:"px-3 py-2.5",children:ma(Number(t.mem_usage||0),`${Number(t.mem_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:356:17",className:"px-3 py-2.5",children:ma(Number(t.disk_usage||0),`${Number(t.disk_usage||0).toFixed(1)}%`)}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:357:17",className:"px-3 py-2.5 text-[var(--dg-text-secondary)]",children:t.region||"—"}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:358:17",className:"px-3 py-2.5 font-mono text-[var(--dg-text-secondary)]",children:t.ip||"—"}),a.jsx("td",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:359:17",className:"px-3 py-2.5",children:a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:360:19",variant:"ghost",size:"sm",className:"h-7 text-xs text-blue-400 hover:text-blue-300 hover:bg-blue-500/10 px-2",onClick:()=>r(`/host-monitor?host=${encodeURIComponent(t.hostname)}`),children:[a.jsx(Ba,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:362:21",className:"w-3.5 h-3.5 mr-1"}),"图表"]})})]},t.hostname+C))})]}),e.length>y&&a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:370:11",className:"flex items-center justify-between px-3 py-2 bg-[var(--dg-bg-tertiary)] border-t border-[var(--dg-border)] text-xs",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:371:13",className:"flex items-center gap-2 text-[var(--dg-text-muted)]",children:[a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:372:15",children:["共 ",e.length," 条"]}),a.jsxs("select",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:373:15",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded px-2 py-0.5 text-xs",value:y,onChange:t=>{z(Number(t.target.value)),P(1)},children:[a.jsx("option",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:374:17",value:10,children:"10/页"}),a.jsx("option",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:375:17",value:20,children:"20/页"}),a.jsx("option",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:376:17",value:30,children:"30/页"})]})]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:379:13",className:"flex items-center gap-1",children:[a.jsx("button",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:380:15",className:"px-2 py-0.5 rounded hover:bg-[var(--dg-bg-primary)] disabled:opacity-30",disabled:m<=1,onClick:()=>P(t=>t-1),children:"上一页"}),a.jsxs("span",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:381:15",className:"px-2 text-[var(--dg-text-primary)]",children:[m," / ",wa]}),a.jsx("button",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:382:15",className:"px-2 py-0.5 rounded hover:bg-[var(--dg-bg-primary)] disabled:opacity-30",disabled:m>=wa,onClick:()=>P(t=>t+1),children:"下一页"})]})]})]})]}):a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:164:29",className:"text-center py-20 text-[var(--dg-text-muted)]",children:[a.jsx(Q,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:164:92",className:"h-8 w-8 mx-auto mb-2"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:164:135",className:"text-sm",children:"暂无服务器资产"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:164:169",className:"text-xs mt-1",children:"请先在「服务器管理」中添加主机,然后在此安装 Agent"})]})},Ws=()=>{const[s,r]=o.useState(null),[e,c]=o.useState(!0);return o.useEffect(()=>{Xa.list().then(i=>{const x=i?.data||i||[];r(x.find(b=>b.is_default)||x[0]||null)}).catch(()=>{}).finally(()=>c(!1))},[]),e?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:401:23",className:"text-center py-20 text-[var(--dg-text-muted)]",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:401:86",className:"h-6 w-6 mx-auto mb-2 animate-spin"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:401:144",className:"text-xs",children:"加载数据源…"})]}):s?a.jsx(fs,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:403:10",dsUrl:s.url,dsUsername:s.username,dsPassword:s.password}):a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:402:19",className:"text-center py-20 text-[var(--dg-text-muted)]",children:[a.jsx(Oa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:402:82",className:"h-8 w-8 mx-auto mb-2"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:402:127",className:"text-sm",children:"未配置 Zabbix 数据源"}),a.jsxs("a",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:402:168",href:"/datasources",className:"text-xs text-blue-400 hover:underline inline-flex items-center gap-1",children:["前往配置 ",a.jsx(Ma,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:402:277",className:"w-3 h-3"})]})]})},_s=()=>{const[s,r]=o.useState(null),[e,c]=o.useState(!0);return o.useEffect(()=>{as.list().then(i=>{const x=i?.data||i||[];r(x.find(b=>b.is_default)||x[0]||null)}).catch(()=>{}).finally(()=>c(!1))},[]),e?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:415:23",className:"text-center py-20 text-[var(--dg-text-muted)]",children:[a.jsx(J,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:415:86",className:"h-6 w-6 mx-auto mb-2 animate-spin"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:415:144",className:"text-xs",children:"加载数据源…"})]}):s?a.jsx(Ps,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:417:10",dsUrl:s.url}):a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:416:19",className:"text-center py-20 text-[var(--dg-text-muted)]",children:[a.jsx(Oa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:416:82",className:"h-8 w-8 mx-auto mb-2"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:416:127",className:"text-sm",children:"未配置 Prometheus 数据源"}),a.jsxs("a",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:416:172",href:"/datasources",className:"text-xs text-blue-400 hover:underline inline-flex items-center gap-1",children:["前往配置 ",a.jsx(Ma,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:416:281",className:"w-3 h-3"})]})]})},$s=()=>{const[s,r]=o.useState([]),[e,c]=o.useState(null),[i,x]=o.useState(!1),[b,g]=o.useState(!1),[N,w]=o.useState({name:"",description:"",datasource:"prometheus",datasourceUrl:""}),[m,P]=o.useState({title:"",type:"graph",query:"",width:6,height:4}),y=async()=>{try{const A=(await ga.getDashboards()).data||[];r(A),A.length>0&&!e&&c(A[0])}catch{}};o.useEffect(()=>{y()},[]);const z=async()=>{if(!N.name){u.error("请输入名称");return}try{await ga.createDashboard({...N,panels:[]}),u.success("创建成功"),x(!1),w({name:"",description:"",datasource:"prometheus",datasourceUrl:""}),y()}catch{u.error("创建失败")}},v=async()=>{if(!(!m.title||!m.query||!e))try{const h={id:Date.now().toString(),...m,datasource:e.datasource,x:0,y:0,options:{legend:!0,tooltip:!0,refreshInterval:30}};await ga.updateDashboard(e.id,{...e,panels:[...e.panels,h]}),u.success("面板添加成功"),g(!1),P({title:"",type:"graph",query:"",width:6,height:4}),y()}catch{u.error("添加失败")}};return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:451:5",className:"space-y-4",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:452:7",className:"flex items-center gap-2",children:[a.jsxs(xa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:453:9",value:e?.id,onValueChange:h=>{const A=s.find(W=>W.id===h);A&&c(A)},children:[a.jsx(pa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:454:11",className:"w-[240px] h-8 text-xs",children:a.jsx(ba,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:454:60",placeholder:"选择仪表盘"})}),a.jsx(ua,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:455:11",children:s.map(h=>a.jsxs(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:455:47",value:h.id,children:[h.name,h.isDefault?" (默认)":""]},h.id))})]}),a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:457:9",variant:"outline",size:"sm",className:"h-8 text-[10px]",onClick:y,children:[a.jsx(ca,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:457:89",className:"w-3 h-3 mr-1"}),"刷新"]}),e&&a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:458:20",variant:"outline",size:"sm",className:"h-8 text-[10px]",onClick:()=>g(!0),children:[a.jsx(Aa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:458:117",className:"w-3 h-3 mr-1"}),"添加面板"]}),a.jsxs(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:459:9",variant:"outline",size:"sm",className:"h-8 text-[10px]",onClick:()=>x(!0),children:[a.jsx(Aa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:459:109",className:"w-3 h-3 mr-1"}),"新建"]})]}),e?e.panels.length===0?a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:464:11",className:"text-center py-16 text-[var(--dg-text-muted)]",children:[a.jsx(Ba,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:464:74",className:"w-10 h-10 mx-auto mb-2 opacity-50"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:464:133",className:"text-xs",children:"暂无面板"})]}):a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:466:11",className:"grid grid-cols-12 gap-3",children:e.panels.map(h=>a.jsxs(U,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:468:15",style:{gridColumn:`span ${h.width}`,minHeight:`${h.height*80}px`},children:[a.jsx(ya,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:469:17",className:"py-2 px-3",children:a.jsx(Ga,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:469:51",className:"text-[11px] font-medium",children:h.title})}),a.jsx(H,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:470:17",className:"p-3 pt-0",children:a.jsx(gs,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:470:51",panel:h})})]},h.id))}):a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:476:9",className:"text-center py-16 text-[var(--dg-text-muted)]",children:[a.jsx(Ia,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:476:72",className:"w-10 h-10 mx-auto mb-2 opacity-50"}),a.jsx("p",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:476:129",className:"text-xs",children:"暂无仪表盘"})]}),a.jsx(oa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:479:7",open:i,onOpenChange:x,children:a.jsxs(ra,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:479:62",children:[a.jsx(na,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:479:77",children:a.jsx(da,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:479:91",children:"新建仪表盘"})}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:480:9",className:"space-y-3",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:480:36",children:[a.jsx(L,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:480:41",children:"名称"}),a.jsx(X,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:480:58",value:N.name,onChange:h=>w({...N,name:h.target.value})})]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:11",children:[a.jsx(L,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:16",children:"数据源"}),a.jsxs(xa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:34",value:N.datasource,onValueChange:h=>w({...N,datasource:h}),children:[a.jsx(pa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:124",children:a.jsx(ba,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:139"})}),a.jsxs(ua,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:170",children:[a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:185",value:"prometheus",children:"Prometheus"}),a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:239",value:"zabbix",children:"Zabbix"}),a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:285",value:"skywalking",children:"SkyWalking"}),a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:481:339",value:"custom",children:"自定义"})]})]})]})]}),a.jsxs(Na,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:482:9",children:[a.jsx(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:482:23",variant:"outline",onClick:()=>x(!1),children:"取消"}),a.jsx(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:482:97",onClick:z,children:"创建"})]})]})}),a.jsx(oa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:484:7",open:b,onOpenChange:g,children:a.jsxs(ra,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:484:56",children:[a.jsx(na,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:484:71",children:a.jsx(da,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:484:85",children:"添加面板"})}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:485:9",className:"space-y-3",children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:485:36",children:[a.jsx(L,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:485:41",children:"标题"}),a.jsx(X,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:485:58",value:m.title,onChange:h=>P({...m,title:h.target.value})})]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:11",children:[a.jsx(L,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:16",children:"类型"}),a.jsxs(xa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:33",value:m.type,onValueChange:h=>P({...m,type:h}),children:[a.jsx(pa,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:111",children:a.jsx(ba,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:126"})}),a.jsxs(ua,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:157",children:[a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:172",value:"graph",children:"折线图"}),a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:214",value:"stat",children:"数值"}),a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:254",value:"gauge",children:"仪表盘"}),a.jsx(B,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:486:296",value:"table",children:"表格"})]})]})]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:487:11",children:[a.jsx(L,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:487:16",children:"查询"}),a.jsx(X,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:487:33",value:m.query,onChange:h=>P({...m,query:h.target.value})})]})]}),a.jsxs(Na,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:488:9",children:[a.jsx(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:488:23",variant:"outline",onClick:()=>g(!1),children:"取消"}),a.jsx(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:488:94",onClick:v,children:"添加"})]})]})})]})},Xs=()=>{const[s,r]=o.useState("agent"),[e,c]=o.useState(!1);return a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:499:5",className:`space-y-4 ${e?"fixed inset-0 z-50 bg-background p-4 overflow-auto":""}`,children:[a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:502:7",className:"flex items-center gap-1 p-1 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[zs.map(i=>a.jsxs("button",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:504:11",onClick:()=>r(i.id),className:`flex items-center gap-1.5 px-4 py-2 rounded-md text-xs font-medium transition-colors ${s===i.id?"bg-[var(--dg-bg-primary)] text-[var(--dg-text-primary)] shadow-sm":"text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"}`,children:[i.icon,i.label]},i.id)),a.jsx("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:517:9",className:"ml-auto",children:a.jsx(D,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:518:11",variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>c(!e),children:e?a.jsx(hs,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:519:27",className:"w-3.5 h-3.5"}):a.jsx(ms,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:519:67",className:"w-3.5 h-3.5"})})})]}),a.jsxs("div",{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:525:7",className:"min-h-[50vh]",children:[s==="agent"&&a.jsx(ks,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:526:29"}),s==="zabbix"&&a.jsx(Ws,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:527:30"}),s==="prometheus"&&a.jsx(_s,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:528:34"}),s==="dashboard"&&a.jsx($s,{"code-path":"src/components/monitor/dashboard/GrafanaDashboard.tsx:529:33"})]})]})};export{Xs as default}; diff --git a/backend/static/assets/HostMonitor-D4f8NRVg.js b/backend/static/assets/HostMonitor-BSWHuvXi.js similarity index 99% rename from backend/static/assets/HostMonitor-D4f8NRVg.js rename to backend/static/assets/HostMonitor-BSWHuvXi.js index e21ada2..8d0516b 100644 --- a/backend/static/assets/HostMonitor-D4f8NRVg.js +++ b/backend/static/assets/HostMonitor-BSWHuvXi.js @@ -1 +1 @@ -import{j as t,r as H}from"./vendor-codemirror-C7mXSpXt.js";import{f as Bt,G as Mt,B as L,D as wt,a as Pt,b as Ct,c as kt,d as Dt,e as Tt,t as qt,as as Kt}from"./index-LZWfu62c.js";import{a as E}from"./agent-g0Vk8FYK.js";import{u as ct,q as K,b as pt}from"./unwrap-BmWy-KM2.js";import{C,a as k}from"./card-B-RtdR4H.js";import{S as ft,a as yt,b as Nt,c as Ht,d as et}from"./select-4xU_9B3_.js";import{c as q,T as Ot,a as Rt,b as Gt}from"./tabs-kmtfM2I-.js";import{B as Q}from"./badge-B0F5ZNtn.js";import{R as mt,A as gt,C as ut,X as bt,Y as jt,T as vt,a as at,B as Lt}from"./AreaChart-Czgv4pNk.js";import{N as st,R as Ft,P as Wt,y as zt,a as ht,b as ot,aE as Ut,T as Vt,A as $t,H as W,L as Qt,h as V,_ as Xt,b0 as _t,I as Jt,b1 as Yt,g as Zt,b2 as lt}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function te(){return ct({queryKey:K.hostMonitor.hosts(),queryFn:async()=>{const e=await E.getLatest();return pt(e)},staleTime:3e4})}function ee(e,a){return ct({queryKey:K.hostMonitor.history(e,a),queryFn:async()=>{if(!e)return[];const i=await E.getHistory(e,a);return pt(i)},enabled:!!e,staleTime:3e4})}function se(e){return ct({queryKey:K.hostMonitor.probes(e),queryFn:async()=>{if(!e)return[];const a=await E.getHealthProbes({hostname:e});return pt(a)},enabled:!!e})}function oe(e){return ct({queryKey:K.hostMonitor.portPolicy(e),queryFn:async()=>{if(!e)return{port_filter_mode:"whitelist",port_whitelist:[]};const a=await E.getPortPolicy(e);return{port_filter_mode:a?.data?.port_filter_mode||"blacklist",port_whitelist:a?.data?.port_whitelist||[]}},enabled:!!e})}const xt=[{label:"1小时",hours:1,window:60,buckets:60},{label:"6小时",hours:6,window:300,buckets:72},{label:"12小时",hours:12,window:600,buckets:72},{label:"1天",hours:24,window:1800,buckets:96},{label:"3天",hours:72,window:3600,buckets:72},{label:"7天",hours:168,window:10800,buckets:56},{label:"14天",hours:336,window:21600,buckets:48}],St=(e="")=>({name:"",hostname:e,probe_type:"http_get",http_url:"",http_method:"GET",http_expect_code:200,http_expect_body:"",tcp_host:"localhost",tcp_port:3306,exec_command:"",timeout:10,interval:60,description:""});function j(e,a,i){if(!e||e.length===0)return[];const l=Math.max(1,Math.ceil(e.length/i)),p=[];for(let n=0;nM+F,0)/c.length,x=Math.max(...c),N=Math.min(...c),D=d[Math.floor(d.length/2)]||0;p.push({time:new Date(D*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),timestamp:D,avg:Number(s.toFixed(2)),max:Number(x.toFixed(2)),min:Number(N.toFixed(2)),count:c.length})}return p.slice(-i)}function v(e){if(!e)return{};if(typeof e=="object")return e;try{return JSON.parse(e)}catch{return{}}}function rt(e){return e>=1024*1024*1024?`${(e/1024/1024/1024).toFixed(1)} GB/s`:e>=1024*1024?`${(e/1024/1024).toFixed(1)} MB/s`:e>=1024?`${(e/1024).toFixed(1)} KB/s`:`${e.toFixed(1)} B/s`}function ae(e,a){const i=[],l=[],p=[],n=[],c=[],d=[],m=[],s=[],x=[],N=[],D=[],M=[],F=[],o=[],B=[],X=[],z=[],$=[],J=[],w=[],g=[];for(const h of e){const it=h.report_time?new Date(h.report_time).getTime()/1e3:h.created_at?new Date(h.created_at).getTime()/1e3:0;g.push(it),i.push(h.cpu_usage||0),o.push(h.cpu_iowait||0),l.push(h.mem_usage||0),B.push(h.mem_available||0),p.push(h.load1||0),n.push(h.disk_usage||0);const O=v(h.disk_info);if(Array.isArray(O)&&O.length>0){const u=O.find(f=>f.mount==="/")||O[0];w.push(u?.inode_usage_pct||0)}else w.push(0);const _=v(h.net_info);c.push(_.tcp_established||0),d.push(_.tcp_time_wait||0),m.push(_.tcp_close_wait||0),z.push((_.tcp_established||0)+(_.tcp_time_wait||0)+(_.tcp_close_wait||0)),s.push(_.net_rx_bps||0),x.push(_.net_tx_bps||0),$.push(_.net_rx_errors||0),J.push(_.net_tx_errors||0);const U=v(h.disk_io_info);N.push(U.read_bps||0),D.push(U.write_bps||0),X.push(U.util||0);const P=v(h.swap_info);M.push(P?.usage_percent||0);const b=v(h.fd_info);F.push(b?.usage_pct||0)}return{cpu:j(i,g,a.buckets),mem:j(l,g,a.buckets),load1:j(p,g,a.buckets),disk:j(n,g,a.buckets),tcpEst:j(c,g,a.buckets),tcpTW:j(d,g,a.buckets),tcpCW:j(m,g,a.buckets),rx:j(s.map(h=>h/1024),g,a.buckets),tx:j(x.map(h=>h/1024),g,a.buckets),ioRead:j(N.map(h=>h/1024),g,a.buckets),ioWrite:j(D.map(h=>h/1024),g,a.buckets),swap:j(M,g,a.buckets),fd:j(F,g,a.buckets),iowait:j(o,g,a.buckets),memAvail:j(B,g,a.buckets),ioUtil:j(X,g,a.buckets),connTotal:j(z,g,a.buckets),rxErr:j($,g,a.buckets),txErr:j(J,g,a.buckets),inode:j(w,g,a.buckets)}}function re(e,a,i,l,p,n,c="--"){return e?n==="cpu"?e.cpu_usage!=null?`${e.cpu_usage.toFixed(1)}%`:c:n==="mem"?e.mem_usage!=null?`${e.mem_usage.toFixed(1)}%`:c:n==="disk"?e.disk_usage!=null?`${e.disk_usage.toFixed(1)}%`:c:n==="load1"?e.load1!=null?String(e.load1):c:n==="tcp"?a.tcp_established!=null?String(a.tcp_established):c:n==="tw"?a.tcp_time_wait!=null?String(a.tcp_time_wait):c:n==="rx"?a.net_rx_bps!=null?`${(a.net_rx_bps/1024).toFixed(1)} KB/s`:c:n==="tx"?a.net_tx_bps!=null?`${(a.net_tx_bps/1024).toFixed(1)} KB/s`:c:n==="ioR"?i.read_bps!=null?`${rt(i.read_bps)}`:c:n==="ioW"?i.write_bps!=null?`${rt(i.write_bps)}`:c:n==="swap"?l?.usage_percent!=null?`${l.usage_percent.toFixed(1)}%`:c:n==="fd"&&p?.usage_pct!=null?`${p.usage_pct.toFixed(1)}%`:c:c}function y({title:e,value:a,icon:i,data:l,color:p,unit:n,domain:c,aggType:d}){const m=l.map(s=>({...s,value:s[d]}));return t.jsx(C,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:26:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:27:7",className:"p-3",children:[t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:28:9",className:"flex items-center justify-between mb-1",children:t.jsxs("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:29:11",className:"flex items-center gap-1.5",children:[i,t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:29:60",className:"text-xs text-[var(--dg-text-primary)] font-medium truncate",children:e})]})}),t.jsxs("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:31:9",className:"mb-2",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:32:11",className:"text-xl font-bold text-[var(--dg-text-primary)] tabular-nums",children:a}),n&&t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:33:20",className:"text-xs text-[var(--dg-text-muted)] ml-1",children:n})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:35:9",className:"h-48",children:m.length===0?t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:37:13",className:"h-full flex items-center justify-center text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-md",children:"暂无数据"}):t.jsx(mt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:39:13",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:40:15",data:m,margin:{top:2,right:2,bottom:0,left:-10},children:[t.jsx("defs",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:41:17",children:t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:42:19",id:`grad-${e}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:43:21",offset:"5%",stopColor:p,stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:44:21",offset:"95%",stopColor:p,stopOpacity:0})]})}),t.jsx(ut,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:47:17",strokeDasharray:"3 3",stroke:"#1e293b",strokeOpacity:.5}),t.jsx(bt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:48:17",dataKey:"time",hide:!0}),t.jsx(jt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:49:17",hide:!0,domain:c[1]==="auto"?[0,s=>s*1.1]:c}),t.jsx(vt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:50:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"4px",color:"#f8fafc",fontSize:"11px",padding:"4px 8px"},formatter:s=>[`${s.toFixed(2)} ${n}`,e.replace(/\(.+\)/,"")],labelFormatter:s=>`时间: ${s}`}),t.jsx(at,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:53:17",type:"monotone",dataKey:"value",stroke:p,strokeWidth:1.5,fill:`url(#grad-${e})`}),t.jsx(Lt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:54:17",dataKey:"time",height:24,stroke:"#334155",fill:"#0f172a",startIndex:Math.max(0,m.length-Math.min(20,m.length))})]})})})]})})}function ce({title:e,currentRx:a,currentTx:i,rxData:l,txData:p,aggType:n,unit:c}){const d=l.map((x,N)=>({time:x.time,timestamp:x.timestamp,rx:x[n]??0,tx:p[N]?.[n]??0})),m=`grad-rx-${e.replace(/\s/g,"")}`,s=`grad-tx-${e.replace(/\s/g,"")}`;return t.jsx(C,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:32:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:33:7",className:"p-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:34:9",className:"flex items-center justify-between mb-1",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:35:11",className:"flex items-center gap-1.5",children:[t.jsx(st,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:36:13",className:"h-4 w-4 text-blue-400"}),t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:37:13",className:"text-xs text-[var(--dg-text-primary)] font-medium",children:e})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:39:11",className:"flex items-center gap-3 text-xs",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:13",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:19",className:"inline-block w-2.5 h-2.5 rounded-sm bg-blue-400 mr-1 align-middle"}),"接收 ",t.jsx("b",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:108",className:"text-blue-300",children:a})]}),t.jsxs("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:13",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:19",className:"inline-block w-2.5 h-2.5 rounded-sm bg-emerald-400 mr-1 align-middle"}),"发送 ",t.jsx("b",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:111",className:"text-emerald-300",children:i})]})]})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:44:9",className:"h-56",children:d.length===0?t.jsx("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:46:13",className:"h-full flex items-center justify-center text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-md",children:"暂无数据"}):t.jsx(mt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:48:13",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:49:15",data:d,margin:{top:2,right:2,bottom:0,left:-10},children:[t.jsxs("defs",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:50:17",children:[t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:51:19",id:m,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:52:21",offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:53:21",offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}),t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:55:19",id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:56:21",offset:"5%",stopColor:"#10b981",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:57:21",offset:"95%",stopColor:"#10b981",stopOpacity:0})]})]}),t.jsx(ut,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:60:17",strokeDasharray:"3 3",stroke:"#1e293b",strokeOpacity:.5}),t.jsx(bt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:61:17",dataKey:"time",hide:!0}),t.jsx(jt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:62:17",hide:!0,domain:[0,"auto"]}),t.jsx(vt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:63:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"4px",color:"#f8fafc",fontSize:"11px",padding:"4px 8px"},formatter:(x,N)=>[`${x.toFixed(2)} ${c}`,N==="rx"?"接收":"发送"],labelFormatter:x=>`时间: ${x}`}),t.jsx(at,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:66:17",type:"monotone",dataKey:"rx",stroke:"#3b82f6",strokeWidth:1.5,fill:`url(#${m})`,name:"rx"}),t.jsx(at,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:67:17",type:"monotone",dataKey:"tx",stroke:"#10b981",strokeWidth:1.5,fill:`url(#${s})`,name:"tx"}),t.jsx(Lt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:68:17",dataKey:"time",height:24,stroke:"#334155",fill:"#0f172a",startIndex:Math.max(0,d.length-Math.min(20,d.length))})]})})})]})})}function ie({selectedHost:e}){const a=Bt(),i=Mt(),{data:l=[],refetch:p}=se(e),[n,c]=H.useState(!1),[d,m]=H.useState(null),[s,x]=H.useState(St()),N=()=>{m(null),x(St(e)),c(!0)},D=o=>{m(o),x({name:String(o.name||""),hostname:String(o.hostname||""),probe_type:String(o.probe_type||"http_get"),http_url:String(o.http_url||""),http_method:String(o.http_method||"GET"),http_expect_code:Number(o.http_expect_code)||200,http_expect_body:String(o.http_expect_body||""),tcp_host:String(o.tcp_host||""),tcp_port:Number(o.tcp_port)||3306,exec_command:String(o.exec_command||""),timeout:Number(o.timeout)||10,interval:Number(o.interval)||60,description:String(o.description||"")}),c(!0)},M=async()=>{if(!(!s.name||!s.hostname))try{d?await E.updateHealthProbe(d.id,s):await E.createHealthProbe(s),c(!1),i.invalidateQueries({queryKey:K.hostMonitor.probes(e)})}catch{qt.error("保存失败")}},F=async o=>{await a({title:"删除探针",description:`确定删除探针「${o.name}」?`,confirmText:"删除",variant:"destructive"})&&(await E.deleteHealthProbe(o.id),i.invalidateQueries({queryKey:K.hostMonitor.probes(e)}))};return t.jsxs(t.Fragment,{children:[t.jsxs(q,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:88:7",value:"health_probes",className:"mt-3 space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:89:9",className:"flex items-center justify-between",children:[t.jsx("h3",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:90:11",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:"探针列表(Agent 在目标主机本地执行探测)"}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:91:11",className:"flex gap-2",children:[t.jsxs(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:92:13",size:"sm",variant:"outline",className:"h-7 text-[11px]",onClick:()=>p(),children:[t.jsx(Ft,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:93:15",className:"w-3 h-3 mr-1"}),"刷新"]}),t.jsxs(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:95:13",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:N,children:[t.jsx(Wt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:96:15",className:"w-3 h-3 mr-1"}),"添加探针"]})]})]}),l.length===0?t.jsx(C,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:101:11",className:"bg-[var(--dg-bg-secondary)] border-dashed border-[var(--dg-border)]",children:t.jsx(k,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:102:13",className:"p-8 text-center text-xs text-[var(--dg-text-muted)]",children:'暂无健康探针,点击"添加探针"创建'})}):t.jsx("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:107:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:l.map(o=>t.jsx(C,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:109:15",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${o.last_status==="down"?"border-red-700/50":""}`,children:t.jsxs(k,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:110:17",className:"p-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:111:19",className:"flex items-start justify-between mb-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:112:21",className:"flex items-center gap-2",children:[o.last_status==="up"?t.jsx(zt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:113:49",className:"w-4 h-4 text-emerald-400"}):o.last_status==="down"?t.jsx(ht,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:114:51",className:"w-4 h-4 text-red-400"}):t.jsx(ot,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:115:24",className:"w-4 h-4 text-slate-500"}),t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:116:23",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:String(o.name)}),t.jsx(Q,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:117:23",variant:"outline",className:"text-[10px] h-5 px-1.5 capitalize",children:o.probe_type==="http_get"?"HTTP":o.probe_type==="tcp_socket"?"TCP":"Exec"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:121:21",className:"flex gap-1",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:122:23",variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>D(o),children:t.jsx(Ut,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:123:25",className:"w-3 h-3"})}),t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:125:23",variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",onClick:()=>F(o),children:t.jsx(Vt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:126:25",className:"w-3 h-3"})})]})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:130:19",className:"space-y-1 text-[11px] text-[var(--dg-text-muted)]",children:[o.probe_type==="http_get"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:132:23",className:"truncate",children:["URL: ",String(o.http_url)]}),o.probe_type==="tcp_socket"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:135:23",children:[String(o.tcp_host),":",String(o.tcp_port)]}),o.probe_type==="exec_command"&&t.jsx("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:138:23",className:"truncate font-mono",children:String(o.exec_command)}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:140:21",className:"flex items-center gap-3",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:141:23",children:["状态: ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:141:33",className:o.last_status==="up"?"text-emerald-400":o.last_status==="down"?"text-red-400":"text-slate-400",children:o.last_status?String(o.last_status).toUpperCase():"未检测"})]}),Number(o.last_latency_ms)>0&&t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:144:57",children:["延迟: ",String(o.last_latency_ms),"ms"]}),Number(o.fail_count)>0&&t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:145:52",className:"text-red-400",children:["连续失败: ",String(o.fail_count),"次"]}),o.last_checked_at&&t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:146:45",className:"text-[10px]",children:new Date(String(o.last_checked_at)).toLocaleString("zh-CN")})]})]})]})},String(o.id)))})]}),t.jsx(wt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:156:7",open:n,onOpenChange:c,children:t.jsxs(Pt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:157:9",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg",children:[t.jsxs(Ct,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:158:11",children:[t.jsx(kt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:159:13",className:"text-[var(--dg-text-primary)]",children:d?"编辑探针":"添加探针"}),t.jsx(Dt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:162:13",className:"text-[var(--dg-text-secondary)]",children:d?"修改健康探针配置":"创建新的健康探针,Agent 在目标主机本地执行探测"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:166:11",className:"space-y-3 max-h-[60vh] overflow-y-auto pr-1",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:167:13",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:168:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["探针名称 ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:168:90",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:169:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.name,onChange:o=>x({...s,name:o.target.value}),placeholder:"如:cex-agent 健康检查"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:171:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:172:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"目标主机"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:173:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.hostname,onChange:o=>x({...s,hostname:o.target.value})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:175:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:176:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"探针类型"}),t.jsxs("select",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:177:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.probe_type,onChange:o=>x({...s,probe_type:o.target.value}),children:[t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:178:17",value:"http_get",children:"HTTP GET"}),t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:179:17",value:"tcp_socket",children:"TCP Socket"}),t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:180:17",value:"exec_command",children:"Exec Command"})]})]}),s.probe_type==="http_get"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:17",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["HTTP URL ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:101",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:187:19",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_url,onChange:o=>x({...s,http_url:o.target.value}),placeholder:"http://localhost:8080/health"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:188:17",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:189:19",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:189:24",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"期望状态码"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:190:21",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_expect_code,onChange:o=>x({...s,http_expect_code:Number(o.target.value)})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:191:19",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:191:24",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"期望响应内容(可选)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:192:21",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_expect_body,onChange:o=>x({...s,http_expect_body:o.target.value})})]})]})]}),s.probe_type==="tcp_socket"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:198:15",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:199:17",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:199:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"TCP 目标地址"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:200:19",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.tcp_host,onChange:o=>x({...s,tcp_host:o.target.value}),placeholder:"localhost"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:201:17",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:201:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"TCP 端口"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:202:19",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.tcp_port,onChange:o=>x({...s,tcp_port:Number(o.target.value)})})]})]}),s.probe_type==="exec_command"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:15",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["执行命令 ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:95",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:208:17",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs font-mono text-[var(--dg-text-primary)]",value:s.exec_command,onChange:o=>x({...s,exec_command:o.target.value}),placeholder:"pgrep -x mysqld"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:211:13",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:212:15",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:212:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"超时(秒)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:213:17",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.timeout,onChange:o=>x({...s,timeout:Number(o.target.value)})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:214:15",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:214:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"间隔(秒)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:215:17",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.interval,onChange:o=>x({...s,interval:Number(o.target.value)})})]})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:218:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:218:18",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"描述"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:219:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.description,onChange:o=>x({...s,description:o.target.value})})]})]}),t.jsxs(Tt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:221:11",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:222:13",variant:"outline",size:"sm",className:"h-7 text-[11px]",onClick:()=>c(!1),children:"取消"}),t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:223:13",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:M,disabled:!s.name||!s.hostname,children:d?"保存":"创建"})]})]})})]})}function ne(e){const a=Number(e);return Number.isInteger(a)&&a>0&&a<=65535}function de(e){return e.split(",").map(a=>parseInt(a.trim(),10)).filter(a=>ne(a))}function le({open:e,onOpenChange:a,portPolicyMode:i,onModeChange:l,portWhitelist:p,onWhitelistChange:n,onSave:c,saving:d}){return t.jsx(wt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:30:5",open:e,onOpenChange:a,children:t.jsxs(Pt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:31:7",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-md",children:[t.jsxs(Ct,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:32:9",children:[t.jsx(kt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:33:11",className:"text-[var(--dg-text-primary)]",children:"端口监控策略"}),t.jsx(Dt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:34:11",className:"text-[var(--dg-text-secondary)]",children:"配置 Agent 端口上报过滤规则"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:36:9",className:"space-y-4",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:37:11",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:38:13",className:"text-[11px] text-[var(--dg-text-muted)] mb-1.5 block",children:"过滤模式"}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:39:13",className:"flex gap-2",children:[t.jsx("button",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:40:15",className:`flex-1 h-9 rounded text-xs font-medium border transition-colors ${i==="whitelist"?"bg-blue-500/20 border-blue-500 text-blue-400":"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,onClick:()=>l("whitelist"),children:"白名单 ─ 全量上报"}),t.jsx("button",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:46:15",className:`flex-1 h-9 rounded text-xs font-medium border transition-colors ${i==="blacklist"?"bg-amber-500/20 border-amber-500 text-amber-400":"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,onClick:()=>l("blacklist"),children:"黑名单 ─ 仅上报选中"})]}),t.jsx("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:53:13",className:"text-[10px] text-[var(--dg-text-muted)] mt-1.5 leading-relaxed",children:i==="whitelist"?"所有发现的端口都上报,任意端口变化都会触发告警 + 恢复通知。":"仅上报选中端口的变化,其余端口变化静默忽略(不告警)。系统进程端口(sshd/rpcbind/systemd等)永远忽略。"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:60:11",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:61:13",className:"text-[11px] text-[var(--dg-text-muted)] mb-1.5 block",children:["端口列表 ",t.jsx("span",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:62:20",className:"text-[var(--dg-text-muted)]",children:"(逗号分隔,如: 80,443,3306,6379)"}),i==="whitelist"&&t.jsx("span",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:63:50",className:"text-blue-400 ml-1",children:"— 白名单模式无需配置"})]}),t.jsx("textarea",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:65:13",className:`w-full h-20 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 py-1.5 text-xs font-mono resize-none ${i==="whitelist"?"text-[var(--dg-text-muted)] opacity-50 cursor-not-allowed":"text-[var(--dg-text-primary)]"}`,value:p.join(","),onChange:m=>{if(i==="whitelist")return;const s=m.target.value;n(de(s))},placeholder:i==="whitelist"?"白名单模式下所有端口自动上报":"80,443,3306,6379",readOnly:i==="whitelist"}),t.jsxs("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:78:13",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:["已输入 ",p.length," 个端口"]})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:83:11",className:"bg-amber-500/5 border border-amber-500/20 rounded p-2.5",children:t.jsxs("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:84:13",className:"text-[10px] text-amber-300/80 leading-relaxed",children:["⚠️ 无论选择哪种模式,以下系统进程端口",t.jsx("b",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:85:35",children:"永远不上报"}),":sshd、rpcbind、master、systemd、dbus-daemon、rsyslogd 等。Agent 采集时自动跳过。"]})})]}),t.jsxs(Tt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:89:9",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:90:11",variant:"outline",size:"sm",className:"h-7 text-[11px]",onClick:()=>a(!1),children:"取消"}),t.jsx(L,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:91:11",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:c,disabled:d,children:d?"保存中…":"保存策略"})]})]})})}function xe({selectedHost:e,serverInfo:a,latest:i,heartbeatInfo:l,portInfoCount:p}){const n=i?.disk_info?v(i.disk_info):null,c=n?Array.isArray(n)?n:n.partitions||[]:[];return t.jsxs(q,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:22:5",value:"system",className:"mt-3 space-y-3",children:[t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:23:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:24:9",className:"p-4",children:t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:25:11",className:"grid grid-cols-2 md:grid-cols-4 gap-x-6 gap-y-3 text-xs",children:[["主机名",a?.hostname||e],["IP 地址",a?.ip||"—"],["操作系统",a?.os||"—"],["内核版本",a?.kernel||"—"],["CPU 核心数",a?.cpu_cores||"—"],["总内存",a?.mem_total?`${a.mem_total.toFixed(0)} GB`:"—"],["已用内存",a?.mem_used?`${a.mem_used.toFixed(1)} GB`:"—"],["运行时长",a?.uptime?`${Math.floor(a.uptime/86400)}天 ${Math.floor(a.uptime%86400/3600)}时`:"—"],["Agent 版本",l?.version||a?.agent_version||"—"],["Agent 序列号",l?.report_seq!=null?String(l.report_seq):"—"],["监听端口数",p>0?`${p}`:"—"],["Agent RSS",l?.self_rss_mb?`${l.self_rss_mb.toFixed(1)} MB`:"—"]].map(([d,m])=>t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:40:15",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:41:17",className:"text-[var(--dg-text-muted)]",children:[d,":"]}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:42:17",className:"text-[var(--dg-text-primary)] font-mono",children:m})]},d))})})}),i&&t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:50:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:51:11",className:"p-4",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:52:13",className:"flex items-center gap-2 mb-2",children:[t.jsx($t,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:53:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),t.jsx("h3",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:54:15",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:"系统负载 (Load Average)"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:56:13",className:"flex items-center gap-6 text-xs",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:20",className:"text-[var(--dg-text-muted)]",children:"1min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:78",className:"text-sm font-bold text-slate-200",children:i.load1??"--"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:20",className:"text-[var(--dg-text-muted)]",children:"5min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:78",className:"text-sm font-bold text-slate-200",children:i.load5??"--"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:20",className:"text-[var(--dg-text-muted)]",children:"15min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:79",className:"text-sm font-bold text-slate-200",children:i.load15??"--"})]})]})]})}),c.length>0&&t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:66:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:67:11",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:68:13",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-2 flex items-center gap-2",children:[t.jsx(W,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:68:108",className:"h-4 w-4"}),"磁盘分区"]}),t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:69:13",className:"space-y-1.5",children:c.map((d,m)=>t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:71:17",className:"flex items-center gap-2 text-xs",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:72:19",className:"text-[var(--dg-text-muted)] w-24 font-mono truncate",children:d.mount||d.mountpoint||d.device||`disk${m}`}),t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:73:19",className:"flex-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:74:21",className:"h-full rounded-full bg-blue-500",style:{width:`${Math.min(d.usage_percent||d.used_percent||0,100)}%`}})}),t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:76:19",className:"text-[var(--dg-text-primary)] w-28 text-right tabular-nums whitespace-nowrap",children:[(d.used_gb??0).toFixed(1),"/",(d.total_gb??0).toFixed(0),"GB"]}),t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:77:19",className:"text-blue-400 w-14 text-right tabular-nums whitespace-nowrap",children:[(d.usage_percent??d.used_percent??0).toFixed(1),"%"]})]},m))})]})})]})}function He(){const e=Mt(),[a]=Kt(),i=a.get("host")||"",[l,p]=H.useState(i),[n,c]=H.useState("basic"),[d,m]=H.useState(1),[s,x]=H.useState("avg"),[N,D]=H.useState("whitelist"),[M,F]=H.useState([]),[o,B]=H.useState(!1),[X,z]=H.useState(!1),{data:$=[],isLoading:J}=te(),{data:w=[],isLoading:g}=ee(l,d),{data:h,refetch:it}=oe(l);H.useEffect(()=>{h&&(D(h.port_filter_mode),F(h.port_whitelist))},[h]),H.useEffect(()=>{if($.length>0&&!l){const r=i?$.find(T=>T.hostname===i):null;p(String(r?.hostname||$[0]?.hostname||""))}},[$,l,i]);const O=async()=>{if(l){z(!0);try{await E.savePortPolicy(l,{port_filter_mode:N,port_whitelist:M}),B(!1),e.invalidateQueries({queryKey:K.hostMonitor.portPolicy(l)})}catch{}finally{z(!1)}}},_=xt.find(r=>r.hours===d)||xt[0],U=J||g,P=$.find(r=>r.hostname===l)||null,b=H.useMemo(()=>{const r=P||{};return w.length===0?r:{...r,...w[w.length-1]}},[P,w]),u=H.useMemo(()=>ae(w,_),[w,_]),f=v(b?.net_info),Y=Array.isArray(b?.port_info)?b.port_info:Array.isArray(v(b?.port_info))?v(b?.port_info):[],nt=v(b?.disk_io_info),At=v(b?.swap_info),dt=Array.isArray(v(b?.process_top_info))?v(b?.process_top_info):[],I=v(b?.fd_info),S=v(b?.cs_info),It=v(b?.heartbeat_info),A=(r,T="--")=>re(b,f,nt,At,I,r,T);return U&&!w.length?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:98:12",className:"flex items-center justify-center h-64",children:t.jsx(Qt,{"code-path":"src/pages/HostMonitor.tsx:98:67",className:"h-8 w-8 animate-spin text-slate-500"})}):t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:102:5",className:"space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:103:7",className:"flex items-center justify-between flex-wrap gap-2",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:104:9",className:"flex items-center gap-2",children:[t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:105:11",className:"h-4 w-4 text-blue-400"}),t.jsxs(ft,{"code-path":"src/pages/HostMonitor.tsx:106:11",value:l,onValueChange:p,children:[t.jsx(yt,{"code-path":"src/pages/HostMonitor.tsx:107:13",className:"w-52 h-8 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(Nt,{"code-path":"src/pages/HostMonitor.tsx:108:15",placeholder:"选择主机..."})}),t.jsx(Ht,{"code-path":"src/pages/HostMonitor.tsx:110:13",className:"bg-slate-800 border-slate-700 text-slate-200",children:$.map(r=>t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:112:17",value:r.hostname,children:r.hostname},r.hostname))})]}),P&&t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:117:13",className:"text-xs text-[var(--dg-text-muted)] ml-2",children:[String(P.os||""),P.cpu_cores?` | ${P.cpu_cores} 核`:"",P.mem_total?` | ${P.mem_total.toFixed(0)}GB`:""]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:122:9",className:"flex items-center gap-2",children:[t.jsxs(ft,{"code-path":"src/pages/HostMonitor.tsx:123:11",value:s,onValueChange:r=>x(r),children:[t.jsx(yt,{"code-path":"src/pages/HostMonitor.tsx:124:13",className:"w-24 h-7 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(Nt,{"code-path":"src/pages/HostMonitor.tsx:125:15"})}),t.jsxs(Ht,{"code-path":"src/pages/HostMonitor.tsx:127:13",className:"bg-slate-800 border-slate-700 text-slate-200",children:[t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:128:15",value:"avg",children:"平均值"}),t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:129:15",value:"max",children:"最大值"}),t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:130:15",value:"min",children:"最小值"})]})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:133:11",className:"flex items-center gap-1",children:xt.map(r=>t.jsx(L,{"code-path":"src/pages/HostMonitor.tsx:135:15",variant:d===r.hours?"default":"outline",size:"sm",className:"h-7 text-xs px-2.5",onClick:()=>m(r.hours),children:r.label},r.hours))})]})]}),t.jsxs(Ot,{"code-path":"src/pages/HostMonitor.tsx:142:7",value:n,onValueChange:c,children:[t.jsx(Rt,{"code-path":"src/pages/HostMonitor.tsx:143:9",className:"h-8 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] gap-0 overflow-x-auto",children:[{id:"basic",label:"基础监控",icon:t.jsx(Xt,{"code-path":"src/pages/HostMonitor.tsx:145:49",className:"w-3 h-3"})},{id:"disk",label:"磁盘监控",icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:146:48",className:"w-3 h-3"})},{id:"network",label:"网络监控",icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:147:51",className:"w-3 h-3"})},{id:"ports",label:"端口监控",icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:148:49",className:"w-3 h-3"})},{id:"process",label:"进程监控",icon:t.jsx(_t,{"code-path":"src/pages/HostMonitor.tsx:149:51",className:"w-3 h-3"})},{id:"system",label:"系统信息",icon:t.jsx(Jt,{"code-path":"src/pages/HostMonitor.tsx:150:50",className:"w-3 h-3"})},{id:"health_probes",label:"健康探针",icon:t.jsx(Yt,{"code-path":"src/pages/HostMonitor.tsx:151:57",className:"w-3 h-3"})}].map(r=>t.jsxs(Gt,{"code-path":"src/pages/HostMonitor.tsx:153:13",value:r.id,className:"text-[11px] h-7 gap-1 data-[state=active]:bg-[var(--dg-bg-primary)]",children:[r.icon,r.label]},r.id))}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:159:9",value:"basic",className:"mt-3 grid grid-cols-1 md:grid-cols-3 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:160:11",title:"CPU 使用率(%)",value:A("cpu"),icon:t.jsx(Zt,{"code-path":"src/pages/HostMonitor.tsx:160:79",className:"h-4 w-4 text-blue-400"}),data:u.cpu,color:"#3b82f6",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:162:11",title:"CPU IO等待(%)",value:b?.cpu_iowait!=null?`${b.cpu_iowait.toFixed(1)}%`:"--",icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:162:145",className:"h-4 w-4 text-orange-400"}),data:u.iowait,color:"#f97316",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:164:11",title:"内存使用率(%)",value:A("mem"),icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:164:77",className:"h-4 w-4 text-emerald-400"}),data:u.mem,color:"#10b981",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:166:11",title:"可用内存(GB)",value:b?.mem_available!=null?`${b.mem_available.toFixed(1)}GB`:"--",icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:166:149",className:"h-4 w-4 text-emerald-400"}),data:u.memAvail,color:"#34d399",unit:"GB",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:168:11",title:"Swap 使用率(%)",value:A("swap"),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:168:81",className:"h-4 w-4 text-red-400"}),data:u.swap,color:"#ef4444",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:170:11",title:"系统负载(1m)",value:A("load1"),icon:t.jsx($t,{"code-path":"src/pages/HostMonitor.tsx:170:79",className:"h-4 w-4 text-purple-400"}),data:u.load1,color:"#8b5cf6",unit:"",domain:[0,"auto"],aggType:s})]}),t.jsx(q,{"code-path":"src/pages/HostMonitor.tsx:174:9",value:"disk",className:"mt-3 space-y-3",children:t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:175:11",className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:176:13",title:"磁盘使用率(%)",value:A("disk"),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:176:80",className:"h-4 w-4 text-orange-400"}),data:u.disk,color:"#f97316",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:178:13",title:"Inode 使用率(%)",value:(()=>{const r=Array.isArray(v(b?.disk_info))?v(b?.disk_info):[],T=r.find(R=>R.mount==="/")||r[0];return T?.inode_usage_pct!=null?`${T.inode_usage_pct.toFixed(1)}%`:"--"})(),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:182:25",className:"h-4 w-4 text-purple-400"}),data:u.inode,color:"#8b5cf6",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:184:13",title:"磁盘读取(KB/s)",value:A("ioR"),icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:184:81",className:"h-4 w-4 text-blue-400"}),data:u.ioRead,color:"#3b82f6",unit:"KB/s",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:186:13",title:"磁盘写入(KB/s)",value:A("ioW"),icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:186:81",className:"h-4 w-4 text-emerald-400"}),data:u.ioWrite,color:"#10b981",unit:"KB/s",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:188:13",title:"磁盘IO繁忙度(%)",value:nt?.util!=null?`${nt.util.toFixed(1)}%`:"--",icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:188:130",className:"h-4 w-4 text-red-400"}),data:u.ioUtil,color:"#ef4444",unit:"%",domain:[0,100],aggType:s})]})}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:193:9",value:"network",className:"mt-3 space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:194:11",className:"grid grid-cols-1 md:grid-cols-4 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:195:13",title:"TCP EST",value:A("tcp"),icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:195:78",className:"h-4 w-4 text-purple-400"}),data:u.tcpEst,color:"#8b5cf6",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:197:13",title:"TCP TIME_WAIT",value:A("tw"),icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:197:83",className:"h-4 w-4 text-amber-400"}),data:u.tcpTW,color:"#f59e0b",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:199:13",title:"TCP CLOSE_WAIT",value:f?.tcp_close_wait!=null?String(f.tcp_close_wait):"--",icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:199:139",className:"h-4 w-4 text-red-400"}),data:u.tcpCW,color:"#ef4444",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:201:13",title:"TCP 总连接",value:f?String((f.tcp_established||0)+(f.tcp_time_wait||0)+(f.tcp_close_wait||0)):"--",icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:201:169",className:"h-4 w-4 text-cyan-400"}),data:u.connTotal,color:"#22d3ee",unit:"个",domain:[0,"auto"],aggType:s})]}),t.jsx(ce,{"code-path":"src/pages/HostMonitor.tsx:204:11",title:"网卡带宽吞吐",currentRx:f?.net_rx_bps!=null?rt(f.net_rx_bps):"--",currentTx:f?.net_tx_bps!=null?rt(f.net_tx_bps):"--",rxData:u.rx,txData:u.tx,aggType:s,unit:"KB/s"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:211:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3 mt-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:212:13",title:"网卡接收错误",value:f?.net_rx_errors!=null?String(f.net_rx_errors):"--",icon:t.jsx(ht,{"code-path":"src/pages/HostMonitor.tsx:212:129",className:"h-4 w-4 text-red-400"}),data:u.rxErr,color:"#ef4444",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:214:13",title:"网卡发送错误",value:f?.net_tx_errors!=null?String(f.net_tx_errors):"--",icon:t.jsx(ht,{"code-path":"src/pages/HostMonitor.tsx:214:129",className:"h-4 w-4 text-orange-400"}),data:u.txErr,color:"#f97316",unit:"个",domain:[0,"auto"],aggType:s})]})]}),t.jsx(q,{"code-path":"src/pages/HostMonitor.tsx:219:9",value:"ports",className:"mt-3 space-y-3",children:t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:220:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:221:13",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:222:15",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:223:17",className:"h-4 w-4 text-emerald-400"}),"监听端口 ",Y.length,t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:224:17",className:"ml-auto flex items-center gap-2",children:[N==="blacklist"&&M.length>0&&t.jsxs(Q,{"code-path":"src/pages/HostMonitor.tsx:226:21",variant:"outline",className:"text-[10px] text-amber-400 border-amber-500/30",children:["黑名单: ",M.join(",")]}),N==="whitelist"&&t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:231:21",variant:"outline",className:"text-[10px] text-blue-400 border-blue-500/30",children:"白名单模式"}),t.jsx(L,{"code-path":"src/pages/HostMonitor.tsx:235:19",variant:"outline",size:"sm",className:"h-6 text-[10px] px-2",onClick:()=>{it(),B(!0)},children:"策略配置"})]})]}),Y.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:242:17",className:"text-center py-6 text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"暂无端口数据"}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:246:17",className:"overflow-x-auto",children:t.jsxs("table",{"code-path":"src/pages/HostMonitor.tsx:247:19",className:"w-full text-xs",children:[t.jsx("thead",{"code-path":"src/pages/HostMonitor.tsx:248:21",children:t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:249:23",className:"text-[var(--dg-text-muted)] border-b border-[var(--dg-border)]",children:[t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:250:25",className:"py-1.5 text-left font-medium",children:"端口"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:251:25",className:"py-1.5 text-left font-medium",children:"协议"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:252:25",className:"py-1.5 text-left font-medium",children:"进程"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:253:25",className:"py-1.5 text-right font-medium",children:"状态"})]})}),t.jsx("tbody",{"code-path":"src/pages/HostMonitor.tsx:256:21",children:Y.map((r,T)=>t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:258:25",className:"border-b border-[var(--dg-border)]/30 hover:bg-slate-800/30 transition-colors",children:[t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:259:27",className:"py-1.5 font-mono text-[var(--dg-text-primary)]",children:r.port}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:260:27",className:"py-1.5",children:t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:261:29",variant:"outline",className:"text-[10px] font-mono",children:r.protocol||"tcp"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:265:27",className:"py-1.5 font-mono text-[var(--dg-text-muted)]",children:r.process||"—"}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:266:27",className:"py-1.5 text-right",children:t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:267:29",variant:"default",className:"text-[10px] bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"LISTEN"})})]},T))})]})})]})})}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:281:9",value:"process",className:"mt-3 space-y-3",children:[t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:282:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:283:13",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:284:15",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(_t,{"code-path":"src/pages/HostMonitor.tsx:285:17",className:"h-4 w-4 text-cyan-400"}),"进程 TOP ",dt.length]}),dt.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:288:17",className:"text-center py-6 text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"Agent v2.0+ 支持,等待数据上报…"}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:292:17",className:"overflow-x-auto",children:t.jsxs("table",{"code-path":"src/pages/HostMonitor.tsx:293:19",className:"w-full text-xs",children:[t.jsx("thead",{"code-path":"src/pages/HostMonitor.tsx:294:21",children:t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:295:23",className:"text-[var(--dg-text-muted)] border-b border-[var(--dg-border)]",children:[t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:296:25",className:"py-1.5 text-left font-medium w-[40%]",children:"进程名称 / CMD"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:297:25",className:"py-1.5 text-right font-medium w-[8%]",children:"PID"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:298:25",className:"py-1.5 text-right font-medium w-[16%]",children:"内存使用率(%)"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:299:25",className:"py-1.5 text-right font-medium w-[16%]",children:"CPU使用率(%)"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:300:25",className:"py-1.5 text-right font-medium w-[20%]",children:"打开文件数"})]})}),t.jsx("tbody",{"code-path":"src/pages/HostMonitor.tsx:303:21",children:dt.map((r,T)=>{const R=r.cmdline||r.name||"?",Z=r.cpu_pct!=null?Number(r.cpu_pct):null,tt=r.mem_pct!=null?Number(r.mem_pct):null;return t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:309:27",className:"border-b border-[var(--dg-border)]/30 hover:bg-slate-800/30 transition-colors",children:[t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:310:29",className:"py-1.5 pr-2",children:t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:311:31",className:"flex items-center gap-1 group/cmd",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:312:33",className:"font-mono text-[var(--dg-text-primary)] truncate max-w-[320px] inline-block align-middle",title:R,children:R}),t.jsx("button",{"code-path":"src/pages/HostMonitor.tsx:315:33",className:"opacity-0 group-hover/cmd:opacity-100 transition-opacity p-0.5 hover:text-cyan-400 shrink-0",title:"复制命令行",onClick:async Et=>{Et.stopPropagation();try{await navigator.clipboard.writeText(R)}catch{const G=document.createElement("textarea");G.value=R,G.style.position="fixed",G.style.opacity="0",document.body.appendChild(G),G.select(),document.execCommand("copy"),document.body.removeChild(G)}},children:t.jsxs("svg",{"code-path":"src/pages/HostMonitor.tsx:330:35",className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("rect",{"code-path":"src/pages/HostMonitor.tsx:331:37",x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.jsx("path",{"code-path":"src/pages/HostMonitor.tsx:332:37",d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:337:29",className:"py-1.5 text-right font-mono text-[var(--dg-text-muted)]",children:r.pid}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:338:29",className:"py-1.5 text-right font-mono",children:t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:339:31",className:tt!=null&&tt>50?"text-rose-400":"text-cyan-400",children:tt!=null?tt.toFixed(2):"--"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:343:29",className:"py-1.5 text-right font-mono",children:t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:344:31",className:Z!=null&&Z>50?"text-rose-400":"text-[var(--dg-text-primary)]",children:Z!=null?Z.toFixed(2):"--"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:348:29",className:"py-1.5 text-right font-mono text-[var(--dg-text-muted)]",children:r.fd_count??"--"})]},T)})})]})})]})}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:359:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:360:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:361:15",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:362:17",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:363:19",className:"h-4 w-4 text-violet-400"}),"FD 文件句柄"]}),I?.allocated!=null?t.jsxs(t.Fragment,{children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:367:21",className:"flex items-center gap-4 mb-3 text-xs",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:368:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:369:25",className:"text-[var(--dg-text-muted)]",children:"已分配 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:370:25",className:"font-mono text-[var(--dg-text-primary)] font-semibold",children:I.allocated.toLocaleString()})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:372:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:373:25",className:"text-[var(--dg-text-muted)]",children:"上限 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:374:25",className:"font-mono text-[var(--dg-text-primary)] font-semibold",children:I.max===-1?"无限制":I.max?.toLocaleString()||"—"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:376:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:377:25",className:"text-[var(--dg-text-muted)]",children:"使用率 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:378:25",className:`font-mono font-semibold ${I.usage_pct>80?"text-rose-400":"text-violet-400"}`,children:I.usage_pct!=null?`${I.usage_pct.toFixed(1)}%`:"—"})]})]}),u.fd.length>0&&t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:384:23",className:"h-[120px]",children:t.jsx(mt,{"code-path":"src/pages/HostMonitor.tsx:385:25",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/HostMonitor.tsx:386:27",data:u.fd,children:[t.jsx(ut,{"code-path":"src/pages/HostMonitor.tsx:387:29",strokeDasharray:"3 3",stroke:"var(--dg-border)"}),t.jsx(bt,{"code-path":"src/pages/HostMonitor.tsx:388:29",dataKey:"time",tick:{fontSize:10,fill:"var(--dg-text-muted)"},interval:"preserveStartEnd"}),t.jsx(jt,{"code-path":"src/pages/HostMonitor.tsx:389:29",tick:{fontSize:10,fill:"var(--dg-text-muted)"},unit:"%",domain:[0,"auto"]}),t.jsx(vt,{"code-path":"src/pages/HostMonitor.tsx:390:29",contentStyle:{background:"#1e293b",border:"1px solid #334155",borderRadius:6,fontSize:11}}),t.jsx("defs",{"code-path":"src/pages/HostMonitor.tsx:391:29",children:t.jsxs("linearGradient",{"code-path":"src/pages/HostMonitor.tsx:392:31",id:"fdGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:393:33",offset:"0%",stopColor:"#a78bfa",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:394:33",offset:"100%",stopColor:"#a78bfa",stopOpacity:.05})]})}),t.jsx(at,{"code-path":"src/pages/HostMonitor.tsx:397:29",type:"monotone",dataKey:s,stroke:"#a78bfa",strokeWidth:1.5,fill:"url(#fdGrad)",name:"FD使用率"})]})})})]}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:404:19",className:"text-center py-4 text-xs text-[var(--dg-text-muted)]",children:"等待数据…"})]})}),t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:409:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:410:15",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:411:17",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(Ft,{"code-path":"src/pages/HostMonitor.tsx:412:19",className:"h-4 w-4 text-emerald-400"}),"上下文切换"]}),S?.ctx_per_sec!=null?t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:415:19",className:"space-y-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:416:21",className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:417:23",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3 text-center",children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:418:25",className:"text-[10px] text-[var(--dg-text-muted)] mb-1",children:"CTX 切换/秒"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:419:25",className:"text-lg font-bold font-mono text-emerald-400",children:[(S.ctx_per_sec/1e6).toFixed(1),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:420:66",className:"text-xs font-normal text-[var(--dg-text-muted)] ml-0.5",children:"M"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:422:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-1 font-mono",children:[S.ctx_per_sec?.toLocaleString()," 次"]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:424:23",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3 text-center",children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:425:25",className:"text-[10px] text-[var(--dg-text-muted)] mb-1",children:"IRQ 中断/秒"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:426:25",className:"text-lg font-bold font-mono text-amber-400",children:[(S.irq_per_sec/1e6).toFixed(1),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:427:66",className:"text-xs font-normal text-[var(--dg-text-muted)] ml-0.5",children:"M"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:429:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-1 font-mono",children:[S.irq_per_sec?.toLocaleString()," 次"]})]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:432:21",className:"space-y-1",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:433:23",className:"flex justify-between text-[10px]",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:434:25",className:"text-emerald-400",children:"CTX"}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:435:25",className:"text-amber-400",children:"IRQ"})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:437:23",className:"h-2 bg-[var(--dg-bg-primary)] rounded-full overflow-hidden flex",children:S.ctx_per_sec+S.irq_per_sec>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:440:29",className:"h-full bg-emerald-500/60 rounded-l-full transition-all",style:{width:`${(S.ctx_per_sec/(S.ctx_per_sec+S.irq_per_sec)*100).toFixed(1)}%`}}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:442:29",className:"h-full bg-amber-500/60 rounded-r-full transition-all",style:{width:`${(S.irq_per_sec/(S.ctx_per_sec+S.irq_per_sec)*100).toFixed(1)}%`}})]})})]})]}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:450:19",className:"text-center py-4 text-xs text-[var(--dg-text-muted)]",children:"等待数据…"})]})})]})]}),t.jsx(xe,{"code-path":"src/pages/HostMonitor.tsx:457:9",selectedHost:l,serverInfo:P,latest:b,heartbeatInfo:It,portInfoCount:Y.length}),t.jsx(ie,{"code-path":"src/pages/HostMonitor.tsx:465:9",selectedHost:l})]}),t.jsx(le,{"code-path":"src/pages/HostMonitor.tsx:468:7",open:o,onOpenChange:B,portPolicyMode:N,onModeChange:D,portWhitelist:M,onWhitelistChange:F,onSave:O,saving:X})]})}export{He as HostMonitor}; +import{j as t,r as H}from"./vendor-codemirror-B1SGo4xl.js";import{f as Bt,G as Mt,B as L,D as wt,a as Pt,b as Ct,c as kt,d as Dt,e as Tt,t as qt,as as Kt}from"./index-Bp-M7P_8.js";import{a as E}from"./agent-BZUl25f5.js";import{u as ct,q as K,b as pt}from"./unwrap-D6sbt6TG.js";import{C,a as k}from"./card-BHSBTtub.js";import{S as ft,a as yt,b as Nt,c as Ht,d as et}from"./select-DbhcBWnH.js";import{c as q,T as Ot,a as Rt,b as Gt}from"./tabs-DbNlmoQJ.js";import{B as Q}from"./badge-B00SZHvE.js";import{R as mt,A as gt,C as ut,X as bt,Y as jt,T as vt,a as at,B as Lt}from"./AreaChart-B_pR5s1C.js";import{N as st,R as Ft,P as Wt,y as zt,a as ht,b as ot,aE as Ut,T as Vt,A as $t,H as W,L as Qt,h as V,_ as Xt,b0 as _t,I as Jt,b1 as Yt,g as Zt,b2 as lt}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";function te(){return ct({queryKey:K.hostMonitor.hosts(),queryFn:async()=>{const e=await E.getLatest();return pt(e)},staleTime:3e4})}function ee(e,a){return ct({queryKey:K.hostMonitor.history(e,a),queryFn:async()=>{if(!e)return[];const i=await E.getHistory(e,a);return pt(i)},enabled:!!e,staleTime:3e4})}function se(e){return ct({queryKey:K.hostMonitor.probes(e),queryFn:async()=>{if(!e)return[];const a=await E.getHealthProbes({hostname:e});return pt(a)},enabled:!!e})}function oe(e){return ct({queryKey:K.hostMonitor.portPolicy(e),queryFn:async()=>{if(!e)return{port_filter_mode:"whitelist",port_whitelist:[]};const a=await E.getPortPolicy(e);return{port_filter_mode:a?.data?.port_filter_mode||"blacklist",port_whitelist:a?.data?.port_whitelist||[]}},enabled:!!e})}const xt=[{label:"1小时",hours:1,window:60,buckets:60},{label:"6小时",hours:6,window:300,buckets:72},{label:"12小时",hours:12,window:600,buckets:72},{label:"1天",hours:24,window:1800,buckets:96},{label:"3天",hours:72,window:3600,buckets:72},{label:"7天",hours:168,window:10800,buckets:56},{label:"14天",hours:336,window:21600,buckets:48}],St=(e="")=>({name:"",hostname:e,probe_type:"http_get",http_url:"",http_method:"GET",http_expect_code:200,http_expect_body:"",tcp_host:"localhost",tcp_port:3306,exec_command:"",timeout:10,interval:60,description:""});function j(e,a,i){if(!e||e.length===0)return[];const l=Math.max(1,Math.ceil(e.length/i)),p=[];for(let n=0;nM+F,0)/c.length,x=Math.max(...c),N=Math.min(...c),D=d[Math.floor(d.length/2)]||0;p.push({time:new Date(D*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}),timestamp:D,avg:Number(s.toFixed(2)),max:Number(x.toFixed(2)),min:Number(N.toFixed(2)),count:c.length})}return p.slice(-i)}function v(e){if(!e)return{};if(typeof e=="object")return e;try{return JSON.parse(e)}catch{return{}}}function rt(e){return e>=1024*1024*1024?`${(e/1024/1024/1024).toFixed(1)} GB/s`:e>=1024*1024?`${(e/1024/1024).toFixed(1)} MB/s`:e>=1024?`${(e/1024).toFixed(1)} KB/s`:`${e.toFixed(1)} B/s`}function ae(e,a){const i=[],l=[],p=[],n=[],c=[],d=[],m=[],s=[],x=[],N=[],D=[],M=[],F=[],o=[],B=[],X=[],z=[],$=[],J=[],w=[],g=[];for(const h of e){const it=h.report_time?new Date(h.report_time).getTime()/1e3:h.created_at?new Date(h.created_at).getTime()/1e3:0;g.push(it),i.push(h.cpu_usage||0),o.push(h.cpu_iowait||0),l.push(h.mem_usage||0),B.push(h.mem_available||0),p.push(h.load1||0),n.push(h.disk_usage||0);const O=v(h.disk_info);if(Array.isArray(O)&&O.length>0){const u=O.find(f=>f.mount==="/")||O[0];w.push(u?.inode_usage_pct||0)}else w.push(0);const _=v(h.net_info);c.push(_.tcp_established||0),d.push(_.tcp_time_wait||0),m.push(_.tcp_close_wait||0),z.push((_.tcp_established||0)+(_.tcp_time_wait||0)+(_.tcp_close_wait||0)),s.push(_.net_rx_bps||0),x.push(_.net_tx_bps||0),$.push(_.net_rx_errors||0),J.push(_.net_tx_errors||0);const U=v(h.disk_io_info);N.push(U.read_bps||0),D.push(U.write_bps||0),X.push(U.util||0);const P=v(h.swap_info);M.push(P?.usage_percent||0);const b=v(h.fd_info);F.push(b?.usage_pct||0)}return{cpu:j(i,g,a.buckets),mem:j(l,g,a.buckets),load1:j(p,g,a.buckets),disk:j(n,g,a.buckets),tcpEst:j(c,g,a.buckets),tcpTW:j(d,g,a.buckets),tcpCW:j(m,g,a.buckets),rx:j(s.map(h=>h/1024),g,a.buckets),tx:j(x.map(h=>h/1024),g,a.buckets),ioRead:j(N.map(h=>h/1024),g,a.buckets),ioWrite:j(D.map(h=>h/1024),g,a.buckets),swap:j(M,g,a.buckets),fd:j(F,g,a.buckets),iowait:j(o,g,a.buckets),memAvail:j(B,g,a.buckets),ioUtil:j(X,g,a.buckets),connTotal:j(z,g,a.buckets),rxErr:j($,g,a.buckets),txErr:j(J,g,a.buckets),inode:j(w,g,a.buckets)}}function re(e,a,i,l,p,n,c="--"){return e?n==="cpu"?e.cpu_usage!=null?`${e.cpu_usage.toFixed(1)}%`:c:n==="mem"?e.mem_usage!=null?`${e.mem_usage.toFixed(1)}%`:c:n==="disk"?e.disk_usage!=null?`${e.disk_usage.toFixed(1)}%`:c:n==="load1"?e.load1!=null?String(e.load1):c:n==="tcp"?a.tcp_established!=null?String(a.tcp_established):c:n==="tw"?a.tcp_time_wait!=null?String(a.tcp_time_wait):c:n==="rx"?a.net_rx_bps!=null?`${(a.net_rx_bps/1024).toFixed(1)} KB/s`:c:n==="tx"?a.net_tx_bps!=null?`${(a.net_tx_bps/1024).toFixed(1)} KB/s`:c:n==="ioR"?i.read_bps!=null?`${rt(i.read_bps)}`:c:n==="ioW"?i.write_bps!=null?`${rt(i.write_bps)}`:c:n==="swap"?l?.usage_percent!=null?`${l.usage_percent.toFixed(1)}%`:c:n==="fd"&&p?.usage_pct!=null?`${p.usage_pct.toFixed(1)}%`:c:c}function y({title:e,value:a,icon:i,data:l,color:p,unit:n,domain:c,aggType:d}){const m=l.map(s=>({...s,value:s[d]}));return t.jsx(C,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:26:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:27:7",className:"p-3",children:[t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:28:9",className:"flex items-center justify-between mb-1",children:t.jsxs("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:29:11",className:"flex items-center gap-1.5",children:[i,t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:29:60",className:"text-xs text-[var(--dg-text-primary)] font-medium truncate",children:e})]})}),t.jsxs("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:31:9",className:"mb-2",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:32:11",className:"text-xl font-bold text-[var(--dg-text-primary)] tabular-nums",children:a}),n&&t.jsx("span",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:33:20",className:"text-xs text-[var(--dg-text-muted)] ml-1",children:n})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:35:9",className:"h-48",children:m.length===0?t.jsx("div",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:37:13",className:"h-full flex items-center justify-center text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-md",children:"暂无数据"}):t.jsx(mt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:39:13",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:40:15",data:m,margin:{top:2,right:2,bottom:0,left:-10},children:[t.jsx("defs",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:41:17",children:t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:42:19",id:`grad-${e}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:43:21",offset:"5%",stopColor:p,stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:44:21",offset:"95%",stopColor:p,stopOpacity:0})]})}),t.jsx(ut,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:47:17",strokeDasharray:"3 3",stroke:"#1e293b",strokeOpacity:.5}),t.jsx(bt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:48:17",dataKey:"time",hide:!0}),t.jsx(jt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:49:17",hide:!0,domain:c[1]==="auto"?[0,s=>s*1.1]:c}),t.jsx(vt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:50:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"4px",color:"#f8fafc",fontSize:"11px",padding:"4px 8px"},formatter:s=>[`${s.toFixed(2)} ${n}`,e.replace(/\(.+\)/,"")],labelFormatter:s=>`时间: ${s}`}),t.jsx(at,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:53:17",type:"monotone",dataKey:"value",stroke:p,strokeWidth:1.5,fill:`url(#grad-${e})`}),t.jsx(Lt,{"code-path":"src/pages/host-monitor/MetricChartCard.tsx:54:17",dataKey:"time",height:24,stroke:"#334155",fill:"#0f172a",startIndex:Math.max(0,m.length-Math.min(20,m.length))})]})})})]})})}function ce({title:e,currentRx:a,currentTx:i,rxData:l,txData:p,aggType:n,unit:c}){const d=l.map((x,N)=>({time:x.time,timestamp:x.timestamp,rx:x[n]??0,tx:p[N]?.[n]??0})),m=`grad-rx-${e.replace(/\s/g,"")}`,s=`grad-tx-${e.replace(/\s/g,"")}`;return t.jsx(C,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:32:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:33:7",className:"p-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:34:9",className:"flex items-center justify-between mb-1",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:35:11",className:"flex items-center gap-1.5",children:[t.jsx(st,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:36:13",className:"h-4 w-4 text-blue-400"}),t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:37:13",className:"text-xs text-[var(--dg-text-primary)] font-medium",children:e})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:39:11",className:"flex items-center gap-3 text-xs",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:13",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:19",className:"inline-block w-2.5 h-2.5 rounded-sm bg-blue-400 mr-1 align-middle"}),"接收 ",t.jsx("b",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:40:108",className:"text-blue-300",children:a})]}),t.jsxs("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:13",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:19",className:"inline-block w-2.5 h-2.5 rounded-sm bg-emerald-400 mr-1 align-middle"}),"发送 ",t.jsx("b",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:41:111",className:"text-emerald-300",children:i})]})]})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:44:9",className:"h-56",children:d.length===0?t.jsx("div",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:46:13",className:"h-full flex items-center justify-center text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-md",children:"暂无数据"}):t.jsx(mt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:48:13",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:49:15",data:d,margin:{top:2,right:2,bottom:0,left:-10},children:[t.jsxs("defs",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:50:17",children:[t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:51:19",id:m,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:52:21",offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:53:21",offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}),t.jsxs("linearGradient",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:55:19",id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:56:21",offset:"5%",stopColor:"#10b981",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/host-monitor/DualLineChart.tsx:57:21",offset:"95%",stopColor:"#10b981",stopOpacity:0})]})]}),t.jsx(ut,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:60:17",strokeDasharray:"3 3",stroke:"#1e293b",strokeOpacity:.5}),t.jsx(bt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:61:17",dataKey:"time",hide:!0}),t.jsx(jt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:62:17",hide:!0,domain:[0,"auto"]}),t.jsx(vt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:63:17",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"4px",color:"#f8fafc",fontSize:"11px",padding:"4px 8px"},formatter:(x,N)=>[`${x.toFixed(2)} ${c}`,N==="rx"?"接收":"发送"],labelFormatter:x=>`时间: ${x}`}),t.jsx(at,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:66:17",type:"monotone",dataKey:"rx",stroke:"#3b82f6",strokeWidth:1.5,fill:`url(#${m})`,name:"rx"}),t.jsx(at,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:67:17",type:"monotone",dataKey:"tx",stroke:"#10b981",strokeWidth:1.5,fill:`url(#${s})`,name:"tx"}),t.jsx(Lt,{"code-path":"src/pages/host-monitor/DualLineChart.tsx:68:17",dataKey:"time",height:24,stroke:"#334155",fill:"#0f172a",startIndex:Math.max(0,d.length-Math.min(20,d.length))})]})})})]})})}function ie({selectedHost:e}){const a=Bt(),i=Mt(),{data:l=[],refetch:p}=se(e),[n,c]=H.useState(!1),[d,m]=H.useState(null),[s,x]=H.useState(St()),N=()=>{m(null),x(St(e)),c(!0)},D=o=>{m(o),x({name:String(o.name||""),hostname:String(o.hostname||""),probe_type:String(o.probe_type||"http_get"),http_url:String(o.http_url||""),http_method:String(o.http_method||"GET"),http_expect_code:Number(o.http_expect_code)||200,http_expect_body:String(o.http_expect_body||""),tcp_host:String(o.tcp_host||""),tcp_port:Number(o.tcp_port)||3306,exec_command:String(o.exec_command||""),timeout:Number(o.timeout)||10,interval:Number(o.interval)||60,description:String(o.description||"")}),c(!0)},M=async()=>{if(!(!s.name||!s.hostname))try{d?await E.updateHealthProbe(d.id,s):await E.createHealthProbe(s),c(!1),i.invalidateQueries({queryKey:K.hostMonitor.probes(e)})}catch{qt.error("保存失败")}},F=async o=>{await a({title:"删除探针",description:`确定删除探针「${o.name}」?`,confirmText:"删除",variant:"destructive"})&&(await E.deleteHealthProbe(o.id),i.invalidateQueries({queryKey:K.hostMonitor.probes(e)}))};return t.jsxs(t.Fragment,{children:[t.jsxs(q,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:88:7",value:"health_probes",className:"mt-3 space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:89:9",className:"flex items-center justify-between",children:[t.jsx("h3",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:90:11",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:"探针列表(Agent 在目标主机本地执行探测)"}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:91:11",className:"flex gap-2",children:[t.jsxs(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:92:13",size:"sm",variant:"outline",className:"h-7 text-[11px]",onClick:()=>p(),children:[t.jsx(Ft,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:93:15",className:"w-3 h-3 mr-1"}),"刷新"]}),t.jsxs(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:95:13",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:N,children:[t.jsx(Wt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:96:15",className:"w-3 h-3 mr-1"}),"添加探针"]})]})]}),l.length===0?t.jsx(C,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:101:11",className:"bg-[var(--dg-bg-secondary)] border-dashed border-[var(--dg-border)]",children:t.jsx(k,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:102:13",className:"p-8 text-center text-xs text-[var(--dg-text-muted)]",children:'暂无健康探针,点击"添加探针"创建'})}):t.jsx("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:107:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:l.map(o=>t.jsx(C,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:109:15",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${o.last_status==="down"?"border-red-700/50":""}`,children:t.jsxs(k,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:110:17",className:"p-3",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:111:19",className:"flex items-start justify-between mb-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:112:21",className:"flex items-center gap-2",children:[o.last_status==="up"?t.jsx(zt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:113:49",className:"w-4 h-4 text-emerald-400"}):o.last_status==="down"?t.jsx(ht,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:114:51",className:"w-4 h-4 text-red-400"}):t.jsx(ot,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:115:24",className:"w-4 h-4 text-slate-500"}),t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:116:23",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:String(o.name)}),t.jsx(Q,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:117:23",variant:"outline",className:"text-[10px] h-5 px-1.5 capitalize",children:o.probe_type==="http_get"?"HTTP":o.probe_type==="tcp_socket"?"TCP":"Exec"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:121:21",className:"flex gap-1",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:122:23",variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>D(o),children:t.jsx(Ut,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:123:25",className:"w-3 h-3"})}),t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:125:23",variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-400 hover:text-red-300",onClick:()=>F(o),children:t.jsx(Vt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:126:25",className:"w-3 h-3"})})]})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:130:19",className:"space-y-1 text-[11px] text-[var(--dg-text-muted)]",children:[o.probe_type==="http_get"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:132:23",className:"truncate",children:["URL: ",String(o.http_url)]}),o.probe_type==="tcp_socket"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:135:23",children:[String(o.tcp_host),":",String(o.tcp_port)]}),o.probe_type==="exec_command"&&t.jsx("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:138:23",className:"truncate font-mono",children:String(o.exec_command)}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:140:21",className:"flex items-center gap-3",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:141:23",children:["状态: ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:141:33",className:o.last_status==="up"?"text-emerald-400":o.last_status==="down"?"text-red-400":"text-slate-400",children:o.last_status?String(o.last_status).toUpperCase():"未检测"})]}),Number(o.last_latency_ms)>0&&t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:144:57",children:["延迟: ",String(o.last_latency_ms),"ms"]}),Number(o.fail_count)>0&&t.jsxs("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:145:52",className:"text-red-400",children:["连续失败: ",String(o.fail_count),"次"]}),o.last_checked_at&&t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:146:45",className:"text-[10px]",children:new Date(String(o.last_checked_at)).toLocaleString("zh-CN")})]})]})]})},String(o.id)))})]}),t.jsx(wt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:156:7",open:n,onOpenChange:c,children:t.jsxs(Pt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:157:9",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-lg",children:[t.jsxs(Ct,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:158:11",children:[t.jsx(kt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:159:13",className:"text-[var(--dg-text-primary)]",children:d?"编辑探针":"添加探针"}),t.jsx(Dt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:162:13",className:"text-[var(--dg-text-secondary)]",children:d?"修改健康探针配置":"创建新的健康探针,Agent 在目标主机本地执行探测"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:166:11",className:"space-y-3 max-h-[60vh] overflow-y-auto pr-1",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:167:13",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:168:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["探针名称 ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:168:90",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:169:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.name,onChange:o=>x({...s,name:o.target.value}),placeholder:"如:cex-agent 健康检查"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:171:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:172:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"目标主机"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:173:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.hostname,onChange:o=>x({...s,hostname:o.target.value})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:175:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:176:15",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"探针类型"}),t.jsxs("select",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:177:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.probe_type,onChange:o=>x({...s,probe_type:o.target.value}),children:[t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:178:17",value:"http_get",children:"HTTP GET"}),t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:179:17",value:"tcp_socket",children:"TCP Socket"}),t.jsx("option",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:180:17",value:"exec_command",children:"Exec Command"})]})]}),s.probe_type==="http_get"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:17",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["HTTP URL ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:186:101",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:187:19",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_url,onChange:o=>x({...s,http_url:o.target.value}),placeholder:"http://localhost:8080/health"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:188:17",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:189:19",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:189:24",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"期望状态码"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:190:21",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_expect_code,onChange:o=>x({...s,http_expect_code:Number(o.target.value)})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:191:19",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:191:24",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"期望响应内容(可选)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:192:21",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.http_expect_body,onChange:o=>x({...s,http_expect_body:o.target.value})})]})]})]}),s.probe_type==="tcp_socket"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:198:15",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:199:17",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:199:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"TCP 目标地址"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:200:19",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.tcp_host,onChange:o=>x({...s,tcp_host:o.target.value}),placeholder:"localhost"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:201:17",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:201:22",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"TCP 端口"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:202:19",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.tcp_port,onChange:o=>x({...s,tcp_port:Number(o.target.value)})})]})]}),s.probe_type==="exec_command"&&t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:15",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:["执行命令 ",t.jsx("span",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:207:95",className:"text-red-400",children:"*"})]}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:208:17",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs font-mono text-[var(--dg-text-primary)]",value:s.exec_command,onChange:o=>x({...s,exec_command:o.target.value}),placeholder:"pgrep -x mysqld"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:211:13",className:"grid grid-cols-2 gap-2",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:212:15",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:212:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"超时(秒)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:213:17",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.timeout,onChange:o=>x({...s,timeout:Number(o.target.value)})})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:214:15",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:214:20",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"间隔(秒)"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:215:17",type:"number",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.interval,onChange:o=>x({...s,interval:Number(o.target.value)})})]})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:218:13",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:218:18",className:"text-[11px] text-[var(--dg-text-muted)] mb-1 block",children:"描述"}),t.jsx("input",{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:219:15",className:"w-full h-8 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 text-xs text-[var(--dg-text-primary)]",value:s.description,onChange:o=>x({...s,description:o.target.value})})]})]}),t.jsxs(Tt,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:221:11",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:222:13",variant:"outline",size:"sm",className:"h-7 text-[11px]",onClick:()=>c(!1),children:"取消"}),t.jsx(L,{"code-path":"src/pages/host-monitor/HealthProbeSection.tsx:223:13",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:M,disabled:!s.name||!s.hostname,children:d?"保存":"创建"})]})]})})]})}function ne(e){const a=Number(e);return Number.isInteger(a)&&a>0&&a<=65535}function de(e){return e.split(",").map(a=>parseInt(a.trim(),10)).filter(a=>ne(a))}function le({open:e,onOpenChange:a,portPolicyMode:i,onModeChange:l,portWhitelist:p,onWhitelistChange:n,onSave:c,saving:d}){return t.jsx(wt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:30:5",open:e,onOpenChange:a,children:t.jsxs(Pt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:31:7",showOverlay:!1,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-md",children:[t.jsxs(Ct,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:32:9",children:[t.jsx(kt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:33:11",className:"text-[var(--dg-text-primary)]",children:"端口监控策略"}),t.jsx(Dt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:34:11",className:"text-[var(--dg-text-secondary)]",children:"配置 Agent 端口上报过滤规则"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:36:9",className:"space-y-4",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:37:11",children:[t.jsx("label",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:38:13",className:"text-[11px] text-[var(--dg-text-muted)] mb-1.5 block",children:"过滤模式"}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:39:13",className:"flex gap-2",children:[t.jsx("button",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:40:15",className:`flex-1 h-9 rounded text-xs font-medium border transition-colors ${i==="whitelist"?"bg-blue-500/20 border-blue-500 text-blue-400":"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,onClick:()=>l("whitelist"),children:"白名单 ─ 全量上报"}),t.jsx("button",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:46:15",className:`flex-1 h-9 rounded text-xs font-medium border transition-colors ${i==="blacklist"?"bg-amber-500/20 border-amber-500 text-amber-400":"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,onClick:()=>l("blacklist"),children:"黑名单 ─ 仅上报选中"})]}),t.jsx("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:53:13",className:"text-[10px] text-[var(--dg-text-muted)] mt-1.5 leading-relaxed",children:i==="whitelist"?"所有发现的端口都上报,任意端口变化都会触发告警 + 恢复通知。":"仅上报选中端口的变化,其余端口变化静默忽略(不告警)。系统进程端口(sshd/rpcbind/systemd等)永远忽略。"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:60:11",children:[t.jsxs("label",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:61:13",className:"text-[11px] text-[var(--dg-text-muted)] mb-1.5 block",children:["端口列表 ",t.jsx("span",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:62:20",className:"text-[var(--dg-text-muted)]",children:"(逗号分隔,如: 80,443,3306,6379)"}),i==="whitelist"&&t.jsx("span",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:63:50",className:"text-blue-400 ml-1",children:"— 白名单模式无需配置"})]}),t.jsx("textarea",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:65:13",className:`w-full h-20 bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] rounded px-2 py-1.5 text-xs font-mono resize-none ${i==="whitelist"?"text-[var(--dg-text-muted)] opacity-50 cursor-not-allowed":"text-[var(--dg-text-primary)]"}`,value:p.join(","),onChange:m=>{if(i==="whitelist")return;const s=m.target.value;n(de(s))},placeholder:i==="whitelist"?"白名单模式下所有端口自动上报":"80,443,3306,6379",readOnly:i==="whitelist"}),t.jsxs("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:78:13",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:["已输入 ",p.length," 个端口"]})]}),t.jsx("div",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:83:11",className:"bg-amber-500/5 border border-amber-500/20 rounded p-2.5",children:t.jsxs("p",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:84:13",className:"text-[10px] text-amber-300/80 leading-relaxed",children:["⚠️ 无论选择哪种模式,以下系统进程端口",t.jsx("b",{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:85:35",children:"永远不上报"}),":sshd、rpcbind、master、systemd、dbus-daemon、rsyslogd 等。Agent 采集时自动跳过。"]})})]}),t.jsxs(Tt,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:89:9",children:[t.jsx(L,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:90:11",variant:"outline",size:"sm",className:"h-7 text-[11px]",onClick:()=>a(!1),children:"取消"}),t.jsx(L,{"code-path":"src/pages/host-monitor/PortPolicyDialog.tsx:91:11",size:"sm",className:"h-7 text-[11px] bg-blue-600 hover:bg-blue-500",onClick:c,disabled:d,children:d?"保存中…":"保存策略"})]})]})})}function xe({selectedHost:e,serverInfo:a,latest:i,heartbeatInfo:l,portInfoCount:p}){const n=i?.disk_info?v(i.disk_info):null,c=n?Array.isArray(n)?n:n.partitions||[]:[];return t.jsxs(q,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:22:5",value:"system",className:"mt-3 space-y-3",children:[t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:23:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:24:9",className:"p-4",children:t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:25:11",className:"grid grid-cols-2 md:grid-cols-4 gap-x-6 gap-y-3 text-xs",children:[["主机名",a?.hostname||e],["IP 地址",a?.ip||"—"],["操作系统",a?.os||"—"],["内核版本",a?.kernel||"—"],["CPU 核心数",a?.cpu_cores||"—"],["总内存",a?.mem_total?`${a.mem_total.toFixed(0)} GB`:"—"],["已用内存",a?.mem_used?`${a.mem_used.toFixed(1)} GB`:"—"],["运行时长",a?.uptime?`${Math.floor(a.uptime/86400)}天 ${Math.floor(a.uptime%86400/3600)}时`:"—"],["Agent 版本",l?.version||a?.agent_version||"—"],["Agent 序列号",l?.report_seq!=null?String(l.report_seq):"—"],["监听端口数",p>0?`${p}`:"—"],["Agent RSS",l?.self_rss_mb?`${l.self_rss_mb.toFixed(1)} MB`:"—"]].map(([d,m])=>t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:40:15",children:[t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:41:17",className:"text-[var(--dg-text-muted)]",children:[d,":"]}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:42:17",className:"text-[var(--dg-text-primary)] font-mono",children:m})]},d))})})}),i&&t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:50:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:51:11",className:"p-4",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:52:13",className:"flex items-center gap-2 mb-2",children:[t.jsx($t,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:53:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),t.jsx("h3",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:54:15",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:"系统负载 (Load Average)"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:56:13",className:"flex items-center gap-6 text-xs",children:[t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:20",className:"text-[var(--dg-text-muted)]",children:"1min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:57:78",className:"text-sm font-bold text-slate-200",children:i.load1??"--"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:20",className:"text-[var(--dg-text-muted)]",children:"5min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:58:78",className:"text-sm font-bold text-slate-200",children:i.load5??"--"})]}),t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:15",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:20",className:"text-[var(--dg-text-muted)]",children:"15min "}),t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:59:79",className:"text-sm font-bold text-slate-200",children:i.load15??"--"})]})]})]})}),c.length>0&&t.jsx(C,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:66:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:67:11",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:68:13",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-2 flex items-center gap-2",children:[t.jsx(W,{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:68:108",className:"h-4 w-4"}),"磁盘分区"]}),t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:69:13",className:"space-y-1.5",children:c.map((d,m)=>t.jsxs("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:71:17",className:"flex items-center gap-2 text-xs",children:[t.jsx("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:72:19",className:"text-[var(--dg-text-muted)] w-24 font-mono truncate",children:d.mount||d.mountpoint||d.device||`disk${m}`}),t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:73:19",className:"flex-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:t.jsx("div",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:74:21",className:"h-full rounded-full bg-blue-500",style:{width:`${Math.min(d.usage_percent||d.used_percent||0,100)}%`}})}),t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:76:19",className:"text-[var(--dg-text-primary)] w-28 text-right tabular-nums whitespace-nowrap",children:[(d.used_gb??0).toFixed(1),"/",(d.total_gb??0).toFixed(0),"GB"]}),t.jsxs("span",{"code-path":"src/pages/host-monitor/SystemInfoSection.tsx:77:19",className:"text-blue-400 w-14 text-right tabular-nums whitespace-nowrap",children:[(d.usage_percent??d.used_percent??0).toFixed(1),"%"]})]},m))})]})})]})}function He(){const e=Mt(),[a]=Kt(),i=a.get("host")||"",[l,p]=H.useState(i),[n,c]=H.useState("basic"),[d,m]=H.useState(1),[s,x]=H.useState("avg"),[N,D]=H.useState("whitelist"),[M,F]=H.useState([]),[o,B]=H.useState(!1),[X,z]=H.useState(!1),{data:$=[],isLoading:J}=te(),{data:w=[],isLoading:g}=ee(l,d),{data:h,refetch:it}=oe(l);H.useEffect(()=>{h&&(D(h.port_filter_mode),F(h.port_whitelist))},[h]),H.useEffect(()=>{if($.length>0&&!l){const r=i?$.find(T=>T.hostname===i):null;p(String(r?.hostname||$[0]?.hostname||""))}},[$,l,i]);const O=async()=>{if(l){z(!0);try{await E.savePortPolicy(l,{port_filter_mode:N,port_whitelist:M}),B(!1),e.invalidateQueries({queryKey:K.hostMonitor.portPolicy(l)})}catch{}finally{z(!1)}}},_=xt.find(r=>r.hours===d)||xt[0],U=J||g,P=$.find(r=>r.hostname===l)||null,b=H.useMemo(()=>{const r=P||{};return w.length===0?r:{...r,...w[w.length-1]}},[P,w]),u=H.useMemo(()=>ae(w,_),[w,_]),f=v(b?.net_info),Y=Array.isArray(b?.port_info)?b.port_info:Array.isArray(v(b?.port_info))?v(b?.port_info):[],nt=v(b?.disk_io_info),At=v(b?.swap_info),dt=Array.isArray(v(b?.process_top_info))?v(b?.process_top_info):[],I=v(b?.fd_info),S=v(b?.cs_info),It=v(b?.heartbeat_info),A=(r,T="--")=>re(b,f,nt,At,I,r,T);return U&&!w.length?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:98:12",className:"flex items-center justify-center h-64",children:t.jsx(Qt,{"code-path":"src/pages/HostMonitor.tsx:98:67",className:"h-8 w-8 animate-spin text-slate-500"})}):t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:102:5",className:"space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:103:7",className:"flex items-center justify-between flex-wrap gap-2",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:104:9",className:"flex items-center gap-2",children:[t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:105:11",className:"h-4 w-4 text-blue-400"}),t.jsxs(ft,{"code-path":"src/pages/HostMonitor.tsx:106:11",value:l,onValueChange:p,children:[t.jsx(yt,{"code-path":"src/pages/HostMonitor.tsx:107:13",className:"w-52 h-8 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(Nt,{"code-path":"src/pages/HostMonitor.tsx:108:15",placeholder:"选择主机..."})}),t.jsx(Ht,{"code-path":"src/pages/HostMonitor.tsx:110:13",className:"bg-slate-800 border-slate-700 text-slate-200",children:$.map(r=>t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:112:17",value:r.hostname,children:r.hostname},r.hostname))})]}),P&&t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:117:13",className:"text-xs text-[var(--dg-text-muted)] ml-2",children:[String(P.os||""),P.cpu_cores?` | ${P.cpu_cores} 核`:"",P.mem_total?` | ${P.mem_total.toFixed(0)}GB`:""]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:122:9",className:"flex items-center gap-2",children:[t.jsxs(ft,{"code-path":"src/pages/HostMonitor.tsx:123:11",value:s,onValueChange:r=>x(r),children:[t.jsx(yt,{"code-path":"src/pages/HostMonitor.tsx:124:13",className:"w-24 h-7 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsx(Nt,{"code-path":"src/pages/HostMonitor.tsx:125:15"})}),t.jsxs(Ht,{"code-path":"src/pages/HostMonitor.tsx:127:13",className:"bg-slate-800 border-slate-700 text-slate-200",children:[t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:128:15",value:"avg",children:"平均值"}),t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:129:15",value:"max",children:"最大值"}),t.jsx(et,{"code-path":"src/pages/HostMonitor.tsx:130:15",value:"min",children:"最小值"})]})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:133:11",className:"flex items-center gap-1",children:xt.map(r=>t.jsx(L,{"code-path":"src/pages/HostMonitor.tsx:135:15",variant:d===r.hours?"default":"outline",size:"sm",className:"h-7 text-xs px-2.5",onClick:()=>m(r.hours),children:r.label},r.hours))})]})]}),t.jsxs(Ot,{"code-path":"src/pages/HostMonitor.tsx:142:7",value:n,onValueChange:c,children:[t.jsx(Rt,{"code-path":"src/pages/HostMonitor.tsx:143:9",className:"h-8 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] gap-0 overflow-x-auto",children:[{id:"basic",label:"基础监控",icon:t.jsx(Xt,{"code-path":"src/pages/HostMonitor.tsx:145:49",className:"w-3 h-3"})},{id:"disk",label:"磁盘监控",icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:146:48",className:"w-3 h-3"})},{id:"network",label:"网络监控",icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:147:51",className:"w-3 h-3"})},{id:"ports",label:"端口监控",icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:148:49",className:"w-3 h-3"})},{id:"process",label:"进程监控",icon:t.jsx(_t,{"code-path":"src/pages/HostMonitor.tsx:149:51",className:"w-3 h-3"})},{id:"system",label:"系统信息",icon:t.jsx(Jt,{"code-path":"src/pages/HostMonitor.tsx:150:50",className:"w-3 h-3"})},{id:"health_probes",label:"健康探针",icon:t.jsx(Yt,{"code-path":"src/pages/HostMonitor.tsx:151:57",className:"w-3 h-3"})}].map(r=>t.jsxs(Gt,{"code-path":"src/pages/HostMonitor.tsx:153:13",value:r.id,className:"text-[11px] h-7 gap-1 data-[state=active]:bg-[var(--dg-bg-primary)]",children:[r.icon,r.label]},r.id))}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:159:9",value:"basic",className:"mt-3 grid grid-cols-1 md:grid-cols-3 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:160:11",title:"CPU 使用率(%)",value:A("cpu"),icon:t.jsx(Zt,{"code-path":"src/pages/HostMonitor.tsx:160:79",className:"h-4 w-4 text-blue-400"}),data:u.cpu,color:"#3b82f6",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:162:11",title:"CPU IO等待(%)",value:b?.cpu_iowait!=null?`${b.cpu_iowait.toFixed(1)}%`:"--",icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:162:145",className:"h-4 w-4 text-orange-400"}),data:u.iowait,color:"#f97316",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:164:11",title:"内存使用率(%)",value:A("mem"),icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:164:77",className:"h-4 w-4 text-emerald-400"}),data:u.mem,color:"#10b981",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:166:11",title:"可用内存(GB)",value:b?.mem_available!=null?`${b.mem_available.toFixed(1)}GB`:"--",icon:t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:166:149",className:"h-4 w-4 text-emerald-400"}),data:u.memAvail,color:"#34d399",unit:"GB",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:168:11",title:"Swap 使用率(%)",value:A("swap"),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:168:81",className:"h-4 w-4 text-red-400"}),data:u.swap,color:"#ef4444",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:170:11",title:"系统负载(1m)",value:A("load1"),icon:t.jsx($t,{"code-path":"src/pages/HostMonitor.tsx:170:79",className:"h-4 w-4 text-purple-400"}),data:u.load1,color:"#8b5cf6",unit:"",domain:[0,"auto"],aggType:s})]}),t.jsx(q,{"code-path":"src/pages/HostMonitor.tsx:174:9",value:"disk",className:"mt-3 space-y-3",children:t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:175:11",className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:176:13",title:"磁盘使用率(%)",value:A("disk"),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:176:80",className:"h-4 w-4 text-orange-400"}),data:u.disk,color:"#f97316",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:178:13",title:"Inode 使用率(%)",value:(()=>{const r=Array.isArray(v(b?.disk_info))?v(b?.disk_info):[],T=r.find(R=>R.mount==="/")||r[0];return T?.inode_usage_pct!=null?`${T.inode_usage_pct.toFixed(1)}%`:"--"})(),icon:t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:182:25",className:"h-4 w-4 text-purple-400"}),data:u.inode,color:"#8b5cf6",unit:"%",domain:[0,100],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:184:13",title:"磁盘读取(KB/s)",value:A("ioR"),icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:184:81",className:"h-4 w-4 text-blue-400"}),data:u.ioRead,color:"#3b82f6",unit:"KB/s",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:186:13",title:"磁盘写入(KB/s)",value:A("ioW"),icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:186:81",className:"h-4 w-4 text-emerald-400"}),data:u.ioWrite,color:"#10b981",unit:"KB/s",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:188:13",title:"磁盘IO繁忙度(%)",value:nt?.util!=null?`${nt.util.toFixed(1)}%`:"--",icon:t.jsx(lt,{"code-path":"src/pages/HostMonitor.tsx:188:130",className:"h-4 w-4 text-red-400"}),data:u.ioUtil,color:"#ef4444",unit:"%",domain:[0,100],aggType:s})]})}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:193:9",value:"network",className:"mt-3 space-y-3",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:194:11",className:"grid grid-cols-1 md:grid-cols-4 gap-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:195:13",title:"TCP EST",value:A("tcp"),icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:195:78",className:"h-4 w-4 text-purple-400"}),data:u.tcpEst,color:"#8b5cf6",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:197:13",title:"TCP TIME_WAIT",value:A("tw"),icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:197:83",className:"h-4 w-4 text-amber-400"}),data:u.tcpTW,color:"#f59e0b",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:199:13",title:"TCP CLOSE_WAIT",value:f?.tcp_close_wait!=null?String(f.tcp_close_wait):"--",icon:t.jsx(ot,{"code-path":"src/pages/HostMonitor.tsx:199:139",className:"h-4 w-4 text-red-400"}),data:u.tcpCW,color:"#ef4444",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:201:13",title:"TCP 总连接",value:f?String((f.tcp_established||0)+(f.tcp_time_wait||0)+(f.tcp_close_wait||0)):"--",icon:t.jsx(st,{"code-path":"src/pages/HostMonitor.tsx:201:169",className:"h-4 w-4 text-cyan-400"}),data:u.connTotal,color:"#22d3ee",unit:"个",domain:[0,"auto"],aggType:s})]}),t.jsx(ce,{"code-path":"src/pages/HostMonitor.tsx:204:11",title:"网卡带宽吞吐",currentRx:f?.net_rx_bps!=null?rt(f.net_rx_bps):"--",currentTx:f?.net_tx_bps!=null?rt(f.net_tx_bps):"--",rxData:u.rx,txData:u.tx,aggType:s,unit:"KB/s"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:211:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3 mt-3",children:[t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:212:13",title:"网卡接收错误",value:f?.net_rx_errors!=null?String(f.net_rx_errors):"--",icon:t.jsx(ht,{"code-path":"src/pages/HostMonitor.tsx:212:129",className:"h-4 w-4 text-red-400"}),data:u.rxErr,color:"#ef4444",unit:"个",domain:[0,"auto"],aggType:s}),t.jsx(y,{"code-path":"src/pages/HostMonitor.tsx:214:13",title:"网卡发送错误",value:f?.net_tx_errors!=null?String(f.net_tx_errors):"--",icon:t.jsx(ht,{"code-path":"src/pages/HostMonitor.tsx:214:129",className:"h-4 w-4 text-orange-400"}),data:u.txErr,color:"#f97316",unit:"个",domain:[0,"auto"],aggType:s})]})]}),t.jsx(q,{"code-path":"src/pages/HostMonitor.tsx:219:9",value:"ports",className:"mt-3 space-y-3",children:t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:220:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:221:13",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:222:15",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(V,{"code-path":"src/pages/HostMonitor.tsx:223:17",className:"h-4 w-4 text-emerald-400"}),"监听端口 ",Y.length,t.jsxs("span",{"code-path":"src/pages/HostMonitor.tsx:224:17",className:"ml-auto flex items-center gap-2",children:[N==="blacklist"&&M.length>0&&t.jsxs(Q,{"code-path":"src/pages/HostMonitor.tsx:226:21",variant:"outline",className:"text-[10px] text-amber-400 border-amber-500/30",children:["黑名单: ",M.join(",")]}),N==="whitelist"&&t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:231:21",variant:"outline",className:"text-[10px] text-blue-400 border-blue-500/30",children:"白名单模式"}),t.jsx(L,{"code-path":"src/pages/HostMonitor.tsx:235:19",variant:"outline",size:"sm",className:"h-6 text-[10px] px-2",onClick:()=>{it(),B(!0)},children:"策略配置"})]})]}),Y.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:242:17",className:"text-center py-6 text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"暂无端口数据"}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:246:17",className:"overflow-x-auto",children:t.jsxs("table",{"code-path":"src/pages/HostMonitor.tsx:247:19",className:"w-full text-xs",children:[t.jsx("thead",{"code-path":"src/pages/HostMonitor.tsx:248:21",children:t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:249:23",className:"text-[var(--dg-text-muted)] border-b border-[var(--dg-border)]",children:[t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:250:25",className:"py-1.5 text-left font-medium",children:"端口"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:251:25",className:"py-1.5 text-left font-medium",children:"协议"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:252:25",className:"py-1.5 text-left font-medium",children:"进程"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:253:25",className:"py-1.5 text-right font-medium",children:"状态"})]})}),t.jsx("tbody",{"code-path":"src/pages/HostMonitor.tsx:256:21",children:Y.map((r,T)=>t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:258:25",className:"border-b border-[var(--dg-border)]/30 hover:bg-slate-800/30 transition-colors",children:[t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:259:27",className:"py-1.5 font-mono text-[var(--dg-text-primary)]",children:r.port}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:260:27",className:"py-1.5",children:t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:261:29",variant:"outline",className:"text-[10px] font-mono",children:r.protocol||"tcp"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:265:27",className:"py-1.5 font-mono text-[var(--dg-text-muted)]",children:r.process||"—"}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:266:27",className:"py-1.5 text-right",children:t.jsx(Q,{"code-path":"src/pages/HostMonitor.tsx:267:29",variant:"default",className:"text-[10px] bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"LISTEN"})})]},T))})]})})]})})}),t.jsxs(q,{"code-path":"src/pages/HostMonitor.tsx:281:9",value:"process",className:"mt-3 space-y-3",children:[t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:282:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:283:13",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:284:15",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(_t,{"code-path":"src/pages/HostMonitor.tsx:285:17",className:"h-4 w-4 text-cyan-400"}),"进程 TOP ",dt.length]}),dt.length===0?t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:288:17",className:"text-center py-6 text-xs text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"Agent v2.0+ 支持,等待数据上报…"}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:292:17",className:"overflow-x-auto",children:t.jsxs("table",{"code-path":"src/pages/HostMonitor.tsx:293:19",className:"w-full text-xs",children:[t.jsx("thead",{"code-path":"src/pages/HostMonitor.tsx:294:21",children:t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:295:23",className:"text-[var(--dg-text-muted)] border-b border-[var(--dg-border)]",children:[t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:296:25",className:"py-1.5 text-left font-medium w-[40%]",children:"进程名称 / CMD"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:297:25",className:"py-1.5 text-right font-medium w-[8%]",children:"PID"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:298:25",className:"py-1.5 text-right font-medium w-[16%]",children:"内存使用率(%)"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:299:25",className:"py-1.5 text-right font-medium w-[16%]",children:"CPU使用率(%)"}),t.jsx("th",{"code-path":"src/pages/HostMonitor.tsx:300:25",className:"py-1.5 text-right font-medium w-[20%]",children:"打开文件数"})]})}),t.jsx("tbody",{"code-path":"src/pages/HostMonitor.tsx:303:21",children:dt.map((r,T)=>{const R=r.cmdline||r.name||"?",Z=r.cpu_pct!=null?Number(r.cpu_pct):null,tt=r.mem_pct!=null?Number(r.mem_pct):null;return t.jsxs("tr",{"code-path":"src/pages/HostMonitor.tsx:309:27",className:"border-b border-[var(--dg-border)]/30 hover:bg-slate-800/30 transition-colors",children:[t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:310:29",className:"py-1.5 pr-2",children:t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:311:31",className:"flex items-center gap-1 group/cmd",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:312:33",className:"font-mono text-[var(--dg-text-primary)] truncate max-w-[320px] inline-block align-middle",title:R,children:R}),t.jsx("button",{"code-path":"src/pages/HostMonitor.tsx:315:33",className:"opacity-0 group-hover/cmd:opacity-100 transition-opacity p-0.5 hover:text-cyan-400 shrink-0",title:"复制命令行",onClick:async Et=>{Et.stopPropagation();try{await navigator.clipboard.writeText(R)}catch{const G=document.createElement("textarea");G.value=R,G.style.position="fixed",G.style.opacity="0",document.body.appendChild(G),G.select(),document.execCommand("copy"),document.body.removeChild(G)}},children:t.jsxs("svg",{"code-path":"src/pages/HostMonitor.tsx:330:35",className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("rect",{"code-path":"src/pages/HostMonitor.tsx:331:37",x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),t.jsx("path",{"code-path":"src/pages/HostMonitor.tsx:332:37",d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:337:29",className:"py-1.5 text-right font-mono text-[var(--dg-text-muted)]",children:r.pid}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:338:29",className:"py-1.5 text-right font-mono",children:t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:339:31",className:tt!=null&&tt>50?"text-rose-400":"text-cyan-400",children:tt!=null?tt.toFixed(2):"--"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:343:29",className:"py-1.5 text-right font-mono",children:t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:344:31",className:Z!=null&&Z>50?"text-rose-400":"text-[var(--dg-text-primary)]",children:Z!=null?Z.toFixed(2):"--"})}),t.jsx("td",{"code-path":"src/pages/HostMonitor.tsx:348:29",className:"py-1.5 text-right font-mono text-[var(--dg-text-muted)]",children:r.fd_count??"--"})]},T)})})]})})]})}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:359:11",className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:360:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:361:15",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:362:17",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(W,{"code-path":"src/pages/HostMonitor.tsx:363:19",className:"h-4 w-4 text-violet-400"}),"FD 文件句柄"]}),I?.allocated!=null?t.jsxs(t.Fragment,{children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:367:21",className:"flex items-center gap-4 mb-3 text-xs",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:368:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:369:25",className:"text-[var(--dg-text-muted)]",children:"已分配 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:370:25",className:"font-mono text-[var(--dg-text-primary)] font-semibold",children:I.allocated.toLocaleString()})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:372:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:373:25",className:"text-[var(--dg-text-muted)]",children:"上限 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:374:25",className:"font-mono text-[var(--dg-text-primary)] font-semibold",children:I.max===-1?"无限制":I.max?.toLocaleString()||"—"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:376:23",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:377:25",className:"text-[var(--dg-text-muted)]",children:"使用率 "}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:378:25",className:`font-mono font-semibold ${I.usage_pct>80?"text-rose-400":"text-violet-400"}`,children:I.usage_pct!=null?`${I.usage_pct.toFixed(1)}%`:"—"})]})]}),u.fd.length>0&&t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:384:23",className:"h-[120px]",children:t.jsx(mt,{"code-path":"src/pages/HostMonitor.tsx:385:25",width:"100%",height:"100%",children:t.jsxs(gt,{"code-path":"src/pages/HostMonitor.tsx:386:27",data:u.fd,children:[t.jsx(ut,{"code-path":"src/pages/HostMonitor.tsx:387:29",strokeDasharray:"3 3",stroke:"var(--dg-border)"}),t.jsx(bt,{"code-path":"src/pages/HostMonitor.tsx:388:29",dataKey:"time",tick:{fontSize:10,fill:"var(--dg-text-muted)"},interval:"preserveStartEnd"}),t.jsx(jt,{"code-path":"src/pages/HostMonitor.tsx:389:29",tick:{fontSize:10,fill:"var(--dg-text-muted)"},unit:"%",domain:[0,"auto"]}),t.jsx(vt,{"code-path":"src/pages/HostMonitor.tsx:390:29",contentStyle:{background:"#1e293b",border:"1px solid #334155",borderRadius:6,fontSize:11}}),t.jsx("defs",{"code-path":"src/pages/HostMonitor.tsx:391:29",children:t.jsxs("linearGradient",{"code-path":"src/pages/HostMonitor.tsx:392:31",id:"fdGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:393:33",offset:"0%",stopColor:"#a78bfa",stopOpacity:.3}),t.jsx("stop",{"code-path":"src/pages/HostMonitor.tsx:394:33",offset:"100%",stopColor:"#a78bfa",stopOpacity:.05})]})}),t.jsx(at,{"code-path":"src/pages/HostMonitor.tsx:397:29",type:"monotone",dataKey:s,stroke:"#a78bfa",strokeWidth:1.5,fill:"url(#fdGrad)",name:"FD使用率"})]})})})]}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:404:19",className:"text-center py-4 text-xs text-[var(--dg-text-muted)]",children:"等待数据…"})]})}),t.jsx(C,{"code-path":"src/pages/HostMonitor.tsx:409:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:t.jsxs(k,{"code-path":"src/pages/HostMonitor.tsx:410:15",className:"p-4",children:[t.jsxs("h3",{"code-path":"src/pages/HostMonitor.tsx:411:17",className:"text-xs font-medium text-[var(--dg-text-primary)] mb-3 flex items-center gap-2",children:[t.jsx(Ft,{"code-path":"src/pages/HostMonitor.tsx:412:19",className:"h-4 w-4 text-emerald-400"}),"上下文切换"]}),S?.ctx_per_sec!=null?t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:415:19",className:"space-y-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:416:21",className:"grid grid-cols-2 gap-4",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:417:23",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3 text-center",children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:418:25",className:"text-[10px] text-[var(--dg-text-muted)] mb-1",children:"CTX 切换/秒"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:419:25",className:"text-lg font-bold font-mono text-emerald-400",children:[(S.ctx_per_sec/1e6).toFixed(1),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:420:66",className:"text-xs font-normal text-[var(--dg-text-muted)] ml-0.5",children:"M"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:422:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-1 font-mono",children:[S.ctx_per_sec?.toLocaleString()," 次"]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:424:23",className:"bg-[var(--dg-bg-primary)] rounded-lg p-3 text-center",children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:425:25",className:"text-[10px] text-[var(--dg-text-muted)] mb-1",children:"IRQ 中断/秒"}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:426:25",className:"text-lg font-bold font-mono text-amber-400",children:[(S.irq_per_sec/1e6).toFixed(1),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:427:66",className:"text-xs font-normal text-[var(--dg-text-muted)] ml-0.5",children:"M"})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:429:25",className:"text-[10px] text-[var(--dg-text-muted)] mt-1 font-mono",children:[S.irq_per_sec?.toLocaleString()," 次"]})]})]}),t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:432:21",className:"space-y-1",children:[t.jsxs("div",{"code-path":"src/pages/HostMonitor.tsx:433:23",className:"flex justify-between text-[10px]",children:[t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:434:25",className:"text-emerald-400",children:"CTX"}),t.jsx("span",{"code-path":"src/pages/HostMonitor.tsx:435:25",className:"text-amber-400",children:"IRQ"})]}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:437:23",className:"h-2 bg-[var(--dg-bg-primary)] rounded-full overflow-hidden flex",children:S.ctx_per_sec+S.irq_per_sec>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:440:29",className:"h-full bg-emerald-500/60 rounded-l-full transition-all",style:{width:`${(S.ctx_per_sec/(S.ctx_per_sec+S.irq_per_sec)*100).toFixed(1)}%`}}),t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:442:29",className:"h-full bg-amber-500/60 rounded-r-full transition-all",style:{width:`${(S.irq_per_sec/(S.ctx_per_sec+S.irq_per_sec)*100).toFixed(1)}%`}})]})})]})]}):t.jsx("div",{"code-path":"src/pages/HostMonitor.tsx:450:19",className:"text-center py-4 text-xs text-[var(--dg-text-muted)]",children:"等待数据…"})]})})]})]}),t.jsx(xe,{"code-path":"src/pages/HostMonitor.tsx:457:9",selectedHost:l,serverInfo:P,latest:b,heartbeatInfo:It,portInfoCount:Y.length}),t.jsx(ie,{"code-path":"src/pages/HostMonitor.tsx:465:9",selectedHost:l})]}),t.jsx(le,{"code-path":"src/pages/HostMonitor.tsx:468:7",open:o,onOpenChange:B,portPolicyMode:N,onModeChange:D,portWhitelist:M,onWhitelistChange:F,onSave:O,saving:X})]})}export{He as HostMonitor}; diff --git a/backend/static/assets/K8sShortcutRedirect-fX_VMnZ-.js b/backend/static/assets/K8sShortcutRedirect-C_rbNsgP.js similarity index 78% rename from backend/static/assets/K8sShortcutRedirect-fX_VMnZ-.js rename to backend/static/assets/K8sShortcutRedirect-C_rbNsgP.js index a23be2d..c5a8df7 100644 --- a/backend/static/assets/K8sShortcutRedirect-fX_VMnZ-.js +++ b/backend/static/assets/K8sShortcutRedirect-C_rbNsgP.js @@ -1 +1 @@ -import{r as n,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{i as a}from"./index-LZWfu62c.js";import{k as i}from"./index-Z0O8nAcG.js";import{L as u}from"./vendor-icons-Aso0-eeY.js";function x({target:r}){const e=a();return n.useEffect(()=>{i.getClusters().then(c=>{const t=c?.list||[];if(t.length>0){const o=t[0].code||String(t[0].id);e(`/kubernetes/${o}/${r}`,{replace:!0})}else e("/kubernetes",{replace:!0})}).catch(()=>e("/kubernetes",{replace:!0}))},[e,r]),s.jsxs("div",{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:30:5",className:"flex flex-col items-center justify-center py-24 text-slate-500 gap-2",children:[s.jsx(u,{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:31:7",className:"h-6 w-6 animate-spin"}),s.jsx("span",{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:32:7",className:"text-sm",children:"正在跳转..."})]})}export{x as default}; +import{r as n,j as s}from"./vendor-codemirror-B1SGo4xl.js";import{i as a}from"./index-Bp-M7P_8.js";import{k as i}from"./index-BkulU9RM.js";import{L as u}from"./vendor-icons-BWk-DH7F.js";function x({target:r}){const e=a();return n.useEffect(()=>{i.getClusters().then(c=>{const t=c?.list||[];if(t.length>0){const o=t[0].code||String(t[0].id);e(`/kubernetes/${o}/${r}`,{replace:!0})}else e("/kubernetes",{replace:!0})}).catch(()=>e("/kubernetes",{replace:!0}))},[e,r]),s.jsxs("div",{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:30:5",className:"flex flex-col items-center justify-center py-24 text-slate-500 gap-2",children:[s.jsx(u,{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:31:7",className:"h-6 w-6 animate-spin"}),s.jsx("span",{"code-path":"src/components/kubernetes/K8sShortcutRedirect.tsx:32:7",className:"text-sm",children:"正在跳转..."})]})}export{x as default}; diff --git a/backend/static/assets/KubernetesClusters-DD7SeVKO.js b/backend/static/assets/KubernetesClusters-CJYiuz5A.js similarity index 98% rename from backend/static/assets/KubernetesClusters-DD7SeVKO.js rename to backend/static/assets/KubernetesClusters-CJYiuz5A.js index f2a5c66..d6a575d 100644 --- a/backend/static/assets/KubernetesClusters-DD7SeVKO.js +++ b/backend/static/assets/KubernetesClusters-CJYiuz5A.js @@ -1,4 +1,4 @@ -import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{B as T,M as ae,J as _e,v as Re,r as ce,R as Pe,s as $,w as X,N as Te,x as H,P as Ee,y as Ae,m as E,D as oe,a as le,b as Me,c as ue,d as de,e as Ie,t as I,o as Fe,a9 as Ge,aa as Oe,ab as Be,ac as Le,ad as Q,ae as F}from"./index-LZWfu62c.js";import{C as G,b as U,c as z,d as ie,a as O}from"./card-B-RtdR4H.js";import{I as L}from"./input-BdDauX3U.js";import{B as y}from"./badge-B0F5ZNtn.js";import{k as w}from"./index-Z0O8nAcG.js";import{T as Ue,a as ze,b as A,c as M}from"./tabs-kmtfM2I-.js";import{i as xe,a as pe,aG as $e,r as We,L as Ve,an as qe,ao as He,X as Xe,R as q,P as Je,S as Ye,aP as Ze,x as Qe,p as et,k as tt,v as st,T as rt,l as nt,y as at}from"./vendor-icons-Aso0-eeY.js";import{R as ct,A as ot,C as lt,X as ut,Y as dt,T as it,a as ee}from"./AreaChart-Czgv4pNk.js";import{T as te}from"./textarea-BdtIagjy.js";import{L as P}from"./label-u-lNUbKh.js";import{u as xt}from"./index-CYARH0Cq.js";import{x as pt,a as mt}from"./vendor-xterm-20M9KZE1.js";function bt({cluster:a,onClose:x}){const[r,g]=n.useState([]),[s,u]=n.useState([]),[d,K]=n.useState([]),[k,C]=n.useState([]),[b,f]=n.useState([]),h=n.useMemo(()=>{if(!r||r.length===0)return{cpuPct:0,memPct:0};let t=0,i=0,m=0;for(const j of r){const D=j.cpu||0,o=j.cpu_usage_m?parseFloat(String(j.cpu_usage_m).replace("m","")):0,l=D>0?o/1e3/D*100:0,N=j.memory_mb||0,_=j.mem_usage_mi?parseFloat(String(j.mem_usage_mi).replace("Mi","").replace("Ki","")):0,V=j.mem_usage_mi?.includes?.("Ki")?_/1024:j.mem_usage_mi?.includes?.("Gi")?_*1024:_,B=N>0?V/N*100:0;(l>0||B>0)&&(t+=l,i+=B,m++)}return{cpuPct:m>0?t/m:0,memPct:m>0?i/m:0}},[r]),p=async t=>{try{const[i,m,j,D,o]=await Promise.all([w.getNodes(t).catch(()=>[]),w.getPods(t).catch(()=>[]),w.getDeployments(t).catch(()=>[]),w.getServices(t).catch(()=>[]),w.getIngresses(t).catch(()=>[])]),l=N=>Array.isArray(N)?N:N?.list||[];g(l(i)),u(l(m)),K(l(j)),C(l(D)),f(l(o))}catch(i){console.error("加载集群详情失败:",i)}};return n.useEffect(()=>{a?.id&&p(a.id)},[a?.id]),e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:81:5",className:"bg-slate-900 border-slate-800",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:82:7",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:83:9",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:84:11",className:"flex items-center gap-3",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:85:13",className:"h-6 w-6 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:86:13",children:[e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:87:15",className:"text-slate-100",children:a.name}),e.jsxs(ie,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:88:15",className:"text-slate-500",children:[a.version," · ",a.node_count||0," 节点 · 创建于"," ",a.created_at?new Date(a.created_at).toLocaleDateString():"-"]})]})]}),e.jsxs(T,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:94:11",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-100",onClick:x,children:[e.jsx(pe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:100:13",className:"h-4 w-4 mr-2"}),"关闭"]})]})}),e.jsx(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:105:7",children:e.jsxs(Ue,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:106:9",defaultValue:"overview",className:"w-full",children:[e.jsxs(ze,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:107:11",className:"bg-slate-800 border border-slate-700 flex-wrap h-auto",children:[e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:108:13",value:"overview",className:"data-[state=active]:bg-slate-700",children:"概览"}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:111:13",value:"nodes",className:"data-[state=active]:bg-slate-700",children:["节点 (",r.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:114:13",value:"pods",className:"data-[state=active]:bg-slate-700",children:["Pod (",s.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:117:13",value:"deployments",className:"data-[state=active]:bg-slate-700",children:["Deployment (",d.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:120:13",value:"services",className:"data-[state=active]:bg-slate-700",children:["Service (",k.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:123:13",value:"ingresses",className:"data-[state=active]:bg-slate-700",children:["Ingress (",b.length,")"]}),e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:126:13",value:"events",className:"data-[state=active]:bg-slate-700",children:"事件"})]}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:131:11",value:"overview",className:"mt-4 space-y-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:132:13",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:133:15",className:"bg-slate-800/50 border-slate-700",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:134:17",className:"pb-2",children:e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:135:19",className:"text-sm text-slate-400",children:"资源使用趋势"})}),e.jsxs(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:137:17",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:138:19",className:"h-[200px]",children:e.jsx(ct,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:139:21",width:"100%",height:"100%",children:e.jsxs(ot,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:140:23",data:[{time:"CPU",cpu:Number(h.cpuPct.toFixed(1)),memory:Number(h.memPct.toFixed(1))}],children:[e.jsxs("defs",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:143:25",children:[e.jsxs("linearGradient",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:144:27",id:"colorCpu",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:145:29",offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:146:29",offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}),e.jsxs("linearGradient",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:148:27",id:"colorMemory",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:149:29",offset:"5%",stopColor:"#10b981",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:150:29",offset:"95%",stopColor:"#10b981",stopOpacity:0})]})]}),e.jsx(lt,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:153:25",strokeDasharray:"3 3",stroke:"#1e293b"}),e.jsx(ut,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:154:25",dataKey:"time",stroke:"#475569",fontSize:12}),e.jsx(dt,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:155:25",stroke:"#475569",fontSize:12,domain:[0,100]}),e.jsx(it,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:156:25",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"6px",color:"#f8fafc"}}),e.jsx(ee,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:164:25",type:"monotone",dataKey:"cpu",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorCpu)",name:"CPU(%)"}),e.jsx(ee,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:172:25",type:"monotone",dataKey:"memory",stroke:"#10b981",fillOpacity:1,fill:"url(#colorMemory)",name:"内存(%)"})]})})}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:183:19",className:"flex justify-center gap-6 mt-2 text-xs text-slate-400",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:184:21",children:["CPU: ",e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:184:32",className:"text-blue-400 font-bold",children:[h.cpuPct.toFixed(1),"%"]})]}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:185:21",children:["内存: ",e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:185:31",className:"text-emerald-400 font-bold",children:[h.memPct.toFixed(1),"%"]})]})]})]})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:190:15",className:"bg-slate-800/50 border-slate-700",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:191:17",className:"pb-2",children:e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:192:19",className:"text-sm text-slate-400",children:"资源分布"})}),e.jsx(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:194:17",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:195:19",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:196:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:197:23",className:"text-3xl font-bold text-blue-400",children:a.pod_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:198:23",className:"text-sm text-slate-500 mt-1",children:"Pod"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:200:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:201:23",className:"text-3xl font-bold text-emerald-400",children:a.service_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:202:23",className:"text-sm text-slate-500 mt-1",children:"Service"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:204:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:205:23",className:"text-3xl font-bold text-purple-400",children:a.deployment_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:206:23",className:"text-sm text-slate-500 mt-1",children:"Deployment"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:208:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:209:23",className:"text-3xl font-bold text-amber-400",children:a.node_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:210:23",className:"text-sm text-slate-500 mt-1",children:"节点"})]})]})})]})]})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:218:11",value:"nodes",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:219:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:220:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:221:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:222:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:223:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:224:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"角色"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:225:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"状态"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:226:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"CPU"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:227:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"内存"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:228:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"Pod"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:229:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"操作系统"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:232:17",className:"divide-y divide-slate-800",children:r.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:234:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:235:23",colSpan:7,className:"px-4 py-8 text-center text-slate-500",children:"暂无节点数据"})}):r.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:239:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:240:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:241:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:242:25",variant:"outline",className:t.role==="master"?"border-purple-500/30 text-purple-400 bg-purple-500/10":"border-blue-500/30 text-blue-400 bg-blue-500/10",children:t.role==="master"?"Master":"Worker"})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:253:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:254:25",variant:"outline",className:(t.status||"").toLowerCase()==="ready"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-red-500/30 text-red-400 bg-red-500/10",children:(t.status||"").toLowerCase()==="ready"?"Ready":"NotReady"})}),e.jsxs("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:265:23",className:"px-4 py-3 text-sm text-slate-300",children:[t.cpu_usage_m||"0m"," / ",t.cpu,"核"]}),e.jsxs("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:268:23",className:"px-4 py-3 text-sm text-slate-300",children:[t.mem_usage_mi||"0Mi"," / ",t.memory_mb?(t.memory_mb/1024).toFixed(0)+"GB":"-"]}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:271:23",className:"px-4 py-3 text-sm text-slate-300",children:t.max_pods??0}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:272:23",className:"px-4 py-3 text-sm text-slate-400",children:t.os})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:281:11",value:"pods",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:282:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:283:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:284:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:285:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:286:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:287:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:288:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"状态"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:289:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"重启次数"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:290:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"CPU"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:291:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"内存"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:292:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"节点"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:295:17",className:"divide-y divide-slate-800",children:s.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:297:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:298:23",colSpan:7,className:"px-4 py-8 text-center text-slate-500",children:"暂无Pod数据"})}):s.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:302:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:303:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:304:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:305:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:309:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:310:25",variant:"outline",className:(t.status||"").toLowerCase()==="running"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":(t.status||"").toLowerCase()==="pending"?"border-amber-500/30 text-amber-400 bg-amber-500/10":"border-red-500/30 text-red-400 bg-red-500/10",children:t.status})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:323:23",className:"px-4 py-3 text-sm text-slate-300",children:t.restart_count??0}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:324:23",className:"px-4 py-3 text-sm text-slate-300",children:t.cpu_usage_m||"0m"}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:325:23",className:"px-4 py-3 text-sm text-slate-300",children:t.mem_usage_mi||"0Mi"}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:326:23",className:"px-4 py-3 text-sm text-slate-400",children:t.node_name})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:335:11",value:"deployments",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:336:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:337:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:338:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:339:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:340:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:341:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:342:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"副本数"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:343:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"可用副本"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:344:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"镜像"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:345:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"创建时间"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:348:17",className:"divide-y divide-slate-800",children:d.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:350:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:351:23",colSpan:6,className:"px-4 py-8 text-center text-slate-500",children:"暂无Deployment数据"})}):d.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:355:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:356:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:357:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:358:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:362:23",className:"px-4 py-3 text-sm text-slate-300",children:t.replicas}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:363:23",className:"px-4 py-3",children:e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:364:25",className:`text-sm ${(t.available_replicas??t.availableReplicas)===t.replicas?"text-emerald-400":"text-amber-400"}`,children:[t.available_replicas??t.availableReplicas," / ",t.replicas]})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:368:23",className:"px-4 py-3 text-sm text-slate-400 truncate max-w-[200px]",children:t.image}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:369:23",className:"px-4 py-3 text-sm text-slate-400",children:t.created_at||t.createdAt})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:378:11",value:"services",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:379:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:380:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:381:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:382:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:383:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:384:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:385:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"类型"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:386:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"ClusterIP"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:387:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"端口"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:388:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"Selector"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:391:17",className:"divide-y divide-slate-800",children:k.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:393:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:394:23",colSpan:6,className:"px-4 py-8 text-center text-slate-500",children:"暂无Service数据"})}):k.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:398:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:399:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:400:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:401:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:405:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:406:25",variant:"outline",className:t.type==="ClusterIP"?"border-blue-500/30 text-blue-400 bg-blue-500/10":t.type==="NodePort"?"border-purple-500/30 text-purple-400 bg-purple-500/10":"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:t.type})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:419:23",className:"px-4 py-3 text-sm text-slate-300",children:t.cluster_ip??t.clusterIP}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:420:23",className:"px-4 py-3 text-sm text-slate-300",children:t.ports}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:421:23",className:"px-4 py-3 text-sm text-slate-400",children:t.selector})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:430:11",value:"ingresses",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:431:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:432:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:433:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:434:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:435:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:436:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:437:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"Hosts"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:438:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"后端服务"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:439:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"TLS"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:442:17",className:"divide-y divide-slate-800",children:b.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:444:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:445:23",colSpan:5,className:"px-4 py-8 text-center text-slate-500",children:"暂无Ingress数据"})}):b.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:449:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:450:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:451:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:452:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:456:23",className:"px-4 py-3 text-sm text-slate-300",children:t.hosts}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:457:23",className:"px-4 py-3 text-sm text-slate-300",children:t.backend}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:458:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:459:25",variant:"outline",className:t.tls?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-slate-700 text-slate-400",children:t.tls?"已启用":"未启用"})})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:478:11",value:"events",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:479:13",className:"space-y-2",children:[{type:"Normal",reason:"Started",message:"Started container nginx",time:"2分钟前"},{type:"Normal",reason:"Created",message:"Created pod nginx-deployment-xxx",time:"5分钟前"},{type:"Warning",reason:"FailedScheduling",message:"0/3 nodes are available",time:"10分钟前"},{type:"Normal",reason:"Pulling",message:'Pulling image "nginx:latest"',time:"15分钟前"},{type:"Normal",reason:"Pulled",message:"Successfully pulled image",time:"12分钟前"}].map((t,i)=>e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:487:17",className:"flex items-center gap-3 p-3 rounded-lg bg-slate-800/50",children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:491:19",variant:"outline",className:t.type==="Normal"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-amber-500/30 text-amber-400 bg-amber-500/10",children:t.type}),e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:501:19",className:"text-sm font-medium text-slate-300 min-w-[120px]",children:t.reason}),e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:502:19",className:"text-sm text-slate-400 flex-1",children:t.message}),e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:503:19",className:"text-xs text-slate-500",children:t.time})]},i))})})]})})]})}var J="Radio",[ht,me]=ce(J),[gt,Ct]=ht(J),be=n.forwardRef((a,x)=>{const{__scopeRadio:r,name:g,checked:s=!1,required:u,disabled:d,value:K="on",onCheck:k,form:C,...b}=a,[f,h]=n.useState(null),p=X(x,m=>h(m)),t=n.useRef(!1),i=f?C||!!f.closest("form"):!0;return e.jsxs(gt,{scope:r,checked:s,disabled:d,children:[e.jsx($.button,{type:"button",role:"radio","aria-checked":s,"data-state":ke(s),"data-disabled":d?"":void 0,disabled:d,value:K,...b,ref:p,onClick:H(a.onClick,m=>{s||k?.(),i&&(t.current=m.isPropagationStopped(),t.current||m.stopPropagation())})}),i&&e.jsx(Ce,{control:f,bubbles:!t.current,name:g,value:K,checked:s,required:u,disabled:d,form:C,style:{transform:"translateX(-100%)"}})]})});be.displayName=J;var he="RadioIndicator",ge=n.forwardRef((a,x)=>{const{__scopeRadio:r,forceMount:g,...s}=a,u=Ct(he,r);return e.jsx(Ee,{present:g||u.checked,children:e.jsx($.span,{"data-state":ke(u.checked),"data-disabled":u.disabled?"":void 0,...s,ref:x})})});ge.displayName=he;var kt="RadioBubbleInput",Ce=n.forwardRef(({__scopeRadio:a,control:x,checked:r,bubbles:g=!0,...s},u)=>{const d=n.useRef(null),K=X(d,u),k=xt(r),C=Ae(x);return n.useEffect(()=>{const b=d.current;if(!b)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(k!==r&&p){const t=new Event("click",{bubbles:g});p.call(b,r),b.dispatchEvent(t)}},[k,r,g]),e.jsx($.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:K,style:{...s.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Ce.displayName=kt;function ke(a){return a?"checked":"unchecked"}var ft=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],W="RadioGroup",[jt]=ce(W,[ae,me]),fe=ae(),je=me(),[Kt,vt]=jt(W),Ke=n.forwardRef((a,x)=>{const{__scopeRadioGroup:r,name:g,defaultValue:s,value:u,required:d=!1,disabled:K=!1,orientation:k,dir:C,loop:b=!0,onValueChange:f,...h}=a,p=fe(r),t=_e(C),[i,m]=Re({prop:u,defaultProp:s??null,onChange:f,caller:W});return e.jsx(Kt,{scope:r,name:g,required:d,disabled:K,value:i,onValueChange:m,children:e.jsx(Pe,{asChild:!0,...p,orientation:k,dir:t,loop:b,children:e.jsx($.div,{role:"radiogroup","aria-required":d,"aria-orientation":k,"data-disabled":K?"":void 0,dir:t,...h,ref:x})})})});Ke.displayName=W;var ve="RadioGroupItem",Ne=n.forwardRef((a,x)=>{const{__scopeRadioGroup:r,disabled:g,...s}=a,u=vt(ve,r),d=u.disabled||g,K=fe(r),k=je(r),C=n.useRef(null),b=X(x,C),f=u.value===s.value,h=n.useRef(!1);return n.useEffect(()=>{const p=i=>{ft.includes(i.key)&&(h.current=!0)},t=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",t)}},[]),e.jsx(Te,{asChild:!0,...K,focusable:!d,active:f,children:e.jsx(be,{disabled:d,required:u.required,checked:f,...k,...s,name:u.name,ref:b,onCheck:()=>u.onValueChange(s.value),onKeyDown:H(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:H(s.onFocus,()=>{h.current&&C.current?.click()})})})});Ne.displayName=ve;var Nt="RadioGroupIndicator",De=n.forwardRef((a,x)=>{const{__scopeRadioGroup:r,...g}=a,s=je(r);return e.jsx(ge,{...s,...g,ref:x})});De.displayName=Nt;var Dt=Ke,yt=Ne,wt=De;function St({className:a,...x}){return e.jsx(Dt,{"code-path":"src/components/ui/radio-group.tsx:14:5","data-slot":"radio-group",className:E("grid gap-3",a),...x})}function se({className:a,...x}){return e.jsx(yt,{"code-path":"src/components/ui/radio-group.tsx:27:5","data-slot":"radio-group-item",className:E("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",a),...x,children:e.jsx(wt,{"code-path":"src/components/ui/radio-group.tsx:35:7","data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:e.jsx($e,{"code-path":"src/components/ui/radio-group.tsx:39:9",className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}const re=/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/,ne={name:"",version:"",description:"",config_type:1,api_server:"",token:"",kube_config:""};function _t({open:a,onOpenChange:x,editingCluster:r,onSaved:g}){const[s,u]=n.useState({...ne}),[d,K]=n.useState(!1),[k,C]=n.useState(!1),[b,f]=n.useState(!1),[h,p]=n.useState("");n.useEffect(()=>{a&&(r&&r.id?w.getClusterDetail(r.id).then(o=>{const l=o||{};C(!!l.has_token),f(!!l.has_kube_config),u({name:l.name||"",version:l.version||"",description:l.description||"",config_type:Number(l.config_type??1),api_server:l.api_server||"",token:"",kube_config:""}),p("")}).catch(()=>{u({name:r.name||"",version:r.version||"",description:r.description||"",config_type:Number(r.config_type??1),api_server:r.api_server||"",token:"",kube_config:""}),p("")}):(C(!1),f(!1),u({...ne}),p("")))},[a,r]);const t=o=>{u({...s,name:o}),o.trim()?re.test(o)?p(""):p("只允许英文、数字和连字符(-),首尾不能是连字符"):p("")},i=o=>{const l=o.match(/^\s*server:\s*(\S+)\s*$/m);return l?l[1]:""},m=o=>{const l=i(o);u(N=>({...N,kube_config:o,api_server:l||N.api_server}))},j=async()=>{if(!s.name.trim()||!re.test(s.name.trim())){I.error("请输入有效的集群名称(英文/数字/连字符)");return}try{K(!0);const o={name:s.name.trim(),code:s.name.trim(),version:s.version,description:s.description,config_type:s.config_type,api_server:s.api_server,token:s.config_type===0?s.token:"",kube_config:s.config_type===1?s.kube_config:""};r?await w.updateCluster(r.id,o):await w.createCluster(o),x(!1),g()}catch(o){console.error("保存集群失败:",o)}finally{K(!1)}},D=d||!s.name.trim()||!!h;return e.jsx(oe,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:143:5",open:a,onOpenChange:x,children:e.jsxs(le,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:144:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-2xl",children:[e.jsxs(Me,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:145:9",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:146:11",className:"text-[var(--dg-text-primary)]",children:r?"编辑集群":"添加集群"}),e.jsx(de,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:149:11",className:"text-[var(--dg-text-secondary)]",children:r?"修改集群接入配置":"配置新的 Kubernetes 集群接入信息"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:153:9",className:"space-y-4 py-2 max-h-[60vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:154:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:155:13",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:156:15",className:"text-[var(--dg-text-secondary)]",children:"集群名称"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:157:15",value:s.name,onChange:o=>t(o.target.value),placeholder:"如: prod-cluster",className:`bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] ${h?"border-red-500":""}`}),h&&e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:163:29",className:"text-xs text-red-400",children:h}),e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:164:15",className:"text-xs text-[var(--dg-text-muted)]",children:"只允许英文、数字和连字符(-),首尾不能是连字符。名称将作为集群唯一标识。"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:168:13",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:169:15",className:"text-[var(--dg-text-secondary)]",children:"版本(可选)"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:170:15",value:s.version,onChange:o=>u({...s,version:o.target.value}),placeholder:"如: 1.28.0",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:179:11",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:180:13",className:"text-[var(--dg-text-secondary)]",children:"描述"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:181:13",value:s.description,onChange:o=>u({...s,description:o.target.value}),placeholder:"集群用途描述",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:189:11",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:190:13",className:"text-[var(--dg-text-secondary)]",children:"接入方式"}),e.jsxs(St,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:191:13",value:String(s.config_type),onValueChange:o=>u({...s,config_type:Number(o)}),className:"flex gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:196:15",className:"flex items-center gap-2 px-3 py-2 rounded-md border border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(se,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:197:17",value:"0",id:"ct-0"}),e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:198:17",htmlFor:"ct-0",className:"cursor-pointer text-[var(--dg-text-primary)] font-normal",children:"Token"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:200:15",className:"flex items-center gap-2 px-3 py-2 rounded-md border border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(se,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:201:17",value:"1",id:"ct-1"}),e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:202:17",htmlFor:"ct-1",className:"cursor-pointer text-[var(--dg-text-primary)] font-normal",children:"Kubeconfig"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:207:11",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:208:13",className:"text-[var(--dg-text-secondary)]",children:"API Server"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:209:13",value:s.api_server,onChange:o=>u({...s,api_server:o.target.value}),placeholder:"https://10.0.0.1:6443",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]}),s.config_type===0?e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:218:13",className:"space-y-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:219:15",className:"text-[var(--dg-text-secondary)]",children:["Token ",k&&e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:220:36",className:"text-emerald-400 text-xs ml-1",children:"✓ 已配置(留空不修改)"})]}),e.jsx(te,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:222:15",value:s.token,onChange:o=>u({...s,token:o.target.value}),placeholder:k?"已配置,输入新值覆盖...":"粘贴 Service Account Token...",rows:4,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] font-mono text-xs"})]}):e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:231:13",className:"space-y-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:232:15",className:"text-[var(--dg-text-secondary)]",children:["Kubeconfig ",b&&e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:233:46",className:"text-emerald-400 text-xs ml-1",children:"✓ 已配置(留空不修改)"})]}),e.jsx(te,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:235:15",value:s.kube_config,onChange:o=>m(o.target.value),placeholder:b?"已配置,输入新值覆盖...":`apiVersion: v1 +import{r as n,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{B as T,M as ae,J as _e,v as Re,r as ce,R as Pe,s as $,w as X,N as Te,x as H,P as Ee,y as Ae,m as E,D as oe,a as le,b as Me,c as ue,d as de,e as Ie,t as I,o as Fe,a8 as Ge,a9 as Oe,aa as Be,ab as Le,ac as Q,ad as F}from"./index-Bp-M7P_8.js";import{C as G,b as U,c as z,d as ie,a as O}from"./card-BHSBTtub.js";import{I as L}from"./input-Bnlm--la.js";import{B as y}from"./badge-B00SZHvE.js";import{k as w}from"./index-BkulU9RM.js";import{T as Ue,a as ze,b as A,c as M}from"./tabs-DbNlmoQJ.js";import{i as xe,a as pe,aG as $e,r as We,L as Ve,an as qe,ao as He,X as Xe,R as q,P as Je,S as Ye,aM as Ze,x as Qe,p as et,k as tt,v as st,T as rt,l as nt,y as at}from"./vendor-icons-BWk-DH7F.js";import{R as ct,A as ot,C as lt,X as ut,Y as dt,T as it,a as ee}from"./AreaChart-B_pR5s1C.js";import{T as te}from"./textarea-BvOVhaCD.js";import{L as P}from"./label-NkONM5Mp.js";import{u as xt}from"./index-5FEebgvX.js";import{x as pt,a as mt}from"./vendor-xterm-20M9KZE1.js";function bt({cluster:a,onClose:x}){const[r,g]=n.useState([]),[s,u]=n.useState([]),[d,K]=n.useState([]),[k,C]=n.useState([]),[b,f]=n.useState([]),h=n.useMemo(()=>{if(!r||r.length===0)return{cpuPct:0,memPct:0};let t=0,i=0,m=0;for(const j of r){const D=j.cpu||0,o=j.cpu_usage_m?parseFloat(String(j.cpu_usage_m).replace("m","")):0,l=D>0?o/1e3/D*100:0,N=j.memory_mb||0,_=j.mem_usage_mi?parseFloat(String(j.mem_usage_mi).replace("Mi","").replace("Ki","")):0,V=j.mem_usage_mi?.includes?.("Ki")?_/1024:j.mem_usage_mi?.includes?.("Gi")?_*1024:_,B=N>0?V/N*100:0;(l>0||B>0)&&(t+=l,i+=B,m++)}return{cpuPct:m>0?t/m:0,memPct:m>0?i/m:0}},[r]),p=async t=>{try{const[i,m,j,D,o]=await Promise.all([w.getNodes(t).catch(()=>[]),w.getPods(t).catch(()=>[]),w.getDeployments(t).catch(()=>[]),w.getServices(t).catch(()=>[]),w.getIngresses(t).catch(()=>[])]),l=N=>Array.isArray(N)?N:N?.list||[];g(l(i)),u(l(m)),K(l(j)),C(l(D)),f(l(o))}catch(i){console.error("加载集群详情失败:",i)}};return n.useEffect(()=>{a?.id&&p(a.id)},[a?.id]),e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:81:5",className:"bg-slate-900 border-slate-800",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:82:7",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:83:9",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:84:11",className:"flex items-center gap-3",children:[e.jsx(xe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:85:13",className:"h-6 w-6 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:86:13",children:[e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:87:15",className:"text-slate-100",children:a.name}),e.jsxs(ie,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:88:15",className:"text-slate-500",children:[a.version," · ",a.node_count||0," 节点 · 创建于"," ",a.created_at?new Date(a.created_at).toLocaleDateString():"-"]})]})]}),e.jsxs(T,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:94:11",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-100",onClick:x,children:[e.jsx(pe,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:100:13",className:"h-4 w-4 mr-2"}),"关闭"]})]})}),e.jsx(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:105:7",children:e.jsxs(Ue,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:106:9",defaultValue:"overview",className:"w-full",children:[e.jsxs(ze,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:107:11",className:"bg-slate-800 border border-slate-700 flex-wrap h-auto",children:[e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:108:13",value:"overview",className:"data-[state=active]:bg-slate-700",children:"概览"}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:111:13",value:"nodes",className:"data-[state=active]:bg-slate-700",children:["节点 (",r.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:114:13",value:"pods",className:"data-[state=active]:bg-slate-700",children:["Pod (",s.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:117:13",value:"deployments",className:"data-[state=active]:bg-slate-700",children:["Deployment (",d.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:120:13",value:"services",className:"data-[state=active]:bg-slate-700",children:["Service (",k.length,")"]}),e.jsxs(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:123:13",value:"ingresses",className:"data-[state=active]:bg-slate-700",children:["Ingress (",b.length,")"]}),e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:126:13",value:"events",className:"data-[state=active]:bg-slate-700",children:"事件"})]}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:131:11",value:"overview",className:"mt-4 space-y-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:132:13",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:133:15",className:"bg-slate-800/50 border-slate-700",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:134:17",className:"pb-2",children:e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:135:19",className:"text-sm text-slate-400",children:"资源使用趋势"})}),e.jsxs(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:137:17",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:138:19",className:"h-[200px]",children:e.jsx(ct,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:139:21",width:"100%",height:"100%",children:e.jsxs(ot,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:140:23",data:[{time:"CPU",cpu:Number(h.cpuPct.toFixed(1)),memory:Number(h.memPct.toFixed(1))}],children:[e.jsxs("defs",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:143:25",children:[e.jsxs("linearGradient",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:144:27",id:"colorCpu",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:145:29",offset:"5%",stopColor:"#3b82f6",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:146:29",offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]}),e.jsxs("linearGradient",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:148:27",id:"colorMemory",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:149:29",offset:"5%",stopColor:"#10b981",stopOpacity:.3}),e.jsx("stop",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:150:29",offset:"95%",stopColor:"#10b981",stopOpacity:0})]})]}),e.jsx(lt,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:153:25",strokeDasharray:"3 3",stroke:"#1e293b"}),e.jsx(ut,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:154:25",dataKey:"time",stroke:"#475569",fontSize:12}),e.jsx(dt,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:155:25",stroke:"#475569",fontSize:12,domain:[0,100]}),e.jsx(it,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:156:25",contentStyle:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:"6px",color:"#f8fafc"}}),e.jsx(ee,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:164:25",type:"monotone",dataKey:"cpu",stroke:"#3b82f6",fillOpacity:1,fill:"url(#colorCpu)",name:"CPU(%)"}),e.jsx(ee,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:172:25",type:"monotone",dataKey:"memory",stroke:"#10b981",fillOpacity:1,fill:"url(#colorMemory)",name:"内存(%)"})]})})}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:183:19",className:"flex justify-center gap-6 mt-2 text-xs text-slate-400",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:184:21",children:["CPU: ",e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:184:32",className:"text-blue-400 font-bold",children:[h.cpuPct.toFixed(1),"%"]})]}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:185:21",children:["内存: ",e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:185:31",className:"text-emerald-400 font-bold",children:[h.memPct.toFixed(1),"%"]})]})]})]})]}),e.jsxs(G,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:190:15",className:"bg-slate-800/50 border-slate-700",children:[e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:191:17",className:"pb-2",children:e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:192:19",className:"text-sm text-slate-400",children:"资源分布"})}),e.jsx(O,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:194:17",children:e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:195:19",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:196:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:197:23",className:"text-3xl font-bold text-blue-400",children:a.pod_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:198:23",className:"text-sm text-slate-500 mt-1",children:"Pod"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:200:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:201:23",className:"text-3xl font-bold text-emerald-400",children:a.service_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:202:23",className:"text-sm text-slate-500 mt-1",children:"Service"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:204:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:205:23",className:"text-3xl font-bold text-purple-400",children:a.deployment_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:206:23",className:"text-sm text-slate-500 mt-1",children:"Deployment"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:208:21",className:"text-center p-4 rounded-lg bg-slate-800",children:[e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:209:23",className:"text-3xl font-bold text-amber-400",children:a.node_count||0}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:210:23",className:"text-sm text-slate-500 mt-1",children:"节点"})]})]})})]})]})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:218:11",value:"nodes",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:219:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:220:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:221:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:222:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:223:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:224:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"角色"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:225:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"状态"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:226:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"CPU"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:227:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"内存"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:228:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"Pod"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:229:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"操作系统"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:232:17",className:"divide-y divide-slate-800",children:r.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:234:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:235:23",colSpan:7,className:"px-4 py-8 text-center text-slate-500",children:"暂无节点数据"})}):r.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:239:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:240:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:241:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:242:25",variant:"outline",className:t.role==="master"?"border-purple-500/30 text-purple-400 bg-purple-500/10":"border-blue-500/30 text-blue-400 bg-blue-500/10",children:t.role==="master"?"Master":"Worker"})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:253:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:254:25",variant:"outline",className:(t.status||"").toLowerCase()==="ready"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-red-500/30 text-red-400 bg-red-500/10",children:(t.status||"").toLowerCase()==="ready"?"Ready":"NotReady"})}),e.jsxs("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:265:23",className:"px-4 py-3 text-sm text-slate-300",children:[t.cpu_usage_m||"0m"," / ",t.cpu,"核"]}),e.jsxs("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:268:23",className:"px-4 py-3 text-sm text-slate-300",children:[t.mem_usage_mi||"0Mi"," / ",t.memory_mb?(t.memory_mb/1024).toFixed(0)+"GB":"-"]}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:271:23",className:"px-4 py-3 text-sm text-slate-300",children:t.max_pods??0}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:272:23",className:"px-4 py-3 text-sm text-slate-400",children:t.os})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:281:11",value:"pods",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:282:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:283:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:284:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:285:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:286:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:287:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:288:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"状态"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:289:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"重启次数"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:290:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"CPU"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:291:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"内存"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:292:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"节点"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:295:17",className:"divide-y divide-slate-800",children:s.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:297:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:298:23",colSpan:7,className:"px-4 py-8 text-center text-slate-500",children:"暂无Pod数据"})}):s.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:302:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:303:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:304:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:305:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:309:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:310:25",variant:"outline",className:(t.status||"").toLowerCase()==="running"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":(t.status||"").toLowerCase()==="pending"?"border-amber-500/30 text-amber-400 bg-amber-500/10":"border-red-500/30 text-red-400 bg-red-500/10",children:t.status})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:323:23",className:"px-4 py-3 text-sm text-slate-300",children:t.restart_count??0}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:324:23",className:"px-4 py-3 text-sm text-slate-300",children:t.cpu_usage_m||"0m"}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:325:23",className:"px-4 py-3 text-sm text-slate-300",children:t.mem_usage_mi||"0Mi"}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:326:23",className:"px-4 py-3 text-sm text-slate-400",children:t.node_name})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:335:11",value:"deployments",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:336:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:337:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:338:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:339:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:340:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:341:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:342:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"副本数"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:343:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"可用副本"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:344:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"镜像"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:345:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"创建时间"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:348:17",className:"divide-y divide-slate-800",children:d.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:350:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:351:23",colSpan:6,className:"px-4 py-8 text-center text-slate-500",children:"暂无Deployment数据"})}):d.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:355:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:356:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:357:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:358:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:362:23",className:"px-4 py-3 text-sm text-slate-300",children:t.replicas}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:363:23",className:"px-4 py-3",children:e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:364:25",className:`text-sm ${(t.available_replicas??t.availableReplicas)===t.replicas?"text-emerald-400":"text-amber-400"}`,children:[t.available_replicas??t.availableReplicas," / ",t.replicas]})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:368:23",className:"px-4 py-3 text-sm text-slate-400 truncate max-w-[200px]",children:t.image}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:369:23",className:"px-4 py-3 text-sm text-slate-400",children:t.created_at||t.createdAt})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:378:11",value:"services",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:379:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:380:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:381:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:382:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:383:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:384:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:385:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"类型"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:386:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"ClusterIP"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:387:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"端口"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:388:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"Selector"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:391:17",className:"divide-y divide-slate-800",children:k.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:393:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:394:23",colSpan:6,className:"px-4 py-8 text-center text-slate-500",children:"暂无Service数据"})}):k.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:398:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:399:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:400:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:401:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:405:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:406:25",variant:"outline",className:t.type==="ClusterIP"?"border-blue-500/30 text-blue-400 bg-blue-500/10":t.type==="NodePort"?"border-purple-500/30 text-purple-400 bg-purple-500/10":"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:t.type})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:419:23",className:"px-4 py-3 text-sm text-slate-300",children:t.cluster_ip??t.clusterIP}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:420:23",className:"px-4 py-3 text-sm text-slate-300",children:t.ports}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:421:23",className:"px-4 py-3 text-sm text-slate-400",children:t.selector})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:430:11",value:"ingresses",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:431:13",className:"border rounded-lg border-slate-700 overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:432:15",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:433:17",className:"bg-slate-800",children:e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:434:19",children:[e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:435:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"名称"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:436:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"命名空间"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:437:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"Hosts"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:438:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"后端服务"}),e.jsx("th",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:439:21",className:"px-4 py-3 text-left text-xs font-medium text-slate-400",children:"TLS"})]})}),e.jsx("tbody",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:442:17",className:"divide-y divide-slate-800",children:b.length===0?e.jsx("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:444:21",children:e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:445:23",colSpan:5,className:"px-4 py-8 text-center text-slate-500",children:"暂无Ingress数据"})}):b.map(t=>e.jsxs("tr",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:449:21",className:"hover:bg-slate-800/50",children:[e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:450:23",className:"px-4 py-3 text-sm text-slate-200",children:t.name}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:451:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:452:25",variant:"outline",className:"border-slate-700 text-slate-400",children:t.namespace})}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:456:23",className:"px-4 py-3 text-sm text-slate-300",children:t.hosts}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:457:23",className:"px-4 py-3 text-sm text-slate-300",children:t.backend}),e.jsx("td",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:458:23",className:"px-4 py-3",children:e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:459:25",variant:"outline",className:t.tls?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-slate-700 text-slate-400",children:t.tls?"已启用":"未启用"})})]},t.id||t.name))})]})})}),e.jsx(M,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:478:11",value:"events",className:"mt-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:479:13",className:"space-y-2",children:[{type:"Normal",reason:"Started",message:"Started container nginx",time:"2分钟前"},{type:"Normal",reason:"Created",message:"Created pod nginx-deployment-xxx",time:"5分钟前"},{type:"Warning",reason:"FailedScheduling",message:"0/3 nodes are available",time:"10分钟前"},{type:"Normal",reason:"Pulling",message:'Pulling image "nginx:latest"',time:"15分钟前"},{type:"Normal",reason:"Pulled",message:"Successfully pulled image",time:"12分钟前"}].map((t,i)=>e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:487:17",className:"flex items-center gap-3 p-3 rounded-lg bg-slate-800/50",children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:491:19",variant:"outline",className:t.type==="Normal"?"border-emerald-500/30 text-emerald-400 bg-emerald-500/10":"border-amber-500/30 text-amber-400 bg-amber-500/10",children:t.type}),e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:501:19",className:"text-sm font-medium text-slate-300 min-w-[120px]",children:t.reason}),e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:502:19",className:"text-sm text-slate-400 flex-1",children:t.message}),e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDetail.tsx:503:19",className:"text-xs text-slate-500",children:t.time})]},i))})})]})})]})}var J="Radio",[ht,me]=ce(J),[gt,Ct]=ht(J),be=n.forwardRef((a,x)=>{const{__scopeRadio:r,name:g,checked:s=!1,required:u,disabled:d,value:K="on",onCheck:k,form:C,...b}=a,[f,h]=n.useState(null),p=X(x,m=>h(m)),t=n.useRef(!1),i=f?C||!!f.closest("form"):!0;return e.jsxs(gt,{scope:r,checked:s,disabled:d,children:[e.jsx($.button,{type:"button",role:"radio","aria-checked":s,"data-state":ke(s),"data-disabled":d?"":void 0,disabled:d,value:K,...b,ref:p,onClick:H(a.onClick,m=>{s||k?.(),i&&(t.current=m.isPropagationStopped(),t.current||m.stopPropagation())})}),i&&e.jsx(Ce,{control:f,bubbles:!t.current,name:g,value:K,checked:s,required:u,disabled:d,form:C,style:{transform:"translateX(-100%)"}})]})});be.displayName=J;var he="RadioIndicator",ge=n.forwardRef((a,x)=>{const{__scopeRadio:r,forceMount:g,...s}=a,u=Ct(he,r);return e.jsx(Ee,{present:g||u.checked,children:e.jsx($.span,{"data-state":ke(u.checked),"data-disabled":u.disabled?"":void 0,...s,ref:x})})});ge.displayName=he;var kt="RadioBubbleInput",Ce=n.forwardRef(({__scopeRadio:a,control:x,checked:r,bubbles:g=!0,...s},u)=>{const d=n.useRef(null),K=X(d,u),k=xt(r),C=Ae(x);return n.useEffect(()=>{const b=d.current;if(!b)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(k!==r&&p){const t=new Event("click",{bubbles:g});p.call(b,r),b.dispatchEvent(t)}},[k,r,g]),e.jsx($.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:K,style:{...s.style,...C,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Ce.displayName=kt;function ke(a){return a?"checked":"unchecked"}var ft=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],W="RadioGroup",[jt]=ce(W,[ae,me]),fe=ae(),je=me(),[Kt,vt]=jt(W),Ke=n.forwardRef((a,x)=>{const{__scopeRadioGroup:r,name:g,defaultValue:s,value:u,required:d=!1,disabled:K=!1,orientation:k,dir:C,loop:b=!0,onValueChange:f,...h}=a,p=fe(r),t=_e(C),[i,m]=Re({prop:u,defaultProp:s??null,onChange:f,caller:W});return e.jsx(Kt,{scope:r,name:g,required:d,disabled:K,value:i,onValueChange:m,children:e.jsx(Pe,{asChild:!0,...p,orientation:k,dir:t,loop:b,children:e.jsx($.div,{role:"radiogroup","aria-required":d,"aria-orientation":k,"data-disabled":K?"":void 0,dir:t,...h,ref:x})})})});Ke.displayName=W;var ve="RadioGroupItem",Ne=n.forwardRef((a,x)=>{const{__scopeRadioGroup:r,disabled:g,...s}=a,u=vt(ve,r),d=u.disabled||g,K=fe(r),k=je(r),C=n.useRef(null),b=X(x,C),f=u.value===s.value,h=n.useRef(!1);return n.useEffect(()=>{const p=i=>{ft.includes(i.key)&&(h.current=!0)},t=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",t),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",t)}},[]),e.jsx(Te,{asChild:!0,...K,focusable:!d,active:f,children:e.jsx(be,{disabled:d,required:u.required,checked:f,...k,...s,name:u.name,ref:b,onCheck:()=>u.onValueChange(s.value),onKeyDown:H(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:H(s.onFocus,()=>{h.current&&C.current?.click()})})})});Ne.displayName=ve;var Nt="RadioGroupIndicator",De=n.forwardRef((a,x)=>{const{__scopeRadioGroup:r,...g}=a,s=je(r);return e.jsx(ge,{...s,...g,ref:x})});De.displayName=Nt;var Dt=Ke,yt=Ne,wt=De;function St({className:a,...x}){return e.jsx(Dt,{"code-path":"src/components/ui/radio-group.tsx:14:5","data-slot":"radio-group",className:E("grid gap-3",a),...x})}function se({className:a,...x}){return e.jsx(yt,{"code-path":"src/components/ui/radio-group.tsx:27:5","data-slot":"radio-group-item",className:E("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",a),...x,children:e.jsx(wt,{"code-path":"src/components/ui/radio-group.tsx:35:7","data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:e.jsx($e,{"code-path":"src/components/ui/radio-group.tsx:39:9",className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}const re=/^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?$/,ne={name:"",version:"",description:"",config_type:1,api_server:"",token:"",kube_config:""};function _t({open:a,onOpenChange:x,editingCluster:r,onSaved:g}){const[s,u]=n.useState({...ne}),[d,K]=n.useState(!1),[k,C]=n.useState(!1),[b,f]=n.useState(!1),[h,p]=n.useState("");n.useEffect(()=>{a&&(r&&r.id?w.getClusterDetail(r.id).then(o=>{const l=o||{};C(!!l.has_token),f(!!l.has_kube_config),u({name:l.name||"",version:l.version||"",description:l.description||"",config_type:Number(l.config_type??1),api_server:l.api_server||"",token:"",kube_config:""}),p("")}).catch(()=>{u({name:r.name||"",version:r.version||"",description:r.description||"",config_type:Number(r.config_type??1),api_server:r.api_server||"",token:"",kube_config:""}),p("")}):(C(!1),f(!1),u({...ne}),p("")))},[a,r]);const t=o=>{u({...s,name:o}),o.trim()?re.test(o)?p(""):p("只允许英文、数字和连字符(-),首尾不能是连字符"):p("")},i=o=>{const l=o.match(/^\s*server:\s*(\S+)\s*$/m);return l?l[1]:""},m=o=>{const l=i(o);u(N=>({...N,kube_config:o,api_server:l||N.api_server}))},j=async()=>{if(!s.name.trim()||!re.test(s.name.trim())){I.error("请输入有效的集群名称(英文/数字/连字符)");return}try{K(!0);const o={name:s.name.trim(),code:s.name.trim(),version:s.version,description:s.description,config_type:s.config_type,api_server:s.api_server,token:s.config_type===0?s.token:"",kube_config:s.config_type===1?s.kube_config:""};r?await w.updateCluster(r.id,o):await w.createCluster(o),x(!1),g()}catch(o){console.error("保存集群失败:",o)}finally{K(!1)}},D=d||!s.name.trim()||!!h;return e.jsx(oe,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:143:5",open:a,onOpenChange:x,children:e.jsxs(le,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:144:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-2xl",children:[e.jsxs(Me,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:145:9",children:[e.jsx(ue,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:146:11",className:"text-[var(--dg-text-primary)]",children:r?"编辑集群":"添加集群"}),e.jsx(de,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:149:11",className:"text-[var(--dg-text-secondary)]",children:r?"修改集群接入配置":"配置新的 Kubernetes 集群接入信息"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:153:9",className:"space-y-4 py-2 max-h-[60vh] overflow-y-auto pr-1",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:154:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:155:13",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:156:15",className:"text-[var(--dg-text-secondary)]",children:"集群名称"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:157:15",value:s.name,onChange:o=>t(o.target.value),placeholder:"如: prod-cluster",className:`bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] ${h?"border-red-500":""}`}),h&&e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:163:29",className:"text-xs text-red-400",children:h}),e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:164:15",className:"text-xs text-[var(--dg-text-muted)]",children:"只允许英文、数字和连字符(-),首尾不能是连字符。名称将作为集群唯一标识。"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:168:13",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:169:15",className:"text-[var(--dg-text-secondary)]",children:"版本(可选)"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:170:15",value:s.version,onChange:o=>u({...s,version:o.target.value}),placeholder:"如: 1.28.0",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:179:11",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:180:13",className:"text-[var(--dg-text-secondary)]",children:"描述"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:181:13",value:s.description,onChange:o=>u({...s,description:o.target.value}),placeholder:"集群用途描述",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:189:11",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:190:13",className:"text-[var(--dg-text-secondary)]",children:"接入方式"}),e.jsxs(St,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:191:13",value:String(s.config_type),onValueChange:o=>u({...s,config_type:Number(o)}),className:"flex gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:196:15",className:"flex items-center gap-2 px-3 py-2 rounded-md border border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(se,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:197:17",value:"0",id:"ct-0"}),e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:198:17",htmlFor:"ct-0",className:"cursor-pointer text-[var(--dg-text-primary)] font-normal",children:"Token"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:200:15",className:"flex items-center gap-2 px-3 py-2 rounded-md border border-[var(--dg-border)] cursor-pointer hover:bg-[var(--dg-bg-hover)]",children:[e.jsx(se,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:201:17",value:"1",id:"ct-1"}),e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:202:17",htmlFor:"ct-1",className:"cursor-pointer text-[var(--dg-text-primary)] font-normal",children:"Kubeconfig"})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:207:11",className:"space-y-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:208:13",className:"text-[var(--dg-text-secondary)]",children:"API Server"}),e.jsx(L,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:209:13",value:s.api_server,onChange:o=>u({...s,api_server:o.target.value}),placeholder:"https://10.0.0.1:6443",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]"})]}),s.config_type===0?e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:218:13",className:"space-y-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:219:15",className:"text-[var(--dg-text-secondary)]",children:["Token ",k&&e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:220:36",className:"text-emerald-400 text-xs ml-1",children:"✓ 已配置(留空不修改)"})]}),e.jsx(te,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:222:15",value:s.token,onChange:o=>u({...s,token:o.target.value}),placeholder:k?"已配置,输入新值覆盖...":"粘贴 Service Account Token...",rows:4,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] font-mono text-xs"})]}):e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:231:13",className:"space-y-2",children:[e.jsxs(P,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:232:15",className:"text-[var(--dg-text-secondary)]",children:["Kubeconfig ",b&&e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:233:46",className:"text-emerald-400 text-xs ml-1",children:"✓ 已配置(留空不修改)"})]}),e.jsx(te,{"code-path":"src/components/kubernetes/KubernetesClusterDialog.tsx:235:15",value:s.kube_config,onChange:o=>m(o.target.value),placeholder:b?"已配置,输入新值覆盖...":`apiVersion: v1 kind: Config clusters: - cluster: diff --git a/backend/static/assets/KubernetesNodes-B0frAPbY.js b/backend/static/assets/KubernetesNodes-C9RSUKWj.js similarity index 95% rename from backend/static/assets/KubernetesNodes-B0frAPbY.js rename to backend/static/assets/KubernetesNodes-C9RSUKWj.js index aff32a5..241c55c 100644 --- a/backend/static/assets/KubernetesNodes-B0frAPbY.js +++ b/backend/static/assets/KubernetesNodes-C9RSUKWj.js @@ -1 +1 @@ -import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as F,a as I}from"./card-B-RtdR4H.js";import{B as A}from"./index-LZWfu62c.js";import{I as P}from"./input-BdDauX3U.js";import{B as l}from"./badge-B0F5ZNtn.js";import{S as w,a as y,b as C,c as S,d as x}from"./select-4xU_9B3_.js";import{T as V,a as H,b as u,c as o,d as U,e as n}from"./table-BPFYQwjr.js";import{k as B}from"./index-Z0O8nAcG.js";import{L as T,R as W,S as z,h as G}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function te(){const[$,h]=t.useState([]),[c,i]=t.useState(""),[R,N]=t.useState([]),[b,k]=t.useState(!1),[j,M]=t.useState(""),[p,L]=t.useState("all"),K=t.useCallback(async()=>{try{const r=(await B.getClusters())?.list||[];h(r),r.length>0&&!c&&i(String(r[0].id))}catch{h([])}},[]);t.useEffect(()=>{K()},[K]);const m=t.useCallback(async()=>{if(c){k(!0);try{const s=await B.getNodes(c);N(Array.isArray(s)?s:s?.list||[])}catch{N([])}finally{k(!1)}}},[c]);t.useEffect(()=>{m()},[m]);const g=R.filter(s=>(s.name||"").toLowerCase().includes(j.toLowerCase())&&(p==="all"||s.role===p)),_=s=>s==="master"?e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:52:9",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:"Master"}):e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:53:9",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"Worker"}),E=s=>s==="Ready"?e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:57:9",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:s}):e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:58:9",variant:"destructive",children:s||"Unknown"});return e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:61:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:62:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:63:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:64:11",className:"text-2xl font-bold text-slate-100",children:"节点管理"}),e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:65:11",className:"text-sm text-slate-500 mt-1",children:"Kubernetes 集群工作节点状态与资源"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:67:9",className:"flex items-center gap-2",children:[e.jsxs(w,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:68:11",value:c,onValueChange:i,children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:69:13",className:"w-48 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(C,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:70:15",placeholder:"选择集群"})}),e.jsx(S,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:72:13",className:"bg-slate-800 border-slate-700",children:$.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:74:17",value:String(s.id),children:s.name},s.id))})]}),e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:78:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:m,disabled:b,children:b?e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:79:24",className:"h-4 w-4 animate-spin"}):e.jsx(W,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:79:71",className:"h-4 w-4"})})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:84:7",className:"flex items-center gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:85:9",className:"relative w-56",children:[e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:86:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:87:11",placeholder:"搜索节点...",value:j,onChange:s=>M(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs(w,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:89:9",value:p,onValueChange:L,children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:90:11",className:"w-32 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(C,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:91:13"})}),e.jsxs(S,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:93:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:94:13",value:"all",children:"全部角色"}),e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:95:13",value:"master",children:"Master"}),e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:96:13",value:"worker",children:"Worker"})]})]})]}),e.jsx(F,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:101:7",className:"bg-slate-900 border-slate-800",children:e.jsx(I,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:102:9",className:"p-0",children:e.jsxs(V,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:103:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:104:13",children:e.jsxs(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:105:15",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:106:17",className:"text-slate-400",children:"节点名称"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:107:17",className:"text-slate-400",children:"IP"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:108:17",className:"text-slate-400",children:"角色"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:109:17",className:"text-slate-400",children:"状态"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:110:17",className:"text-slate-400",children:"配置"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:111:17",className:"text-slate-400",children:"使用率"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:112:17",className:"text-slate-400",children:"Pods"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:113:17",className:"text-slate-400",children:"Kubelet"})]})}),e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:116:13",children:b?e.jsx(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:118:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:118:27",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:118:95",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):g.length===0?e.jsx(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:120:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:120:27",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(G,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:120:95",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),c?"暂无节点数据":"请选择集群"]})}):g.map(s=>e.jsxs(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:123:19",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:124:21",className:"font-medium text-slate-200",children:s.name}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:125:21",children:e.jsx("code",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:125:32",className:"text-sm text-slate-300 bg-slate-800 px-1.5 py-0.5 rounded",children:s.ip||"-"})}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:126:21",children:_(s.role)}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:127:21",children:E(s.status)}),e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:128:21",className:"text-sm text-slate-400",children:[s.cpu?`${s.cpu}核`:"-"," / ",s.memory?`${Math.round(s.memory/1024)}GB`:"-"]}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:131:21",children:(()=>{const r=s.cpu_usage||0,d=s.memory_usage||0,f=a=>a>=85?"bg-red-500":a>=60?"bg-yellow-500":"bg-emerald-500",v=a=>a>=85?"text-red-400":a>=60?"text-yellow-400":"text-emerald-400";return e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:138:27",className:"flex flex-col gap-1 min-w-[120px]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:139:29",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:140:31",className:"text-xs text-slate-500 w-7",children:"CPU"}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:141:31",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:142:33",className:`h-full rounded-full ${f(r)}`,style:{width:`${Math.min(r,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:144:31",className:`text-xs w-9 text-right ${v(r)}`,children:[r.toFixed(0),"%"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:146:29",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:147:31",className:"text-xs text-slate-500 w-7",children:"Mem"}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:148:31",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:149:33",className:`h-full rounded-full ${f(d)}`,style:{width:`${Math.min(d,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:151:31",className:`text-xs w-9 text-right ${v(d)}`,children:[d.toFixed(0),"%"]})]})]})})()}),e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:157:21",className:"text-sm text-slate-400",children:[s.pod_count||0," / ",s.max_pods||"-"]}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:158:21",className:"text-xs text-slate-500",children:s.kubelet_version||"-"})]},s.id))})]})})})]})}export{te as KubernetesNodes}; +import{r as t,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as F,a as I}from"./card-BHSBTtub.js";import{B as A}from"./index-Bp-M7P_8.js";import{I as P}from"./input-Bnlm--la.js";import{B as l}from"./badge-B00SZHvE.js";import{S as w,a as y,b as C,c as S,d as x}from"./select-DbhcBWnH.js";import{T as V,a as H,b as u,c as o,d as U,e as n}from"./table-u8V9iTZf.js";import{k as B}from"./index-BkulU9RM.js";import{L as T,R as W,S as z,h as G}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";function te(){const[$,h]=t.useState([]),[c,i]=t.useState(""),[R,N]=t.useState([]),[b,k]=t.useState(!1),[j,M]=t.useState(""),[p,L]=t.useState("all"),K=t.useCallback(async()=>{try{const r=(await B.getClusters())?.list||[];h(r),r.length>0&&!c&&i(String(r[0].id))}catch{h([])}},[]);t.useEffect(()=>{K()},[K]);const m=t.useCallback(async()=>{if(c){k(!0);try{const s=await B.getNodes(c);N(Array.isArray(s)?s:s?.list||[])}catch{N([])}finally{k(!1)}}},[c]);t.useEffect(()=>{m()},[m]);const g=R.filter(s=>(s.name||"").toLowerCase().includes(j.toLowerCase())&&(p==="all"||s.role===p)),_=s=>s==="master"?e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:52:9",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:"Master"}):e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:53:9",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"Worker"}),E=s=>s==="Ready"?e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:57:9",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:s}):e.jsx(l,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:58:9",variant:"destructive",children:s||"Unknown"});return e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:61:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:62:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:63:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:64:11",className:"text-2xl font-bold text-slate-100",children:"节点管理"}),e.jsx("p",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:65:11",className:"text-sm text-slate-500 mt-1",children:"Kubernetes 集群工作节点状态与资源"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:67:9",className:"flex items-center gap-2",children:[e.jsxs(w,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:68:11",value:c,onValueChange:i,children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:69:13",className:"w-48 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(C,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:70:15",placeholder:"选择集群"})}),e.jsx(S,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:72:13",className:"bg-slate-800 border-slate-700",children:$.map(s=>e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:74:17",value:String(s.id),children:s.name},s.id))})]}),e.jsx(A,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:78:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:m,disabled:b,children:b?e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:79:24",className:"h-4 w-4 animate-spin"}):e.jsx(W,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:79:71",className:"h-4 w-4"})})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:84:7",className:"flex items-center gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:85:9",className:"relative w-56",children:[e.jsx(z,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:86:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(P,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:87:11",placeholder:"搜索节点...",value:j,onChange:s=>M(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs(w,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:89:9",value:p,onValueChange:L,children:[e.jsx(y,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:90:11",className:"w-32 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(C,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:91:13"})}),e.jsxs(S,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:93:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:94:13",value:"all",children:"全部角色"}),e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:95:13",value:"master",children:"Master"}),e.jsx(x,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:96:13",value:"worker",children:"Worker"})]})]})]}),e.jsx(F,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:101:7",className:"bg-slate-900 border-slate-800",children:e.jsx(I,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:102:9",className:"p-0",children:e.jsxs(V,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:103:11",children:[e.jsx(H,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:104:13",children:e.jsxs(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:105:15",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:106:17",className:"text-slate-400",children:"节点名称"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:107:17",className:"text-slate-400",children:"IP"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:108:17",className:"text-slate-400",children:"角色"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:109:17",className:"text-slate-400",children:"状态"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:110:17",className:"text-slate-400",children:"配置"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:111:17",className:"text-slate-400",children:"使用率"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:112:17",className:"text-slate-400",children:"Pods"}),e.jsx(o,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:113:17",className:"text-slate-400",children:"Kubelet"})]})}),e.jsx(U,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:116:13",children:b?e.jsx(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:118:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:118:27",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(T,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:118:95",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):g.length===0?e.jsx(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:120:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:120:27",colSpan:8,className:"text-center text-slate-500 py-12",children:[e.jsx(G,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:120:95",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),c?"暂无节点数据":"请选择集群"]})}):g.map(s=>e.jsxs(u,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:123:19",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:124:21",className:"font-medium text-slate-200",children:s.name}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:125:21",children:e.jsx("code",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:125:32",className:"text-sm text-slate-300 bg-slate-800 px-1.5 py-0.5 rounded",children:s.ip||"-"})}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:126:21",children:_(s.role)}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:127:21",children:E(s.status)}),e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:128:21",className:"text-sm text-slate-400",children:[s.cpu?`${s.cpu}核`:"-"," / ",s.memory?`${Math.round(s.memory/1024)}GB`:"-"]}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:131:21",children:(()=>{const r=s.cpu_usage||0,d=s.memory_usage||0,f=a=>a>=85?"bg-red-500":a>=60?"bg-yellow-500":"bg-emerald-500",v=a=>a>=85?"text-red-400":a>=60?"text-yellow-400":"text-emerald-400";return e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:138:27",className:"flex flex-col gap-1 min-w-[120px]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:139:29",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:140:31",className:"text-xs text-slate-500 w-7",children:"CPU"}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:141:31",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:142:33",className:`h-full rounded-full ${f(r)}`,style:{width:`${Math.min(r,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:144:31",className:`text-xs w-9 text-right ${v(r)}`,children:[r.toFixed(0),"%"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:146:29",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:147:31",className:"text-xs text-slate-500 w-7",children:"Mem"}),e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:148:31",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:149:33",className:`h-full rounded-full ${f(d)}`,style:{width:`${Math.min(d,100)}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:151:31",className:`text-xs w-9 text-right ${v(d)}`,children:[d.toFixed(0),"%"]})]})]})})()}),e.jsxs(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:157:21",className:"text-sm text-slate-400",children:[s.pod_count||0," / ",s.max_pods||"-"]}),e.jsx(n,{"code-path":"src/components/kubernetes/KubernetesNodes.tsx:158:21",className:"text-xs text-slate-500",children:s.kubelet_version||"-"})]},s.id))})]})})})]})}export{te as KubernetesNodes}; diff --git a/backend/static/assets/LoginLogsTab-BZTjs1T3.js b/backend/static/assets/LoginLogsTab-CaJThVCv.js similarity index 93% rename from backend/static/assets/LoginLogsTab-BZTjs1T3.js rename to backend/static/assets/LoginLogsTab-CaJThVCv.js index f8c6b6a..d40f7fd 100644 --- a/backend/static/assets/LoginLogsTab-BZTjs1T3.js +++ b/backend/static/assets/LoginLogsTab-CaJThVCv.js @@ -1 +1 @@ -import{r as n,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{C as N,a as v}from"./card-B-RtdR4H.js";import{B as h}from"./index-LZWfu62c.js";import{I as _}from"./input-BdDauX3U.js";import{B as i}from"./badge-B0F5ZNtn.js";import{T as y,a as C,b as L,c as o,d as w,e as c}from"./table-BPFYQwjr.js";import{l as S}from"./terminal-BchqP-zB.js";import{S as k,R as B,Z as I,G as A,_ as R}from"./vendor-icons-Aso0-eeY.js";function z(a){return{id:a.id??0,username:a.username??"",login_type:a.login_type??"password",ip:a.ip??"",location:a.location??"",browser:a.browser??"",os:a.os??"",user_agent:a.user_agent??a.userAgent??"",status:a.status==="failed"||a.status==="fail"?"fail":"success",fail_reason:a.fail_reason??a.message??"",login_at:a.login_at??a.created_at??"",created_at:a.created_at??a.login_at??""}}function M(){const[a,g]=n.useState([]),[b,d]=n.useState(!0),[p,m]=n.useState(""),[r,u]=n.useState(""),l=n.useCallback(async()=>{d(!0);try{const e={page:1,page_size:100};r&&(e.status=r==="fail"?"failed":r);const f=(await S.list(e))?.list??[];g(f.map(z))}catch{g([])}finally{d(!1)}},[r]);n.useEffect(()=>{l()},[l]);const x=a.filter(e=>{const t=p.toLowerCase();return!t||(e.username||"").toLowerCase().includes(t)||(e.ip||"").toLowerCase().includes(t)||(e.location||"").toLowerCase().includes(t)||(e.user_agent||"").toLowerCase().includes(t)}),T=(e,t)=>e==="success"?s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:88:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"成功"}):s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:92:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",title:t||void 0,children:t||"失败"}),j=e=>{switch(e){case"password":return"密码登录";case"ldap":return"LDAP";case"token":return"Token";case"oauth":return"OAuth";default:return e||"密码登录"}};return s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:113:5",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:115:7",className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:116:9",className:"relative w-64",children:[s.jsx(k,{"code-path":"src/pages/LoginLogsTab.tsx:117:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),s.jsx(_,{"code-path":"src/pages/LoginLogsTab.tsx:118:11",placeholder:"搜索用户/IP/归属地...",value:p,onChange:e=>m(e.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:126:9",className:"flex items-center gap-1",children:[{value:"",label:"全部"},{value:"success",label:"成功"},{value:"fail",label:"失败"}].map(({value:e,label:t})=>s.jsx(h,{"code-path":"src/pages/LoginLogsTab.tsx:132:13",variant:r===e?"default":"outline",size:"sm",className:r===e?"h-8 bg-blue-600 hover:bg-blue-700 text-white":"h-8 border-slate-700 text-slate-400 hover:text-slate-100 hover:bg-slate-800",onClick:()=>u(e),children:t},e||"all"))}),s.jsxs(h,{"code-path":"src/pages/LoginLogsTab.tsx:148:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:l,children:[s.jsx(B,{"code-path":"src/pages/LoginLogsTab.tsx:153:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),s.jsx(N,{"code-path":"src/pages/LoginLogsTab.tsx:159:7",className:"bg-slate-900 border-slate-800",children:s.jsx(v,{"code-path":"src/pages/LoginLogsTab.tsx:160:9",className:"p-0",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:161:11",className:"border-t border-slate-800",children:b?s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:163:15",className:"flex items-center justify-center py-16",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:164:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):x.length===0?s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:167:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[s.jsx(I,{"code-path":"src/pages/LoginLogsTab.tsx:168:17",className:"h-8 w-8 mb-3 opacity-40"}),s.jsx("p",{"code-path":"src/pages/LoginLogsTab.tsx:169:17",className:"text-sm",children:"暂无登录日志"})]}):s.jsxs(y,{"code-path":"src/pages/LoginLogsTab.tsx:172:15",children:[s.jsx(C,{"code-path":"src/pages/LoginLogsTab.tsx:173:17",children:s.jsxs(L,{"code-path":"src/pages/LoginLogsTab.tsx:174:19",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:175:21",className:"text-slate-400",children:"登录时间"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:176:21",className:"text-slate-400",children:"用户"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:177:21",className:"text-slate-400",children:"登录方式"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:178:21",className:"text-slate-400",children:"IP"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:179:21",className:"text-slate-400",children:"归属地"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:180:21",className:"text-slate-400",children:"浏览器/OS"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:181:21",className:"text-slate-400",children:"状态"})]})}),s.jsx(w,{"code-path":"src/pages/LoginLogsTab.tsx:184:17",children:x.map(e=>s.jsxs(L,{"code-path":"src/pages/LoginLogsTab.tsx:186:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:187:23",children:s.jsx("span",{"code-path":"src/pages/LoginLogsTab.tsx:188:25",className:"text-sm text-slate-400",children:e.login_at?new Date(e.login_at).toLocaleString():"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:192:23",children:s.jsx("span",{"code-path":"src/pages/LoginLogsTab.tsx:193:25",className:"text-sm text-slate-200 font-medium",children:e.username||"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:195:23",children:s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:196:25",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 text-xs",children:j(e.login_type)})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:200:23",children:s.jsx("code",{"code-path":"src/pages/LoginLogsTab.tsx:201:25",className:"text-xs text-slate-400 bg-slate-800 px-2 py-0.5 rounded",children:e.ip||"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:205:23",children:s.jsxs("span",{"code-path":"src/pages/LoginLogsTab.tsx:206:25",className:"text-xs text-slate-500 flex items-center gap-1",children:[s.jsx(A,{"code-path":"src/pages/LoginLogsTab.tsx:207:27",className:"h-3 w-3"}),e.location||"--"]})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:211:23",children:s.jsxs("span",{"code-path":"src/pages/LoginLogsTab.tsx:212:25",className:"text-xs text-slate-500 flex items-center gap-1",title:e.user_agent,children:[s.jsx(R,{"code-path":"src/pages/LoginLogsTab.tsx:213:27",className:"h-3 w-3 flex-shrink-0"}),e.browser||e.os?[e.browser,e.os].filter(Boolean).join(" / "):e.user_agent?e.user_agent.length>40?e.user_agent.slice(0,40)+"...":e.user_agent:"--"]})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:223:23",children:T(e.status,e.fail_reason)})]},e.id))})]})})})})]})}export{M as LoginLogsTab}; +import{r as n,j as s}from"./vendor-codemirror-B1SGo4xl.js";import{C as N,a as v}from"./card-BHSBTtub.js";import{B as h}from"./index-Bp-M7P_8.js";import{I as _}from"./input-Bnlm--la.js";import{B as i}from"./badge-B00SZHvE.js";import{T as y,a as C,b as L,c as o,d as w,e as c}from"./table-u8V9iTZf.js";import{l as S}from"./terminal-DMFQ_5h4.js";import{S as k,R as B,Z as I,G as A,_ as R}from"./vendor-icons-BWk-DH7F.js";function z(a){return{id:a.id??0,username:a.username??"",login_type:a.login_type??"password",ip:a.ip??"",location:a.location??"",browser:a.browser??"",os:a.os??"",user_agent:a.user_agent??a.userAgent??"",status:a.status==="failed"||a.status==="fail"?"fail":"success",fail_reason:a.fail_reason??a.message??"",login_at:a.login_at??a.created_at??"",created_at:a.created_at??a.login_at??""}}function M(){const[a,g]=n.useState([]),[b,d]=n.useState(!0),[p,m]=n.useState(""),[r,u]=n.useState(""),l=n.useCallback(async()=>{d(!0);try{const e={page:1,page_size:100};r&&(e.status=r==="fail"?"failed":r);const f=(await S.list(e))?.list??[];g(f.map(z))}catch{g([])}finally{d(!1)}},[r]);n.useEffect(()=>{l()},[l]);const x=a.filter(e=>{const t=p.toLowerCase();return!t||(e.username||"").toLowerCase().includes(t)||(e.ip||"").toLowerCase().includes(t)||(e.location||"").toLowerCase().includes(t)||(e.user_agent||"").toLowerCase().includes(t)}),T=(e,t)=>e==="success"?s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:88:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"成功"}):s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:92:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",title:t||void 0,children:t||"失败"}),j=e=>{switch(e){case"password":return"密码登录";case"ldap":return"LDAP";case"token":return"Token";case"oauth":return"OAuth";default:return e||"密码登录"}};return s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:113:5",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:115:7",className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:116:9",className:"relative w-64",children:[s.jsx(k,{"code-path":"src/pages/LoginLogsTab.tsx:117:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),s.jsx(_,{"code-path":"src/pages/LoginLogsTab.tsx:118:11",placeholder:"搜索用户/IP/归属地...",value:p,onChange:e=>m(e.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:126:9",className:"flex items-center gap-1",children:[{value:"",label:"全部"},{value:"success",label:"成功"},{value:"fail",label:"失败"}].map(({value:e,label:t})=>s.jsx(h,{"code-path":"src/pages/LoginLogsTab.tsx:132:13",variant:r===e?"default":"outline",size:"sm",className:r===e?"h-8 bg-blue-600 hover:bg-blue-700 text-white":"h-8 border-slate-700 text-slate-400 hover:text-slate-100 hover:bg-slate-800",onClick:()=>u(e),children:t},e||"all"))}),s.jsxs(h,{"code-path":"src/pages/LoginLogsTab.tsx:148:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:l,children:[s.jsx(B,{"code-path":"src/pages/LoginLogsTab.tsx:153:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),s.jsx(N,{"code-path":"src/pages/LoginLogsTab.tsx:159:7",className:"bg-slate-900 border-slate-800",children:s.jsx(v,{"code-path":"src/pages/LoginLogsTab.tsx:160:9",className:"p-0",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:161:11",className:"border-t border-slate-800",children:b?s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:163:15",className:"flex items-center justify-center py-16",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:164:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):x.length===0?s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:167:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[s.jsx(I,{"code-path":"src/pages/LoginLogsTab.tsx:168:17",className:"h-8 w-8 mb-3 opacity-40"}),s.jsx("p",{"code-path":"src/pages/LoginLogsTab.tsx:169:17",className:"text-sm",children:"暂无登录日志"})]}):s.jsxs(y,{"code-path":"src/pages/LoginLogsTab.tsx:172:15",children:[s.jsx(C,{"code-path":"src/pages/LoginLogsTab.tsx:173:17",children:s.jsxs(L,{"code-path":"src/pages/LoginLogsTab.tsx:174:19",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:175:21",className:"text-slate-400",children:"登录时间"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:176:21",className:"text-slate-400",children:"用户"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:177:21",className:"text-slate-400",children:"登录方式"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:178:21",className:"text-slate-400",children:"IP"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:179:21",className:"text-slate-400",children:"归属地"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:180:21",className:"text-slate-400",children:"浏览器/OS"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:181:21",className:"text-slate-400",children:"状态"})]})}),s.jsx(w,{"code-path":"src/pages/LoginLogsTab.tsx:184:17",children:x.map(e=>s.jsxs(L,{"code-path":"src/pages/LoginLogsTab.tsx:186:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:187:23",children:s.jsx("span",{"code-path":"src/pages/LoginLogsTab.tsx:188:25",className:"text-sm text-slate-400",children:e.login_at?new Date(e.login_at).toLocaleString():"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:192:23",children:s.jsx("span",{"code-path":"src/pages/LoginLogsTab.tsx:193:25",className:"text-sm text-slate-200 font-medium",children:e.username||"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:195:23",children:s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:196:25",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 text-xs",children:j(e.login_type)})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:200:23",children:s.jsx("code",{"code-path":"src/pages/LoginLogsTab.tsx:201:25",className:"text-xs text-slate-400 bg-slate-800 px-2 py-0.5 rounded",children:e.ip||"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:205:23",children:s.jsxs("span",{"code-path":"src/pages/LoginLogsTab.tsx:206:25",className:"text-xs text-slate-500 flex items-center gap-1",children:[s.jsx(A,{"code-path":"src/pages/LoginLogsTab.tsx:207:27",className:"h-3 w-3"}),e.location||"--"]})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:211:23",children:s.jsxs("span",{"code-path":"src/pages/LoginLogsTab.tsx:212:25",className:"text-xs text-slate-500 flex items-center gap-1",title:e.user_agent,children:[s.jsx(R,{"code-path":"src/pages/LoginLogsTab.tsx:213:27",className:"h-3 w-3 flex-shrink-0"}),e.browser||e.os?[e.browser,e.os].filter(Boolean).join(" / "):e.user_agent?e.user_agent.length>40?e.user_agent.slice(0,40)+"...":e.user_agent:"--"]})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:223:23",children:T(e.status,e.fail_reason)})]},e.id))})]})})})})]})}export{M as LoginLogsTab}; diff --git a/backend/static/assets/MetricsExplorer-CBLW7MW5.js b/backend/static/assets/MetricsExplorer-4Vq96BvF.js similarity index 96% rename from backend/static/assets/MetricsExplorer-CBLW7MW5.js rename to backend/static/assets/MetricsExplorer-4Vq96BvF.js index 1e071d8..f2d0684 100644 --- a/backend/static/assets/MetricsExplorer-CBLW7MW5.js +++ b/backend/static/assets/MetricsExplorer-4Vq96BvF.js @@ -1 +1 @@ -import{r as l,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as u,a as b}from"./card-B-RtdR4H.js";import{S as I,a as z,b as P,c as B,d as V}from"./select-4xU_9B3_.js";import{B as q}from"./index-LZWfu62c.js";import{I as F}from"./input-BdDauX3U.js";import{m as M}from"./metrics-Dj4l07HZ.js";import{S as H,af as K,u as G,A as y,P as Q,D as U,N as W,H as v,g as J}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const N={cpu:{label:"CPU",icon:e.jsx(J,{"code-path":"src/pages/MetricsExplorer.tsx:34:30",className:"h-4 w-4"})},memory:{label:"内存",icon:e.jsx(v,{"code-path":"src/pages/MetricsExplorer.tsx:35:32",className:"h-4 w-4"})},disk:{label:"磁盘",icon:e.jsx(v,{"code-path":"src/pages/MetricsExplorer.tsx:36:30",className:"h-4 w-4"})},network:{label:"网络",icon:e.jsx(W,{"code-path":"src/pages/MetricsExplorer.tsx:37:33",className:"h-4 w-4"})},middleware:{label:"中间件",icon:e.jsx(U,{"code-path":"src/pages/MetricsExplorer.tsx:38:37",className:"h-4 w-4"})},device:{label:"设备",icon:e.jsx(y,{"code-path":"src/pages/MetricsExplorer.tsx:39:32",className:"h-4 w-4"})}};function ce(){const[n,w]=l.useState([]),[j,S]=l.useState([]),[x,C]=l.useState(""),[o,E]=l.useState([]),[k,f]=l.useState([]),[T,O]=l.useState(!0),[m,_]=l.useState(""),A=l.useCallback(async()=>{try{const s=await M.getTargets({page_size:200});w(s?.list||[])}catch{}finally{O(!1)}},[]),D=l.useCallback(async()=>{try{const s=await M.getNames();S(s||[])}catch{}},[]);l.useEffect(()=>{A(),D()},[]),l.useEffect(()=>{if(!x||o.length===0||!n.find(c=>String(c.id)===x))return;const t=Math.floor(Date.now()/1e3),r=t-3600;Promise.all(o.map(c=>M.query({target_id:x,metric_name:c,from:String(r),to:String(t),limit:200}).then(a=>Array.isArray(a)?a:[]).catch(()=>[]))).then(c=>{f(c.flat())})},[x,o,n]);const L=m?j.filter(s=>s.toLowerCase().includes(m.toLowerCase())):j,g=n.find(s=>String(s.id)===x),R=L.reduce((s,t)=>{const r=t.split("_")[0]||"other";return s[r]||(s[r]=[]),s[r].push(t),s},{}),d={};k.forEach(s=>{d[s.timestamp]||(d[s.timestamp]={}),d[s.timestamp][s.metric_name]=s.value});const p=Object.keys(d).map(Number).sort((s,t)=>s-t),$=Math.max(1,...Object.values(d).flatMap(s=>Object.values(s))),h=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#06b6d4","#f97316"];return e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:118:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:120:7",className:"flex items-center gap-4 flex-wrap",children:[e.jsxs(I,{"code-path":"src/pages/MetricsExplorer.tsx:121:9",value:x,onValueChange:C,children:[e.jsx(z,{"code-path":"src/pages/MetricsExplorer.tsx:122:11",className:"w-64 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(P,{"code-path":"src/pages/MetricsExplorer.tsx:123:13",placeholder:T?"加载中...":"选择监控目标..."})}),e.jsx(B,{"code-path":"src/pages/MetricsExplorer.tsx:125:11",className:"bg-slate-800 border-slate-700 text-slate-200 max-h-80",children:n.map(s=>e.jsx(V,{"code-path":"src/pages/MetricsExplorer.tsx:127:15",value:String(s.id),children:e.jsxs("span",{"code-path":"src/pages/MetricsExplorer.tsx:128:17",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:129:19",className:`inline-block w-1.5 h-1.5 rounded-full ${s.status==="online"?"bg-emerald-400":"bg-slate-500"}`}),s.name," (",s.ip||s.type,")"]})},s.id))})]}),e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:137:9",className:"relative flex-1 max-w-sm",children:[e.jsx(H,{"code-path":"src/pages/MetricsExplorer.tsx:138:11",className:"absolute left-2.5 top-2 h-4 w-4 text-slate-500"}),e.jsx(F,{"code-path":"src/pages/MetricsExplorer.tsx:139:11",className:"pl-8 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",placeholder:"搜索指标...",value:m,onChange:s=>_(s.target.value)})]}),e.jsx(q,{"code-path":"src/pages/MetricsExplorer.tsx:146:9",variant:"ghost",size:"sm",onClick:()=>{E([]),f([])},children:"清除"})]}),x?e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:159:9",className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:161:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] lg:col-span-1",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:162:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:163:15",className:"flex items-center gap-2 mb-3",children:[e.jsx(G,{"code-path":"src/pages/MetricsExplorer.tsx:164:17",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/MetricsExplorer.tsx:165:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"指标列表"}),e.jsxs("span",{"code-path":"src/pages/MetricsExplorer.tsx:166:17",className:"text-xs text-[var(--dg-text-muted)] ml-auto",children:[o.length," 已选"]})]}),e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:168:15",className:"space-y-4 max-h-[60vh] overflow-y-auto",children:Object.entries(R).map(([s,t])=>e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:170:19",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:171:21",className:"flex items-center gap-1.5 mb-1.5 text-xs text-[var(--dg-text-muted)]",children:[N[s]?.icon,e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:173:23",children:N[s]?.label||s})]}),e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:175:21",className:"space-y-0.5",children:t.map(r=>{const c=o.includes(r);return e.jsxs("label",{"code-path":"src/pages/MetricsExplorer.tsx:179:27",className:`flex items-center gap-2 px-2 py-1 rounded cursor-pointer text-xs transition-colors ${c?"bg-blue-500/10 text-blue-300":"text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,children:[e.jsx("input",{"code-path":"src/pages/MetricsExplorer.tsx:180:29",type:"checkbox",className:"rounded border-slate-600 bg-slate-800 accent-blue-500",checked:c,onChange:()=>{E(a=>c?a.filter(i=>i!==r):[...a,r])}}),e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:190:29",className:"truncate",children:r})]},r)})})]},s))})]})}),e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:202:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] lg:col-span-2",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:203:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:204:15",className:"flex items-center gap-2 mb-3",children:[e.jsx(y,{"code-path":"src/pages/MetricsExplorer.tsx:205:17",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("h3",{"code-path":"src/pages/MetricsExplorer.tsx:206:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:[g?.name||""," — 最近 1 小时"]})]}),o.length===0?e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:211:17",className:"h-64 flex items-center justify-center text-sm text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:212:19",className:"text-center",children:[e.jsx(Q,{"code-path":"src/pages/MetricsExplorer.tsx:213:21",className:"h-8 w-8 text-slate-600 mx-auto mb-2"}),"请从左侧勾选指标"]})}):p.length===0?e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:218:17",className:"h-64 flex items-center justify-center text-sm text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"暂无数据"}):e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:222:17",className:"h-80 overflow-x-auto",children:e.jsxs("svg",{"code-path":"src/pages/MetricsExplorer.tsx:223:19",viewBox:`0 0 ${Math.max(p.length*4,400)} 300`,className:"w-full h-full min-w-[400px]",children:[[0,25,50,75,100].map(s=>e.jsx("line",{"code-path":"src/pages/MetricsExplorer.tsx:226:23",x1:"0",y1:300-s/100*260,x2:Math.max(p.length*4,400),y2:300-s/100*260,stroke:"#1e293b",strokeDasharray:"3 3"},s)),o.map((s,t)=>{const r=p.map((a,i)=>({x:i*4+2,y:300-(d[a][s]??0)/$*260})).filter(a=>d[p[Math.round((a.x-2)/4)]]?.[s]!=null);if(r.length<2)return null;const c=r.map((a,i)=>`${i===0?"M":"L"}${a.x} ${a.y}`).join(" ");return e.jsx("g",{"code-path":"src/pages/MetricsExplorer.tsx:236:25",children:e.jsx("path",{"code-path":"src/pages/MetricsExplorer.tsx:237:27",d:c,fill:"none",stroke:h[t%h.length],strokeWidth:"1.5"})},s)}),p.filter((s,t)=>t%15===0).map((s,t)=>e.jsx("text",{"code-path":"src/pages/MetricsExplorer.tsx:243:23",x:t*60+2,y:"295",fill:"#475569",fontSize:"9",children:new Date(s*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})},s))]})}),o.length>0&&e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:252:17",className:"flex flex-wrap gap-3 mt-3",children:o.map((s,t)=>e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:254:21",className:"flex items-center gap-1.5 text-xs text-[var(--dg-text-secondary)]",children:[e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:255:23",className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:h[t%h.length]}}),s]},s))})]})})]}):e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:152:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:153:11",className:"p-12 text-center",children:[e.jsx(K,{"code-path":"src/pages/MetricsExplorer.tsx:154:13",className:"h-12 w-12 text-slate-600 mx-auto mb-4"}),e.jsx("p",{"code-path":"src/pages/MetricsExplorer.tsx:155:13",className:"text-[var(--dg-text-muted)]",children:"请先选择监控目标,然后勾选要查看的指标"})]})}),g&&Object.keys(g.latest_metrics||{}).length>0&&e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:268:9",className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:Object.entries(g.latest_metrics).map(([s,t])=>e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:270:13",className:"bg-[var(--dg-bg-secondary)] rounded-lg p-3 border border-[var(--dg-border)] text-center",children:[e.jsx("p",{"code-path":"src/pages/MetricsExplorer.tsx:271:15",className:"text-[10px] text-[var(--dg-text-muted)] truncate",children:s}),e.jsx("p",{"code-path":"src/pages/MetricsExplorer.tsx:272:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:typeof t=="number"?t.toFixed(1):"--"})]},s))})]})}export{ce as MetricsExplorer,ce as default}; +import{r as l,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as u,a as b}from"./card-BHSBTtub.js";import{S as I,a as z,b as P,c as B,d as V}from"./select-DbhcBWnH.js";import{B as q}from"./index-Bp-M7P_8.js";import{I as F}from"./input-Bnlm--la.js";import{m as M}from"./metrics-D_WSC7FH.js";import{S as H,af as K,u as G,A as y,P as Q,D as U,N as W,H as v,g as J}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";const N={cpu:{label:"CPU",icon:e.jsx(J,{"code-path":"src/pages/MetricsExplorer.tsx:34:30",className:"h-4 w-4"})},memory:{label:"内存",icon:e.jsx(v,{"code-path":"src/pages/MetricsExplorer.tsx:35:32",className:"h-4 w-4"})},disk:{label:"磁盘",icon:e.jsx(v,{"code-path":"src/pages/MetricsExplorer.tsx:36:30",className:"h-4 w-4"})},network:{label:"网络",icon:e.jsx(W,{"code-path":"src/pages/MetricsExplorer.tsx:37:33",className:"h-4 w-4"})},middleware:{label:"中间件",icon:e.jsx(U,{"code-path":"src/pages/MetricsExplorer.tsx:38:37",className:"h-4 w-4"})},device:{label:"设备",icon:e.jsx(y,{"code-path":"src/pages/MetricsExplorer.tsx:39:32",className:"h-4 w-4"})}};function ce(){const[n,w]=l.useState([]),[j,S]=l.useState([]),[x,C]=l.useState(""),[o,E]=l.useState([]),[k,f]=l.useState([]),[T,O]=l.useState(!0),[m,_]=l.useState(""),A=l.useCallback(async()=>{try{const s=await M.getTargets({page_size:200});w(s?.list||[])}catch{}finally{O(!1)}},[]),D=l.useCallback(async()=>{try{const s=await M.getNames();S(s||[])}catch{}},[]);l.useEffect(()=>{A(),D()},[]),l.useEffect(()=>{if(!x||o.length===0||!n.find(c=>String(c.id)===x))return;const t=Math.floor(Date.now()/1e3),r=t-3600;Promise.all(o.map(c=>M.query({target_id:x,metric_name:c,from:String(r),to:String(t),limit:200}).then(a=>Array.isArray(a)?a:[]).catch(()=>[]))).then(c=>{f(c.flat())})},[x,o,n]);const L=m?j.filter(s=>s.toLowerCase().includes(m.toLowerCase())):j,g=n.find(s=>String(s.id)===x),R=L.reduce((s,t)=>{const r=t.split("_")[0]||"other";return s[r]||(s[r]=[]),s[r].push(t),s},{}),d={};k.forEach(s=>{d[s.timestamp]||(d[s.timestamp]={}),d[s.timestamp][s.metric_name]=s.value});const p=Object.keys(d).map(Number).sort((s,t)=>s-t),$=Math.max(1,...Object.values(d).flatMap(s=>Object.values(s))),h=["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#06b6d4","#f97316"];return e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:118:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:120:7",className:"flex items-center gap-4 flex-wrap",children:[e.jsxs(I,{"code-path":"src/pages/MetricsExplorer.tsx:121:9",value:x,onValueChange:C,children:[e.jsx(z,{"code-path":"src/pages/MetricsExplorer.tsx:122:11",className:"w-64 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(P,{"code-path":"src/pages/MetricsExplorer.tsx:123:13",placeholder:T?"加载中...":"选择监控目标..."})}),e.jsx(B,{"code-path":"src/pages/MetricsExplorer.tsx:125:11",className:"bg-slate-800 border-slate-700 text-slate-200 max-h-80",children:n.map(s=>e.jsx(V,{"code-path":"src/pages/MetricsExplorer.tsx:127:15",value:String(s.id),children:e.jsxs("span",{"code-path":"src/pages/MetricsExplorer.tsx:128:17",className:"flex items-center gap-2",children:[e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:129:19",className:`inline-block w-1.5 h-1.5 rounded-full ${s.status==="online"?"bg-emerald-400":"bg-slate-500"}`}),s.name," (",s.ip||s.type,")"]})},s.id))})]}),e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:137:9",className:"relative flex-1 max-w-sm",children:[e.jsx(H,{"code-path":"src/pages/MetricsExplorer.tsx:138:11",className:"absolute left-2.5 top-2 h-4 w-4 text-slate-500"}),e.jsx(F,{"code-path":"src/pages/MetricsExplorer.tsx:139:11",className:"pl-8 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",placeholder:"搜索指标...",value:m,onChange:s=>_(s.target.value)})]}),e.jsx(q,{"code-path":"src/pages/MetricsExplorer.tsx:146:9",variant:"ghost",size:"sm",onClick:()=>{E([]),f([])},children:"清除"})]}),x?e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:159:9",className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:161:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] lg:col-span-1",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:162:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:163:15",className:"flex items-center gap-2 mb-3",children:[e.jsx(G,{"code-path":"src/pages/MetricsExplorer.tsx:164:17",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/MetricsExplorer.tsx:165:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"指标列表"}),e.jsxs("span",{"code-path":"src/pages/MetricsExplorer.tsx:166:17",className:"text-xs text-[var(--dg-text-muted)] ml-auto",children:[o.length," 已选"]})]}),e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:168:15",className:"space-y-4 max-h-[60vh] overflow-y-auto",children:Object.entries(R).map(([s,t])=>e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:170:19",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:171:21",className:"flex items-center gap-1.5 mb-1.5 text-xs text-[var(--dg-text-muted)]",children:[N[s]?.icon,e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:173:23",children:N[s]?.label||s})]}),e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:175:21",className:"space-y-0.5",children:t.map(r=>{const c=o.includes(r);return e.jsxs("label",{"code-path":"src/pages/MetricsExplorer.tsx:179:27",className:`flex items-center gap-2 px-2 py-1 rounded cursor-pointer text-xs transition-colors ${c?"bg-blue-500/10 text-blue-300":"text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,children:[e.jsx("input",{"code-path":"src/pages/MetricsExplorer.tsx:180:29",type:"checkbox",className:"rounded border-slate-600 bg-slate-800 accent-blue-500",checked:c,onChange:()=>{E(a=>c?a.filter(i=>i!==r):[...a,r])}}),e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:190:29",className:"truncate",children:r})]},r)})})]},s))})]})}),e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:202:11",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] lg:col-span-2",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:203:13",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:204:15",className:"flex items-center gap-2 mb-3",children:[e.jsx(y,{"code-path":"src/pages/MetricsExplorer.tsx:205:17",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("h3",{"code-path":"src/pages/MetricsExplorer.tsx:206:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:[g?.name||""," — 最近 1 小时"]})]}),o.length===0?e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:211:17",className:"h-64 flex items-center justify-center text-sm text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:212:19",className:"text-center",children:[e.jsx(Q,{"code-path":"src/pages/MetricsExplorer.tsx:213:21",className:"h-8 w-8 text-slate-600 mx-auto mb-2"}),"请从左侧勾选指标"]})}):p.length===0?e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:218:17",className:"h-64 flex items-center justify-center text-sm text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"暂无数据"}):e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:222:17",className:"h-80 overflow-x-auto",children:e.jsxs("svg",{"code-path":"src/pages/MetricsExplorer.tsx:223:19",viewBox:`0 0 ${Math.max(p.length*4,400)} 300`,className:"w-full h-full min-w-[400px]",children:[[0,25,50,75,100].map(s=>e.jsx("line",{"code-path":"src/pages/MetricsExplorer.tsx:226:23",x1:"0",y1:300-s/100*260,x2:Math.max(p.length*4,400),y2:300-s/100*260,stroke:"#1e293b",strokeDasharray:"3 3"},s)),o.map((s,t)=>{const r=p.map((a,i)=>({x:i*4+2,y:300-(d[a][s]??0)/$*260})).filter(a=>d[p[Math.round((a.x-2)/4)]]?.[s]!=null);if(r.length<2)return null;const c=r.map((a,i)=>`${i===0?"M":"L"}${a.x} ${a.y}`).join(" ");return e.jsx("g",{"code-path":"src/pages/MetricsExplorer.tsx:236:25",children:e.jsx("path",{"code-path":"src/pages/MetricsExplorer.tsx:237:27",d:c,fill:"none",stroke:h[t%h.length],strokeWidth:"1.5"})},s)}),p.filter((s,t)=>t%15===0).map((s,t)=>e.jsx("text",{"code-path":"src/pages/MetricsExplorer.tsx:243:23",x:t*60+2,y:"295",fill:"#475569",fontSize:"9",children:new Date(s*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})},s))]})}),o.length>0&&e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:252:17",className:"flex flex-wrap gap-3 mt-3",children:o.map((s,t)=>e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:254:21",className:"flex items-center gap-1.5 text-xs text-[var(--dg-text-secondary)]",children:[e.jsx("span",{"code-path":"src/pages/MetricsExplorer.tsx:255:23",className:"w-2.5 h-2.5 rounded-full",style:{backgroundColor:h[t%h.length]}}),s]},s))})]})})]}):e.jsx(u,{"code-path":"src/pages/MetricsExplorer.tsx:152:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(b,{"code-path":"src/pages/MetricsExplorer.tsx:153:11",className:"p-12 text-center",children:[e.jsx(K,{"code-path":"src/pages/MetricsExplorer.tsx:154:13",className:"h-12 w-12 text-slate-600 mx-auto mb-4"}),e.jsx("p",{"code-path":"src/pages/MetricsExplorer.tsx:155:13",className:"text-[var(--dg-text-muted)]",children:"请先选择监控目标,然后勾选要查看的指标"})]})}),g&&Object.keys(g.latest_metrics||{}).length>0&&e.jsx("div",{"code-path":"src/pages/MetricsExplorer.tsx:268:9",className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:Object.entries(g.latest_metrics).map(([s,t])=>e.jsxs("div",{"code-path":"src/pages/MetricsExplorer.tsx:270:13",className:"bg-[var(--dg-bg-secondary)] rounded-lg p-3 border border-[var(--dg-border)] text-center",children:[e.jsx("p",{"code-path":"src/pages/MetricsExplorer.tsx:271:15",className:"text-[10px] text-[var(--dg-text-muted)] truncate",children:s}),e.jsx("p",{"code-path":"src/pages/MetricsExplorer.tsx:272:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:typeof t=="number"?t.toFixed(1):"--"})]},s))})]})}export{ce as MetricsExplorer,ce as default}; diff --git a/backend/static/assets/MonitorCenter-DZJmSfOk.js b/backend/static/assets/MonitorCenter-DUZK-EX-.js similarity index 98% rename from backend/static/assets/MonitorCenter-DZJmSfOk.js rename to backend/static/assets/MonitorCenter-DUZK-EX-.js index 0f36393..2d42dc6 100644 --- a/backend/static/assets/MonitorCenter-DZJmSfOk.js +++ b/backend/static/assets/MonitorCenter-DUZK-EX-.js @@ -1 +1 @@ -import{r as i,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{D as X,j as ue,B as w,a as J,b as K,c as W,d as Y,e as Z,f as Ne,t as C,m as ve}from"./index-LZWfu62c.js";import{HostMonitor as je}from"./HostMonitor-D4f8NRVg.js";import{C as h,a as M}from"./card-B-RtdR4H.js";import{B as u}from"./badge-B0F5ZNtn.js";import{m as be,s as H}from"./metrics-Dj4l07HZ.js";import{L as O,A as R,D as B,h as ee,aG as Se,aH as z,H as ye,aI as te,P as se,T as ae,G as L,aJ as fe,R as we,b as Pe,a as Ce,C as _e,g as Te}from"./vendor-icons-Aso0-eeY.js";import{I as y}from"./input-BdDauX3U.js";import{L as j}from"./label-u-lNUbKh.js";import{S as re,a as oe,b as ce,c as de,d as A}from"./select-4xU_9B3_.js";import{T as ie,a as ne,b as $,c as l,d as xe,e as p}from"./table-BPFYQwjr.js";import{S as De}from"./switch-C4PJnJ9I.js";import{s as I}from"./site-B-pRndoi.js";import"./agent-g0Vk8FYK.js";import"./unwrap-BmWy-KM2.js";import"./tabs-kmtfM2I-.js";import"./AreaChart-Czgv4pNk.js";import"./index-CYARH0Cq.js";function Fe(t){return t==null||t===0?"--":t>1e9?`${(t/1e9).toFixed(1)} GB`:t>1e6?`${(t/1e6).toFixed(1)} MB`:t>1e3?`${(t/1e3).toFixed(1)} KB`:`${t} B`}function E(t){return t==null||Number.isNaN(t)?"--":`${(t*100).toFixed(1)}%`}function F(t,n=0){return t==null||Number.isNaN(t)?"--":t.toFixed(n)}function ke(t){switch(t){case"online":return"text-emerald-400";case"warning":return"text-amber-400";case"error":return"text-red-400";default:return"text-slate-500"}}function Ie(t){switch(t){case"online":return"bg-emerald-400";case"warning":return"bg-amber-400";case"error":return"bg-red-400";default:return"bg-slate-500"}}function Le(){const[t,n]=i.useState([]),[d,N]=i.useState(!0),[v,_]=i.useState(""),T=i.useCallback(async()=>{try{N(!0),_("");const r=await be.getTargets({type:"middleware",page_size:200});n(r?.list||[])}catch(r){_(r.message||"加载失败"),n([])}finally{N(!1)}},[]);i.useEffect(()=>{T()},[]);const b=t.filter(r=>r.type==="redis"||r.name?.toLowerCase().includes("redis")),o=t.filter(r=>r.type==="mysql"||r.name?.toLowerCase().includes("mysql")),x=b.find(r=>r.status==="online")||b[0],c=x?.latest_metrics||{},m=o.find(r=>r.status==="online")||o[0],S=m?.latest_metrics||{};return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:96:5",className:"space-y-6",children:[d&&e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:98:9",className:"flex items-center justify-center py-12",children:[e.jsx(O,{"code-path":"src/pages/MiddlewareMonitor.tsx:99:11",className:"h-6 w-6 animate-spin text-slate-500 mr-2"}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:100:11",className:"text-sm text-[var(--dg-text-muted)]",children:"正在加载中间件指标..."})]}),v&&!d&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:105:9",className:"bg-[var(--dg-bg-secondary)] border-red-500/30",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:106:11",className:"p-6 text-center",children:[e.jsx(R,{"code-path":"src/pages/MiddlewareMonitor.tsx:107:13",className:"h-8 w-8 text-red-400 mx-auto mb-2"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:108:13",className:"text-sm text-red-400",children:v}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:109:13",className:"text-xs text-[var(--dg-text-muted)] mt-2",children:"请确认后端服务可用且已配置中间件采集"})]})}),!d&&!v&&t.length===0&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:115:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:116:11",className:"p-12 text-center",children:[e.jsx(B,{"code-path":"src/pages/MiddlewareMonitor.tsx:117:13",className:"h-12 w-12 text-slate-600 mx-auto mb-4"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:118:13",className:"text-sm text-[var(--dg-text-muted)]",children:"暂无中间件监控目标"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:119:13",className:"text-xs text-[var(--dg-text-muted)] mt-2",children:"需在 Agent 配置 Redis / MySQL 连接信息后启用采集"})]})}),e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:125:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:126:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:127:11",className:"flex items-center gap-2 mb-4",children:[e.jsx(B,{"code-path":"src/pages/MiddlewareMonitor.tsx:128:13",className:"h-4 w-4 text-red-400"}),e.jsx("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:129:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"Redis 监控"}),x&&e.jsxs(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:131:15",variant:"outline",className:"ml-auto text-[10px] border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:[x.name," (",x.ip,")"]})]}),x?e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:139:13",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:140:15",label:"连接数",value:F(c.redis_connected_clients)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:144:15",label:"内存",value:Fe(c.redis_used_memory)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:148:15",label:"命中率",value:E(c.redis_hit_rate)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:152:15",label:"QPS",value:F(c.redis_qps,0)})]}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:137:13",className:"text-sm text-[var(--dg-text-muted)] mb-4",children:"需在 Agent 配置 Redis 连接地址和密码后启用采集。"})]})}),e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:162:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:163:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:164:11",className:"flex items-center gap-2 mb-4",children:[e.jsx(ee,{"code-path":"src/pages/MiddlewareMonitor.tsx:165:13",className:"h-4 w-4 text-blue-400"}),e.jsx("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:166:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"MySQL 监控"}),m&&e.jsxs(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:168:15",variant:"outline",className:"ml-auto text-[10px] border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:[m.name," (",m.ip,")"]})]}),m?e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:176:13",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:177:15",label:"连接数",value:F(S.mysql_connections)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:181:15",label:"QPS",value:F(S.mysql_qps,1)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:185:15",label:"慢查询",value:F(S.mysql_slow_queries)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:189:15",label:"缓冲池命中率",value:E(S.mysql_buffer_hit_rate)})]}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:174:13",className:"text-sm text-[var(--dg-text-muted)] mb-4",children:"需在 Agent 配置 MySQL 连接地址、用户名和密码后启用采集。"})]})}),t.length>0&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:200:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:201:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:202:13",className:"flex items-center gap-2 mb-4",children:[e.jsx(R,{"code-path":"src/pages/MiddlewareMonitor.tsx:203:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:204:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["中间件实例(",t.length,")"]})]}),e.jsx("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:208:13",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(r=>e.jsx(He,{"code-path":"src/pages/MiddlewareMonitor.tsx:210:17",target:r},r.id))})]})}),t.filter(r=>!b.includes(r)&&!o.includes(r)).length>0&&e.jsx("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:219:9",className:"space-y-4",children:t.filter(r=>!b.includes(r)&&!o.includes(r)).map(r=>e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:223:15",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:224:17",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:225:19",className:"flex items-center gap-2 mb-3",children:[e.jsx(Se,{"code-path":"src/pages/MiddlewareMonitor.tsx:226:21",className:`h-3 w-3 ${ke(r.status)}`}),e.jsx("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:227:21",className:"text-sm font-medium text-[var(--dg-text-primary)] capitalize",children:r.type}),e.jsxs(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:228:21",variant:"outline",className:"text-[10px] border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:[r.name," (",r.ip,")"]})]}),Object.keys(r.latest_metrics||{}).length>0?e.jsx("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:233:21",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Object.entries(r.latest_metrics).map(([g,D])=>e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:235:25",label:g,value:F(D,1)},g))}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:239:21",className:"text-xs text-[var(--dg-text-muted)]",children:"暂无指标数据"})]})},r.id))})]})}function f({label:t,value:n}){return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:253:5",className:"bg-[var(--dg-bg-tertiary)] rounded-lg p-3 text-center",children:[e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:254:7",className:"text-xs text-[var(--dg-text-muted)]",children:t}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:255:7",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:n})]})}function He({target:t}){const n=t.latest_metrics||{},d=Object.keys(n).length;return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:266:5",className:"bg-[var(--dg-bg-tertiary)] rounded-lg p-3 border border-[var(--dg-border)] hover:border-[var(--dg-border)]/80 transition-colors",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:267:7",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:268:9",className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:269:11",className:`inline-block w-2 h-2 rounded-full ${Ie(t.status)}`}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:270:11",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:t.name})]}),e.jsx(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:272:9",variant:"outline",className:`text-[10px] capitalize ${t.status==="online"?"border-emerald-400/50 text-emerald-400":"border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,children:t.status})]}),e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:279:7",className:"text-xs text-[var(--dg-text-muted)] mb-2",children:[t.ip," · ",t.type]}),d>0?e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:283:9",className:"flex flex-wrap gap-1.5",children:[Object.entries(n).slice(0,4).map(([N,v])=>e.jsxs("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:285:13",className:"inline-flex items-center gap-1 text-[10px] bg-[var(--dg-bg-primary)] rounded px-1.5 py-0.5 text-[var(--dg-text-secondary)]",children:[e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:286:15",className:"text-[var(--dg-text-muted)]",children:N}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:287:15",className:"font-mono font-medium text-[var(--dg-text-primary)]",children:typeof v=="number"?v.toFixed(1):v})]},N)),d>4&&e.jsxs("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:293:13",className:"text-[10px] text-[var(--dg-text-muted)]",children:["+",d-4," 项"]})]}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:297:9",className:"text-[10px] text-[var(--dg-text-muted)]",children:"暂无指标"})]})}const G={name:"",ip:"",port:161,snmp_version:"v2c",community:"public",template_id:""};function $e(){const[t,n]=i.useState({total:0,online:0,abnormal:0}),[d,N]=i.useState([]),[v,_]=i.useState(!0),[T,b]=i.useState(!1),[o,x]=i.useState({...G}),[c,m]=i.useState(!1),S=i.useCallback(async()=>{try{const a=await H.getStats();n(a)}catch{}},[]),r=i.useCallback(async()=>{try{const a=await H.getDevices();N(a.list??[])}catch{N([])}finally{_(!1)}},[]),g=i.useCallback(()=>{S(),r()},[S,r]);i.useEffect(()=>{g()},[g]);const D=async()=>{if(!(!o.name.trim()||!o.ip.trim())){m(!0);try{await H.createDevice({name:o.name.trim(),ip:o.ip.trim(),port:Number(o.port),snmp_version:o.snmp_version,community:o.community.trim(),template_id:o.template_id?Number(o.template_id):0}),b(!1),x({...G}),g()}catch{}finally{m(!1)}}},q=async a=>{try{await H.deleteDevice(a),g()}catch{}},P=a=>a==="online"?e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:146:14",className:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",children:"在线"}):a==="abnormal"?e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:149:14",className:"bg-red-500/15 text-red-400 border-red-500/30",children:"异常"}):e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:151:12",className:"bg-slate-500/15 text-slate-400 border-slate-500/30",children:"离线"});return e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:156:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:158:7",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:159:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:160:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:161:13",className:"flex items-center gap-2 mb-3",children:[e.jsx(z,{"code-path":"src/pages/SNMPMonitor.tsx:162:15",className:"h-4 w-4 text-cyan-400"}),e.jsx("h3",{"code-path":"src/pages/SNMPMonitor.tsx:163:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"网络设备"})]}),e.jsx("p",{"code-path":"src/pages/SNMPMonitor.tsx:165:13",className:"text-xs text-[var(--dg-text-muted)] mb-3",children:"交换机 / 路由器 / 防火墙"}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:166:13",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:167:15",className:"flex justify-between text-sm",children:[e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:168:17",className:"text-[var(--dg-text-muted)]",children:"设备总数"}),e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:169:17",className:"text-[var(--dg-text-primary)] font-mono",children:t.total})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:171:15",className:"flex justify-between text-sm",children:[e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:172:17",className:"text-[var(--dg-text-muted)]",children:"在线"}),e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:173:17",className:"text-emerald-400 font-mono",children:t.online})]})]})]})}),e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:179:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:180:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:181:13",className:"flex items-center gap-2 mb-3",children:[e.jsx(ye,{"code-path":"src/pages/SNMPMonitor.tsx:182:15",className:"h-4 w-4 text-purple-400"}),e.jsx("h3",{"code-path":"src/pages/SNMPMonitor.tsx:183:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"服务器硬件"})]}),e.jsx("p",{"code-path":"src/pages/SNMPMonitor.tsx:185:13",className:"text-xs text-[var(--dg-text-muted)] mb-3",children:"iLO / iDRAC / IPMI"}),e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:186:13",className:"space-y-2",children:e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:187:15",className:"flex justify-between text-sm",children:[e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:188:17",className:"text-[var(--dg-text-muted)]",children:"异常"}),e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:189:17",className:"text-red-400 font-mono",children:t.abnormal})]})})]})})]}),e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:197:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:198:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:199:11",className:"flex items-center gap-2 mb-3",children:[e.jsx(te,{"code-path":"src/pages/SNMPMonitor.tsx:200:13",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/SNMPMonitor.tsx:201:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"OID 监控模板"})]}),e.jsx("p",{"code-path":"src/pages/SNMPMonitor.tsx:203:11",className:"text-sm text-[var(--dg-text-muted)]",children:"支持 Zabbix 兼容的 SNMP OID 模板(XML 格式),内置思科/H3C/华为交换机模板、服务器硬件监控模板。"}),e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:206:11",className:"mt-3 grid grid-cols-2 md:grid-cols-4 gap-2 text-xs text-[var(--dg-text-secondary)]",children:["思科交换机","H3C S5000","华为交换机","iLO/Dell"].map(a=>e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:208:15",className:"bg-[var(--dg-bg-tertiary)] rounded px-2 py-1 text-center border border-[var(--dg-border)]",children:a},a))})]})}),e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:220:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:221:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:222:11",className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:223:13",className:"flex items-center gap-2",children:[e.jsx(z,{"code-path":"src/pages/SNMPMonitor.tsx:224:15",className:"h-4 w-4 text-cyan-400"}),e.jsxs("h3",{"code-path":"src/pages/SNMPMonitor.tsx:225:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["SNMP 设备列表",!v&&e.jsxs("span",{"code-path":"src/pages/SNMPMonitor.tsx:228:19",className:"ml-2 text-xs text-[var(--dg-text-muted)] font-normal",children:["(",d.length," 台)"]})]})]}),e.jsxs(X,{"code-path":"src/pages/SNMPMonitor.tsx:236:13",open:T,onOpenChange:b,children:[e.jsx(ue,{"code-path":"src/pages/SNMPMonitor.tsx:237:15",asChild:!0,children:e.jsxs(w,{"code-path":"src/pages/SNMPMonitor.tsx:238:17",size:"sm",className:"bg-cyan-500/10 text-cyan-400 hover:bg-cyan-500/20 border border-cyan-500/30",children:[e.jsx(se,{"code-path":"src/pages/SNMPMonitor.tsx:239:19",className:"h-4 w-4"}),"添加设备"]})}),e.jsxs(J,{"code-path":"src/pages/SNMPMonitor.tsx:243:15",className:"bg-slate-900 border-[var(--dg-border)] text-[var(--dg-text-primary)] sm:max-w-md",children:[e.jsxs(K,{"code-path":"src/pages/SNMPMonitor.tsx:244:17",children:[e.jsx(W,{"code-path":"src/pages/SNMPMonitor.tsx:245:19",className:"text-[var(--dg-text-primary)]",children:"添加 SNMP 设备"}),e.jsx(Y,{"code-path":"src/pages/SNMPMonitor.tsx:246:19",className:"text-[var(--dg-text-muted)]",children:"输入设备信息以开始 SNMP 监控采集。"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:251:17",className:"grid gap-4 py-2",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:253:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:254:21",htmlFor:"snmp-name",className:"text-[var(--dg-text-muted)]",children:"设备名称"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:257:21",id:"snmp-name",placeholder:"例如: 核心交换机",value:o.name,onChange:a=>x({...o,name:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:267:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:268:21",htmlFor:"snmp-ip",className:"text-[var(--dg-text-muted)]",children:"IP 地址"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:271:21",id:"snmp-ip",placeholder:"例如: 192.168.1.1",value:o.ip,onChange:a=>x({...o,ip:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:281:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:282:21",htmlFor:"snmp-port",className:"text-[var(--dg-text-muted)]",children:"SNMP 端口"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:285:21",id:"snmp-port",type:"number",placeholder:"161",value:o.port,onChange:a=>x({...o,port:Number(a.target.value)||161}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:296:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:297:21",htmlFor:"snmp-version",className:"text-[var(--dg-text-muted)]",children:"SNMP 版本"}),e.jsxs(re,{"code-path":"src/pages/SNMPMonitor.tsx:300:21",value:o.snmp_version,onValueChange:a=>x({...o,snmp_version:a}),children:[e.jsx(oe,{"code-path":"src/pages/SNMPMonitor.tsx:304:23",id:"snmp-version",className:"w-full bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(ce,{"code-path":"src/pages/SNMPMonitor.tsx:308:25"})}),e.jsxs(de,{"code-path":"src/pages/SNMPMonitor.tsx:310:23",className:"bg-slate-800 border-slate-700 text-slate-200",children:[e.jsx(A,{"code-path":"src/pages/SNMPMonitor.tsx:311:25",value:"v2c",children:"v2c"}),e.jsx(A,{"code-path":"src/pages/SNMPMonitor.tsx:312:25",value:"v3",children:"v3"})]})]})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:318:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:319:21",htmlFor:"snmp-community",className:"text-[var(--dg-text-muted)]",children:"Community"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:322:21",id:"snmp-community",placeholder:"public",value:o.community,onChange:a=>x({...o,community:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:332:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:333:21",htmlFor:"snmp-template",className:"text-[var(--dg-text-muted)]",children:"模板 ID"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:336:21",id:"snmp-template",type:"number",placeholder:"模板 ID",value:o.template_id,onChange:a=>x({...o,template_id:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]})]}),e.jsxs(Z,{"code-path":"src/pages/SNMPMonitor.tsx:347:17",children:[e.jsx(w,{"code-path":"src/pages/SNMPMonitor.tsx:348:19",variant:"outline",onClick:()=>b(!1),className:"border-[var(--dg-border)] text-[var(--dg-text-muted)] hover:bg-slate-800",children:"取消"}),e.jsx(w,{"code-path":"src/pages/SNMPMonitor.tsx:355:19",onClick:D,disabled:c||!o.name.trim()||!o.ip.trim(),className:"bg-cyan-500/10 text-cyan-400 hover:bg-cyan-500/20 border border-cyan-500/30",children:c?"添加中...":"确认添加"})]})]})]})]}),v?e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:369:13",className:"py-12 text-center text-sm text-[var(--dg-text-muted)]",children:"加载中..."}):d.length===0?e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:371:13",className:"py-12 text-center text-sm text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"暂无 SNMP 设备,点击「添加设备」开始监控"}):e.jsxs(ie,{"code-path":"src/pages/SNMPMonitor.tsx:375:13",children:[e.jsx(ne,{"code-path":"src/pages/SNMPMonitor.tsx:376:15",children:e.jsxs($,{"code-path":"src/pages/SNMPMonitor.tsx:377:17",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:378:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:379:19",className:"text-[var(--dg-text-muted)]",children:"IP 地址"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:380:19",className:"text-[var(--dg-text-muted)]",children:"端口"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:381:19",className:"text-[var(--dg-text-muted)]",children:"版本"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:382:19",className:"text-[var(--dg-text-muted)]",children:"Community"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:383:19",className:"text-[var(--dg-text-muted)]",children:"模板 ID"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:384:19",className:"text-[var(--dg-text-muted)]",children:"状态"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:385:19",className:"text-[var(--dg-text-muted)] w-16",children:"操作"})]})}),e.jsx(xe,{"code-path":"src/pages/SNMPMonitor.tsx:388:15",children:d.map(a=>e.jsxs($,{"code-path":"src/pages/SNMPMonitor.tsx:390:19",className:"border-[var(--dg-border)]",children:[e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:391:21",className:"text-[var(--dg-text-primary)] font-medium",children:a.name}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:394:21",className:"text-[var(--dg-text-muted)] font-mono text-xs",children:a.ip}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:397:21",className:"text-[var(--dg-text-muted)]",children:a.port}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:398:21",children:e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:399:23",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:a.snmp_version})}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:403:21",className:"text-[var(--dg-text-muted)] font-mono text-xs",children:a.community}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:406:21",className:"text-[var(--dg-text-muted)]",children:a.template_id||"--"}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:407:21",children:P(a.status)}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:408:21",children:e.jsx(w,{"code-path":"src/pages/SNMPMonitor.tsx:409:23",variant:"ghost",size:"icon-sm",onClick:()=>q(a.id),className:"text-slate-500 hover:text-red-400 hover:bg-red-500/10",title:"删除设备",children:e.jsx(ae,{"code-path":"src/pages/SNMPMonitor.tsx:416:25",className:"h-4 w-4"})})})]},a.id))})]})]})})]})}const qe=[{icon:L,name:"HTTP",color:"text-blue-400",desc:"HTTP URL 状态码 & 响应时间"},{icon:L,name:"HTTPS",color:"text-emerald-400",desc:"HTTPS SSL 证书 & 响应时间"},{icon:ee,name:"TCP",color:"text-orange-400",desc:"TCP 端口连通性检测"},{icon:L,name:"DNS",color:"text-cyan-400",desc:"域名解析延迟 & 结果验证"},{icon:fe,name:"PING",color:"text-purple-400",desc:"ICMP 连通性 & 延迟"}],Oe=["HTTP","HTTPS","TCP","DNS","PING"],Q={name:"",url:"",type:"HTTP",frequency_sec:60,timeout_sec:10,expected_status_code:200};function Re(t){switch(t){case"up":return e.jsx(_e,{"code-path":"src/pages/SiteMonitor.tsx:106:14",className:"h-4 w-4 text-emerald-400"});case"down":return e.jsx(Ce,{"code-path":"src/pages/SiteMonitor.tsx:108:14",className:"h-4 w-4 text-red-400"});default:return e.jsx(Pe,{"code-path":"src/pages/SiteMonitor.tsx:110:14",className:"h-4 w-4 text-gray-400"})}}function Be(t){switch(t){case"up":return e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:117:14",className:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",children:"正常"});case"down":return e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:119:14",className:"bg-red-500/15 text-red-400 border-red-500/30",children:"异常"});default:return e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:121:14",className:"bg-gray-500/15 text-gray-400 border-gray-500/30",children:"未知"})}}function Ae(t){return t==null||t===0?"--":t<1e3?`${t.toFixed(0)}ms`:`${(t/1e3).toFixed(2)}s`}function Ue(t){if(!t)return"--";const n=new Date(t),d=N=>String(N).padStart(2,"0");return`${d(n.getMonth()+1)}-${d(n.getDate())} ${d(n.getHours())}:${d(n.getMinutes())}`}function ze(){const[t,n]=i.useState(null),[d,N]=i.useState([]),[v,_]=i.useState(!0),[T,b]=i.useState(!1),[o,x]=i.useState(!1),[c,m]=i.useState({...Q}),[S,r]=i.useState(!1),[g,D]=i.useState(null),q=Ne(),P=i.useCallback(async()=>{try{const s=await I.getStats();n(s)}catch{}},[]),a=i.useCallback(async()=>{b(!0);try{const s=await I.getTasks();N(s?.list||[])}catch{}finally{b(!1),_(!1)}},[]);i.useEffect(()=>{P(),a()},[P,a]);const U=g?d.filter(s=>s.type?.toUpperCase()===g.toUpperCase()):d,le=()=>{m({...Q}),x(!0)},pe=async()=>{if(!c.name.trim()||!c.url.trim()){C.error("名称和 URL 不能为空");return}r(!0);try{await I.createTask({name:c.name.trim(),url:c.url.trim(),type:c.type.toLowerCase(),frequency_sec:Number(c.frequency_sec)||60,timeout_sec:Number(c.timeout_sec)||10,expected_status_code:Number(c.expected_status_code)||200}),C.success("拨测任务已创建"),x(!1),a(),P()}catch(s){C.error(s.message||"创建失败")}finally{r(!1)}},me=async s=>{if(await q({title:"删除拨测任务",description:`确定删除「${s.name}」吗?此操作不可恢复。`,variant:"destructive"}))try{await I.deleteTask(s.id),C.success("任务已删除"),a(),P()}catch(Me){C.error(Me.message||"删除失败")}},ge=async s=>{try{await I.toggleTask(s.id,!s.enabled),C.success(s.enabled?"已停用":"已启用"),a(),P()}catch(k){C.error(k.message||"操作失败")}},he=t?.availability!=null?`${(t.availability*100).toFixed(1)}%`:"--";return v?e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:249:7",className:"flex items-center justify-center py-20",children:e.jsx(O,{"code-path":"src/pages/SiteMonitor.tsx:250:9",className:"h-8 w-8 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:256:5",className:"space-y-6",children:[e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:258:7",className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3",children:qe.map(s=>{const k=g===s.name;return e.jsx(h,{"code-path":"src/pages/SiteMonitor.tsx:262:13",onClick:()=>D(k?null:s.name),className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] transition-colors cursor-pointer ${k?"border-[var(--dg-blue)]/60 ring-1 ring-[var(--dg-blue)]/30":"hover:border-[var(--dg-blue)]/30"}`,children:e.jsxs(M,{"code-path":"src/pages/SiteMonitor.tsx:269:15",className:"p-3 text-center",children:[e.jsx(s.icon,{"code-path":"src/pages/SiteMonitor.tsx:270:17",className:`h-5 w-5 mx-auto mb-1.5 ${s.color}`}),e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:271:17",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:s.name}),e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:272:17",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5",children:s.desc})]})},s.name)})}),e.jsx(h,{"code-path":"src/pages/SiteMonitor.tsx:280:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SiteMonitor.tsx:281:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:282:11",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:283:13",className:"flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/pages/SiteMonitor.tsx:284:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/SiteMonitor.tsx:285:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"拨测任务概览"})]}),e.jsxs(w,{"code-path":"src/pages/SiteMonitor.tsx:287:13",size:"sm",variant:"ghost",className:"h-7 text-xs text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",onClick:()=>{P(),a()},disabled:T,children:[e.jsx(we,{"code-path":"src/pages/SiteMonitor.tsx:294:15",className:`h-3.5 w-3.5 ${T?"animate-spin":""}`}),"刷新"]})]}),e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:298:11",className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[{label:"总任务数",value:t?.total_tasks??"--"},{label:"已启用",value:t?.enabled_tasks??"--"},{label:"正常",value:t?.up_count??"--",color:"text-emerald-400"},{label:"异常",value:t?.down_count??"--",color:"text-red-400"},{label:"可用率",value:he,color:"text-blue-400"}].map(s=>e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:306:15",className:"bg-[var(--dg-bg-tertiary)] rounded-lg p-3 text-center",children:[e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:307:17",className:"text-xs text-[var(--dg-text-muted)]",children:s.label}),e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:308:17",className:`text-lg font-bold ${s.color||"text-[var(--dg-text-primary)]"}`,children:s.value})]},s.label))})]})}),e.jsx(h,{"code-path":"src/pages/SiteMonitor.tsx:318:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SiteMonitor.tsx:319:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:320:11",className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:321:13",className:"flex items-center gap-2",children:[e.jsx(R,{"code-path":"src/pages/SiteMonitor.tsx:322:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("h3",{"code-path":"src/pages/SiteMonitor.tsx:323:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["拨测任务列表",g&&e.jsxs(u,{"code-path":"src/pages/SiteMonitor.tsx:326:19",variant:"outline",className:"ml-2 text-[10px] cursor-pointer border-[var(--dg-blue)]/40 text-[var(--dg-blue)] h-5",onClick:()=>D(null),children:[g," ×"]})]})]}),e.jsxs(w,{"code-path":"src/pages/SiteMonitor.tsx:336:13",size:"sm",className:"h-8 gap-1.5",onClick:le,children:[e.jsx(se,{"code-path":"src/pages/SiteMonitor.tsx:341:15",className:"h-3.5 w-3.5"}),"添加任务"]})]}),U.length===0?e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:347:13",className:"text-center py-12 text-sm text-[var(--dg-text-muted)]",children:d.length===0?"暂无拨测任务,点击「添加任务」创建第一个":"当前筛选条件下无任务"}):e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:353:13",className:"overflow-x-auto",children:e.jsxs(ie,{"code-path":"src/pages/SiteMonitor.tsx:354:15",children:[e.jsx(ne,{"code-path":"src/pages/SiteMonitor.tsx:355:17",children:e.jsxs($,{"code-path":"src/pages/SiteMonitor.tsx:356:19",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:357:21",className:"text-xs text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:358:21",className:"text-xs text-[var(--dg-text-muted)]",children:"URL"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:359:21",className:"text-xs text-[var(--dg-text-muted)]",children:"类型"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:360:21",className:"text-xs text-[var(--dg-text-muted)]",children:"间隔"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:361:21",className:"text-xs text-[var(--dg-text-muted)]",children:"状态"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:362:21",className:"text-xs text-[var(--dg-text-muted)]",children:"延迟"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:363:21",className:"text-xs text-[var(--dg-text-muted)]",children:"上次检测"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:364:21",className:"text-xs text-[var(--dg-text-muted)]",children:"启用"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:365:21",className:"text-xs text-[var(--dg-text-muted)]",children:"操作"})]})}),e.jsx(xe,{"code-path":"src/pages/SiteMonitor.tsx:368:17",children:U.map(s=>e.jsxs($,{"code-path":"src/pages/SiteMonitor.tsx:370:21",className:"border-[var(--dg-border)]",children:[e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:371:23",className:"text-sm text-[var(--dg-text-primary)] font-medium",children:s.name}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:374:23",className:"text-sm text-[var(--dg-text-muted)] max-w-[200px] truncate",children:s.url}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:377:23",children:e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:378:25",variant:"outline",className:"text-[11px] border-[var(--dg-border)]",children:s.type?.toUpperCase()})}),e.jsxs(p,{"code-path":"src/pages/SiteMonitor.tsx:382:23",className:"text-sm text-[var(--dg-text-muted)]",children:[s.frequency_sec,"s"]}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:385:23",children:e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:386:25",className:"flex items-center gap-1.5",children:[Re(s.last_status),e.jsx("span",{"code-path":"src/pages/SiteMonitor.tsx:388:27",className:"text-sm text-[var(--dg-text-muted)]",children:Be(s.last_status)})]})}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:393:23",className:"text-sm text-[var(--dg-text-muted)]",children:Ae(s.last_response_time_ms)}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:396:23",className:"text-sm text-[var(--dg-text-muted)]",children:Ue(s.last_checked_at)}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:399:23",children:e.jsx(De,{"code-path":"src/pages/SiteMonitor.tsx:400:25",checked:s.enabled,onCheckedChange:()=>ge(s)})}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:405:23",children:e.jsx(w,{"code-path":"src/pages/SiteMonitor.tsx:406:25",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>me(s),children:e.jsx(ae,{"code-path":"src/pages/SiteMonitor.tsx:412:27",className:"h-4 w-4"})})})]},s.id))})]})})]})}),e.jsx(X,{"code-path":"src/pages/SiteMonitor.tsx:425:7",open:o,onOpenChange:x,children:e.jsxs(J,{"code-path":"src/pages/SiteMonitor.tsx:426:9",className:"sm:max-w-md bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsxs(K,{"code-path":"src/pages/SiteMonitor.tsx:427:11",children:[e.jsx(W,{"code-path":"src/pages/SiteMonitor.tsx:428:13",children:"添加拨测任务"}),e.jsx(Y,{"code-path":"src/pages/SiteMonitor.tsx:429:13",className:"text-[var(--dg-text-muted)]",children:"配置站点探活任务,系统将按指定频率自动检测"})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:434:11",className:"grid gap-4 py-2",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:436:13",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:437:15",htmlFor:"task-name",className:"text-[var(--dg-text-primary)]",children:"任务名称"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:438:15",id:"task-name",placeholder:"例如:官网首页检测",value:c.name,onChange:s=>m({...c,name:s.target.value})})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:447:13",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:448:15",htmlFor:"task-url",className:"text-[var(--dg-text-primary)]",children:"目标 URL"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:449:15",id:"task-url",placeholder:"例如:https://example.com 或 192.168.1.1",value:c.url,onChange:s=>m({...c,url:s.target.value})})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:458:13",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:459:15",className:"text-[var(--dg-text-primary)]",children:"协议类型"}),e.jsxs(re,{"code-path":"src/pages/SiteMonitor.tsx:460:15",value:c.type,onValueChange:s=>m({...c,type:s}),children:[e.jsx(oe,{"code-path":"src/pages/SiteMonitor.tsx:464:17",children:e.jsx(ce,{"code-path":"src/pages/SiteMonitor.tsx:465:19"})}),e.jsx(de,{"code-path":"src/pages/SiteMonitor.tsx:467:17",children:Oe.map(s=>e.jsx(A,{"code-path":"src/pages/SiteMonitor.tsx:469:21",value:s,children:s},s))})]})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:476:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:477:15",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:478:17",htmlFor:"freq",className:"text-[var(--dg-text-primary)]",children:"检测间隔 (秒)"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:481:17",id:"freq",type:"number",min:10,max:86400,value:c.frequency_sec,onChange:s=>m({...c,frequency_sec:Number(s.target.value)||60})})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:492:15",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:493:17",htmlFor:"timeout",className:"text-[var(--dg-text-primary)]",children:"超时 (秒)"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:496:17",id:"timeout",type:"number",min:1,max:300,value:c.timeout_sec,onChange:s=>m({...c,timeout_sec:Number(s.target.value)||10})})]})]}),(c.type==="HTTP"||c.type==="HTTPS")&&e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:511:15",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:512:17",htmlFor:"status-code",className:"text-[var(--dg-text-primary)]",children:"期望状态码"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:515:17",id:"status-code",type:"number",min:100,max:599,value:c.expected_status_code,onChange:s=>m({...c,expected_status_code:Number(s.target.value)||200})})]})]}),e.jsxs(Z,{"code-path":"src/pages/SiteMonitor.tsx:529:11",children:[e.jsx(w,{"code-path":"src/pages/SiteMonitor.tsx:530:13",variant:"outline",onClick:()=>x(!1),disabled:S,children:"取消"}),e.jsxs(w,{"code-path":"src/pages/SiteMonitor.tsx:533:13",onClick:pe,disabled:S,children:[S&&e.jsx(O,{"code-path":"src/pages/SiteMonitor.tsx:534:26",className:"h-4 w-4 animate-spin mr-1"}),"创建任务"]})]})]})})]})}const V=[{id:"host",name:"主机监控",icon:Te,description:"CPU / 内存 / 磁盘 / 网络 / 磁盘IO"},{id:"middleware",name:"中间件监控",icon:B,description:"Redis / MySQL 指标采集"},{id:"snmp",name:"SNMP 监控",icon:te,description:"网络设备 / 服务器硬件 (OID 模板)"},{id:"site",name:"站点拨测",icon:L,description:"HTTP / PING / DNS / TCP / WS 拨测"}];function it(){const[t,n]=i.useState("host");return e.jsxs("div",{"code-path":"src/pages/MonitorCenter.tsx:30:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/MonitorCenter.tsx:31:7",children:[e.jsx("h1",{"code-path":"src/pages/MonitorCenter.tsx:32:9",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"监控中心"}),e.jsx("p",{"code-path":"src/pages/MonitorCenter.tsx:33:9",className:"text-sm text-[var(--dg-text-muted)] mt-1",children:"全面的基础设施与应用监控"})]}),e.jsx("div",{"code-path":"src/pages/MonitorCenter.tsx:37:7",className:"flex gap-1 bg-[var(--dg-bg-secondary)] p-1 rounded-lg border border-[var(--dg-border)]",children:V.map(d=>e.jsxs("button",{"code-path":"src/pages/MonitorCenter.tsx:39:11",onClick:()=>n(d.id),className:ve("flex-1 flex items-center justify-center gap-2 px-4 py-2.5 rounded-md text-sm font-medium transition-all",t===d.id?"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-primary)] shadow-sm":"text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"),children:[e.jsx(d.icon,{"code-path":"src/pages/MonitorCenter.tsx:49:13",className:"h-4 w-4"}),e.jsx("span",{"code-path":"src/pages/MonitorCenter.tsx:50:13",className:"hidden sm:inline",children:d.name})]},d.id))}),e.jsx("p",{"code-path":"src/pages/MonitorCenter.tsx:56:7",className:"text-sm text-[var(--dg-text-muted)] -mt-4",children:V.find(d=>d.id===t)?.description}),e.jsxs("div",{"code-path":"src/pages/MonitorCenter.tsx:61:7",className:"min-h-[400px]",children:[t==="host"&&e.jsx(je,{"code-path":"src/pages/MonitorCenter.tsx:62:34"}),t==="middleware"&&e.jsx(Le,{"code-path":"src/pages/MonitorCenter.tsx:63:40"}),t==="snmp"&&e.jsx($e,{"code-path":"src/pages/MonitorCenter.tsx:64:34"}),t==="site"&&e.jsx(ze,{"code-path":"src/pages/MonitorCenter.tsx:65:34"})]})]})}export{it as MonitorCenter}; +import{r as i,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{D as X,j as ue,B as w,a as J,b as K,c as W,d as Y,e as Z,f as Ne,t as C,m as ve}from"./index-Bp-M7P_8.js";import{HostMonitor as je}from"./HostMonitor-BSWHuvXi.js";import{C as h,a as M}from"./card-BHSBTtub.js";import{B as u}from"./badge-B00SZHvE.js";import{m as be,s as H}from"./metrics-D_WSC7FH.js";import{L as O,A as R,D as B,h as ee,aG as Se,aH as z,H as ye,aI as te,P as se,T as ae,G as L,aJ as fe,R as we,b as Pe,a as Ce,C as _e,g as Te}from"./vendor-icons-BWk-DH7F.js";import{I as y}from"./input-Bnlm--la.js";import{L as j}from"./label-NkONM5Mp.js";import{S as re,a as oe,b as ce,c as de,d as A}from"./select-DbhcBWnH.js";import{T as ie,a as ne,b as $,c as l,d as xe,e as p}from"./table-u8V9iTZf.js";import{S as De}from"./switch-CEwFnSNV.js";import{s as I}from"./site-CjSdjBc1.js";import"./agent-BZUl25f5.js";import"./unwrap-D6sbt6TG.js";import"./tabs-DbNlmoQJ.js";import"./AreaChart-B_pR5s1C.js";import"./index-5FEebgvX.js";function Fe(t){return t==null||t===0?"--":t>1e9?`${(t/1e9).toFixed(1)} GB`:t>1e6?`${(t/1e6).toFixed(1)} MB`:t>1e3?`${(t/1e3).toFixed(1)} KB`:`${t} B`}function E(t){return t==null||Number.isNaN(t)?"--":`${(t*100).toFixed(1)}%`}function F(t,n=0){return t==null||Number.isNaN(t)?"--":t.toFixed(n)}function ke(t){switch(t){case"online":return"text-emerald-400";case"warning":return"text-amber-400";case"error":return"text-red-400";default:return"text-slate-500"}}function Ie(t){switch(t){case"online":return"bg-emerald-400";case"warning":return"bg-amber-400";case"error":return"bg-red-400";default:return"bg-slate-500"}}function Le(){const[t,n]=i.useState([]),[d,N]=i.useState(!0),[v,_]=i.useState(""),T=i.useCallback(async()=>{try{N(!0),_("");const r=await be.getTargets({type:"middleware",page_size:200});n(r?.list||[])}catch(r){_(r.message||"加载失败"),n([])}finally{N(!1)}},[]);i.useEffect(()=>{T()},[]);const b=t.filter(r=>r.type==="redis"||r.name?.toLowerCase().includes("redis")),o=t.filter(r=>r.type==="mysql"||r.name?.toLowerCase().includes("mysql")),x=b.find(r=>r.status==="online")||b[0],c=x?.latest_metrics||{},m=o.find(r=>r.status==="online")||o[0],S=m?.latest_metrics||{};return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:96:5",className:"space-y-6",children:[d&&e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:98:9",className:"flex items-center justify-center py-12",children:[e.jsx(O,{"code-path":"src/pages/MiddlewareMonitor.tsx:99:11",className:"h-6 w-6 animate-spin text-slate-500 mr-2"}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:100:11",className:"text-sm text-[var(--dg-text-muted)]",children:"正在加载中间件指标..."})]}),v&&!d&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:105:9",className:"bg-[var(--dg-bg-secondary)] border-red-500/30",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:106:11",className:"p-6 text-center",children:[e.jsx(R,{"code-path":"src/pages/MiddlewareMonitor.tsx:107:13",className:"h-8 w-8 text-red-400 mx-auto mb-2"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:108:13",className:"text-sm text-red-400",children:v}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:109:13",className:"text-xs text-[var(--dg-text-muted)] mt-2",children:"请确认后端服务可用且已配置中间件采集"})]})}),!d&&!v&&t.length===0&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:115:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:116:11",className:"p-12 text-center",children:[e.jsx(B,{"code-path":"src/pages/MiddlewareMonitor.tsx:117:13",className:"h-12 w-12 text-slate-600 mx-auto mb-4"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:118:13",className:"text-sm text-[var(--dg-text-muted)]",children:"暂无中间件监控目标"}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:119:13",className:"text-xs text-[var(--dg-text-muted)] mt-2",children:"需在 Agent 配置 Redis / MySQL 连接信息后启用采集"})]})}),e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:125:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:126:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:127:11",className:"flex items-center gap-2 mb-4",children:[e.jsx(B,{"code-path":"src/pages/MiddlewareMonitor.tsx:128:13",className:"h-4 w-4 text-red-400"}),e.jsx("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:129:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"Redis 监控"}),x&&e.jsxs(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:131:15",variant:"outline",className:"ml-auto text-[10px] border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:[x.name," (",x.ip,")"]})]}),x?e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:139:13",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:140:15",label:"连接数",value:F(c.redis_connected_clients)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:144:15",label:"内存",value:Fe(c.redis_used_memory)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:148:15",label:"命中率",value:E(c.redis_hit_rate)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:152:15",label:"QPS",value:F(c.redis_qps,0)})]}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:137:13",className:"text-sm text-[var(--dg-text-muted)] mb-4",children:"需在 Agent 配置 Redis 连接地址和密码后启用采集。"})]})}),e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:162:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:163:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:164:11",className:"flex items-center gap-2 mb-4",children:[e.jsx(ee,{"code-path":"src/pages/MiddlewareMonitor.tsx:165:13",className:"h-4 w-4 text-blue-400"}),e.jsx("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:166:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"MySQL 监控"}),m&&e.jsxs(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:168:15",variant:"outline",className:"ml-auto text-[10px] border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:[m.name," (",m.ip,")"]})]}),m?e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:176:13",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:177:15",label:"连接数",value:F(S.mysql_connections)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:181:15",label:"QPS",value:F(S.mysql_qps,1)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:185:15",label:"慢查询",value:F(S.mysql_slow_queries)}),e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:189:15",label:"缓冲池命中率",value:E(S.mysql_buffer_hit_rate)})]}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:174:13",className:"text-sm text-[var(--dg-text-muted)] mb-4",children:"需在 Agent 配置 MySQL 连接地址、用户名和密码后启用采集。"})]})}),t.length>0&&e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:200:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:201:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:202:13",className:"flex items-center gap-2 mb-4",children:[e.jsx(R,{"code-path":"src/pages/MiddlewareMonitor.tsx:203:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:204:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["中间件实例(",t.length,")"]})]}),e.jsx("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:208:13",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:t.map(r=>e.jsx(He,{"code-path":"src/pages/MiddlewareMonitor.tsx:210:17",target:r},r.id))})]})}),t.filter(r=>!b.includes(r)&&!o.includes(r)).length>0&&e.jsx("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:219:9",className:"space-y-4",children:t.filter(r=>!b.includes(r)&&!o.includes(r)).map(r=>e.jsx(h,{"code-path":"src/pages/MiddlewareMonitor.tsx:223:15",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/MiddlewareMonitor.tsx:224:17",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:225:19",className:"flex items-center gap-2 mb-3",children:[e.jsx(Se,{"code-path":"src/pages/MiddlewareMonitor.tsx:226:21",className:`h-3 w-3 ${ke(r.status)}`}),e.jsx("h3",{"code-path":"src/pages/MiddlewareMonitor.tsx:227:21",className:"text-sm font-medium text-[var(--dg-text-primary)] capitalize",children:r.type}),e.jsxs(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:228:21",variant:"outline",className:"text-[10px] border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:[r.name," (",r.ip,")"]})]}),Object.keys(r.latest_metrics||{}).length>0?e.jsx("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:233:21",className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:Object.entries(r.latest_metrics).map(([g,D])=>e.jsx(f,{"code-path":"src/pages/MiddlewareMonitor.tsx:235:25",label:g,value:F(D,1)},g))}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:239:21",className:"text-xs text-[var(--dg-text-muted)]",children:"暂无指标数据"})]})},r.id))})]})}function f({label:t,value:n}){return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:253:5",className:"bg-[var(--dg-bg-tertiary)] rounded-lg p-3 text-center",children:[e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:254:7",className:"text-xs text-[var(--dg-text-muted)]",children:t}),e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:255:7",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:n})]})}function He({target:t}){const n=t.latest_metrics||{},d=Object.keys(n).length;return e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:266:5",className:"bg-[var(--dg-bg-tertiary)] rounded-lg p-3 border border-[var(--dg-border)] hover:border-[var(--dg-border)]/80 transition-colors",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:267:7",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:268:9",className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:269:11",className:`inline-block w-2 h-2 rounded-full ${Ie(t.status)}`}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:270:11",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:t.name})]}),e.jsx(u,{"code-path":"src/pages/MiddlewareMonitor.tsx:272:9",variant:"outline",className:`text-[10px] capitalize ${t.status==="online"?"border-emerald-400/50 text-emerald-400":"border-[var(--dg-border)] text-[var(--dg-text-muted)]"}`,children:t.status})]}),e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:279:7",className:"text-xs text-[var(--dg-text-muted)] mb-2",children:[t.ip," · ",t.type]}),d>0?e.jsxs("div",{"code-path":"src/pages/MiddlewareMonitor.tsx:283:9",className:"flex flex-wrap gap-1.5",children:[Object.entries(n).slice(0,4).map(([N,v])=>e.jsxs("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:285:13",className:"inline-flex items-center gap-1 text-[10px] bg-[var(--dg-bg-primary)] rounded px-1.5 py-0.5 text-[var(--dg-text-secondary)]",children:[e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:286:15",className:"text-[var(--dg-text-muted)]",children:N}),e.jsx("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:287:15",className:"font-mono font-medium text-[var(--dg-text-primary)]",children:typeof v=="number"?v.toFixed(1):v})]},N)),d>4&&e.jsxs("span",{"code-path":"src/pages/MiddlewareMonitor.tsx:293:13",className:"text-[10px] text-[var(--dg-text-muted)]",children:["+",d-4," 项"]})]}):e.jsx("p",{"code-path":"src/pages/MiddlewareMonitor.tsx:297:9",className:"text-[10px] text-[var(--dg-text-muted)]",children:"暂无指标"})]})}const G={name:"",ip:"",port:161,snmp_version:"v2c",community:"public",template_id:""};function $e(){const[t,n]=i.useState({total:0,online:0,abnormal:0}),[d,N]=i.useState([]),[v,_]=i.useState(!0),[T,b]=i.useState(!1),[o,x]=i.useState({...G}),[c,m]=i.useState(!1),S=i.useCallback(async()=>{try{const a=await H.getStats();n(a)}catch{}},[]),r=i.useCallback(async()=>{try{const a=await H.getDevices();N(a.list??[])}catch{N([])}finally{_(!1)}},[]),g=i.useCallback(()=>{S(),r()},[S,r]);i.useEffect(()=>{g()},[g]);const D=async()=>{if(!(!o.name.trim()||!o.ip.trim())){m(!0);try{await H.createDevice({name:o.name.trim(),ip:o.ip.trim(),port:Number(o.port),snmp_version:o.snmp_version,community:o.community.trim(),template_id:o.template_id?Number(o.template_id):0}),b(!1),x({...G}),g()}catch{}finally{m(!1)}}},q=async a=>{try{await H.deleteDevice(a),g()}catch{}},P=a=>a==="online"?e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:146:14",className:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",children:"在线"}):a==="abnormal"?e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:149:14",className:"bg-red-500/15 text-red-400 border-red-500/30",children:"异常"}):e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:151:12",className:"bg-slate-500/15 text-slate-400 border-slate-500/30",children:"离线"});return e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:156:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:158:7",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:159:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:160:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:161:13",className:"flex items-center gap-2 mb-3",children:[e.jsx(z,{"code-path":"src/pages/SNMPMonitor.tsx:162:15",className:"h-4 w-4 text-cyan-400"}),e.jsx("h3",{"code-path":"src/pages/SNMPMonitor.tsx:163:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"网络设备"})]}),e.jsx("p",{"code-path":"src/pages/SNMPMonitor.tsx:165:13",className:"text-xs text-[var(--dg-text-muted)] mb-3",children:"交换机 / 路由器 / 防火墙"}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:166:13",className:"space-y-2",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:167:15",className:"flex justify-between text-sm",children:[e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:168:17",className:"text-[var(--dg-text-muted)]",children:"设备总数"}),e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:169:17",className:"text-[var(--dg-text-primary)] font-mono",children:t.total})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:171:15",className:"flex justify-between text-sm",children:[e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:172:17",className:"text-[var(--dg-text-muted)]",children:"在线"}),e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:173:17",className:"text-emerald-400 font-mono",children:t.online})]})]})]})}),e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:179:9",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:180:11",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:181:13",className:"flex items-center gap-2 mb-3",children:[e.jsx(ye,{"code-path":"src/pages/SNMPMonitor.tsx:182:15",className:"h-4 w-4 text-purple-400"}),e.jsx("h3",{"code-path":"src/pages/SNMPMonitor.tsx:183:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"服务器硬件"})]}),e.jsx("p",{"code-path":"src/pages/SNMPMonitor.tsx:185:13",className:"text-xs text-[var(--dg-text-muted)] mb-3",children:"iLO / iDRAC / IPMI"}),e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:186:13",className:"space-y-2",children:e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:187:15",className:"flex justify-between text-sm",children:[e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:188:17",className:"text-[var(--dg-text-muted)]",children:"异常"}),e.jsx("span",{"code-path":"src/pages/SNMPMonitor.tsx:189:17",className:"text-red-400 font-mono",children:t.abnormal})]})})]})})]}),e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:197:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:198:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:199:11",className:"flex items-center gap-2 mb-3",children:[e.jsx(te,{"code-path":"src/pages/SNMPMonitor.tsx:200:13",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/SNMPMonitor.tsx:201:13",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"OID 监控模板"})]}),e.jsx("p",{"code-path":"src/pages/SNMPMonitor.tsx:203:11",className:"text-sm text-[var(--dg-text-muted)]",children:"支持 Zabbix 兼容的 SNMP OID 模板(XML 格式),内置思科/H3C/华为交换机模板、服务器硬件监控模板。"}),e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:206:11",className:"mt-3 grid grid-cols-2 md:grid-cols-4 gap-2 text-xs text-[var(--dg-text-secondary)]",children:["思科交换机","H3C S5000","华为交换机","iLO/Dell"].map(a=>e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:208:15",className:"bg-[var(--dg-bg-tertiary)] rounded px-2 py-1 text-center border border-[var(--dg-border)]",children:a},a))})]})}),e.jsx(h,{"code-path":"src/pages/SNMPMonitor.tsx:220:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SNMPMonitor.tsx:221:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:222:11",className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:223:13",className:"flex items-center gap-2",children:[e.jsx(z,{"code-path":"src/pages/SNMPMonitor.tsx:224:15",className:"h-4 w-4 text-cyan-400"}),e.jsxs("h3",{"code-path":"src/pages/SNMPMonitor.tsx:225:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["SNMP 设备列表",!v&&e.jsxs("span",{"code-path":"src/pages/SNMPMonitor.tsx:228:19",className:"ml-2 text-xs text-[var(--dg-text-muted)] font-normal",children:["(",d.length," 台)"]})]})]}),e.jsxs(X,{"code-path":"src/pages/SNMPMonitor.tsx:236:13",open:T,onOpenChange:b,children:[e.jsx(ue,{"code-path":"src/pages/SNMPMonitor.tsx:237:15",asChild:!0,children:e.jsxs(w,{"code-path":"src/pages/SNMPMonitor.tsx:238:17",size:"sm",className:"bg-cyan-500/10 text-cyan-400 hover:bg-cyan-500/20 border border-cyan-500/30",children:[e.jsx(se,{"code-path":"src/pages/SNMPMonitor.tsx:239:19",className:"h-4 w-4"}),"添加设备"]})}),e.jsxs(J,{"code-path":"src/pages/SNMPMonitor.tsx:243:15",className:"bg-slate-900 border-[var(--dg-border)] text-[var(--dg-text-primary)] sm:max-w-md",children:[e.jsxs(K,{"code-path":"src/pages/SNMPMonitor.tsx:244:17",children:[e.jsx(W,{"code-path":"src/pages/SNMPMonitor.tsx:245:19",className:"text-[var(--dg-text-primary)]",children:"添加 SNMP 设备"}),e.jsx(Y,{"code-path":"src/pages/SNMPMonitor.tsx:246:19",className:"text-[var(--dg-text-muted)]",children:"输入设备信息以开始 SNMP 监控采集。"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:251:17",className:"grid gap-4 py-2",children:[e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:253:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:254:21",htmlFor:"snmp-name",className:"text-[var(--dg-text-muted)]",children:"设备名称"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:257:21",id:"snmp-name",placeholder:"例如: 核心交换机",value:o.name,onChange:a=>x({...o,name:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:267:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:268:21",htmlFor:"snmp-ip",className:"text-[var(--dg-text-muted)]",children:"IP 地址"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:271:21",id:"snmp-ip",placeholder:"例如: 192.168.1.1",value:o.ip,onChange:a=>x({...o,ip:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:281:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:282:21",htmlFor:"snmp-port",className:"text-[var(--dg-text-muted)]",children:"SNMP 端口"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:285:21",id:"snmp-port",type:"number",placeholder:"161",value:o.port,onChange:a=>x({...o,port:Number(a.target.value)||161}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:296:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:297:21",htmlFor:"snmp-version",className:"text-[var(--dg-text-muted)]",children:"SNMP 版本"}),e.jsxs(re,{"code-path":"src/pages/SNMPMonitor.tsx:300:21",value:o.snmp_version,onValueChange:a=>x({...o,snmp_version:a}),children:[e.jsx(oe,{"code-path":"src/pages/SNMPMonitor.tsx:304:23",id:"snmp-version",className:"w-full bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(ce,{"code-path":"src/pages/SNMPMonitor.tsx:308:25"})}),e.jsxs(de,{"code-path":"src/pages/SNMPMonitor.tsx:310:23",className:"bg-slate-800 border-slate-700 text-slate-200",children:[e.jsx(A,{"code-path":"src/pages/SNMPMonitor.tsx:311:25",value:"v2c",children:"v2c"}),e.jsx(A,{"code-path":"src/pages/SNMPMonitor.tsx:312:25",value:"v3",children:"v3"})]})]})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:318:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:319:21",htmlFor:"snmp-community",className:"text-[var(--dg-text-muted)]",children:"Community"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:322:21",id:"snmp-community",placeholder:"public",value:o.community,onChange:a=>x({...o,community:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/pages/SNMPMonitor.tsx:332:19",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SNMPMonitor.tsx:333:21",htmlFor:"snmp-template",className:"text-[var(--dg-text-muted)]",children:"模板 ID"}),e.jsx(y,{"code-path":"src/pages/SNMPMonitor.tsx:336:21",id:"snmp-template",type:"number",placeholder:"模板 ID",value:o.template_id,onChange:a=>x({...o,template_id:a.target.value}),className:"bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]})]}),e.jsxs(Z,{"code-path":"src/pages/SNMPMonitor.tsx:347:17",children:[e.jsx(w,{"code-path":"src/pages/SNMPMonitor.tsx:348:19",variant:"outline",onClick:()=>b(!1),className:"border-[var(--dg-border)] text-[var(--dg-text-muted)] hover:bg-slate-800",children:"取消"}),e.jsx(w,{"code-path":"src/pages/SNMPMonitor.tsx:355:19",onClick:D,disabled:c||!o.name.trim()||!o.ip.trim(),className:"bg-cyan-500/10 text-cyan-400 hover:bg-cyan-500/20 border border-cyan-500/30",children:c?"添加中...":"确认添加"})]})]})]})]}),v?e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:369:13",className:"py-12 text-center text-sm text-[var(--dg-text-muted)]",children:"加载中..."}):d.length===0?e.jsx("div",{"code-path":"src/pages/SNMPMonitor.tsx:371:13",className:"py-12 text-center text-sm text-[var(--dg-text-muted)] border border-dashed border-[var(--dg-border)] rounded-lg",children:"暂无 SNMP 设备,点击「添加设备」开始监控"}):e.jsxs(ie,{"code-path":"src/pages/SNMPMonitor.tsx:375:13",children:[e.jsx(ne,{"code-path":"src/pages/SNMPMonitor.tsx:376:15",children:e.jsxs($,{"code-path":"src/pages/SNMPMonitor.tsx:377:17",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:378:19",className:"text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:379:19",className:"text-[var(--dg-text-muted)]",children:"IP 地址"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:380:19",className:"text-[var(--dg-text-muted)]",children:"端口"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:381:19",className:"text-[var(--dg-text-muted)]",children:"版本"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:382:19",className:"text-[var(--dg-text-muted)]",children:"Community"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:383:19",className:"text-[var(--dg-text-muted)]",children:"模板 ID"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:384:19",className:"text-[var(--dg-text-muted)]",children:"状态"}),e.jsx(l,{"code-path":"src/pages/SNMPMonitor.tsx:385:19",className:"text-[var(--dg-text-muted)] w-16",children:"操作"})]})}),e.jsx(xe,{"code-path":"src/pages/SNMPMonitor.tsx:388:15",children:d.map(a=>e.jsxs($,{"code-path":"src/pages/SNMPMonitor.tsx:390:19",className:"border-[var(--dg-border)]",children:[e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:391:21",className:"text-[var(--dg-text-primary)] font-medium",children:a.name}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:394:21",className:"text-[var(--dg-text-muted)] font-mono text-xs",children:a.ip}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:397:21",className:"text-[var(--dg-text-muted)]",children:a.port}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:398:21",children:e.jsx(u,{"code-path":"src/pages/SNMPMonitor.tsx:399:23",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)]",children:a.snmp_version})}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:403:21",className:"text-[var(--dg-text-muted)] font-mono text-xs",children:a.community}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:406:21",className:"text-[var(--dg-text-muted)]",children:a.template_id||"--"}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:407:21",children:P(a.status)}),e.jsx(p,{"code-path":"src/pages/SNMPMonitor.tsx:408:21",children:e.jsx(w,{"code-path":"src/pages/SNMPMonitor.tsx:409:23",variant:"ghost",size:"icon-sm",onClick:()=>q(a.id),className:"text-slate-500 hover:text-red-400 hover:bg-red-500/10",title:"删除设备",children:e.jsx(ae,{"code-path":"src/pages/SNMPMonitor.tsx:416:25",className:"h-4 w-4"})})})]},a.id))})]})]})})]})}const qe=[{icon:L,name:"HTTP",color:"text-blue-400",desc:"HTTP URL 状态码 & 响应时间"},{icon:L,name:"HTTPS",color:"text-emerald-400",desc:"HTTPS SSL 证书 & 响应时间"},{icon:ee,name:"TCP",color:"text-orange-400",desc:"TCP 端口连通性检测"},{icon:L,name:"DNS",color:"text-cyan-400",desc:"域名解析延迟 & 结果验证"},{icon:fe,name:"PING",color:"text-purple-400",desc:"ICMP 连通性 & 延迟"}],Oe=["HTTP","HTTPS","TCP","DNS","PING"],Q={name:"",url:"",type:"HTTP",frequency_sec:60,timeout_sec:10,expected_status_code:200};function Re(t){switch(t){case"up":return e.jsx(_e,{"code-path":"src/pages/SiteMonitor.tsx:106:14",className:"h-4 w-4 text-emerald-400"});case"down":return e.jsx(Ce,{"code-path":"src/pages/SiteMonitor.tsx:108:14",className:"h-4 w-4 text-red-400"});default:return e.jsx(Pe,{"code-path":"src/pages/SiteMonitor.tsx:110:14",className:"h-4 w-4 text-gray-400"})}}function Be(t){switch(t){case"up":return e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:117:14",className:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",children:"正常"});case"down":return e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:119:14",className:"bg-red-500/15 text-red-400 border-red-500/30",children:"异常"});default:return e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:121:14",className:"bg-gray-500/15 text-gray-400 border-gray-500/30",children:"未知"})}}function Ae(t){return t==null||t===0?"--":t<1e3?`${t.toFixed(0)}ms`:`${(t/1e3).toFixed(2)}s`}function Ue(t){if(!t)return"--";const n=new Date(t),d=N=>String(N).padStart(2,"0");return`${d(n.getMonth()+1)}-${d(n.getDate())} ${d(n.getHours())}:${d(n.getMinutes())}`}function ze(){const[t,n]=i.useState(null),[d,N]=i.useState([]),[v,_]=i.useState(!0),[T,b]=i.useState(!1),[o,x]=i.useState(!1),[c,m]=i.useState({...Q}),[S,r]=i.useState(!1),[g,D]=i.useState(null),q=Ne(),P=i.useCallback(async()=>{try{const s=await I.getStats();n(s)}catch{}},[]),a=i.useCallback(async()=>{b(!0);try{const s=await I.getTasks();N(s?.list||[])}catch{}finally{b(!1),_(!1)}},[]);i.useEffect(()=>{P(),a()},[P,a]);const U=g?d.filter(s=>s.type?.toUpperCase()===g.toUpperCase()):d,le=()=>{m({...Q}),x(!0)},pe=async()=>{if(!c.name.trim()||!c.url.trim()){C.error("名称和 URL 不能为空");return}r(!0);try{await I.createTask({name:c.name.trim(),url:c.url.trim(),type:c.type.toLowerCase(),frequency_sec:Number(c.frequency_sec)||60,timeout_sec:Number(c.timeout_sec)||10,expected_status_code:Number(c.expected_status_code)||200}),C.success("拨测任务已创建"),x(!1),a(),P()}catch(s){C.error(s.message||"创建失败")}finally{r(!1)}},me=async s=>{if(await q({title:"删除拨测任务",description:`确定删除「${s.name}」吗?此操作不可恢复。`,variant:"destructive"}))try{await I.deleteTask(s.id),C.success("任务已删除"),a(),P()}catch(Me){C.error(Me.message||"删除失败")}},ge=async s=>{try{await I.toggleTask(s.id,!s.enabled),C.success(s.enabled?"已停用":"已启用"),a(),P()}catch(k){C.error(k.message||"操作失败")}},he=t?.availability!=null?`${(t.availability*100).toFixed(1)}%`:"--";return v?e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:249:7",className:"flex items-center justify-center py-20",children:e.jsx(O,{"code-path":"src/pages/SiteMonitor.tsx:250:9",className:"h-8 w-8 animate-spin text-[var(--dg-text-muted)]"})}):e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:256:5",className:"space-y-6",children:[e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:258:7",className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-3",children:qe.map(s=>{const k=g===s.name;return e.jsx(h,{"code-path":"src/pages/SiteMonitor.tsx:262:13",onClick:()=>D(k?null:s.name),className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] transition-colors cursor-pointer ${k?"border-[var(--dg-blue)]/60 ring-1 ring-[var(--dg-blue)]/30":"hover:border-[var(--dg-blue)]/30"}`,children:e.jsxs(M,{"code-path":"src/pages/SiteMonitor.tsx:269:15",className:"p-3 text-center",children:[e.jsx(s.icon,{"code-path":"src/pages/SiteMonitor.tsx:270:17",className:`h-5 w-5 mx-auto mb-1.5 ${s.color}`}),e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:271:17",className:"text-xs font-medium text-[var(--dg-text-primary)]",children:s.name}),e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:272:17",className:"text-[10px] text-[var(--dg-text-muted)] mt-0.5",children:s.desc})]})},s.name)})}),e.jsx(h,{"code-path":"src/pages/SiteMonitor.tsx:280:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SiteMonitor.tsx:281:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:282:11",className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:283:13",className:"flex items-center gap-2",children:[e.jsx(L,{"code-path":"src/pages/SiteMonitor.tsx:284:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsx("h3",{"code-path":"src/pages/SiteMonitor.tsx:285:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"拨测任务概览"})]}),e.jsxs(w,{"code-path":"src/pages/SiteMonitor.tsx:287:13",size:"sm",variant:"ghost",className:"h-7 text-xs text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",onClick:()=>{P(),a()},disabled:T,children:[e.jsx(we,{"code-path":"src/pages/SiteMonitor.tsx:294:15",className:`h-3.5 w-3.5 ${T?"animate-spin":""}`}),"刷新"]})]}),e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:298:11",className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[{label:"总任务数",value:t?.total_tasks??"--"},{label:"已启用",value:t?.enabled_tasks??"--"},{label:"正常",value:t?.up_count??"--",color:"text-emerald-400"},{label:"异常",value:t?.down_count??"--",color:"text-red-400"},{label:"可用率",value:he,color:"text-blue-400"}].map(s=>e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:306:15",className:"bg-[var(--dg-bg-tertiary)] rounded-lg p-3 text-center",children:[e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:307:17",className:"text-xs text-[var(--dg-text-muted)]",children:s.label}),e.jsx("p",{"code-path":"src/pages/SiteMonitor.tsx:308:17",className:`text-lg font-bold ${s.color||"text-[var(--dg-text-primary)]"}`,children:s.value})]},s.label))})]})}),e.jsx(h,{"code-path":"src/pages/SiteMonitor.tsx:318:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(M,{"code-path":"src/pages/SiteMonitor.tsx:319:9",className:"p-4",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:320:11",className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:321:13",className:"flex items-center gap-2",children:[e.jsx(R,{"code-path":"src/pages/SiteMonitor.tsx:322:15",className:"h-4 w-4 text-[var(--dg-text-muted)]"}),e.jsxs("h3",{"code-path":"src/pages/SiteMonitor.tsx:323:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["拨测任务列表",g&&e.jsxs(u,{"code-path":"src/pages/SiteMonitor.tsx:326:19",variant:"outline",className:"ml-2 text-[10px] cursor-pointer border-[var(--dg-blue)]/40 text-[var(--dg-blue)] h-5",onClick:()=>D(null),children:[g," ×"]})]})]}),e.jsxs(w,{"code-path":"src/pages/SiteMonitor.tsx:336:13",size:"sm",className:"h-8 gap-1.5",onClick:le,children:[e.jsx(se,{"code-path":"src/pages/SiteMonitor.tsx:341:15",className:"h-3.5 w-3.5"}),"添加任务"]})]}),U.length===0?e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:347:13",className:"text-center py-12 text-sm text-[var(--dg-text-muted)]",children:d.length===0?"暂无拨测任务,点击「添加任务」创建第一个":"当前筛选条件下无任务"}):e.jsx("div",{"code-path":"src/pages/SiteMonitor.tsx:353:13",className:"overflow-x-auto",children:e.jsxs(ie,{"code-path":"src/pages/SiteMonitor.tsx:354:15",children:[e.jsx(ne,{"code-path":"src/pages/SiteMonitor.tsx:355:17",children:e.jsxs($,{"code-path":"src/pages/SiteMonitor.tsx:356:19",className:"border-[var(--dg-border)] hover:bg-transparent",children:[e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:357:21",className:"text-xs text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:358:21",className:"text-xs text-[var(--dg-text-muted)]",children:"URL"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:359:21",className:"text-xs text-[var(--dg-text-muted)]",children:"类型"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:360:21",className:"text-xs text-[var(--dg-text-muted)]",children:"间隔"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:361:21",className:"text-xs text-[var(--dg-text-muted)]",children:"状态"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:362:21",className:"text-xs text-[var(--dg-text-muted)]",children:"延迟"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:363:21",className:"text-xs text-[var(--dg-text-muted)]",children:"上次检测"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:364:21",className:"text-xs text-[var(--dg-text-muted)]",children:"启用"}),e.jsx(l,{"code-path":"src/pages/SiteMonitor.tsx:365:21",className:"text-xs text-[var(--dg-text-muted)]",children:"操作"})]})}),e.jsx(xe,{"code-path":"src/pages/SiteMonitor.tsx:368:17",children:U.map(s=>e.jsxs($,{"code-path":"src/pages/SiteMonitor.tsx:370:21",className:"border-[var(--dg-border)]",children:[e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:371:23",className:"text-sm text-[var(--dg-text-primary)] font-medium",children:s.name}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:374:23",className:"text-sm text-[var(--dg-text-muted)] max-w-[200px] truncate",children:s.url}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:377:23",children:e.jsx(u,{"code-path":"src/pages/SiteMonitor.tsx:378:25",variant:"outline",className:"text-[11px] border-[var(--dg-border)]",children:s.type?.toUpperCase()})}),e.jsxs(p,{"code-path":"src/pages/SiteMonitor.tsx:382:23",className:"text-sm text-[var(--dg-text-muted)]",children:[s.frequency_sec,"s"]}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:385:23",children:e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:386:25",className:"flex items-center gap-1.5",children:[Re(s.last_status),e.jsx("span",{"code-path":"src/pages/SiteMonitor.tsx:388:27",className:"text-sm text-[var(--dg-text-muted)]",children:Be(s.last_status)})]})}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:393:23",className:"text-sm text-[var(--dg-text-muted)]",children:Ae(s.last_response_time_ms)}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:396:23",className:"text-sm text-[var(--dg-text-muted)]",children:Ue(s.last_checked_at)}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:399:23",children:e.jsx(De,{"code-path":"src/pages/SiteMonitor.tsx:400:25",checked:s.enabled,onCheckedChange:()=>ge(s)})}),e.jsx(p,{"code-path":"src/pages/SiteMonitor.tsx:405:23",children:e.jsx(w,{"code-path":"src/pages/SiteMonitor.tsx:406:25",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>me(s),children:e.jsx(ae,{"code-path":"src/pages/SiteMonitor.tsx:412:27",className:"h-4 w-4"})})})]},s.id))})]})})]})}),e.jsx(X,{"code-path":"src/pages/SiteMonitor.tsx:425:7",open:o,onOpenChange:x,children:e.jsxs(J,{"code-path":"src/pages/SiteMonitor.tsx:426:9",className:"sm:max-w-md bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsxs(K,{"code-path":"src/pages/SiteMonitor.tsx:427:11",children:[e.jsx(W,{"code-path":"src/pages/SiteMonitor.tsx:428:13",children:"添加拨测任务"}),e.jsx(Y,{"code-path":"src/pages/SiteMonitor.tsx:429:13",className:"text-[var(--dg-text-muted)]",children:"配置站点探活任务,系统将按指定频率自动检测"})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:434:11",className:"grid gap-4 py-2",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:436:13",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:437:15",htmlFor:"task-name",className:"text-[var(--dg-text-primary)]",children:"任务名称"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:438:15",id:"task-name",placeholder:"例如:官网首页检测",value:c.name,onChange:s=>m({...c,name:s.target.value})})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:447:13",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:448:15",htmlFor:"task-url",className:"text-[var(--dg-text-primary)]",children:"目标 URL"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:449:15",id:"task-url",placeholder:"例如:https://example.com 或 192.168.1.1",value:c.url,onChange:s=>m({...c,url:s.target.value})})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:458:13",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:459:15",className:"text-[var(--dg-text-primary)]",children:"协议类型"}),e.jsxs(re,{"code-path":"src/pages/SiteMonitor.tsx:460:15",value:c.type,onValueChange:s=>m({...c,type:s}),children:[e.jsx(oe,{"code-path":"src/pages/SiteMonitor.tsx:464:17",children:e.jsx(ce,{"code-path":"src/pages/SiteMonitor.tsx:465:19"})}),e.jsx(de,{"code-path":"src/pages/SiteMonitor.tsx:467:17",children:Oe.map(s=>e.jsx(A,{"code-path":"src/pages/SiteMonitor.tsx:469:21",value:s,children:s},s))})]})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:476:13",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:477:15",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:478:17",htmlFor:"freq",className:"text-[var(--dg-text-primary)]",children:"检测间隔 (秒)"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:481:17",id:"freq",type:"number",min:10,max:86400,value:c.frequency_sec,onChange:s=>m({...c,frequency_sec:Number(s.target.value)||60})})]}),e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:492:15",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:493:17",htmlFor:"timeout",className:"text-[var(--dg-text-primary)]",children:"超时 (秒)"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:496:17",id:"timeout",type:"number",min:1,max:300,value:c.timeout_sec,onChange:s=>m({...c,timeout_sec:Number(s.target.value)||10})})]})]}),(c.type==="HTTP"||c.type==="HTTPS")&&e.jsxs("div",{"code-path":"src/pages/SiteMonitor.tsx:511:15",className:"grid gap-1.5",children:[e.jsx(j,{"code-path":"src/pages/SiteMonitor.tsx:512:17",htmlFor:"status-code",className:"text-[var(--dg-text-primary)]",children:"期望状态码"}),e.jsx(y,{"code-path":"src/pages/SiteMonitor.tsx:515:17",id:"status-code",type:"number",min:100,max:599,value:c.expected_status_code,onChange:s=>m({...c,expected_status_code:Number(s.target.value)||200})})]})]}),e.jsxs(Z,{"code-path":"src/pages/SiteMonitor.tsx:529:11",children:[e.jsx(w,{"code-path":"src/pages/SiteMonitor.tsx:530:13",variant:"outline",onClick:()=>x(!1),disabled:S,children:"取消"}),e.jsxs(w,{"code-path":"src/pages/SiteMonitor.tsx:533:13",onClick:pe,disabled:S,children:[S&&e.jsx(O,{"code-path":"src/pages/SiteMonitor.tsx:534:26",className:"h-4 w-4 animate-spin mr-1"}),"创建任务"]})]})]})})]})}const V=[{id:"host",name:"主机监控",icon:Te,description:"CPU / 内存 / 磁盘 / 网络 / 磁盘IO"},{id:"middleware",name:"中间件监控",icon:B,description:"Redis / MySQL 指标采集"},{id:"snmp",name:"SNMP 监控",icon:te,description:"网络设备 / 服务器硬件 (OID 模板)"},{id:"site",name:"站点拨测",icon:L,description:"HTTP / PING / DNS / TCP / WS 拨测"}];function it(){const[t,n]=i.useState("host");return e.jsxs("div",{"code-path":"src/pages/MonitorCenter.tsx:30:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/pages/MonitorCenter.tsx:31:7",children:[e.jsx("h1",{"code-path":"src/pages/MonitorCenter.tsx:32:9",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"监控中心"}),e.jsx("p",{"code-path":"src/pages/MonitorCenter.tsx:33:9",className:"text-sm text-[var(--dg-text-muted)] mt-1",children:"全面的基础设施与应用监控"})]}),e.jsx("div",{"code-path":"src/pages/MonitorCenter.tsx:37:7",className:"flex gap-1 bg-[var(--dg-bg-secondary)] p-1 rounded-lg border border-[var(--dg-border)]",children:V.map(d=>e.jsxs("button",{"code-path":"src/pages/MonitorCenter.tsx:39:11",onClick:()=>n(d.id),className:ve("flex-1 flex items-center justify-center gap-2 px-4 py-2.5 rounded-md text-sm font-medium transition-all",t===d.id?"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-primary)] shadow-sm":"text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"),children:[e.jsx(d.icon,{"code-path":"src/pages/MonitorCenter.tsx:49:13",className:"h-4 w-4"}),e.jsx("span",{"code-path":"src/pages/MonitorCenter.tsx:50:13",className:"hidden sm:inline",children:d.name})]},d.id))}),e.jsx("p",{"code-path":"src/pages/MonitorCenter.tsx:56:7",className:"text-sm text-[var(--dg-text-muted)] -mt-4",children:V.find(d=>d.id===t)?.description}),e.jsxs("div",{"code-path":"src/pages/MonitorCenter.tsx:61:7",className:"min-h-[400px]",children:[t==="host"&&e.jsx(je,{"code-path":"src/pages/MonitorCenter.tsx:62:34"}),t==="middleware"&&e.jsx(Le,{"code-path":"src/pages/MonitorCenter.tsx:63:40"}),t==="snmp"&&e.jsx($e,{"code-path":"src/pages/MonitorCenter.tsx:64:34"}),t==="site"&&e.jsx(ze,{"code-path":"src/pages/MonitorCenter.tsx:65:34"})]})]})}export{it as MonitorCenter}; diff --git a/backend/static/assets/NamespaceManagementPage-BuGcKQSw.js b/backend/static/assets/NamespaceManagementPage-BDbop8KJ.js similarity index 97% rename from backend/static/assets/NamespaceManagementPage-BuGcKQSw.js rename to backend/static/assets/NamespaceManagementPage-BDbop8KJ.js index 7ae2a87..8ddfc2d 100644 --- a/backend/static/assets/NamespaceManagementPage-BuGcKQSw.js +++ b/backend/static/assets/NamespaceManagementPage-BDbop8KJ.js @@ -1 +1 @@ -import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as p,a as l}from"./card-B-RtdR4H.js";import{g as Z,i as ee,L as A,B as m,D as L,j as se,a as O,b as B,c as E,e as R,t as q}from"./index-LZWfu62c.js";import{B as H}from"./badge-B0F5ZNtn.js";import{I as $}from"./input-BdDauX3U.js";import{L as ae}from"./label-u-lNUbKh.js";import{T as te,a as ne,b as i,c,d as ce,e as a}from"./table-BPFYQwjr.js";import{k as j}from"./index-Z0O8nAcG.js";import{f as z,B as P,L as N,R as re,P as me,k as oe,A as pe,N as le,j as I,C as xe,l as Q,T as de}from"./vendor-icons-Aso0-eeY.js";const ge=new Set(["kube-system","kube-public","kube-node-lease","default","devops"]);function fe(){const{clusterCode:t}=Z(),F=ee(),[o,M]=n.useState([]),[u,f]=n.useState(!1),[b,J]=n.useState(""),[K,k]=n.useState(!1),[d,y]=n.useState(""),[v,w]=n.useState(!1),[g,h]=n.useState(null),[C,S]=n.useState(!1),x=n.useCallback(async()=>{if(t){f(!0);try{const s=await j.getNamespacesDetail(t);M(Array.isArray(s)?s:[])}catch{M([])}finally{f(!1)}}},[t]);n.useEffect(()=>{x()},[x]);const D=async()=>{if(!(!t||!d.trim())){w(!0);try{await j.createNamespace(t,d.trim()),y(""),k(!1),await x()}catch(s){q.error(s?.message||"创建失败")}finally{w(!1)}}},Y=async()=>{if(!(!t||!g)){S(!0);try{await j.deleteNamespace(t,g),h(null),await x()}catch(s){q.error(s?.message||"删除失败")}finally{S(!1)}}},T=o.filter(s=>!b||s.name.toLowerCase().includes(b.toLowerCase())),G=o.reduce((s,r)=>s+(r.resource_counts?.deployments||0),0),U=o.reduce((s,r)=>s+(r.resource_counts?.pods||0),0),V=o.reduce((s,r)=>s+(r.resource_counts?.services||0),0),W=o.filter(s=>s.has_resource_quota).length;return e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:109:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:111:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(A,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:112:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(z,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:113:9",className:"h-3 w-3"}),e.jsx(A,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:114:9",to:`/kubernetes/${t}`,className:"hover:text-slate-300 transition-colors",children:t}),e.jsx(z,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:115:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:116:9",className:"text-slate-300",children:"命名空间管理"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:120:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:121:9",children:[e.jsxs("h1",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:122:11",className:"text-2xl font-bold text-slate-100 flex items-center gap-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:123:13",className:"h-6 w-6 text-emerald-400"}),"命名空间管理"]}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:126:11",className:"text-sm text-slate-500 mt-1",children:"命名空间资源配额与生命周期管理"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:128:9",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:129:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:x,disabled:u,children:u?e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:131:24",className:"h-4 w-4 animate-spin"}):e.jsx(re,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:131:71",className:"h-4 w-4"})}),e.jsxs(L,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:133:11",open:K,onOpenChange:k,children:[e.jsx(se,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:134:13",asChild:!0,children:e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:135:15",className:"bg-blue-600 hover:bg-blue-700",children:[e.jsx(me,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:136:17",className:"h-4 w-4 mr-1"}),"创建命名空间"]})}),e.jsxs(O,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:139:13",children:[e.jsx(B,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:140:15",children:e.jsx(E,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:141:17",children:"创建命名空间"})}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:143:15",className:"space-y-4 py-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:144:17",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:145:19",children:"命名空间名称"}),e.jsx($,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:146:19",value:d,onChange:s=>y(s.target.value),placeholder:"例如: my-app",onKeyDown:s=>s.key==="Enter"&&D()}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:152:19",className:"text-xs text-slate-500",children:"名称需符合 DNS-1123 标准(小写字母/数字/连字符)"})]})}),e.jsxs(R,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:157:15",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:158:17",variant:"outline",onClick:()=>k(!1),children:"取消"}),e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:159:17",onClick:D,disabled:v||!d.trim(),children:[v?e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:160:31",className:"h-4 w-4 animate-spin mr-1"}):null,"创建"]})]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:170:7",className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:171:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:172:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:173:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:173:18",className:"text-xs text-slate-500",children:"命名空间"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:173:64",className:"text-xl font-bold text-emerald-400",children:o.length})]}),e.jsx(P,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:174:13",className:"h-6 w-6 opacity-30 text-emerald-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:177:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:178:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:179:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:179:18",className:"text-xs text-slate-500",children:"Deployments"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:179:71",className:"text-xl font-bold text-blue-400",children:G})]}),e.jsx(oe,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:180:13",className:"h-6 w-6 opacity-30 text-blue-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:183:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:184:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:185:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:185:18",className:"text-xs text-slate-500",children:"Pods"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:185:64",className:"text-xl font-bold text-purple-400",children:U})]}),e.jsx(pe,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:186:13",className:"h-6 w-6 opacity-30 text-purple-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:189:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:190:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:191:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:191:18",className:"text-xs text-slate-500",children:"Services"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:191:68",className:"text-xl font-bold text-cyan-400",children:V})]}),e.jsx(le,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:192:13",className:"h-6 w-6 opacity-30 text-cyan-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:195:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:196:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:197:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:197:18",className:"text-xs text-slate-500",children:"配额限制"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:197:64",className:"text-xl font-bold text-amber-400",children:W})]}),e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:198:13",className:"h-6 w-6 opacity-30 text-amber-400"})]})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:204:7",className:"flex items-center gap-3",children:e.jsx($,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:205:9",value:b,onChange:s=>J(s.target.value),placeholder:"搜索命名空间...",className:"max-w-xs bg-slate-900 border-slate-700"})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:214:7",className:"bg-slate-900 border-slate-800",children:e.jsx(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:215:9",className:"p-0",children:e.jsxs(te,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:216:11",children:[e.jsx(ne,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:217:13",children:e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:218:15",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:219:17",className:"text-slate-400",children:"名称"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:220:17",className:"text-slate-400",children:"状态"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:221:17",className:"text-slate-400",children:"年龄"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:222:17",className:"text-slate-400 text-center",children:"Deploy"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:223:17",className:"text-slate-400 text-center",children:"Pods"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:224:17",className:"text-slate-400 text-center",children:"Svc"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:225:17",className:"text-slate-400 text-center",children:"配额"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:226:17",className:"text-slate-400",children:"标签"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:227:17",className:"text-slate-400 text-center",children:"操作"})]})}),e.jsx(ce,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:230:13",children:u?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:232:17",children:e.jsxs(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:232:27",colSpan:9,className:"text-center text-slate-500 py-12",children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:233:19",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):T.length===0?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:236:17",children:e.jsxs(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:236:27",colSpan:9,className:"text-center text-slate-500 py-12",children:[e.jsx(P,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:237:19",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"暂无命名空间"]})}):T.map(s=>{const r=ge.has(s.name);return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:243:21",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:244:23",className:"font-medium",children:e.jsx("button",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:245:25",className:"text-blue-400 hover:text-blue-300 hover:underline text-left",onClick:()=>F(`/kubernetes/${t}/namespace/${s.name}`),children:s.name})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:252:23",children:e.jsxs(H,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:253:25",className:s.status==="Active"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:[s.status==="Active"?e.jsx(xe,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:254:53",className:"h-3 w-3 mr-1"}):e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:254:97",className:"h-3 w-3 mr-1"}),s.status]})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:258:23",className:"text-sm text-slate-400",children:s.age}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:259:23",className:"text-center text-sm text-slate-300",children:s.resource_counts?.deployments??0}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:260:23",className:"text-center text-sm text-slate-300",children:s.resource_counts?.pods??0}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:261:23",className:"text-center text-sm text-slate-300",children:s.resource_counts?.services??0}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:262:23",className:"text-center",children:s.has_resource_quota?e.jsxs(H,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:264:27",className:"bg-amber-500/20 text-amber-400",title:JSON.stringify(s.resource_quotas?.[0]?.status),children:[e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:265:29",className:"h-3 w-3 mr-1"}),"有"]}):e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:268:27",className:"text-xs text-slate-600",children:"-"})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:271:23",className:"text-xs",children:s.labels&&Object.keys(s.labels).length>0?e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:273:27",className:"flex flex-wrap gap-1 max-w-[200px]",children:[Object.entries(s.labels).slice(0,3).map(([_,X])=>e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:275:31",className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400",children:[_,"=",X]},_)),Object.keys(s.labels).length>3&&e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:278:31",className:"text-slate-600",children:["+",Object.keys(s.labels).length-3]})]}):e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:282:27",className:"text-slate-600",children:"-"})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:285:23",className:"text-center",children:r?e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:287:27",className:"text-xs text-slate-600",children:"系统"}):e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:289:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>h(s.name),title:"删除命名空间",children:e.jsx(de,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:295:29",className:"h-3.5 w-3.5"})})})]},s.name)})})]})})}),e.jsx(L,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:309:7",open:!!g,onOpenChange:s=>!s&&h(null),children:e.jsxs(O,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:310:9",children:[e.jsx(B,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:311:11",children:e.jsxs(E,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:312:13",className:"text-red-400 flex items-center gap-2",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:313:15",className:"h-5 w-5"}),"删除命名空间"]})}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:316:11",className:"space-y-3 py-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:317:13",className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:318:15",className:"text-sm text-red-300",children:["⚠️ 即将删除命名空间 ",e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:319:29",className:"font-bold",children:g})," 及其中所有资源。"]}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:321:15",className:"text-xs text-red-400/70 mt-1",children:"此操作不可逆,所有 Deployment/Pod/Service/ConfigMap 等资源将被永久删除。"})]})}),e.jsxs(R,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:326:11",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:327:13",variant:"outline",onClick:()=>h(null),children:"取消"}),e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:328:13",variant:"destructive",onClick:Y,disabled:C,children:[C?e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:329:27",className:"h-4 w-4 animate-spin mr-1"}):null,"确认删除"]})]})]})})]})}export{fe as default}; +import{r as n,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as p,a as l}from"./card-BHSBTtub.js";import{g as Z,i as ee,L as A,B as m,D as L,j as se,a as O,b as B,c as E,e as R,t as q}from"./index-Bp-M7P_8.js";import{B as H}from"./badge-B00SZHvE.js";import{I as $}from"./input-Bnlm--la.js";import{L as ae}from"./label-NkONM5Mp.js";import{T as te,a as ne,b as i,c,d as ce,e as a}from"./table-u8V9iTZf.js";import{k as j}from"./index-BkulU9RM.js";import{f as z,B as P,L as N,R as re,P as me,k as oe,A as pe,N as le,j as I,C as xe,l as Q,T as de}from"./vendor-icons-BWk-DH7F.js";const ge=new Set(["kube-system","kube-public","kube-node-lease","default","devops"]);function fe(){const{clusterCode:t}=Z(),F=ee(),[o,M]=n.useState([]),[u,f]=n.useState(!1),[b,J]=n.useState(""),[K,k]=n.useState(!1),[d,y]=n.useState(""),[v,w]=n.useState(!1),[g,h]=n.useState(null),[C,S]=n.useState(!1),x=n.useCallback(async()=>{if(t){f(!0);try{const s=await j.getNamespacesDetail(t);M(Array.isArray(s)?s:[])}catch{M([])}finally{f(!1)}}},[t]);n.useEffect(()=>{x()},[x]);const D=async()=>{if(!(!t||!d.trim())){w(!0);try{await j.createNamespace(t,d.trim()),y(""),k(!1),await x()}catch(s){q.error(s?.message||"创建失败")}finally{w(!1)}}},Y=async()=>{if(!(!t||!g)){S(!0);try{await j.deleteNamespace(t,g),h(null),await x()}catch(s){q.error(s?.message||"删除失败")}finally{S(!1)}}},T=o.filter(s=>!b||s.name.toLowerCase().includes(b.toLowerCase())),G=o.reduce((s,r)=>s+(r.resource_counts?.deployments||0),0),U=o.reduce((s,r)=>s+(r.resource_counts?.pods||0),0),V=o.reduce((s,r)=>s+(r.resource_counts?.services||0),0),W=o.filter(s=>s.has_resource_quota).length;return e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:109:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:111:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(A,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:112:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(z,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:113:9",className:"h-3 w-3"}),e.jsx(A,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:114:9",to:`/kubernetes/${t}`,className:"hover:text-slate-300 transition-colors",children:t}),e.jsx(z,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:115:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:116:9",className:"text-slate-300",children:"命名空间管理"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:120:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:121:9",children:[e.jsxs("h1",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:122:11",className:"text-2xl font-bold text-slate-100 flex items-center gap-2",children:[e.jsx(P,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:123:13",className:"h-6 w-6 text-emerald-400"}),"命名空间管理"]}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:126:11",className:"text-sm text-slate-500 mt-1",children:"命名空间资源配额与生命周期管理"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:128:9",className:"flex items-center gap-2",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:129:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:x,disabled:u,children:u?e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:131:24",className:"h-4 w-4 animate-spin"}):e.jsx(re,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:131:71",className:"h-4 w-4"})}),e.jsxs(L,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:133:11",open:K,onOpenChange:k,children:[e.jsx(se,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:134:13",asChild:!0,children:e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:135:15",className:"bg-blue-600 hover:bg-blue-700",children:[e.jsx(me,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:136:17",className:"h-4 w-4 mr-1"}),"创建命名空间"]})}),e.jsxs(O,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:139:13",children:[e.jsx(B,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:140:15",children:e.jsx(E,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:141:17",children:"创建命名空间"})}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:143:15",className:"space-y-4 py-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:144:17",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:145:19",children:"命名空间名称"}),e.jsx($,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:146:19",value:d,onChange:s=>y(s.target.value),placeholder:"例如: my-app",onKeyDown:s=>s.key==="Enter"&&D()}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:152:19",className:"text-xs text-slate-500",children:"名称需符合 DNS-1123 标准(小写字母/数字/连字符)"})]})}),e.jsxs(R,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:157:15",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:158:17",variant:"outline",onClick:()=>k(!1),children:"取消"}),e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:159:17",onClick:D,disabled:v||!d.trim(),children:[v?e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:160:31",className:"h-4 w-4 animate-spin mr-1"}):null,"创建"]})]})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:170:7",className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:171:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:172:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:173:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:173:18",className:"text-xs text-slate-500",children:"命名空间"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:173:64",className:"text-xl font-bold text-emerald-400",children:o.length})]}),e.jsx(P,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:174:13",className:"h-6 w-6 opacity-30 text-emerald-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:177:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:178:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:179:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:179:18",className:"text-xs text-slate-500",children:"Deployments"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:179:71",className:"text-xl font-bold text-blue-400",children:G})]}),e.jsx(oe,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:180:13",className:"h-6 w-6 opacity-30 text-blue-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:183:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:184:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:185:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:185:18",className:"text-xs text-slate-500",children:"Pods"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:185:64",className:"text-xl font-bold text-purple-400",children:U})]}),e.jsx(pe,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:186:13",className:"h-6 w-6 opacity-30 text-purple-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:189:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:190:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:191:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:191:18",className:"text-xs text-slate-500",children:"Services"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:191:68",className:"text-xl font-bold text-cyan-400",children:V})]}),e.jsx(le,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:192:13",className:"h-6 w-6 opacity-30 text-cyan-400"})]})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:195:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:196:11",className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:197:13",children:[e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:197:18",className:"text-xs text-slate-500",children:"配额限制"}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:197:64",className:"text-xl font-bold text-amber-400",children:W})]}),e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:198:13",className:"h-6 w-6 opacity-30 text-amber-400"})]})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:204:7",className:"flex items-center gap-3",children:e.jsx($,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:205:9",value:b,onChange:s=>J(s.target.value),placeholder:"搜索命名空间...",className:"max-w-xs bg-slate-900 border-slate-700"})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:214:7",className:"bg-slate-900 border-slate-800",children:e.jsx(l,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:215:9",className:"p-0",children:e.jsxs(te,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:216:11",children:[e.jsx(ne,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:217:13",children:e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:218:15",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:219:17",className:"text-slate-400",children:"名称"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:220:17",className:"text-slate-400",children:"状态"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:221:17",className:"text-slate-400",children:"年龄"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:222:17",className:"text-slate-400 text-center",children:"Deploy"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:223:17",className:"text-slate-400 text-center",children:"Pods"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:224:17",className:"text-slate-400 text-center",children:"Svc"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:225:17",className:"text-slate-400 text-center",children:"配额"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:226:17",className:"text-slate-400",children:"标签"}),e.jsx(c,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:227:17",className:"text-slate-400 text-center",children:"操作"})]})}),e.jsx(ce,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:230:13",children:u?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:232:17",children:e.jsxs(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:232:27",colSpan:9,className:"text-center text-slate-500 py-12",children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:233:19",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):T.length===0?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:236:17",children:e.jsxs(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:236:27",colSpan:9,className:"text-center text-slate-500 py-12",children:[e.jsx(P,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:237:19",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"暂无命名空间"]})}):T.map(s=>{const r=ge.has(s.name);return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:243:21",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:244:23",className:"font-medium",children:e.jsx("button",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:245:25",className:"text-blue-400 hover:text-blue-300 hover:underline text-left",onClick:()=>F(`/kubernetes/${t}/namespace/${s.name}`),children:s.name})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:252:23",children:e.jsxs(H,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:253:25",className:s.status==="Active"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:[s.status==="Active"?e.jsx(xe,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:254:53",className:"h-3 w-3 mr-1"}):e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:254:97",className:"h-3 w-3 mr-1"}),s.status]})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:258:23",className:"text-sm text-slate-400",children:s.age}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:259:23",className:"text-center text-sm text-slate-300",children:s.resource_counts?.deployments??0}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:260:23",className:"text-center text-sm text-slate-300",children:s.resource_counts?.pods??0}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:261:23",className:"text-center text-sm text-slate-300",children:s.resource_counts?.services??0}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:262:23",className:"text-center",children:s.has_resource_quota?e.jsxs(H,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:264:27",className:"bg-amber-500/20 text-amber-400",title:JSON.stringify(s.resource_quotas?.[0]?.status),children:[e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:265:29",className:"h-3 w-3 mr-1"}),"有"]}):e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:268:27",className:"text-xs text-slate-600",children:"-"})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:271:23",className:"text-xs",children:s.labels&&Object.keys(s.labels).length>0?e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:273:27",className:"flex flex-wrap gap-1 max-w-[200px]",children:[Object.entries(s.labels).slice(0,3).map(([_,X])=>e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:275:31",className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400",children:[_,"=",X]},_)),Object.keys(s.labels).length>3&&e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:278:31",className:"text-slate-600",children:["+",Object.keys(s.labels).length-3]})]}):e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:282:27",className:"text-slate-600",children:"-"})}),e.jsx(a,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:285:23",className:"text-center",children:r?e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:287:27",className:"text-xs text-slate-600",children:"系统"}):e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:289:27",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>h(s.name),title:"删除命名空间",children:e.jsx(de,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:295:29",className:"h-3.5 w-3.5"})})})]},s.name)})})]})})}),e.jsx(L,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:309:7",open:!!g,onOpenChange:s=>!s&&h(null),children:e.jsxs(O,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:310:9",children:[e.jsx(B,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:311:11",children:e.jsxs(E,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:312:13",className:"text-red-400 flex items-center gap-2",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:313:15",className:"h-5 w-5"}),"删除命名空间"]})}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:316:11",className:"space-y-3 py-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:317:13",className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:318:15",className:"text-sm text-red-300",children:["⚠️ 即将删除命名空间 ",e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:319:29",className:"font-bold",children:g})," 及其中所有资源。"]}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:321:15",className:"text-xs text-red-400/70 mt-1",children:"此操作不可逆,所有 Deployment/Pod/Service/ConfigMap 等资源将被永久删除。"})]})}),e.jsxs(R,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:326:11",children:[e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:327:13",variant:"outline",onClick:()=>h(null),children:"取消"}),e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:328:13",variant:"destructive",onClick:Y,disabled:C,children:[C?e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceManagementPage.tsx:329:27",className:"h-4 w-4 animate-spin mr-1"}):null,"确认删除"]})]})]})})]})}export{fe as default}; diff --git a/backend/static/assets/NamespaceOverviewPage-CrqNiJMQ.js b/backend/static/assets/NamespaceOverviewPage-DWvjX0rM.js similarity index 94% rename from backend/static/assets/NamespaceOverviewPage-CrqNiJMQ.js rename to backend/static/assets/NamespaceOverviewPage-DWvjX0rM.js index 9f7a5f5..826f946 100644 --- a/backend/static/assets/NamespaceOverviewPage-CrqNiJMQ.js +++ b/backend/static/assets/NamespaceOverviewPage-DWvjX0rM.js @@ -1 +1 @@ -import{r,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{g,L as l}from"./index-LZWfu62c.js";import{k as o}from"./index-Z0O8nAcG.js";import{f as i,i as h,B as b,k as N,b as f,N as u,F as k,j as w,A as j}from"./vendor-icons-Aso0-eeY.js";const P=[{type:"deployments",label:"Deployments",icon:b,desc:"工作负载副本管理"},{type:"pods",label:"Pods",icon:N,desc:"容器实例运行状态"},{type:"cronjobs",label:"CronJobs",icon:f,desc:"定时任务管理"},{type:"services",label:"Services",icon:u,desc:"服务发现与负载均衡"},{type:"ingresses",label:"Ingresses",icon:u,desc:"外部流量路由规则"},{type:"configmaps",label:"ConfigMaps",icon:k,desc:"配置字典"},{type:"secrets",label:"Secrets",icon:w,desc:"密钥与凭证"},{type:"hpas",label:"HPAs",icon:j,desc:"水平自动伸缩策略"}];function A(){const{clusterCode:t,namespace:a}=g(),[x,p]=r.useState({}),[v,m]=r.useState(!1),d=r.useCallback(async()=>{if(!(!t||!a)){m(!0);try{const e=await Promise.allSettled([o.getNamespaceDeployments(t,a),o.getNamespacePods(t,a),o.getNamespaceServices(t,a),o.getNamespaceIngresses(t,a),o.getNamespaceConfigMaps(t,a),o.getNamespaceSecrets(t,a),o.getHPAs(t,a),o.getCronJobs(t,a)]),c=n=>Array.isArray(n)?n:n?.list||n?.data||[];p({deployments:c(e[0].status==="fulfilled"?e[0].value:[]).length,pods:c(e[1].status==="fulfilled"?e[1].value:[]).length,services:c(e[2].status==="fulfilled"?e[2].value:[]).length,ingresses:c(e[3].status==="fulfilled"?e[3].value:[]).length,configmaps:c(e[4].status==="fulfilled"?e[4].value:[]).length,secrets:c(e[5].status==="fulfilled"?e[5].value:[]).length,hpas:c(e[6].status==="fulfilled"?e[6].value:[]).length,cronjobs:c(e[7].status==="fulfilled"?e[7].value:[]).length})}catch{p({})}finally{m(!1)}}},[t,a]);return r.useEffect(()=>{d()},[d]),s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:65:5",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:67:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[s.jsx(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:68:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:69:9",className:"h-3 w-3"}),s.jsx(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:70:9",to:`/kubernetes/${t}`,className:"hover:text-slate-300 transition-colors",children:t}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:71:9",className:"h-3 w-3"}),s.jsx("span",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:72:9",className:"text-slate-300",children:a})]}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:76:7",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:77:9",children:[s.jsxs("h1",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:78:11",className:"text-2xl font-bold text-slate-100 flex items-center gap-2",children:[s.jsx(h,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:79:13",className:"h-6 w-6 text-blue-400"}),a]}),s.jsx("p",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:82:11",className:"text-sm text-slate-500 mt-1",children:"命名空间概览"})]})}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:87:7",className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:P.map(e=>s.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:89:11",to:`/kubernetes/${t}/namespace/${a}/${e.type}`,className:"bg-slate-900 border border-slate-800 rounded-lg p-4 hover:border-slate-600 hover:bg-slate-800/50 transition-all group",children:[s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:93:13",className:"flex items-center justify-between mb-2",children:[s.jsx(e.icon,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:94:15",className:"h-5 w-5 text-slate-500 group-hover:text-blue-400 transition-colors"}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:95:15",className:"h-4 w-4 text-slate-600 group-hover:text-slate-400 transition-colors"})]}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:97:13",className:"text-lg font-bold text-slate-100",children:v?"-":x[e.type]??0}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:98:13",className:"text-sm text-slate-500",children:e.label}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:99:13",className:"text-xs text-slate-600 mt-1",children:e.desc})]},e.type))})]})}export{A as default}; +import{r,j as s}from"./vendor-codemirror-B1SGo4xl.js";import{g,L as l}from"./index-Bp-M7P_8.js";import{k as o}from"./index-BkulU9RM.js";import{f as i,i as h,B as b,k as N,b as f,N as u,F as k,j as w,A as j}from"./vendor-icons-BWk-DH7F.js";const P=[{type:"deployments",label:"Deployments",icon:b,desc:"工作负载副本管理"},{type:"pods",label:"Pods",icon:N,desc:"容器实例运行状态"},{type:"cronjobs",label:"CronJobs",icon:f,desc:"定时任务管理"},{type:"services",label:"Services",icon:u,desc:"服务发现与负载均衡"},{type:"ingresses",label:"Ingresses",icon:u,desc:"外部流量路由规则"},{type:"configmaps",label:"ConfigMaps",icon:k,desc:"配置字典"},{type:"secrets",label:"Secrets",icon:w,desc:"密钥与凭证"},{type:"hpas",label:"HPAs",icon:j,desc:"水平自动伸缩策略"}];function A(){const{clusterCode:t,namespace:a}=g(),[x,p]=r.useState({}),[v,m]=r.useState(!1),d=r.useCallback(async()=>{if(!(!t||!a)){m(!0);try{const e=await Promise.allSettled([o.getNamespaceDeployments(t,a),o.getNamespacePods(t,a),o.getNamespaceServices(t,a),o.getNamespaceIngresses(t,a),o.getNamespaceConfigMaps(t,a),o.getNamespaceSecrets(t,a),o.getHPAs(t,a),o.getCronJobs(t,a)]),c=n=>Array.isArray(n)?n:n?.list||n?.data||[];p({deployments:c(e[0].status==="fulfilled"?e[0].value:[]).length,pods:c(e[1].status==="fulfilled"?e[1].value:[]).length,services:c(e[2].status==="fulfilled"?e[2].value:[]).length,ingresses:c(e[3].status==="fulfilled"?e[3].value:[]).length,configmaps:c(e[4].status==="fulfilled"?e[4].value:[]).length,secrets:c(e[5].status==="fulfilled"?e[5].value:[]).length,hpas:c(e[6].status==="fulfilled"?e[6].value:[]).length,cronjobs:c(e[7].status==="fulfilled"?e[7].value:[]).length})}catch{p({})}finally{m(!1)}}},[t,a]);return r.useEffect(()=>{d()},[d]),s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:65:5",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:67:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[s.jsx(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:68:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:69:9",className:"h-3 w-3"}),s.jsx(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:70:9",to:`/kubernetes/${t}`,className:"hover:text-slate-300 transition-colors",children:t}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:71:9",className:"h-3 w-3"}),s.jsx("span",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:72:9",className:"text-slate-300",children:a})]}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:76:7",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:77:9",children:[s.jsxs("h1",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:78:11",className:"text-2xl font-bold text-slate-100 flex items-center gap-2",children:[s.jsx(h,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:79:13",className:"h-6 w-6 text-blue-400"}),a]}),s.jsx("p",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:82:11",className:"text-sm text-slate-500 mt-1",children:"命名空间概览"})]})}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:87:7",className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:P.map(e=>s.jsxs(l,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:89:11",to:`/kubernetes/${t}/namespace/${a}/${e.type}`,className:"bg-slate-900 border border-slate-800 rounded-lg p-4 hover:border-slate-600 hover:bg-slate-800/50 transition-all group",children:[s.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:93:13",className:"flex items-center justify-between mb-2",children:[s.jsx(e.icon,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:94:15",className:"h-5 w-5 text-slate-500 group-hover:text-blue-400 transition-colors"}),s.jsx(i,{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:95:15",className:"h-4 w-4 text-slate-600 group-hover:text-slate-400 transition-colors"})]}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:97:13",className:"text-lg font-bold text-slate-100",children:v?"-":x[e.type]??0}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:98:13",className:"text-sm text-slate-500",children:e.label}),s.jsx("div",{"code-path":"src/components/kubernetes/NamespaceOverviewPage.tsx:99:13",className:"text-xs text-slate-600 mt-1",children:e.desc})]},e.type))})]})}export{A as default}; diff --git a/backend/static/assets/NamespaceResourcePage-Cf6hgoD2.js b/backend/static/assets/NamespaceResourcePage-Cf6hgoD2.js deleted file mode 100644 index 3189e80..0000000 --- a/backend/static/assets/NamespaceResourcePage-Cf6hgoD2.js +++ /dev/null @@ -1 +0,0 @@ -import{r as u,j as e,R as le,y as pe,o as xe}from"./vendor-codemirror-C7mXSpXt.js";import{C as ue,a as ie}from"./card-B-RtdR4H.js";import{B as p,g as de,k as he,i as be,L as I}from"./index-LZWfu62c.js";import{I as ge}from"./input-BdDauX3U.js";import{B as m}from"./badge-B0F5ZNtn.js";import{S as U,a as J,b as G,c as X,d as q}from"./select-4xU_9B3_.js";import{T as Ne,a as ke,b as i,c as je,d as Re,e as t}from"./table-BPFYQwjr.js";import{Y as Pe,P as ve,a as fe}from"./PodFileBrowser-Bs6KRfHw.js";import{R as we}from"./ResourceVisualEditor-CXyg-7xn.js";import{u as Z}from"./use-toast-CkA38LVP.js";import{k as l}from"./index-Z0O8nAcG.js";import{ah as B,X as Ce,L as E,j as w,B as C,b as Se,A as ye,F as Ye,N as K,k as $e,f as _,R as De,v as Q,P as Ae,S as Ie,o as N,d as M,r as _e,H as Le}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";import"./vendor-xterm-20M9KZE1.js";import"./label-u-lNUbKh.js";import"./textarea-BdtIagjy.js";function Be({clusterCode:s,onClose:a,onApplied:o}){const{toast:r}=Z(),[n,x]=u.useState(""),[h,k]=u.useState(!1),S=async()=>{if(!n.trim()){r({title:"请输入 YAML",variant:"destructive"});return}k(!0);try{await l.applyYAML(s,n),r({title:"导入成功",description:"YAML 已应用到集群"}),o?.(),a()}catch(b){r({title:"导入失败",description:b.message,variant:"destructive"})}finally{k(!1)}};return e.jsx("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:39:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:a,children:e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:40:7",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[92vw] max-w-4xl max-h-[85vh] flex flex-col shadow-2xl",onClick:b=>b.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:44:9",className:"flex items-center justify-between p-4 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:45:11",className:"flex items-center gap-2",children:[e.jsx(B,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:46:13",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:47:13",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:48:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:"导入 YAML"}),e.jsx("p",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:49:15",className:"text-xs text-[var(--dg-text-muted)]",children:"支持多文档(--- 分隔),适用于新建或更新资源"})]})]}),e.jsx(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:52:11",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:a,children:e.jsx(Ce,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:52:85",className:"h-4 w-4"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:54:9",className:"flex-1 overflow-auto p-4",children:e.jsx(le,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:55:11",value:n,height:"420px",theme:xe,extensions:[pe()],onChange:x,placeholder:"粘贴 YAML 内容...",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0},style:{fontSize:"12px"}})}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:66:9",className:"flex justify-end gap-2 p-4 border-t border-[var(--dg-border)]",children:[e.jsx(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:67:11",variant:"outline",onClick:a,children:"取消"}),e.jsxs(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:68:11",className:"bg-blue-600 hover:bg-blue-700",onClick:S,disabled:h,children:[h?e.jsx(E,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:69:25",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(B,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:69:77",className:"h-4 w-4 mr-1"}),"应用"]})]})]})})}const W=["services","ingresses","configmaps","secrets","pvcs"],R=({name:s,opts:a})=>e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:36:3",className:"flex items-center gap-0.5",children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:37:5",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300",title:"可视化编辑",onClick:()=>a.onEdit?.(s),children:[e.jsx(M,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:38:43",className:"h-3.5 w-3.5 mr-1"}),"编辑"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:39:5",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-slate-400 hover:text-slate-300",title:"YAML",onClick:()=>a.onYaml?.(s),children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:40:43",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]}),L={deployments:{title:"Deployments",subtitle:"Deployment 工作负载运行状态",icon:C,columns:["名称","命名空间","副本","镜像","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:55:7",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>a.onDetail?.(s),children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:56:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:57:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:57:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:58:9",children:(()=>{const o=s.ready_replicas||0,r=s.replicas||0,n=r>0?o/r*100:0,x=o===r;return e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:63:15",className:"flex items-center gap-2 min-w-[100px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:64:17",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:65:19",className:`h-full rounded-full ${x?"bg-emerald-500":"bg-yellow-500"}`,style:{width:`${n}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:67:17",className:`text-xs ${x?"text-emerald-400":"text-yellow-400"}`,children:[o,"/",r]})]})})()}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:72:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:73:9",onClick:o=>o.stopPropagation(),children:e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:74:11",className:"flex items-center gap-0.5",children:e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:75:13",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:76:53",className:"h-3.5 w-3.5"})})})})]},s.name)},pods:{title:"Pods",subtitle:"Pod 实例运行状态",icon:$e,columns:["名称","命名空间","状态","节点","CPU","内存","重启","镜像","操作"],renderRow:(s,a)=>{const o={Running:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",Pending:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",Failed:"bg-red-500/20 text-red-400 border-red-500/30"};return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:88:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:89:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:90:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:90:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:91:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:91:22",className:o[s.status]||"bg-slate-500/20 text-slate-400",children:s.status||"Unknown"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:92:11",className:"text-sm text-slate-400",children:s.node_name||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:93:11",className:"text-sm text-cyan-400",children:s.cpu_usage_m||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:94:11",className:"text-sm text-amber-400",children:s.mem_usage_mi||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:95:11",className:s.restart_count>0?"text-yellow-400":"text-slate-500",children:s.restart_count||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:96:11",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:97:11",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:98:13",className:"flex items-center gap-1",children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:99:15",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300 hover:bg-emerald-500/10",title:"终端",onClick:()=>a.onTerminal?.(s),children:[e.jsx(_e,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:100:79",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:101:15",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-amber-400 hover:text-amber-300 hover:bg-amber-500/10",title:"文件浏览器",onClick:()=>a.onFileBrowser?.(s),children:[e.jsx(Le,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:102:82",className:"h-3.5 w-3.5 mr-1"}),"文件浏览器"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:103:15",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-blue-400 hover:text-blue-300 hover:bg-blue-500/10",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:104:55",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]})})]},s.name)}},services:{title:"Services",subtitle:"Service 网络服务",icon:K,columns:["名称","命名空间","类型","Cluster IP","端口","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:115:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:116:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:117:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:117:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:118:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:118:20",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:s.type||"-"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:119:9",className:"text-sm text-slate-400",children:s.cluster_ip||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:120:9",className:"text-sm text-slate-400",children:s.ports||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:121:9",onClick:o=>o.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:121:57",name:s.name,opts:a})})]},s.name)},ingresses:{title:"Ingresses",subtitle:"Ingress 路由规则",icon:K,columns:["名称","命名空间","Hosts","TLS","操作"],renderRow:(s,a)=>{const o=s.hosts||[];return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:131:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:132:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:133:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:133:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:134:11",className:"text-sm text-slate-400 max-w-[250px] truncate",children:o.length>0?o.join(", "):"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:135:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:135:22",className:s.tls?"bg-emerald-500/20 text-emerald-400":"bg-slate-500/20 text-slate-400",children:s.tls?"HTTPS":"HTTP"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:136:11",onClick:r=>r.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:136:59",name:s.name,opts:a})})]},s.name)}},configmaps:{title:"ConfigMaps",subtitle:"配置字典",icon:Ye,columns:["名称","命名空间","键数量","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:145:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:146:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:147:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:147:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:148:9",className:"text-sm text-slate-400",children:s.key_count||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:149:9",onClick:o=>o.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:149:57",name:s.name,opts:a})})]},s.name)},secrets:{title:"Secrets",subtitle:"密钥管理(仅名称与类型)",icon:w,columns:["名称","命名空间","类型","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:157:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:158:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:159:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:159:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:160:9",className:"text-sm text-slate-400",children:s.type||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:161:9",onClick:o=>o.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:161:57",name:s.name,opts:a})})]},s.name)},hpas:{title:"HPAs",subtitle:"水平自动伸缩",icon:ye,columns:["名称","命名空间","目标","最小/最大","CPU%","Mem%"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:169:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:170:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:171:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:171:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:172:9",className:"text-sm text-slate-400",children:[s.target_kind,"/",s.target_name]}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:173:9",className:"text-sm text-slate-400",children:[s.min_replicas,"/",s.max_replicas]}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:174:9",className:"text-sm text-slate-400",children:[s.cpu_percent??"-","%"]}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:175:9",className:"text-sm text-slate-400",children:[s.mem_percent??"-","%"]})]},s.name)},cronjobs:{title:"CronJobs",subtitle:"定时任务",icon:Se,columns:["名称","命名空间","调度","状态","上次执行"],renderRow:s=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:183:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:184:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:185:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:185:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:186:9",className:"text-sm font-mono text-slate-400",children:s.schedule||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:187:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:187:20",className:s.suspend?"bg-yellow-500/20 text-yellow-400":"bg-emerald-500/20 text-emerald-400",children:s.suspend?"已暂停":"运行中"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:188:9",className:"text-sm text-slate-400",children:s.last_schedule||"-"})]},s.name)},pvcs:{title:"存储卷声明",subtitle:"PersistentVolumeClaim",icon:C,columns:["名称","命名空间","状态","大小","StorageClass","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:196:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:197:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:198:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:198:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:199:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:199:20",className:s.phase==="Bound"?"bg-emerald-500/20 text-emerald-400":"bg-yellow-500/20 text-yellow-400",children:s.phase||"-"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:200:9",className:"text-sm text-slate-400",children:s.size||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:201:9",className:"text-sm text-slate-400",children:s.storage_class||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:202:9",onClick:o=>o.stopPropagation(),children:e.jsx(R,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:202:57",name:s.name,opts:a})})]},s.name)},statefulsets:{title:"StatefulSets",subtitle:"有状态应用",icon:C,columns:["名称","命名空间","副本","就绪","镜像"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:210:7",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>a.onDetail?.(s),children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:211:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:212:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:212:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:213:9",className:"text-sm text-slate-400",children:s.replicas||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:214:9",className:"text-sm text-slate-400",children:s.ready||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:215:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"})]},s.name)},daemonsets:{title:"DaemonSets",subtitle:"守护进程集",icon:C,columns:["名称","命名空间","期望","当前","就绪","镜像"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:223:7",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>a.onDetail?.(s),children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:224:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:225:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:225:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:226:9",className:"text-sm text-slate-400",children:s.desired||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:227:9",className:"text-sm text-slate-400",children:s.current||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:228:9",className:"text-sm text-slate-400",children:s.ready||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:229:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"})]},s.name)},serviceaccounts:{title:"ServiceAccounts",subtitle:"服务账号(RBAC 身份标识)",icon:w,columns:["名称","命名空间","Secret数","镜像拉取凭证","创建时间","操作"],renderRow:(s,a)=>e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:237:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:238:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:239:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:239:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:240:9",className:"text-sm text-slate-400",children:s.secret_count??0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:241:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image_pull_secrets&&s.image_pull_secrets.length>0?s.image_pull_secrets.join(", "):"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:244:9",className:"text-xs text-slate-500",children:s.age||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:245:9",onClick:o=>o.stopPropagation(),children:e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:246:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:247:52",className:"h-3.5 w-3.5"})})})]},s.name)},roles:{title:"Roles",subtitle:"命名空间级角色权限(RBAC)",icon:w,columns:["名称","命名空间","规则数","权限范围","创建时间","操作"],renderRow:(s,a)=>{const o=s.verbs||[],r=s.resources||[],n=o.length>4?o.slice(0,4).join(", ")+` +${o.length-4}`:o.join(", "),x=r.length>4?r.slice(0,4).join(", ")+` +${r.length-4}`:r.join(", ");return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:261:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:262:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:263:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:263:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:264:11",className:"text-sm text-slate-400",children:s.rule_count??0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:265:11",className:"text-xs text-slate-500 max-w-[280px]",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:266:13",className:"flex flex-col gap-0.5",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:267:15",className:"text-cyan-400 truncate",title:o.join(", "),children:["verbs: ",n||"-"]}),e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:268:15",className:"text-amber-400 truncate",title:r.join(", "),children:["resources: ",x||"-"]})]})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:271:11",className:"text-xs text-slate-500",children:s.age||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:272:11",onClick:h=>h.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:273:13",className:"flex items-center gap-0.5",children:[e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:274:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:275:55",className:"h-3.5 w-3.5"})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:276:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-emerald-400 hover:text-emerald-300",title:"编辑",onClick:()=>a.onEdit?.(s.name),children:e.jsx(M,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:277:55",className:"h-3.5 w-3.5"})})]})})]},s.name)}},rolebindings:{title:"RoleBindings",subtitle:"角色绑定关系(RBAC 授权)",icon:w,columns:["名称","命名空间","角色引用","绑定主体","创建时间","操作"],renderRow:(s,a)=>{const o=s.subjects||[],r=o.length>3?o.slice(0,3).join(", ")+` +${o.length-3}`:o.join(", ");return e.jsxs(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:291:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:292:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:293:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:293:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:294:11",children:e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:295:13",className:"bg-purple-500/20 text-purple-400 border-purple-500/30",children:[s.role_ref_kind||"-","/",s.role_ref_name||"-"]})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:299:11",className:"text-xs text-slate-500 max-w-[200px] truncate",title:o.join(", "),children:r||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:302:11",className:"text-xs text-slate-500",children:s.age||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:303:11",onClick:n=>n.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:304:13",className:"flex items-center gap-0.5",children:[e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:305:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:306:56",className:"h-3.5 w-3.5"})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:307:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-emerald-400 hover:text-emerald-300",title:"编辑",onClick:()=>a.onEdit?.(s.name),children:e.jsx(M,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:308:56",className:"h-3.5 w-3.5"})})]})})]},s.name)}}};function Ze(){const{clusterCode:s,namespace:a}=de(),o=he(),r=be();Z();const n=u.useMemo(()=>{const c=o.pathname.split("/"),d=c[c.length-1];if(d&&L[d])return d;if(c.length>=2){const j=c[c.length-2];if(j&&L[j])return j}return"deployments"},[o.pathname]),x=L[n],[h,k]=u.useState([]),[S,b]=u.useState([]),[ee,T]=u.useState([]),[y,z]=u.useState(!1),[V,se]=u.useState(""),[P,Y]=u.useState(null),[v,$]=u.useState(null),[te,F]=u.useState(!1),[D,H]=u.useState(null),[A,O]=u.useState(null);u.useEffect(()=>{l.getClusters().then(c=>{const d=c?.list||[];if(k(d),!s&&d.length>0){const j=d[0].code||String(d[0].id);r(`/kubernetes/${j}/namespace/${a||"default"}/${n}`,{replace:!0})}}).catch(()=>k([]))},[]),u.useEffect(()=>{s&&l.getNamespaces(s).then(c=>{const d=Array.isArray(c)?c:c?.list||c?.data||[];b(d),!a&&d.length>0&&r(`/kubernetes/${s}/namespace/${d[0]}/${n}`,{replace:!0})}).catch(()=>b([]))},[s]);const g=u.useCallback(async()=>{if(!(!s||!a)){z(!0);try{let c=[];switch(n){case"deployments":c=await l.getNamespaceDeployments(s,a).catch(()=>[]);break;case"pods":c=await l.getNamespacePods(s,a).catch(()=>[]);break;case"services":c=await l.getNamespaceServices(s,a).catch(()=>[]);break;case"ingresses":c=await l.getNamespaceIngresses(s,a).catch(()=>[]);break;case"configmaps":c=await l.getNamespaceConfigMaps(s,a).catch(()=>[]);break;case"secrets":c=await l.getNamespaceSecrets(s,a).catch(()=>[]);break;case"hpas":c=await l.getHPAs(s,a).catch(()=>[]);break;case"cronjobs":c=await l.getCronJobs(s,a).catch(()=>[]);break;case"pvcs":c=await l.getPVCs(s,a).catch(()=>[]);break;case"statefulsets":c=await l.getStatefulSets(s,a).catch(()=>[]);break;case"daemonsets":c=await l.getDaemonSets(s,a).catch(()=>[]);break;case"serviceaccounts":c=await l.getServiceAccounts(s,a).catch(()=>[]);break;case"roles":c=await l.getRoles(s,a).catch(()=>[]);break;case"rolebindings":c=await l.getRoleBindings(s,a).catch(()=>[]);break}T(Array.isArray(c)?c:c?.list||c?.data||[])}catch{T([])}finally{z(!1)}}},[s,a,n]);u.useEffect(()=>{g()},[g]);const f=ee.filter(c=>(c.name||"").toLowerCase().includes(V.toLowerCase())),ae=c=>{n==="deployments"?r(`/kubernetes/${s}/namespace/${a}/workload/view/Deployment/${c.name}`):n==="statefulsets"?r(`/kubernetes/${s}/namespace/${a}/workload/view/StatefulSet/${c.name}`):n==="daemonsets"&&r(`/kubernetes/${s}/namespace/${a}/workload/view/DaemonSet/${c.name}`)},ce=c=>Y({resource:n,name:c}),oe=c=>{W.includes(n)?$({resource:n,name:c}):Y({resource:n,name:c,editMode:!0})},ne=()=>$({resource:n,name:"",isCreate:!0}),re=()=>l.exportAsCSV(`${n}-${s}-${a}.csv`,f),me=()=>l.exportAsJSON(`${n}-${s}-${a}.json`,f);return x?e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:424:5",className:"space-y-4",children:[P&&e.jsx(Pe,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:426:9",clusterCode:s||"",namespace:a||"",resource:P.resource,name:P.name,onClose:()=>Y(null),onSaved:g,cleanBeforeEdit:!0,autoEdit:P.editMode===!0}),te&&e.jsx(Be,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:438:9",clusterCode:s||"",onClose:()=>F(!1),onApplied:g}),v&&e.jsx(we,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:445:9",clusterCode:s||"",namespace:a||"",resource:v.resource,name:v.name,isCreate:v.isCreate,onClose:()=>$(null),onSaved:g}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:456:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:457:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),s&&e.jsxs(e.Fragment,{children:[e.jsx(_,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:458:27",className:"h-3 w-3"}),e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:458:63",to:`/kubernetes/${s}`,className:"hover:text-slate-300 transition-colors",children:s})]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(_,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:459:25",className:"h-3 w-3"}),e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:459:61",to:`/kubernetes/${s}/namespace/${a}`,className:"hover:text-slate-300 transition-colors",children:a})]}),e.jsx(_,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:460:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:460:45",className:"text-slate-300",children:x.title})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:462:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:463:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:464:11",className:"text-2xl font-bold text-slate-100",children:x.title}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:465:11",className:"text-sm text-slate-500 mt-1",children:x.subtitle})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:467:9",className:"flex items-center gap-2",children:[e.jsxs(U,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:468:11",value:s||"",onValueChange:c=>r(`/kubernetes/${c}/namespace/${a||"default"}/${n}`),children:[e.jsx(J,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:469:13",className:"w-48 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(G,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:469:97",placeholder:"选择集群"})}),e.jsx(X,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:470:13",className:"bg-slate-800 border-slate-700",children:h.map(c=>e.jsx(q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:470:91",value:c.code||String(c.id),children:c.name},c.id))})]}),e.jsxs(U,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:472:11",value:a||"",onValueChange:c=>r(`/kubernetes/${s}/namespace/${c}/${n}`),children:[e.jsx(J,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:473:13",className:"w-40 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(G,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:473:97",placeholder:"命名空间"})}),e.jsx(X,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:474:13",className:"bg-slate-800 border-slate-700 max-h-[300px]",children:S.map(c=>e.jsx(q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:474:108",value:c,children:c},c))})]}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:476:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:g,disabled:y,children:y?e.jsx(E,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:477:24",className:"h-4 w-4 animate-spin"}):e.jsx(De,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:477:71",className:"h-4 w-4"})}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:479:11",variant:"outline",size:"sm",className:"h-9 border-slate-700 text-slate-400 text-xs",onClick:re,title:"导出CSV",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:480:13",className:"h-3 w-3 mr-1"}),"CSV"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:482:11",variant:"outline",size:"sm",className:"h-9 border-slate-700 text-slate-400 text-xs",onClick:me,title:"导出JSON",children:[e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:483:13",className:"h-3 w-3 mr-1"}),"JSON"]}),W.includes(n)&&e.jsxs(e.Fragment,{children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:487:15",variant:"outline",size:"sm",className:"h-9 border-slate-700 text-slate-400 text-xs",onClick:()=>F(!0),children:[e.jsx(B,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:488:17",className:"h-3 w-3 mr-1"}),"导入"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:490:15",size:"sm",className:"h-9 text-xs bg-blue-600 hover:bg-blue-700",onClick:ne,children:[e.jsx(Ae,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:491:17",className:"h-3 w-3 mr-1"}),"新建"]})]})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:497:7",className:"flex items-center gap-3 flex-wrap",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:498:7",className:"relative w-56 flex-1 min-w-[200px] max-w-xs",children:[e.jsx(Ie,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:499:9",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(ge,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:500:9",placeholder:"搜索...",value:V,onChange:c=>se(c.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]})}),e.jsx(ue,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:503:7",className:"bg-slate-900 border-slate-800",children:e.jsx(ie,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:504:9",className:"p-0",children:e.jsxs(Ne,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:505:11",children:[e.jsx(ke,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:506:13",children:e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:506:26",className:"border-slate-800 hover:bg-transparent",children:x.columns.map(c=>e.jsx(je,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:506:115",className:"text-slate-400",children:c},c))})}),e.jsx(Re,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:507:13",children:y?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:509:17",children:e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:509:27",colSpan:x.columns.length,className:"text-center text-slate-500 py-12",children:[e.jsx(E,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:509:115",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):f.length===0?e.jsx(i,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:511:17",children:e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:511:27",colSpan:x.columns.length,className:"text-center text-slate-500 py-12",children:[e.jsx(x.icon,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:511:115",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"暂无 ",x.title]})}):f.map(c=>x.renderRow(c,{clusterCode:s||"",namespace:a||"",onDetail:ae,onYaml:ce,onEdit:oe,onTerminal:d=>H(d),onFileBrowser:d=>O(d)}))})]})})}),e.jsx(ve,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:521:7",open:!!D,onOpenChange:c=>{c||H(null)},clusterId:h[0]?.id||h[0]?.code||s||"",namespace:a||"",podName:D?.name||"",containers:(D?.containers||[]).map(c=>c.name).filter(Boolean)}),e.jsx(fe,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:530:7",open:!!A,onOpenChange:c=>{c||O(null)},clusterCode:s||"",namespace:a||"",podName:A?.name||"",containers:(A?.containers||[]).map(c=>c.name).filter(Boolean)})]}):e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:421:23",className:"text-slate-400 p-8 text-center",children:["未知资源类型: ",n]})}export{Ze as default}; diff --git a/backend/static/assets/NamespaceResourcePage-CyDeBbkr.js b/backend/static/assets/NamespaceResourcePage-CyDeBbkr.js new file mode 100644 index 0000000..dfcf455 --- /dev/null +++ b/backend/static/assets/NamespaceResourcePage-CyDeBbkr.js @@ -0,0 +1 @@ +import{r as x,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as xe,a as ue}from"./card-BHSBTtub.js";import{B as p,g as ie,k as de,i as he,L as D}from"./index-Bp-M7P_8.js";import{I as be}from"./input-Bnlm--la.js";import{B as m}from"./badge-B00SZHvE.js";import{S as X,a as G,b as q,c as K,d as Q}from"./select-DbhcBWnH.js";import{T as ge,a as Ne,b as u,c as ke,d as Pe,e as t}from"./table-u8V9iTZf.js";import{M as je,b as Re,Y as ve,P as we,a as fe}from"./PodFileBrowser-CVjj8HxI.js";import{R as Ce}from"./ResourceVisualEditor-B64kRCHd.js";import{u as ee}from"./use-toast-DNZLibQY.js";import{k as l}from"./index-BkulU9RM.js";import{ah as E,X as Se,L as T,j as C,B as S,b as ye,A as Ye,F as Ae,N as W,k as $e,f as I,R as _e,v as L,P as De,S as Ie,o as N,d as z,r as Le,H as Me}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";import"./k8s-yaml-utils-4KZB_Bq_.js";import"./vendor-xterm-20M9KZE1.js";import"./label-NkONM5Mp.js";import"./textarea-BvOVhaCD.js";function Ee({clusterCode:s,onClose:a,onApplied:o}){const{toast:r}=ee(),[h,n]=x.useState(""),[d,b]=x.useState(!1),R=async()=>{if(!h.trim()){r({title:"请输入 YAML",variant:"destructive"});return}b(!0);try{await l.applyYAML(s,h),r({title:"导入成功",description:"YAML 已应用到集群"}),o?.(),a()}catch(k){r({title:"导入失败",description:k.message,variant:"destructive"})}finally{b(!1)}};return e.jsx(je,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:38:5",onClose:a,children:e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:39:7",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[92vw] max-w-4xl h-[85vh] flex flex-col shadow-2xl",onClick:k=>k.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:43:9",className:"flex items-center justify-between p-4 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:44:11",className:"flex items-center gap-2",children:[e.jsx(E,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:45:13",className:"h-5 w-5 text-[var(--dg-text-muted)]"}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:46:13",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:47:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:"导入 YAML"}),e.jsx("p",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:48:15",className:"text-xs text-[var(--dg-text-muted)]",children:"支持多文档(--- 分隔),适用于新建或更新资源"})]})]}),e.jsx(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:51:11",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:a,children:e.jsx(Se,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:51:85",className:"h-4 w-4"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:53:9",className:"flex-1 min-h-0 flex flex-col overflow-hidden p-4",children:e.jsx(Re,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:54:11",value:h,fill:!0,fontSize:"12px",onChange:n})}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:61:9",className:"flex justify-end gap-2 p-4 border-t border-[var(--dg-border)] shrink-0",children:[e.jsx(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:62:11",variant:"outline",onClick:a,children:"取消"}),e.jsxs(p,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:63:11",className:"bg-blue-600 hover:bg-blue-700",onClick:R,disabled:d,children:[d?e.jsx(T,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:64:25",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(E,{"code-path":"src/components/kubernetes/YamlImportDialog.tsx:64:77",className:"h-4 w-4 mr-1"}),"应用"]})]})]})})}const Z=["services","ingresses","configmaps","secrets","pvcs"],Te=["deployments","services","ingresses","configmaps","secrets"],j=({name:s,opts:a})=>e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:38:3",className:"flex items-center gap-0.5",children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:39:5",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300",title:"可视化编辑",onClick:()=>a.onEdit?.(s),children:[e.jsx(z,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:40:43",className:"h-3.5 w-3.5 mr-1"}),"编辑"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:41:5",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-slate-400 hover:text-slate-300",title:"YAML",onClick:()=>a.onYaml?.(s),children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:42:43",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]}),M={deployments:{title:"Deployments",subtitle:"Deployment 工作负载运行状态",icon:S,columns:["名称","命名空间","副本","镜像","操作"],renderRow:(s,a)=>e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:57:7",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>a.onDetail?.(s),children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:58:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:59:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:59:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:60:9",children:(()=>{const o=s.ready_replicas||0,r=s.replicas||0,h=r>0?o/r*100:0,n=o===r;return e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:65:15",className:"flex items-center gap-2 min-w-[100px]",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:66:17",className:"flex-1 h-1.5 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:67:19",className:`h-full rounded-full ${n?"bg-emerald-500":"bg-yellow-500"}`,style:{width:`${h}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:69:17",className:`text-xs ${n?"text-emerald-400":"text-yellow-400"}`,children:[o,"/",r]})]})})()}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:74:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:75:9",onClick:o=>o.stopPropagation(),children:e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:76:11",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-blue-400 hover:text-blue-300 hover:bg-blue-500/10",title:"查看 YAML",onClick:()=>a.onYaml?.(s.name),children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:77:51",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})})]},s.name)},pods:{title:"Pods",subtitle:"Pod 实例运行状态",icon:$e,columns:["名称","命名空间","状态","节点","CPU","内存","重启","镜像","操作"],renderRow:(s,a)=>{const o={Running:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",Pending:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",Failed:"bg-red-500/20 text-red-400 border-red-500/30"};return e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:88:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:89:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:90:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:90:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:91:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:91:22",className:o[s.status]||"bg-slate-500/20 text-slate-400",children:s.status||"Unknown"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:92:11",className:"text-sm text-slate-400",children:s.node_name||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:93:11",className:"text-sm text-cyan-400",children:s.cpu_usage_m||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:94:11",className:"text-sm text-amber-400",children:s.mem_usage_mi||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:95:11",className:s.restart_count>0?"text-yellow-400":"text-slate-500",children:s.restart_count||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:96:11",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:97:11",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:98:13",className:"flex items-center gap-1",children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:99:15",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300 hover:bg-emerald-500/10",title:"终端",onClick:()=>a.onTerminal?.(s),children:[e.jsx(Le,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:100:79",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:101:15",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-amber-400 hover:text-amber-300 hover:bg-amber-500/10",title:"文件浏览器",onClick:()=>a.onFileBrowser?.(s),children:[e.jsx(Me,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:102:82",className:"h-3.5 w-3.5 mr-1"}),"文件浏览器"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:103:15",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-blue-400 hover:text-blue-300 hover:bg-blue-500/10",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:[e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:104:55",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]})})]},s.name)}},services:{title:"Services",subtitle:"Service 网络服务",icon:W,columns:["名称","命名空间","类型","Cluster IP","端口","操作"],renderRow:(s,a)=>e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:115:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:116:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:117:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:117:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:118:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:118:20",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:s.type||"-"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:119:9",className:"text-sm text-slate-400",children:s.cluster_ip||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:120:9",className:"text-sm text-slate-400",children:s.ports||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:121:9",onClick:o=>o.stopPropagation(),children:e.jsx(j,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:121:57",name:s.name,opts:a})})]},s.name)},ingresses:{title:"Ingresses",subtitle:"Ingress 路由规则",icon:W,columns:["名称","命名空间","Hosts","TLS","操作"],renderRow:(s,a)=>{const o=s.hosts||[];return e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:131:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:132:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:133:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:133:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:134:11",className:"text-sm text-slate-400 max-w-[250px] truncate",children:o.length>0?o.join(", "):"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:135:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:135:22",className:s.tls?"bg-emerald-500/20 text-emerald-400":"bg-slate-500/20 text-slate-400",children:s.tls?"HTTPS":"HTTP"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:136:11",onClick:r=>r.stopPropagation(),children:e.jsx(j,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:136:59",name:s.name,opts:a})})]},s.name)}},configmaps:{title:"ConfigMaps",subtitle:"配置字典",icon:Ae,columns:["名称","命名空间","键数量","操作"],renderRow:(s,a)=>e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:145:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:146:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:147:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:147:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:148:9",className:"text-sm text-slate-400",children:s.key_count||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:149:9",onClick:o=>o.stopPropagation(),children:e.jsx(j,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:149:57",name:s.name,opts:a})})]},s.name)},secrets:{title:"Secrets",subtitle:"密钥管理(仅名称与类型)",icon:C,columns:["名称","命名空间","类型","操作"],renderRow:(s,a)=>e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:157:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:158:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:159:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:159:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:160:9",className:"text-sm text-slate-400",children:s.type||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:161:9",onClick:o=>o.stopPropagation(),children:e.jsx(j,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:161:57",name:s.name,opts:a})})]},s.name)},hpas:{title:"HPAs",subtitle:"水平自动伸缩",icon:Ye,columns:["名称","命名空间","目标","最小/最大","CPU%","Mem%"],renderRow:(s,a)=>e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:169:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:170:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:171:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:171:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:172:9",className:"text-sm text-slate-400",children:[s.target_kind,"/",s.target_name]}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:173:9",className:"text-sm text-slate-400",children:[s.min_replicas,"/",s.max_replicas]}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:174:9",className:"text-sm text-slate-400",children:[s.cpu_percent??"-","%"]}),e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:175:9",className:"text-sm text-slate-400",children:[s.mem_percent??"-","%"]})]},s.name)},cronjobs:{title:"CronJobs",subtitle:"定时任务",icon:ye,columns:["名称","命名空间","调度","状态","上次执行"],renderRow:s=>e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:183:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:184:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:185:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:185:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:186:9",className:"text-sm font-mono text-slate-400",children:s.schedule||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:187:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:187:20",className:s.suspend?"bg-yellow-500/20 text-yellow-400":"bg-emerald-500/20 text-emerald-400",children:s.suspend?"已暂停":"运行中"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:188:9",className:"text-sm text-slate-400",children:s.last_schedule||"-"})]},s.name)},pvcs:{title:"存储卷声明",subtitle:"PersistentVolumeClaim",icon:S,columns:["名称","命名空间","状态","大小","StorageClass","操作"],renderRow:(s,a)=>e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:196:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:197:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:198:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:198:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:199:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:199:20",className:s.phase==="Bound"?"bg-emerald-500/20 text-emerald-400":"bg-yellow-500/20 text-yellow-400",children:s.phase||"-"})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:200:9",className:"text-sm text-slate-400",children:s.size||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:201:9",className:"text-sm text-slate-400",children:s.storage_class||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:202:9",onClick:o=>o.stopPropagation(),children:e.jsx(j,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:202:57",name:s.name,opts:a})})]},s.name)},statefulsets:{title:"StatefulSets",subtitle:"有状态应用",icon:S,columns:["名称","命名空间","副本","就绪","镜像"],renderRow:(s,a)=>e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:210:7",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>a.onDetail?.(s),children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:211:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:212:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:212:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:213:9",className:"text-sm text-slate-400",children:s.replicas||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:214:9",className:"text-sm text-slate-400",children:s.ready||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:215:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"})]},s.name)},daemonsets:{title:"DaemonSets",subtitle:"守护进程集",icon:S,columns:["名称","命名空间","期望","当前","就绪","镜像"],renderRow:(s,a)=>e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:223:7",className:"border-slate-800 hover:bg-slate-800/30 cursor-pointer",onClick:()=>a.onDetail?.(s),children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:224:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:225:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:225:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:226:9",className:"text-sm text-slate-400",children:s.desired||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:227:9",className:"text-sm text-slate-400",children:s.current||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:228:9",className:"text-sm text-slate-400",children:s.ready||0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:229:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image||"-"})]},s.name)},serviceaccounts:{title:"ServiceAccounts",subtitle:"服务账号(RBAC 身份标识)",icon:C,columns:["名称","命名空间","Secret数","镜像拉取凭证","创建时间","操作"],renderRow:(s,a)=>e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:237:7",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:238:9",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:239:9",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:239:20",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:240:9",className:"text-sm text-slate-400",children:s.secret_count??0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:241:9",className:"text-xs text-slate-500 max-w-[200px] truncate",children:s.image_pull_secrets&&s.image_pull_secrets.length>0?s.image_pull_secrets.join(", "):"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:244:9",className:"text-xs text-slate-500",children:s.age||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:245:9",onClick:o=>o.stopPropagation(),children:e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:246:11",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:247:52",className:"h-3.5 w-3.5"})})})]},s.name)},roles:{title:"Roles",subtitle:"命名空间级角色权限(RBAC)",icon:C,columns:["名称","命名空间","规则数","权限范围","创建时间","操作"],renderRow:(s,a)=>{const o=s.verbs||[],r=s.resources||[],h=o.length>4?o.slice(0,4).join(", ")+` +${o.length-4}`:o.join(", "),n=r.length>4?r.slice(0,4).join(", ")+` +${r.length-4}`:r.join(", ");return e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:261:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:262:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:263:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:263:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:264:11",className:"text-sm text-slate-400",children:s.rule_count??0}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:265:11",className:"text-xs text-slate-500 max-w-[280px]",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:266:13",className:"flex flex-col gap-0.5",children:[e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:267:15",className:"text-cyan-400 truncate",title:o.join(", "),children:["verbs: ",h||"-"]}),e.jsxs("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:268:15",className:"text-amber-400 truncate",title:r.join(", "),children:["resources: ",n||"-"]})]})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:271:11",className:"text-xs text-slate-500",children:s.age||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:272:11",onClick:d=>d.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:273:13",className:"flex items-center gap-0.5",children:[e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:274:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:275:55",className:"h-3.5 w-3.5"})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:276:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-emerald-400 hover:text-emerald-300",title:"编辑",onClick:()=>a.onEdit?.(s.name),children:e.jsx(z,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:277:55",className:"h-3.5 w-3.5"})})]})})]},s.name)}},rolebindings:{title:"RoleBindings",subtitle:"角色绑定关系(RBAC 授权)",icon:C,columns:["名称","命名空间","角色引用","绑定主体","创建时间","操作"],renderRow:(s,a)=>{const o=s.subjects||[],r=o.length>3?o.slice(0,3).join(", ")+` +${o.length-3}`:o.join(", ");return e.jsxs(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:291:9",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:292:11",className:"font-medium text-slate-200",children:s.name}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:293:11",children:e.jsx(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:293:22",variant:"outline",className:"border-slate-700 text-slate-400",children:s.namespace})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:294:11",children:e.jsxs(m,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:295:13",className:"bg-purple-500/20 text-purple-400 border-purple-500/30",children:[s.role_ref_kind||"-","/",s.role_ref_name||"-"]})}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:299:11",className:"text-xs text-slate-500 max-w-[200px] truncate",title:o.join(", "),children:r||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:302:11",className:"text-xs text-slate-500",children:s.age||"-"}),e.jsx(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:303:11",onClick:h=>h.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:304:13",className:"flex items-center gap-0.5",children:[e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:305:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400 hover:text-blue-400",title:"查看YAML",onClick:()=>a.onYaml?.(s.name),children:e.jsx(N,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:306:56",className:"h-3.5 w-3.5"})}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:307:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-emerald-400 hover:text-emerald-300",title:"编辑",onClick:()=>a.onEdit?.(s.name),children:e.jsx(z,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:308:56",className:"h-3.5 w-3.5"})})]})})]},s.name)}}};function ts(){const{clusterCode:s,namespace:a}=ie(),o=de(),r=he(),{toast:h}=ee(),n=x.useMemo(()=>{const c=o.pathname.split("/"),i=c[c.length-1];if(i&&M[i])return i;if(c.length>=2){const P=c[c.length-2];if(P&&M[P])return P}return"deployments"},[o.pathname]),d=M[n],[b,R]=x.useState([]),[k,B]=x.useState([]),[se,V]=x.useState([]),[y,F]=x.useState(!1),[O,te]=x.useState(""),[v,Y]=x.useState(null),[w,A]=x.useState(null),[ae,H]=x.useState(!1),[$,U]=x.useState(null),[_,J]=x.useState(null);x.useEffect(()=>{l.getClusters().then(c=>{const i=c?.list||[];if(R(i),!s&&i.length>0){const P=i[0].code||String(i[0].id);r(`/kubernetes/${P}/namespace/${a||"default"}/${n}`,{replace:!0})}}).catch(()=>R([]))},[]),x.useEffect(()=>{s&&l.getNamespaces(s).then(c=>{const i=Array.isArray(c)?c:c?.list||c?.data||[];B(i),!a&&i.length>0&&r(`/kubernetes/${s}/namespace/${i[0]}/${n}`,{replace:!0})}).catch(()=>B([]))},[s]);const g=x.useCallback(async()=>{if(!(!s||!a)){F(!0);try{let c=[];switch(n){case"deployments":c=await l.getNamespaceDeployments(s,a).catch(()=>[]);break;case"pods":c=await l.getNamespacePods(s,a).catch(()=>[]);break;case"services":c=await l.getNamespaceServices(s,a).catch(()=>[]);break;case"ingresses":c=await l.getNamespaceIngresses(s,a).catch(()=>[]);break;case"configmaps":c=await l.getNamespaceConfigMaps(s,a).catch(()=>[]);break;case"secrets":c=await l.getNamespaceSecrets(s,a).catch(()=>[]);break;case"hpas":c=await l.getHPAs(s,a).catch(()=>[]);break;case"cronjobs":c=await l.getCronJobs(s,a).catch(()=>[]);break;case"pvcs":c=await l.getPVCs(s,a).catch(()=>[]);break;case"statefulsets":c=await l.getStatefulSets(s,a).catch(()=>[]);break;case"daemonsets":c=await l.getDaemonSets(s,a).catch(()=>[]);break;case"serviceaccounts":c=await l.getServiceAccounts(s,a).catch(()=>[]);break;case"roles":c=await l.getRoles(s,a).catch(()=>[]);break;case"rolebindings":c=await l.getRoleBindings(s,a).catch(()=>[]);break}V(Array.isArray(c)?c:c?.list||c?.data||[])}catch{V([])}finally{F(!1)}}},[s,a,n]);x.useEffect(()=>{g()},[g]);const f=se.filter(c=>(c.name||"").toLowerCase().includes(O.toLowerCase())),ce=c=>{n==="deployments"?r(`/kubernetes/${s}/namespace/${a}/workload/view/Deployment/${c.name}`):n==="statefulsets"?r(`/kubernetes/${s}/namespace/${a}/workload/view/StatefulSet/${c.name}`):n==="daemonsets"&&r(`/kubernetes/${s}/namespace/${a}/workload/view/DaemonSet/${c.name}`)},oe=c=>Y({resource:n,name:c}),ne=c=>{Z.includes(n)?A({resource:n,name:c}):Y({resource:n,name:c,editMode:!0})},re=()=>A({resource:n,name:"",isCreate:!0}),me=()=>l.exportAsCSV(`${n}-${s}-${a}.csv`,f),le=()=>l.exportAsJSON(`${n}-${s}-${a}.json`,f),pe=async()=>{if(!(!s||!a))try{await l.exportNamespaceResources(s,a),h({title:"导出完成",description:`${a} 资源 YAML 已开始下载`})}catch(c){h({title:"导出失败",description:c?.message||String(c),variant:"destructive"})}};return d?e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:433:5",className:"space-y-4",children:[v&&e.jsx(ve,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:435:9",clusterCode:s||"",namespace:a||"",resource:v.resource,name:v.name,onClose:()=>Y(null),onSaved:g,autoEdit:v.editMode===!0}),ae&&e.jsx(Ee,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:446:9",clusterCode:s||"",onClose:()=>H(!1),onApplied:g}),w&&e.jsx(Ce,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:453:9",clusterCode:s||"",namespace:a||"",resource:w.resource,name:w.name,isCreate:w.isCreate,onClose:()=>A(null),onSaved:g}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:464:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(D,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:465:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),s&&e.jsxs(e.Fragment,{children:[e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:466:27",className:"h-3 w-3"}),e.jsx(D,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:466:63",to:`/kubernetes/${s}`,className:"hover:text-slate-300 transition-colors",children:s})]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:467:25",className:"h-3 w-3"}),e.jsx(D,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:467:61",to:`/kubernetes/${s}/namespace/${a}`,className:"hover:text-slate-300 transition-colors",children:a})]}),e.jsx(I,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:468:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:468:45",className:"text-slate-300",children:d.title})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:470:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:471:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:472:11",className:"text-2xl font-bold text-slate-100",children:d.title}),e.jsx("p",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:473:11",className:"text-sm text-slate-500 mt-1",children:d.subtitle})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:475:9",className:"flex items-center gap-2",children:[e.jsxs(X,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:476:11",value:s||"",onValueChange:c=>r(`/kubernetes/${c}/namespace/${a||"default"}/${n}`),children:[e.jsx(G,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:477:13",className:"w-48 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:477:97",placeholder:"选择集群"})}),e.jsx(K,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:478:13",className:"bg-slate-800 border-slate-700",children:b.map(c=>e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:478:91",value:c.code||String(c.id),children:c.name},c.id))})]}),e.jsxs(X,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:480:11",value:a||"",onValueChange:c=>r(`/kubernetes/${s}/namespace/${c}/${n}`),children:[e.jsx(G,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:481:13",className:"w-40 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:481:97",placeholder:"命名空间"})}),e.jsx(K,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:482:13",className:"bg-slate-800 border-slate-700 max-h-[300px]",children:k.map(c=>e.jsx(Q,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:482:108",value:c,children:c},c))})]}),e.jsx(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:484:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:g,disabled:y,children:y?e.jsx(T,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:485:24",className:"h-4 w-4 animate-spin"}):e.jsx(_e,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:485:71",className:"h-4 w-4"})}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:487:11",variant:"outline",size:"sm",className:"h-9 border-slate-700 text-slate-400 text-xs",onClick:me,title:"导出CSV",children:[e.jsx(L,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:488:13",className:"h-3 w-3 mr-1"}),"CSV"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:490:11",variant:"outline",size:"sm",className:"h-9 border-slate-700 text-slate-400 text-xs",onClick:le,title:"导出JSON",children:[e.jsx(L,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:491:13",className:"h-3 w-3 mr-1"}),"JSON"]}),Te.includes(n)&&e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:494:13",variant:"outline",size:"sm",className:"h-9 border-slate-700 text-slate-400 text-xs",onClick:pe,title:"导出命名空间 YAML(tar.gz)",children:[e.jsx(L,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:495:15",className:"h-3 w-3 mr-1"}),"导出YAML"]}),Z.includes(n)&&e.jsxs(e.Fragment,{children:[e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:500:15",variant:"outline",size:"sm",className:"h-9 border-slate-700 text-slate-400 text-xs",onClick:()=>H(!0),children:[e.jsx(E,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:501:17",className:"h-3 w-3 mr-1"}),"导入"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:503:15",size:"sm",className:"h-9 text-xs bg-blue-600 hover:bg-blue-700",onClick:re,children:[e.jsx(De,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:504:17",className:"h-3 w-3 mr-1"}),"新建"]})]})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:510:7",className:"flex items-center gap-3 flex-wrap",children:e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:511:7",className:"relative w-56 flex-1 min-w-[200px] max-w-xs",children:[e.jsx(Ie,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:512:9",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(be,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:513:9",placeholder:"搜索...",value:O,onChange:c=>te(c.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]})}),e.jsx(xe,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:516:7",className:"bg-slate-900 border-slate-800",children:e.jsx(ue,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:517:9",className:"p-0",children:e.jsxs(ge,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:518:11",children:[e.jsx(Ne,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:519:13",children:e.jsx(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:519:26",className:"border-slate-800 hover:bg-transparent",children:d.columns.map(c=>e.jsx(ke,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:519:115",className:"text-slate-400",children:c},c))})}),e.jsx(Pe,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:520:13",children:y?e.jsx(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:522:17",children:e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:522:27",colSpan:d.columns.length,className:"text-center text-slate-500 py-12",children:[e.jsx(T,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:522:115",className:"h-5 w-5 animate-spin mx-auto mb-2"}),"加载中..."]})}):f.length===0?e.jsx(u,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:524:17",children:e.jsxs(t,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:524:27",colSpan:d.columns.length,className:"text-center text-slate-500 py-12",children:[e.jsx(d.icon,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:524:115",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"暂无 ",d.title]})}):f.map(c=>d.renderRow(c,{clusterCode:s||"",namespace:a||"",onDetail:ce,onYaml:oe,onEdit:ne,onTerminal:i=>U(i),onFileBrowser:i=>J(i)}))})]})})}),e.jsx(we,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:534:7",open:!!$,onOpenChange:c=>{c||U(null)},clusterId:b[0]?.id||b[0]?.code||s||"",namespace:a||"",podName:$?.name||"",containers:($?.containers||[]).map(c=>c.name).filter(Boolean)}),e.jsx(fe,{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:543:7",open:!!_,onOpenChange:c=>{c||J(null)},clusterCode:s||"",namespace:a||"",podName:_?.name||"",containers:(_?.containers||[]).map(c=>c.name).filter(Boolean)})]}):e.jsxs("div",{"code-path":"src/components/kubernetes/NamespaceResourcePage.tsx:430:23",className:"text-slate-400 p-8 text-center",children:["未知资源类型: ",n]})}export{ts as default}; diff --git a/backend/static/assets/NodeDetailPage-CSCwjDLO.js b/backend/static/assets/NodeDetailPage-DdJm3Cyj.js similarity index 98% rename from backend/static/assets/NodeDetailPage-CSCwjDLO.js rename to backend/static/assets/NodeDetailPage-DdJm3Cyj.js index 6a3f702..0bcc5a0 100644 --- a/backend/static/assets/NodeDetailPage-CSCwjDLO.js +++ b/backend/static/assets/NodeDetailPage-DdJm3Cyj.js @@ -1 +1 @@ -import{r as p,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as c,a as o}from"./card-B-RtdR4H.js";import{g as R,i as M,L as g,B as q}from"./index-LZWfu62c.js";import{B as l}from"./badge-B0F5ZNtn.js";import{T as B,a as L,b as k,c as n,d as S,e as r}from"./table-BPFYQwjr.js";import{k as F}from"./index-Z0O8nAcG.js";import{f as j,h as U,L as P,R as A,l as D,I as E,A as I,C as f,N as z,k as H}from"./vendor-icons-Aso0-eeY.js";function X(){const{clusterCode:d,nodeName:i}=R();M();const[s,N]=p.useState(null),[h,u]=p.useState(!1),b=p.useCallback(async()=>{if(!(!d||!i)){u(!0);try{const t=await F.getNodeDetail(d,i);N(t)}catch{N(null)}finally{u(!1)}}},[d,i]);p.useEffect(()=>{b()},[b]);const x=({label:t,used:a,total:v,unit:w,pct:C,color:$})=>{const m=Math.min(Math.max(C||0,0),100),T=m>80?"bg-red-500":m>60?"bg-amber-500":"bg-emerald-500";return e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:53:7",className:"space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:54:9",className:"flex items-center justify-between text-xs",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:55:11",className:"text-slate-400",children:t}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:56:11",className:"text-slate-300 font-medium",children:[a," / ",v," ",w]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:60:9",className:"flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:61:11",className:"flex-1 h-2 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:62:13",className:`h-full rounded-full ${T} transition-all duration-500`,style:{width:`${m}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:64:11",className:`text-xs font-semibold min-w-[40px] text-right ${$}`,children:[m.toFixed(0),"%"]})]})]})},_=(t,a)=>a==="True"?t==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400":"bg-slate-500/20 text-slate-400",y=t=>t==="NoSchedule"?"bg-red-500/20 text-red-400 border-red-500/30":t==="NoExecute"?"bg-red-600/20 text-red-300 border-red-600/30":t==="PreferNoSchedule"?"bg-amber-500/20 text-amber-400 border-amber-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30";return e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:89:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:91:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(g,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:92:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(j,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:93:9",className:"h-3 w-3"}),e.jsx(g,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:94:9",to:`/kubernetes/${d}`,className:"hover:text-slate-300 transition-colors",children:d}),e.jsx(j,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:95:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:96:9",className:"text-slate-300",children:i})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:100:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:101:9",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:102:11",className:"flex items-center justify-center w-12 h-12 rounded-xl bg-slate-800 border border-slate-700",children:e.jsx(U,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:103:13",className:"h-6 w-6 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:105:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:106:13",className:"flex items-center gap-2",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:107:15",className:"text-2xl font-bold text-slate-100",children:i}),e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:108:15",className:s?.role==="master"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:s?.role||"worker"}),e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:111:15",className:s?.status==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:s?.status||"Unknown"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:115:13",className:"text-sm text-slate-500 mt-0.5",children:[s?.internal_ip&&`${s.internal_ip}`,s?.hostname&&` · ${s.hostname}`]})]})]}),e.jsx(q,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:121:9",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:b,disabled:h,children:h?e.jsx(P,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:123:22",className:"h-4 w-4 animate-spin"}):e.jsx(A,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:123:69",className:"h-4 w-4"})})]}),h&&!s?e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:128:9",className:"bg-slate-900 border-slate-800",children:e.jsx(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:129:11",className:"py-16 flex items-center justify-center",children:e.jsx(P,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:130:13",className:"h-6 w-6 animate-spin text-slate-500"})})}):s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:143:11",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:145:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:146:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:147:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(E,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:148:19",className:"h-4 w-4 text-cyan-400"}),"系统信息"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:150:17",className:"space-y-2 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:151:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:152:21",className:"text-slate-500",children:"容器运行时"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:153:21",className:"text-slate-300 font-mono",children:s.container_runtime||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:155:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:156:21",className:"text-slate-500",children:"Kubelet"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:157:21",className:"text-slate-300 font-mono",children:s.kubelet_version||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:159:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:160:21",className:"text-slate-500",children:"操作系统"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:161:21",className:"text-slate-300",children:s.os_image||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:163:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:164:21",className:"text-slate-500",children:"内核版本"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:165:21",className:"text-slate-300 font-mono",children:s.kernel_version||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:167:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:168:21",className:"text-slate-500",children:"架构"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:169:21",className:"text-slate-300 font-mono",children:s.architecture||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:171:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:172:21",className:"text-slate-500",children:"创建时间"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:173:21",className:"text-slate-300",children:s.creation_time?new Date(s.creation_time).toLocaleString("zh-CN"):"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:175:19",className:"flex items-center justify-between py-1.5",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:176:21",className:"text-slate-500",children:"Pod CIDR"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:177:21",className:"text-slate-300 font-mono",children:s.pod_cidr||"-"})]})]})]})}),e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:184:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:185:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:186:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(I,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:187:19",className:"h-4 w-4 text-emerald-400"}),"资源分配率"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:189:17",className:"space-y-4 mt-4",children:[e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:191:19",label:"CPU 已分配",used:`${(s.cpu_request_m/1e3).toFixed(2)} 核`,total:`${s.cpu_allocatable} 核`,unit:"",pct:s.cpu_alloc_pct,color:"text-emerald-400"}),s.cpu_usage_m&&e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:201:21",label:"CPU 实时使用",used:s.cpu_usage_m,total:`${s.cpu_capacity} 核`,unit:"",pct:parseFloat(s.cpu_usage_m.replace("m",""))/(s.cpu_capacity*1e3)*100,color:"text-blue-400"}),e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:211:19",label:"内存已分配",used:`${s.mem_request_mi} Mi`,total:`${s.mem_allocatable_mb} Mi`,unit:"",pct:s.mem_alloc_pct,color:"text-emerald-400"}),s.mem_usage_mi&&e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:221:21",label:"内存实时使用",used:s.mem_usage_mi,total:`${s.mem_capacity_mb} Mi`,unit:"",pct:parseFloat(s.mem_usage_mi.replace("Mi","").replace("Ki","").replace("Gi",""))/s.mem_capacity_mb*100,color:"text-blue-400"}),e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:231:19",label:"Pod 数量",used:`${s.pod_count}`,total:`${s.pod_allocatable}`,unit:"",pct:s.pod_alloc_pct,color:"text-emerald-400"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:241:17",className:"mt-4 pt-3 border-t border-slate-800/50 space-y-1 text-[11px] text-slate-500",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:242:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:243:21",children:"CPU 容量 / 可分配"}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:244:21",className:"font-mono",children:[s.cpu_capacity," / ",s.cpu_allocatable," 核"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:246:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:247:21",children:"内存容量 / 可分配"}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:248:21",className:"font-mono",children:[s.mem_capacity_mb," / ",s.mem_allocatable_mb," Mi"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:250:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:251:21",children:"Pod 容量 / 可分配"}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:252:21",className:"font-mono",children:[s.pod_capacity," / ",s.pod_allocatable]})]})]})]})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:260:11",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:262:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:263:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:264:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(f,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:265:19",className:"h-4 w-4 text-blue-400"}),"节点条件"]}),!s.conditions||s.conditions.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:268:19",className:"text-xs text-slate-500 py-4 text-center",children:"无条件数据"}):e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:270:19",className:"space-y-2",children:s.conditions.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:272:23",className:"flex items-start gap-2 text-xs py-1.5 border-b border-slate-800/30 last:border-0",children:[e.jsxs(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:273:25",className:_(t.type,t.status),children:[t.status==="True"?e.jsx(f,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:274:53",className:"h-3 w-3 mr-1"}):null,t.type]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:277:25",className:"flex-1 min-w-0",children:[t.reason&&e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:278:43",className:"text-slate-400 block",children:t.reason}),t.message&&e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:279:44",className:"text-slate-600 text-[11px] block truncate",children:t.message})]})]},a))})]})}),e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:289:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:290:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:291:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(D,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:292:19",className:"h-4 w-4 text-amber-400"}),"污点 (Taints)"]}),!s.taints||s.taints.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:295:19",className:"text-xs text-slate-500 py-4 text-center",children:"无污点"}):e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:297:19",className:"space-y-2",children:s.taints.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:299:23",className:"flex items-center gap-2 text-xs",children:[e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:300:25",className:y(t.effect),children:t.effect}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:301:25",className:"text-slate-300 font-mono",children:t.key}),t.value&&e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:302:37",className:"text-slate-500",children:["= ",t.value]})]},a))})]})})]}),s.labels&&s.labels.length>0&&e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:313:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:314:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:315:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(z,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:316:19",className:"h-4 w-4 text-slate-400"}),"标签 (",s.labels.length,")"]}),e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:318:17",className:"flex flex-wrap gap-1.5",children:s.labels.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:320:21",className:"flex items-center gap-1 bg-slate-800/50 border border-slate-700/50 rounded px-2 py-0.5 text-[11px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:321:23",className:"text-slate-400",children:t.key}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:322:23",className:"text-slate-600",children:":"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:323:23",className:"text-slate-300",children:t.value})]},a))})]})}),e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:332:11",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:333:13",className:"p-0",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:334:15",className:"px-4 py-3 border-b border-slate-800",children:e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:335:17",className:"text-sm font-semibold text-slate-200 flex items-center gap-2",children:[e.jsx(H,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:336:19",className:"h-4 w-4 text-cyan-400"}),"节点上的 Pod",e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:338:19",className:"bg-slate-700/50 text-slate-300",children:s.pods?.length||0})]})}),!s.pods||s.pods.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:342:17",className:"text-xs text-slate-500 py-8 text-center",children:"该节点上暂无 Pod"}):e.jsxs(B,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:344:17",children:[e.jsx(L,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:345:19",children:e.jsxs(k,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:346:21",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:347:23",className:"text-slate-400",children:"命名空间"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:348:23",className:"text-slate-400",children:"名称"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:349:23",className:"text-slate-400",children:"状态"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:350:23",className:"text-slate-400",children:"IP"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:351:23",className:"text-slate-400",children:"CPU 请求"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:352:23",className:"text-slate-400",children:"内存请求"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:353:23",className:"text-slate-400",children:"重启次数"})]})}),e.jsx(S,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:356:19",children:s.pods.map((t,a)=>e.jsxs(k,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:358:23",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:359:25",className:"text-sm text-slate-400",children:t.namespace}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:360:25",className:"text-sm font-medium text-slate-200",children:t.name}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:361:25",children:e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:362:27",className:t.status==="Running"?"bg-emerald-500/20 text-emerald-400":t.status==="Pending"?"bg-amber-500/20 text-amber-400":"bg-red-500/20 text-red-400",children:t.status})}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:368:25",className:"text-xs text-slate-400 font-mono",children:t.ip||"-"}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:369:25",className:"text-xs text-slate-400",children:t.cpu_request_m>0?`${t.cpu_request_m}m`:"-"}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:372:25",className:"text-xs text-slate-400",children:t.mem_request_mi>0?`${t.mem_request_mi}Mi`:"-"}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:375:25",className:"text-xs",children:t.restart_count>0?e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:377:29",className:"text-amber-400",children:t.restart_count}):e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:379:29",className:"text-slate-600",children:"0"})})]},a))})]})]})})]}):e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:134:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:135:11",className:"py-16 text-center text-slate-500",children:[e.jsx(D,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:136:13",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"无法加载节点详情"]})})]})}export{X as default}; +import{r as p,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as c,a as o}from"./card-BHSBTtub.js";import{g as R,i as M,L as g,B as q}from"./index-Bp-M7P_8.js";import{B as l}from"./badge-B00SZHvE.js";import{T as B,a as L,b as k,c as n,d as S,e as r}from"./table-u8V9iTZf.js";import{k as F}from"./index-BkulU9RM.js";import{f as j,h as U,L as P,R as A,l as D,I as E,A as I,C as f,N as z,k as H}from"./vendor-icons-BWk-DH7F.js";function X(){const{clusterCode:d,nodeName:i}=R();M();const[s,N]=p.useState(null),[h,u]=p.useState(!1),b=p.useCallback(async()=>{if(!(!d||!i)){u(!0);try{const t=await F.getNodeDetail(d,i);N(t)}catch{N(null)}finally{u(!1)}}},[d,i]);p.useEffect(()=>{b()},[b]);const x=({label:t,used:a,total:v,unit:w,pct:C,color:$})=>{const m=Math.min(Math.max(C||0,0),100),T=m>80?"bg-red-500":m>60?"bg-amber-500":"bg-emerald-500";return e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:53:7",className:"space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:54:9",className:"flex items-center justify-between text-xs",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:55:11",className:"text-slate-400",children:t}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:56:11",className:"text-slate-300 font-medium",children:[a," / ",v," ",w]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:60:9",className:"flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:61:11",className:"flex-1 h-2 rounded-full bg-slate-700/50 overflow-hidden",children:e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:62:13",className:`h-full rounded-full ${T} transition-all duration-500`,style:{width:`${m}%`}})}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:64:11",className:`text-xs font-semibold min-w-[40px] text-right ${$}`,children:[m.toFixed(0),"%"]})]})]})},_=(t,a)=>a==="True"?t==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400":"bg-slate-500/20 text-slate-400",y=t=>t==="NoSchedule"?"bg-red-500/20 text-red-400 border-red-500/30":t==="NoExecute"?"bg-red-600/20 text-red-300 border-red-600/30":t==="PreferNoSchedule"?"bg-amber-500/20 text-amber-400 border-amber-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30";return e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:89:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:91:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(g,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:92:9",to:"/kubernetes",className:"hover:text-slate-300 transition-colors",children:"集群"}),e.jsx(j,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:93:9",className:"h-3 w-3"}),e.jsx(g,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:94:9",to:`/kubernetes/${d}`,className:"hover:text-slate-300 transition-colors",children:d}),e.jsx(j,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:95:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:96:9",className:"text-slate-300",children:i})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:100:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:101:9",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:102:11",className:"flex items-center justify-center w-12 h-12 rounded-xl bg-slate-800 border border-slate-700",children:e.jsx(U,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:103:13",className:"h-6 w-6 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:105:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:106:13",className:"flex items-center gap-2",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:107:15",className:"text-2xl font-bold text-slate-100",children:i}),e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:108:15",className:s?.role==="master"?"bg-blue-500/20 text-blue-400 border-blue-500/30":"bg-slate-500/20 text-slate-400 border-slate-500/30",children:s?.role||"worker"}),e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:111:15",className:s?.status==="Ready"?"bg-emerald-500/20 text-emerald-400":"bg-red-500/20 text-red-400",children:s?.status||"Unknown"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:115:13",className:"text-sm text-slate-500 mt-0.5",children:[s?.internal_ip&&`${s.internal_ip}`,s?.hostname&&` · ${s.hostname}`]})]})]}),e.jsx(q,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:121:9",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:b,disabled:h,children:h?e.jsx(P,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:123:22",className:"h-4 w-4 animate-spin"}):e.jsx(A,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:123:69",className:"h-4 w-4"})})]}),h&&!s?e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:128:9",className:"bg-slate-900 border-slate-800",children:e.jsx(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:129:11",className:"py-16 flex items-center justify-center",children:e.jsx(P,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:130:13",className:"h-6 w-6 animate-spin text-slate-500"})})}):s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:143:11",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:145:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:146:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:147:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(E,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:148:19",className:"h-4 w-4 text-cyan-400"}),"系统信息"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:150:17",className:"space-y-2 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:151:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:152:21",className:"text-slate-500",children:"容器运行时"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:153:21",className:"text-slate-300 font-mono",children:s.container_runtime||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:155:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:156:21",className:"text-slate-500",children:"Kubelet"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:157:21",className:"text-slate-300 font-mono",children:s.kubelet_version||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:159:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:160:21",className:"text-slate-500",children:"操作系统"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:161:21",className:"text-slate-300",children:s.os_image||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:163:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:164:21",className:"text-slate-500",children:"内核版本"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:165:21",className:"text-slate-300 font-mono",children:s.kernel_version||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:167:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:168:21",className:"text-slate-500",children:"架构"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:169:21",className:"text-slate-300 font-mono",children:s.architecture||"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:171:19",className:"flex items-center justify-between py-1.5 border-b border-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:172:21",className:"text-slate-500",children:"创建时间"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:173:21",className:"text-slate-300",children:s.creation_time?new Date(s.creation_time).toLocaleString("zh-CN"):"-"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:175:19",className:"flex items-center justify-between py-1.5",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:176:21",className:"text-slate-500",children:"Pod CIDR"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:177:21",className:"text-slate-300 font-mono",children:s.pod_cidr||"-"})]})]})]})}),e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:184:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:185:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:186:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(I,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:187:19",className:"h-4 w-4 text-emerald-400"}),"资源分配率"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:189:17",className:"space-y-4 mt-4",children:[e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:191:19",label:"CPU 已分配",used:`${(s.cpu_request_m/1e3).toFixed(2)} 核`,total:`${s.cpu_allocatable} 核`,unit:"",pct:s.cpu_alloc_pct,color:"text-emerald-400"}),s.cpu_usage_m&&e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:201:21",label:"CPU 实时使用",used:s.cpu_usage_m,total:`${s.cpu_capacity} 核`,unit:"",pct:parseFloat(s.cpu_usage_m.replace("m",""))/(s.cpu_capacity*1e3)*100,color:"text-blue-400"}),e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:211:19",label:"内存已分配",used:`${s.mem_request_mi} Mi`,total:`${s.mem_allocatable_mb} Mi`,unit:"",pct:s.mem_alloc_pct,color:"text-emerald-400"}),s.mem_usage_mi&&e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:221:21",label:"内存实时使用",used:s.mem_usage_mi,total:`${s.mem_capacity_mb} Mi`,unit:"",pct:parseFloat(s.mem_usage_mi.replace("Mi","").replace("Ki","").replace("Gi",""))/s.mem_capacity_mb*100,color:"text-blue-400"}),e.jsx(x,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:231:19",label:"Pod 数量",used:`${s.pod_count}`,total:`${s.pod_allocatable}`,unit:"",pct:s.pod_alloc_pct,color:"text-emerald-400"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:241:17",className:"mt-4 pt-3 border-t border-slate-800/50 space-y-1 text-[11px] text-slate-500",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:242:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:243:21",children:"CPU 容量 / 可分配"}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:244:21",className:"font-mono",children:[s.cpu_capacity," / ",s.cpu_allocatable," 核"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:246:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:247:21",children:"内存容量 / 可分配"}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:248:21",className:"font-mono",children:[s.mem_capacity_mb," / ",s.mem_allocatable_mb," Mi"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:250:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:251:21",children:"Pod 容量 / 可分配"}),e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:252:21",className:"font-mono",children:[s.pod_capacity," / ",s.pod_allocatable]})]})]})]})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:260:11",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:262:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:263:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:264:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(f,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:265:19",className:"h-4 w-4 text-blue-400"}),"节点条件"]}),!s.conditions||s.conditions.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:268:19",className:"text-xs text-slate-500 py-4 text-center",children:"无条件数据"}):e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:270:19",className:"space-y-2",children:s.conditions.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:272:23",className:"flex items-start gap-2 text-xs py-1.5 border-b border-slate-800/30 last:border-0",children:[e.jsxs(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:273:25",className:_(t.type,t.status),children:[t.status==="True"?e.jsx(f,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:274:53",className:"h-3 w-3 mr-1"}):null,t.type]}),e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:277:25",className:"flex-1 min-w-0",children:[t.reason&&e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:278:43",className:"text-slate-400 block",children:t.reason}),t.message&&e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:279:44",className:"text-slate-600 text-[11px] block truncate",children:t.message})]})]},a))})]})}),e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:289:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:290:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:291:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(D,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:292:19",className:"h-4 w-4 text-amber-400"}),"污点 (Taints)"]}),!s.taints||s.taints.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:295:19",className:"text-xs text-slate-500 py-4 text-center",children:"无污点"}):e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:297:19",className:"space-y-2",children:s.taints.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:299:23",className:"flex items-center gap-2 text-xs",children:[e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:300:25",className:y(t.effect),children:t.effect}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:301:25",className:"text-slate-300 font-mono",children:t.key}),t.value&&e.jsxs("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:302:37",className:"text-slate-500",children:["= ",t.value]})]},a))})]})})]}),s.labels&&s.labels.length>0&&e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:313:13",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:314:15",className:"p-4",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:315:17",className:"text-sm font-semibold text-slate-200 mb-3 flex items-center gap-2",children:[e.jsx(z,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:316:19",className:"h-4 w-4 text-slate-400"}),"标签 (",s.labels.length,")"]}),e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:318:17",className:"flex flex-wrap gap-1.5",children:s.labels.map((t,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:320:21",className:"flex items-center gap-1 bg-slate-800/50 border border-slate-700/50 rounded px-2 py-0.5 text-[11px]",children:[e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:321:23",className:"text-slate-400",children:t.key}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:322:23",className:"text-slate-600",children:":"}),e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:323:23",className:"text-slate-300",children:t.value})]},a))})]})}),e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:332:11",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:333:13",className:"p-0",children:[e.jsx("div",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:334:15",className:"px-4 py-3 border-b border-slate-800",children:e.jsxs("h2",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:335:17",className:"text-sm font-semibold text-slate-200 flex items-center gap-2",children:[e.jsx(H,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:336:19",className:"h-4 w-4 text-cyan-400"}),"节点上的 Pod",e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:338:19",className:"bg-slate-700/50 text-slate-300",children:s.pods?.length||0})]})}),!s.pods||s.pods.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:342:17",className:"text-xs text-slate-500 py-8 text-center",children:"该节点上暂无 Pod"}):e.jsxs(B,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:344:17",children:[e.jsx(L,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:345:19",children:e.jsxs(k,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:346:21",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:347:23",className:"text-slate-400",children:"命名空间"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:348:23",className:"text-slate-400",children:"名称"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:349:23",className:"text-slate-400",children:"状态"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:350:23",className:"text-slate-400",children:"IP"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:351:23",className:"text-slate-400",children:"CPU 请求"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:352:23",className:"text-slate-400",children:"内存请求"}),e.jsx(n,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:353:23",className:"text-slate-400",children:"重启次数"})]})}),e.jsx(S,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:356:19",children:s.pods.map((t,a)=>e.jsxs(k,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:358:23",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:359:25",className:"text-sm text-slate-400",children:t.namespace}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:360:25",className:"text-sm font-medium text-slate-200",children:t.name}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:361:25",children:e.jsx(l,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:362:27",className:t.status==="Running"?"bg-emerald-500/20 text-emerald-400":t.status==="Pending"?"bg-amber-500/20 text-amber-400":"bg-red-500/20 text-red-400",children:t.status})}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:368:25",className:"text-xs text-slate-400 font-mono",children:t.ip||"-"}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:369:25",className:"text-xs text-slate-400",children:t.cpu_request_m>0?`${t.cpu_request_m}m`:"-"}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:372:25",className:"text-xs text-slate-400",children:t.mem_request_mi>0?`${t.mem_request_mi}Mi`:"-"}),e.jsx(r,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:375:25",className:"text-xs",children:t.restart_count>0?e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:377:29",className:"text-amber-400",children:t.restart_count}):e.jsx("span",{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:379:29",className:"text-slate-600",children:"0"})})]},a))})]})]})})]}):e.jsx(c,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:134:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(o,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:135:11",className:"py-16 text-center text-slate-500",children:[e.jsx(D,{"code-path":"src/components/kubernetes/NodeDetailPage.tsx:136:13",className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"无法加载节点详情"]})})]})}export{X as default}; diff --git a/backend/static/assets/PipelineEditor-BEQjb4Gp.js b/backend/static/assets/PipelineEditor-DYHqinGQ.js similarity index 98% rename from backend/static/assets/PipelineEditor-BEQjb4Gp.js rename to backend/static/assets/PipelineEditor-DYHqinGQ.js index c5c1ae8..9a5a5d8 100644 --- a/backend/static/assets/PipelineEditor-BEQjb4Gp.js +++ b/backend/static/assets/PipelineEditor-DYHqinGQ.js @@ -1 +1 @@ -import{r as i,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as P,a as E}from"./card-B-RtdR4H.js";import{g as Qe,f as Xe,t as m,B as p,D as Ye,a as Ze,b as qe,c as es}from"./index-LZWfu62c.js";import{I as u}from"./input-BdDauX3U.js";import{B as j}from"./badge-B0F5ZNtn.js";import{T as ss,a as ts,b as C,c as k}from"./tabs-kmtfM2I-.js";import{S as $,a as O,b as V,c as B,d as h}from"./select-4xU_9B3_.js";import{T as os}from"./textarea-BdtIagjy.js";import{S as G}from"./switch-C4PJnJ9I.js";import{L as y}from"./label-u-lNUbKh.js";import{p as g}from"./pipeline-Lgvc2XUS.js";import{d as ns}from"./config-DAXaHuse.js";import{L as H,J as R,$ as cs,z as ds,j as je,P as D,Q as Pe,f as Ee,O as is,T as S,b as ue,a0 as ve,a1 as Ne,w as rs,X as as,a2 as be,F as ps,a3 as ls,V as xs,k as ms,o as hs,r as ys,a4 as gs,a5 as js,h as Ps,a6 as fe,a7 as Es}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const us={source:"拉取代码",build:"构建",deploy:"部署",test:"测试",custom:"自定义"},we={GitBranch:R,Wrench:fe,Server:Ps,FlaskConical:js,Zap:gs,Terminal:ys,FileCode:hs,Container:ms};function vs(){return`tsk-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}function Ce(r){if(!r)return"-";if(r<60)return`${r}s`;const d=Math.floor(r/60),c=r%60;return c>0?`${d}分${c}秒`:`${d}分`}function Ns({task:r,selected:d,onSelect:c,onDelete:v}){const a=we[r.icon]||fe;return e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:75:5",onClick:c,className:`flex items-center gap-3 p-3 rounded-md border cursor-pointer transition-all group ${d?"border-blue-500 bg-blue-500/10":"border-[var(--dg-border)] hover:border-slate-400 bg-[var(--dg-bg-secondary)]"}`,children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:81:7",className:`p-1.5 rounded ${d?"bg-blue-100":"bg-slate-100 dark:bg-slate-800"}`,children:e.jsx(a,{"code-path":"src/components/deploy/PipelineEditor.tsx:82:9",className:`w-4 h-4 ${d?"text-blue-600":"text-[var(--dg-text-secondary)]"}`})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:84:7",className:"flex-1 min-w-0",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:85:9",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:r.name}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:86:9",className:"text-xs text-[var(--dg-text-secondary)]",children:r.type})]}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:88:7",variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100",onClick:x=>{x.stopPropagation(),v()},children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:89:9",className:"w-3.5 h-3.5 text-red-500"})})]})}function bs({task:r,onUpdate:d}){return r?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:99:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:100:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:100:34",className:"text-xs",children:"任务名称"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:100:73",value:r.name,onChange:c=>d({...r,name:c.target.value}),className:"h-8 text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:101:7",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:102:9",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:102:36",className:"text-xs",children:"类型"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:11",value:r.type,onValueChange:c=>d({...r,type:c}),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:89",className:"h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:128"})}),e.jsxs(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:13",children:[e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:28",value:"build",children:"构建"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:69",value:"deploy",children:"部署"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:111",value:"test",children:"测试"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:151",value:"custom",children:"自定义"})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:106:9",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:106:36",className:"text-xs",children:"图标"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:11",value:r.icon,onValueChange:c=>d({...r,icon:c}),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:89",className:"h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:128"})}),e.jsx(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:108:13",children:Object.entries(we).map(([c])=>e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:108:69",value:c,children:c},c))})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:111:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:111:34",className:"text-xs",children:"脚本类型"}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:112:9",className:"flex gap-2",children:["shell","python"].map(c=>e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:112:68",variant:r.script_type===c?"default":"outline",className:"cursor-pointer text-xs",onClick:()=>d({...r,script_type:c}),children:c},c))})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:114:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:114:34",className:"text-xs",children:"脚本内容"}),e.jsx(os,{"code-path":"src/components/deploy/PipelineEditor.tsx:115:9",value:r.script,onChange:c=>d({...r,script:c.target.value}),className:"font-mono text-xs min-h-[200px] bg-slate-950 text-green-400",placeholder:"#!/bin/bash\\nset -e\\necho 'hello'"})]})]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:97:21",className:"p-6 text-center text-[var(--dg-text-secondary)] text-sm",children:"选择一个任务开始编辑"})}function fs({open:r,onClose:d,run:c,logs:v}){return e.jsx(Ye,{"code-path":"src/components/deploy/PipelineEditor.tsx:124:5",open:r,onOpenChange:d,children:e.jsxs(Ze,{"code-path":"src/components/deploy/PipelineEditor.tsx:125:7",className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[e.jsx(qe,{"code-path":"src/components/deploy/PipelineEditor.tsx:126:9",children:e.jsxs(es,{"code-path":"src/components/deploy/PipelineEditor.tsx:126:23",className:"flex items-center gap-2",children:[e.jsx(Es,{"code-path":"src/components/deploy/PipelineEditor.tsx:126:72",className:"w-5 h-5"}),"执行日志 #",c?.build_number||c?.id]})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:127:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:128:11",className:"flex flex-wrap gap-3 text-sm text-[var(--dg-text-secondary)]",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:129:13",children:["触发方式: ",c?.triggered_by||"manual"]}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:130:13",children:["分支: ",c?.branch||"-"]}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:131:13",children:["耗时: ",Ce(c?.duration)]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:132:13",children:c?.created_at?new Date(c.created_at).toLocaleString("zh-CN"):"-"})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:134:11",className:"bg-slate-950 rounded-md p-3 max-h-[50vh] overflow-y-auto font-mono text-xs",children:v.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:136:15",className:"text-slate-500 py-4 text-center",children:"暂无日志"}):v.map((a,x)=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:139:17",className:"flex gap-2 py-0.5",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:140:19",className:"text-slate-500 shrink-0",children:["[",a.time,"]"]}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:141:19",className:a.level==="error"?"text-red-400":a.level==="warn"?"text-yellow-400":a.level==="success"?"text-green-400":"text-slate-300",children:[a.level==="success"?"✓":a.level==="error"?"✗":a.level==="warn"?"!":">"," ",a.message]})]},x))})]})]})})}function Vs(){const{code:r}=Qe(),d=r||"",[c,v]=i.useState(null),[a,x]=i.useState([]),[_,T]=i.useState(null),[ke,I]=i.useState({}),[Se,_e]=i.useState("flow"),[Te,W]=i.useState(!0),[K,Q]=i.useState(!1),[F,X]=i.useState([]),[Y,Me]=i.useState([]),[J,Z]=i.useState([]),[Le,q]=i.useState(!1),[N,M]=i.useState("manual"),[ee,se]=i.useState(""),[te,oe]=i.useState(""),[ne,ce]=i.useState(""),[b,f]=i.useState([]),[L,de]=i.useState(""),[U,ie]=i.useState(""),[re,ze]=i.useState("editor"),[Ae,ae]=i.useState(!1),[De,Re]=i.useState(null),[$e,pe]=i.useState([]),le=Xe(),xe=i.useCallback(async()=>{try{const s=await ns.getEnvironments();Me(Array.isArray(s)?s:s?.list||[])}catch{}},[]),z=i.useCallback(async()=>{q(!0);try{const s=await g.getMembers(d);Z(Array.isArray(s)?s:s?.data||[])}catch{Z([])}finally{q(!1)}},[d]),A=i.useCallback(async()=>{try{const s=await g.getRuns(d);X(Array.isArray(s)?s:s?.list||[])}catch{X([])}},[d]);i.useEffect(()=>{(async()=>{W(!0);try{const s=await g.getPipelineDetail(d);if(!s||!s.id){v(null),W(!1);return}v(s),M(s.trigger_mode||"manual"),se(s.watch_branches||""),oe(s.cron_expr||""),ce(s.webhook_token||""),de(s.environment_id||"");try{const n=s.variables?JSON.parse(s.variables):{};f(Object.entries(n).map(([o,t])=>[o,String(t)]))}catch{f([])}try{const n=s.stages?JSON.parse(s.stages):[],o=Array.isArray(n)?n:[];x(o);const t={};o.forEach(l=>{t[l.id]=!0}),I(t)}catch{x([])}}catch{m.error("加载失败")}finally{W(!1)}})(),xe(),z(),A()},[d,xe,z,A]);const me=a.flatMap(s=>s.tasks).find(s=>s.id===_)||null,Oe=s=>{x(n=>n.map(o=>({...o,tasks:o.tasks.map(t=>t.id===s.id?s:t)})))},Ve=s=>{const n={id:vs(),name:"新任务",type:"build",icon:"Wrench",config:{},script:"",script_type:"shell"};x(o=>o.map((t,l)=>l===s?{...t,tasks:[...t.tasks,n]}:t))},Be=s=>{x(n=>n.map(o=>({...o,tasks:o.tasks.filter(t=>t.id!==s)}))),_===s&&T(null)},Ie=()=>{const s={id:`stg-${Date.now()}`,name:"新阶段",type:"custom",tasks:[]};x(n=>[...n,s])},We=s=>{x(n=>n.filter((o,t)=>t!==s))},he=(s,n)=>{const o=s+n;if(o<0||o>=a.length)return;const t=[...a];[t[s],t[o]]=[t[o],t[s]],x(t)},Fe=async()=>{Q(!0);try{await g.updatePipeline(d,{stages:JSON.stringify(a),trigger_mode:N,watch_branches:ee,cron_expr:te,webhook_token:ne,environment_id:L?Number(L):null,variables:JSON.stringify(Object.fromEntries(b.filter(([s])=>s.trim())))}),m.success("已保存")}catch{m.error("保存失败")}finally{Q(!1)}},Je=async()=>{try{await g.triggerPipeline(d),m.success("已触发"),A()}catch{m.error("触发失败")}},Ue=async s=>{if(await le({title:"停止运行",description:"确定要停止此运行吗?",variant:"destructive"}))try{await g.stopRun(d,s),m.success("已停止"),A()}catch{m.error("停止失败")}},Ge=async s=>{Re(s),ae(!0);try{const n=await g.getRunLog(d,s.id);pe(n?.logs||[])}catch{pe([])}},He=async()=>{if(!U.trim()){m.error("请输入用户名");return}try{await g.addMember(d,{username:U.trim(),role:re}),m.success("已添加成员"),ie(""),z()}catch(s){m.error(s?.message||"添加失败")}},ye=async s=>{if(await le({title:"移除成员",description:"确定要移除此成员吗?",variant:"destructive"}))try{await g.removeMember(d,s),m.success("已移除"),z()}catch{m.error("移除失败")}},w=Y.find(s=>String(s.id)===String(L));return Te?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:325:23",className:"flex items-center justify-center py-20",children:e.jsx(H,{"code-path":"src/components/deploy/PipelineEditor.tsx:325:79",className:"w-6 h-6 animate-spin"})}):c?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:329:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:331:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:332:9",children:[e.jsxs("h1",{"code-path":"src/components/deploy/PipelineEditor.tsx:333:11",className:"text-xl font-bold flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(R,{"code-path":"src/components/deploy/PipelineEditor.tsx:334:13",className:"w-5 h-5 text-blue-500"}),c.name,w&&e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:336:26",style:{backgroundColor:w.color+"20",color:w.color,borderColor:w.color+"40"},className:"text-xs ml-2",children:w.display_name})]}),e.jsxs("p",{"code-path":"src/components/deploy/PipelineEditor.tsx:338:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:["code: ",c.code," · ",c.description]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:340:9",className:"flex items-center gap-2",children:[e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:341:11",variant:"outline",onClick:Fe,disabled:K,children:[e.jsx(cs,{"code-path":"src/components/deploy/PipelineEditor.tsx:341:76",className:"w-4 h-4 mr-1"}),K?"保存中...":"保存"]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:342:11",variant:"default",onClick:Je,children:[e.jsx(ds,{"code-path":"src/components/deploy/PipelineEditor.tsx:342:61",className:"w-4 h-4 mr-1"}),"运行"]})]})]}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:347:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:348:9",className:"p-3 flex items-center gap-3",children:[e.jsx(je,{"code-path":"src/components/deploy/PipelineEditor.tsx:349:11",className:"w-4 h-4 text-[var(--dg-text-secondary)]"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:350:11",className:"text-sm text-[var(--dg-text-secondary)]",children:"部署环境:"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:351:11",value:String(L),onValueChange:s=>de(s==="__none"?"":s),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:352:13",className:"w-40 h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:352:57",placeholder:"选择环境"})}),e.jsxs(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:353:13",children:[e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:354:15",value:"__none",children:"未指定"}),Y.map(s=>e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:356:17",value:String(s.id),children:e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:357:19",className:"flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:358:21",className:"w-2 h-2 rounded-full inline-block",style:{backgroundColor:s.color}}),s.display_name]})},s.id))]})]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:365:11",className:"text-xs text-[var(--dg-text-secondary)] opacity-70",children:"选择后流水线执行记录会关联到对应环境"})]})}),e.jsxs(ss,{"code-path":"src/components/deploy/PipelineEditor.tsx:369:7",value:Se,onValueChange:_e,children:[e.jsxs(ts,{"code-path":"src/components/deploy/PipelineEditor.tsx:370:9",children:[e.jsx(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:371:11",value:"flow",children:"流程配置"}),e.jsx(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:372:11",value:"triggers",children:"触发设置"}),e.jsx(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:373:11",value:"variables",children:"变量"}),e.jsxs(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:374:11",value:"runs",children:["发布记录 (",F.length,")"]}),e.jsxs(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:375:11",value:"members",children:["成员管理 (",J.length,")"]})]}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:379:9",value:"flow",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:380:11",className:"flex gap-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:381:13",className:"flex-1 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:382:15",className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:383:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["流水线阶段 (",a.length,")"]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:384:17",size:"sm",onClick:Ie,children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:384:60",className:"w-3.5 h-3.5 mr-1"}),"添加阶段"]})]}),a.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:387:17",className:"text-center py-12 border-2 border-dashed rounded-lg text-[var(--dg-text-secondary)]",children:"点击「添加阶段」开始"}):a.map((s,n)=>{const o=ke[s.id]!==!1;return e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:392:19",className:"space-y-1",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:393:21",className:"flex items-center gap-2 px-3 py-2 bg-[var(--dg-bg-tertiary)] rounded-t-md border border-b-0 border-[var(--dg-border)] cursor-pointer",onClick:()=>I(t=>({...t,[s.id]:!o})),children:[e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:397:23",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:t=>{t.stopPropagation(),I(l=>({...l,[s.id]:!o}))},children:o?e.jsx(Pe,{"code-path":"src/components/deploy/PipelineEditor.tsx:398:39",className:"w-3.5 h-3.5"}):e.jsx(Ee,{"code-path":"src/components/deploy/PipelineEditor.tsx:398:81",className:"w-3.5 h-3.5"})}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:400:23",value:s.name,onChange:t=>x(l=>l.map((ge,Ke)=>Ke===n?{...ge,name:t.target.value}:ge)),className:"h-7 text-sm font-medium border-none bg-transparent shadow-none flex-1 px-1",onClick:t=>t.stopPropagation()}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:406:23",className:"text-xs text-[var(--dg-text-secondary)]",children:[s.tasks.length," 任务"]}),e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:407:23",variant:"secondary",className:"text-xs",children:us[s.type]||s.type}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:408:23",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:t=>{t.stopPropagation(),he(n,-1)},disabled:n===0,children:e.jsx(is,{"code-path":"src/components/deploy/PipelineEditor.tsx:408:168",className:"w-3.5 h-3.5"})}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:409:23",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:t=>{t.stopPropagation(),he(n,1)},disabled:n===a.length-1,children:e.jsx(Pe,{"code-path":"src/components/deploy/PipelineEditor.tsx:409:183",className:"w-3.5 h-3.5"})}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:410:23",variant:"ghost",size:"icon",className:"h-6 w-6 text-red-500",onClick:t=>{t.stopPropagation(),We(n)},children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:410:158",className:"w-3.5 h-3.5"})})]}),o&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:413:21",className:"border border-[var(--dg-border)] rounded-b-md p-3 space-y-2",children:[s.tasks.map(t=>e.jsx(Ns,{"code-path":"src/components/deploy/PipelineEditor.tsx:414:46",task:t,selected:_===t.id,onSelect:()=>T(_===t.id?null:t.id),onDelete:()=>Be(t.id)},t.id)),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:415:23",variant:"outline",size:"sm",className:"w-full h-8 text-xs",onClick:()=>Ve(n),children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:415:125",className:"w-3 h-3 mr-1"}),"添加任务"]})]}),nT(null),children:"关闭"})]}),e.jsx(bs,{"code-path":"src/components/deploy/PipelineEditor.tsx:426:15",task:me,onUpdate:Oe,onClose:()=>T(null)})]})]})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:432:9",value:"triggers",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:433:11",className:"space-y-4 max-w-lg",children:[e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:434:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:434:85",className:"pt-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:435:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:435:66",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(R,{"code-path":"src/components/deploy/PipelineEditor.tsx:435:137",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:435:184",className:"font-medium",children:"Git Push 触发"})]}),e.jsx(G,{"code-path":"src/components/deploy/PipelineEditor.tsx:435:238",checked:N==="git_push",onCheckedChange:s=>M(s?"git_push":"manual")})]}),N==="git_push"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:436:46",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:436:73",children:"监听分支"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:436:92",value:ee,onChange:s=>se(s.target.value),placeholder:"master, release/*",className:"h-9"})]})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:438:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:438:85",className:"pt-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:439:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:439:66",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ue,{"code-path":"src/components/deploy/PipelineEditor.tsx:439:137",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:439:180",className:"font-medium",children:"定时触发"})]}),e.jsx(G,{"code-path":"src/components/deploy/PipelineEditor.tsx:439:227",checked:N==="cron",onCheckedChange:s=>M(s?"cron":"manual")})]}),N==="cron"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:440:42",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:440:69",children:"Cron 表达式"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:440:92",value:te,onChange:s=>oe(s.target.value),placeholder:"0 2 * * *",className:"h-9 font-mono"})]})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:442:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:442:85",className:"pt-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:443:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:443:66",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ve,{"code-path":"src/components/deploy/PipelineEditor.tsx:443:137",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:443:182",className:"font-medium",children:"Webhook 触发"})]}),e.jsx(G,{"code-path":"src/components/deploy/PipelineEditor.tsx:443:235",checked:N==="webhook",onCheckedChange:s=>M(s?"webhook":"manual")})]}),N==="webhook"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:444:45",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:444:72",children:"Secret Token"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:444:99",value:ne,onChange:s=>ce(s.target.value),type:"password",placeholder:"输入签名密钥",className:"h-9"})]})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:85",className:"pt-6",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:446:115",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(Ne,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:186",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:446:228",className:"font-medium",children:"手动触发"}),e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:269",variant:"secondary",className:"text-xs",children:"默认启用"})]})})})]})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:451:9",value:"variables",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:452:11",className:"max-w-lg space-y-3",children:[b.map(([s,n],o)=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:454:15",className:"flex gap-2 items-center",children:[e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:455:17",value:s,onChange:t=>{const l=[...b];l[o][0]=t.target.value,f(l)},placeholder:"KEY",className:"h-9 w-40 font-mono text-sm"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:456:17",className:"text-[var(--dg-text-secondary)]",children:"="}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:457:17",value:n,onChange:t=>{const l=[...b];l[o][1]=t.target.value,f(l)},placeholder:"VALUE",className:"h-9 flex-1"}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:458:17",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-500",onClick:()=>f(b.filter((t,l)=>l!==o)),children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:458:152",className:"w-3.5 h-3.5"})})]},o)),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:461:13",variant:"outline",size:"sm",onClick:()=>f([...b,["",""]]),children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:461:104",className:"w-3.5 h-3.5 mr-1"}),"添加变量"]})]})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:466:9",value:"runs",className:"mt-3",children:F.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:468:13",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:"暂无执行记录"}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:470:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/PipelineEditor.tsx:471:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/PipelineEditor.tsx:472:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/PipelineEditor.tsx:473:19",children:[e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:474:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"#"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:475:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:476:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"触发方式"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:477:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"触发人"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:478:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"分支"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:479:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"耗时"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:480:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"时间"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:481:21",className:"px-3 py-2 text-right text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/PipelineEditor.tsx:484:17",children:F.map(s=>e.jsxs("tr",{"code-path":"src/components/deploy/PipelineEditor.tsx:486:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:487:23",className:"px-3 py-2 font-medium text-[var(--dg-text-primary)]",children:["#",s.build_number||s.id]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:488:23",className:"px-3 py-2",children:s.status==="success"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:489:51",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:[e.jsx(rs,{"code-path":"src/components/deploy/PipelineEditor.tsx:489:127",className:"w-3 h-3 mr-0.5"}),"成功"]}):s.status==="failed"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:490:50",className:"bg-red-500/20 text-red-400 border-red-500/30",children:[e.jsx(as,{"code-path":"src/components/deploy/PipelineEditor.tsx:490:114",className:"w-3 h-3 mr-0.5"}),"失败"]}):s.status==="running"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:491:51",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:[e.jsx(H,{"code-path":"src/components/deploy/PipelineEditor.tsx:491:118",className:"w-3 h-3 animate-spin mr-0.5"}),"执行中"]}):s.status==="cancelled"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:492:53",className:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",children:[e.jsx(be,{"code-path":"src/components/deploy/PipelineEditor.tsx:492:126",className:"w-3 h-3 mr-0.5"}),"已停止"]}):e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:493:26",variant:"secondary",className:"text-[var(--dg-text-secondary)]",children:s.status})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:495:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] text-xs",children:[s.trigger_mode==="manual"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:496:57",className:"flex items-center gap-1",children:[e.jsx(Ne,{"code-path":"src/components/deploy/PipelineEditor.tsx:496:99",className:"w-3 h-3"}),"手动"]}),s.trigger_mode==="cron"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:497:55",className:"flex items-center gap-1",children:[e.jsx(ue,{"code-path":"src/components/deploy/PipelineEditor.tsx:497:97",className:"w-3 h-3"}),"定时"]}),s.trigger_mode==="webhook"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:498:58",className:"flex items-center gap-1",children:[e.jsx(ve,{"code-path":"src/components/deploy/PipelineEditor.tsx:498:100",className:"w-3 h-3"}),"Webhook"]}),s.trigger_mode==="git_push"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:499:59",className:"flex items-center gap-1",children:[e.jsx(R,{"code-path":"src/components/deploy/PipelineEditor.tsx:499:101",className:"w-3 h-3"}),"Git Push"]}),!s.trigger_mode&&(s.triggered_by||"手动")]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:502:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] text-xs",children:s.triggered_by||"admin"}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:503:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] font-mono text-xs",children:s.branch||"-"}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:504:23",className:"px-3 py-2 text-[var(--dg-text-secondary)]",children:Ce(s.duration)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:505:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] text-xs",children:s.created_at?new Date(s.created_at).toLocaleString("zh-CN"):"-"}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:506:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:507:25",className:"flex items-center justify-end gap-1",children:[e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:508:27",variant:"ghost",size:"sm",className:"h-7 text-xs text-blue-400 hover:text-blue-300",onClick:()=>Ge(s),children:[e.jsx(ps,{"code-path":"src/components/deploy/PipelineEditor.tsx:508:152",className:"w-3.5 h-3.5 mr-1"}),"日志"]}),(s.status==="running"||s.status==="pending")&&e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:510:29",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>Ue(s.id),children:[e.jsx(be,{"code-path":"src/components/deploy/PipelineEditor.tsx:510:152",className:"w-3.5 h-3.5 mr-1"}),"停止"]})]})})]},s.id))})]})})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:523:9",value:"members",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:524:11",className:"max-w-xl space-y-4",children:[e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:526:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:527:15",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:528:17",className:"flex items-center gap-3",children:[e.jsx(ls,{"code-path":"src/components/deploy/PipelineEditor.tsx:529:19",className:"w-4 h-4 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:530:19",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"添加用户"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:532:17",className:"flex items-end gap-3 mt-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:533:19",className:"flex-1 space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:534:21",className:"text-xs",children:"用户名"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:535:21",value:U,onChange:s=>ie(s.target.value),placeholder:"输入用户名",className:"h-9"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:537:19",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:538:21",className:"text-xs",children:"角色"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:539:21",value:re,onValueChange:ze,children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:540:23",className:"h-9 w-28",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:540:59"})}),e.jsxs(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:541:23",children:[e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:542:25",value:"owner",children:"拥有者"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:543:25",value:"editor",children:"编辑者"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:544:25",value:"viewer",children:"查看者"})]})]})]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:548:19",onClick:He,className:"h-9",children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:548:69",className:"w-4 h-4 mr-1"}),"添加"]})]})]})}),(()=>{const s=J.filter(o=>o.username),n=J.filter(o=>o.group_id);return e.jsxs(e.Fragment,{children:[e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:560:19",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:561:21",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:562:23",className:"px-4 py-2 text-xs font-medium text-[var(--dg-text-secondary)] border-b border-[var(--dg-border)]",children:["👤 直接用户授权 (",s.length,")"]}),Le?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:566:25",className:"flex items-center justify-center py-6",children:e.jsx(H,{"code-path":"src/components/deploy/PipelineEditor.tsx:566:80",className:"w-5 h-5 animate-spin text-[var(--dg-text-secondary)]"})}):s.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:568:25",className:"py-4 text-center text-[var(--dg-text-secondary)] text-xs",children:"暂无直接用户"}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:570:25",className:"divide-y divide-[var(--dg-border)]",children:s.map(o=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:572:29",className:"flex items-center justify-between px-4 py-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:573:31",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:574:33",className:"w-8 h-8 rounded-full bg-blue-500/20 flex items-center justify-center",children:e.jsx(xs,{"code-path":"src/components/deploy/PipelineEditor.tsx:574:119",className:"w-4 h-4 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:575:33",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:576:35",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.username}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:35",className:"text-xs text-[var(--dg-text-secondary)]",children:o.role==="owner"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:114",className:"text-amber-400",children:"拥有者"}):o.role==="editor"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:182",className:"text-blue-400",children:"编辑者"}):e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:227",className:"text-slate-400",children:"查看者"})})]})]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:580:31",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>ye(o.id),children:[e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:580:162",className:"w-3.5 h-3.5 mr-1"}),"移除"]})]},o.id))})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:589:19",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:590:21",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:591:23",className:"px-4 py-2 text-xs font-medium text-[var(--dg-text-secondary)] border-b border-[var(--dg-border)]",children:["👥 用户组授权 (",n.length,")"]}),n.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:595:25",className:"py-4 text-center text-[var(--dg-text-secondary)] text-xs",children:["暂无组授权 — 在「",e.jsx("a",{"code-path":"src/components/deploy/PipelineEditor.tsx:596:37",href:"/deploy/groups",className:"text-blue-400 underline",children:"用户组管理"}),"」页面创建组后,可在此授权"]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:599:25",className:"divide-y divide-[var(--dg-border)]",children:n.map(o=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:601:29",className:"flex items-center justify-between px-4 py-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:602:31",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:603:33",className:"w-8 h-8 rounded-full bg-purple-500/20 flex items-center justify-center",children:e.jsx(je,{"code-path":"src/components/deploy/PipelineEditor.tsx:603:121",className:"w-4 h-4 text-purple-400"})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:604:33",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:605:35",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.group?.name||`组 #${o.group_id}`}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:35",className:"text-xs text-[var(--dg-text-secondary)]",children:[o.role==="owner"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:114",className:"text-amber-400",children:"拥有者"}):o.role==="editor"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:182",className:"text-blue-400",children:"编辑者"}):e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:227",className:"text-slate-400",children:"查看者"})," · 组内全体成员"]})]})]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:609:31",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>ye(o.id),children:[e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:609:162",className:"w-3.5 h-3.5 mr-1"}),"撤销授权"]})]},o.id))})]})})]})})()]})})]}),e.jsx(fs,{"code-path":"src/components/deploy/PipelineEditor.tsx:624:7",open:Ae,onClose:()=>ae(!1),run:De,logs:$e})]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:326:25",className:"text-center py-20 text-[var(--dg-text-secondary)]",children:"流水线不存在"})}export{Vs as default}; +import{r as i,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as P,a as E}from"./card-BHSBTtub.js";import{g as Qe,f as Xe,t as m,B as p,D as Ye,a as Ze,b as qe,c as es}from"./index-Bp-M7P_8.js";import{I as u}from"./input-Bnlm--la.js";import{B as j}from"./badge-B00SZHvE.js";import{T as ss,a as ts,b as C,c as k}from"./tabs-DbNlmoQJ.js";import{S as $,a as O,b as V,c as B,d as h}from"./select-DbhcBWnH.js";import{T as os}from"./textarea-BvOVhaCD.js";import{S as G}from"./switch-CEwFnSNV.js";import{L as y}from"./label-NkONM5Mp.js";import{p as g}from"./pipeline-BGteNHr0.js";import{d as ns}from"./config-CBy2SxR-.js";import{L as H,J as R,$ as cs,z as ds,j as je,P as D,Q as Pe,f as Ee,O as is,T as S,b as ue,a0 as ve,a1 as Ne,w as rs,X as as,a2 as be,F as ps,a3 as ls,V as xs,k as ms,o as hs,r as ys,a4 as gs,a5 as js,h as Ps,a6 as fe,a7 as Es}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";const us={source:"拉取代码",build:"构建",deploy:"部署",test:"测试",custom:"自定义"},we={GitBranch:R,Wrench:fe,Server:Ps,FlaskConical:js,Zap:gs,Terminal:ys,FileCode:hs,Container:ms};function vs(){return`tsk-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}function Ce(r){if(!r)return"-";if(r<60)return`${r}s`;const d=Math.floor(r/60),c=r%60;return c>0?`${d}分${c}秒`:`${d}分`}function Ns({task:r,selected:d,onSelect:c,onDelete:v}){const a=we[r.icon]||fe;return e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:75:5",onClick:c,className:`flex items-center gap-3 p-3 rounded-md border cursor-pointer transition-all group ${d?"border-blue-500 bg-blue-500/10":"border-[var(--dg-border)] hover:border-slate-400 bg-[var(--dg-bg-secondary)]"}`,children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:81:7",className:`p-1.5 rounded ${d?"bg-blue-100":"bg-slate-100 dark:bg-slate-800"}`,children:e.jsx(a,{"code-path":"src/components/deploy/PipelineEditor.tsx:82:9",className:`w-4 h-4 ${d?"text-blue-600":"text-[var(--dg-text-secondary)]"}`})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:84:7",className:"flex-1 min-w-0",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:85:9",className:"text-sm font-medium text-[var(--dg-text-primary)] truncate",children:r.name}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:86:9",className:"text-xs text-[var(--dg-text-secondary)]",children:r.type})]}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:88:7",variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100",onClick:x=>{x.stopPropagation(),v()},children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:89:9",className:"w-3.5 h-3.5 text-red-500"})})]})}function bs({task:r,onUpdate:d}){return r?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:99:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:100:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:100:34",className:"text-xs",children:"任务名称"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:100:73",value:r.name,onChange:c=>d({...r,name:c.target.value}),className:"h-8 text-sm"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:101:7",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:102:9",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:102:36",className:"text-xs",children:"类型"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:11",value:r.type,onValueChange:c=>d({...r,type:c}),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:89",className:"h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:103:128"})}),e.jsxs(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:13",children:[e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:28",value:"build",children:"构建"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:69",value:"deploy",children:"部署"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:111",value:"test",children:"测试"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:104:151",value:"custom",children:"自定义"})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:106:9",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:106:36",className:"text-xs",children:"图标"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:11",value:r.icon,onValueChange:c=>d({...r,icon:c}),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:89",className:"h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:107:128"})}),e.jsx(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:108:13",children:Object.entries(we).map(([c])=>e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:108:69",value:c,children:c},c))})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:111:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:111:34",className:"text-xs",children:"脚本类型"}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:112:9",className:"flex gap-2",children:["shell","python"].map(c=>e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:112:68",variant:r.script_type===c?"default":"outline",className:"cursor-pointer text-xs",onClick:()=>d({...r,script_type:c}),children:c},c))})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:114:7",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:114:34",className:"text-xs",children:"脚本内容"}),e.jsx(os,{"code-path":"src/components/deploy/PipelineEditor.tsx:115:9",value:r.script,onChange:c=>d({...r,script:c.target.value}),className:"font-mono text-xs min-h-[200px] bg-slate-950 text-green-400",placeholder:"#!/bin/bash\\nset -e\\necho 'hello'"})]})]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:97:21",className:"p-6 text-center text-[var(--dg-text-secondary)] text-sm",children:"选择一个任务开始编辑"})}function fs({open:r,onClose:d,run:c,logs:v}){return e.jsx(Ye,{"code-path":"src/components/deploy/PipelineEditor.tsx:124:5",open:r,onOpenChange:d,children:e.jsxs(Ze,{"code-path":"src/components/deploy/PipelineEditor.tsx:125:7",className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[e.jsx(qe,{"code-path":"src/components/deploy/PipelineEditor.tsx:126:9",children:e.jsxs(es,{"code-path":"src/components/deploy/PipelineEditor.tsx:126:23",className:"flex items-center gap-2",children:[e.jsx(Es,{"code-path":"src/components/deploy/PipelineEditor.tsx:126:72",className:"w-5 h-5"}),"执行日志 #",c?.build_number||c?.id]})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:127:9",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:128:11",className:"flex flex-wrap gap-3 text-sm text-[var(--dg-text-secondary)]",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:129:13",children:["触发方式: ",c?.triggered_by||"manual"]}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:130:13",children:["分支: ",c?.branch||"-"]}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:131:13",children:["耗时: ",Ce(c?.duration)]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:132:13",children:c?.created_at?new Date(c.created_at).toLocaleString("zh-CN"):"-"})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:134:11",className:"bg-slate-950 rounded-md p-3 max-h-[50vh] overflow-y-auto font-mono text-xs",children:v.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:136:15",className:"text-slate-500 py-4 text-center",children:"暂无日志"}):v.map((a,x)=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:139:17",className:"flex gap-2 py-0.5",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:140:19",className:"text-slate-500 shrink-0",children:["[",a.time,"]"]}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:141:19",className:a.level==="error"?"text-red-400":a.level==="warn"?"text-yellow-400":a.level==="success"?"text-green-400":"text-slate-300",children:[a.level==="success"?"✓":a.level==="error"?"✗":a.level==="warn"?"!":">"," ",a.message]})]},x))})]})]})})}function Vs(){const{code:r}=Qe(),d=r||"",[c,v]=i.useState(null),[a,x]=i.useState([]),[_,T]=i.useState(null),[ke,I]=i.useState({}),[Se,_e]=i.useState("flow"),[Te,W]=i.useState(!0),[K,Q]=i.useState(!1),[F,X]=i.useState([]),[Y,Me]=i.useState([]),[J,Z]=i.useState([]),[Le,q]=i.useState(!1),[N,M]=i.useState("manual"),[ee,se]=i.useState(""),[te,oe]=i.useState(""),[ne,ce]=i.useState(""),[b,f]=i.useState([]),[L,de]=i.useState(""),[U,ie]=i.useState(""),[re,ze]=i.useState("editor"),[Ae,ae]=i.useState(!1),[De,Re]=i.useState(null),[$e,pe]=i.useState([]),le=Xe(),xe=i.useCallback(async()=>{try{const s=await ns.getEnvironments();Me(Array.isArray(s)?s:s?.list||[])}catch{}},[]),z=i.useCallback(async()=>{q(!0);try{const s=await g.getMembers(d);Z(Array.isArray(s)?s:s?.data||[])}catch{Z([])}finally{q(!1)}},[d]),A=i.useCallback(async()=>{try{const s=await g.getRuns(d);X(Array.isArray(s)?s:s?.list||[])}catch{X([])}},[d]);i.useEffect(()=>{(async()=>{W(!0);try{const s=await g.getPipelineDetail(d);if(!s||!s.id){v(null),W(!1);return}v(s),M(s.trigger_mode||"manual"),se(s.watch_branches||""),oe(s.cron_expr||""),ce(s.webhook_token||""),de(s.environment_id||"");try{const n=s.variables?JSON.parse(s.variables):{};f(Object.entries(n).map(([o,t])=>[o,String(t)]))}catch{f([])}try{const n=s.stages?JSON.parse(s.stages):[],o=Array.isArray(n)?n:[];x(o);const t={};o.forEach(l=>{t[l.id]=!0}),I(t)}catch{x([])}}catch{m.error("加载失败")}finally{W(!1)}})(),xe(),z(),A()},[d,xe,z,A]);const me=a.flatMap(s=>s.tasks).find(s=>s.id===_)||null,Oe=s=>{x(n=>n.map(o=>({...o,tasks:o.tasks.map(t=>t.id===s.id?s:t)})))},Ve=s=>{const n={id:vs(),name:"新任务",type:"build",icon:"Wrench",config:{},script:"",script_type:"shell"};x(o=>o.map((t,l)=>l===s?{...t,tasks:[...t.tasks,n]}:t))},Be=s=>{x(n=>n.map(o=>({...o,tasks:o.tasks.filter(t=>t.id!==s)}))),_===s&&T(null)},Ie=()=>{const s={id:`stg-${Date.now()}`,name:"新阶段",type:"custom",tasks:[]};x(n=>[...n,s])},We=s=>{x(n=>n.filter((o,t)=>t!==s))},he=(s,n)=>{const o=s+n;if(o<0||o>=a.length)return;const t=[...a];[t[s],t[o]]=[t[o],t[s]],x(t)},Fe=async()=>{Q(!0);try{await g.updatePipeline(d,{stages:JSON.stringify(a),trigger_mode:N,watch_branches:ee,cron_expr:te,webhook_token:ne,environment_id:L?Number(L):null,variables:JSON.stringify(Object.fromEntries(b.filter(([s])=>s.trim())))}),m.success("已保存")}catch{m.error("保存失败")}finally{Q(!1)}},Je=async()=>{try{await g.triggerPipeline(d),m.success("已触发"),A()}catch{m.error("触发失败")}},Ue=async s=>{if(await le({title:"停止运行",description:"确定要停止此运行吗?",variant:"destructive"}))try{await g.stopRun(d,s),m.success("已停止"),A()}catch{m.error("停止失败")}},Ge=async s=>{Re(s),ae(!0);try{const n=await g.getRunLog(d,s.id);pe(n?.logs||[])}catch{pe([])}},He=async()=>{if(!U.trim()){m.error("请输入用户名");return}try{await g.addMember(d,{username:U.trim(),role:re}),m.success("已添加成员"),ie(""),z()}catch(s){m.error(s?.message||"添加失败")}},ye=async s=>{if(await le({title:"移除成员",description:"确定要移除此成员吗?",variant:"destructive"}))try{await g.removeMember(d,s),m.success("已移除"),z()}catch{m.error("移除失败")}},w=Y.find(s=>String(s.id)===String(L));return Te?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:325:23",className:"flex items-center justify-center py-20",children:e.jsx(H,{"code-path":"src/components/deploy/PipelineEditor.tsx:325:79",className:"w-6 h-6 animate-spin"})}):c?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:329:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:331:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:332:9",children:[e.jsxs("h1",{"code-path":"src/components/deploy/PipelineEditor.tsx:333:11",className:"text-xl font-bold flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(R,{"code-path":"src/components/deploy/PipelineEditor.tsx:334:13",className:"w-5 h-5 text-blue-500"}),c.name,w&&e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:336:26",style:{backgroundColor:w.color+"20",color:w.color,borderColor:w.color+"40"},className:"text-xs ml-2",children:w.display_name})]}),e.jsxs("p",{"code-path":"src/components/deploy/PipelineEditor.tsx:338:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:["code: ",c.code," · ",c.description]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:340:9",className:"flex items-center gap-2",children:[e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:341:11",variant:"outline",onClick:Fe,disabled:K,children:[e.jsx(cs,{"code-path":"src/components/deploy/PipelineEditor.tsx:341:76",className:"w-4 h-4 mr-1"}),K?"保存中...":"保存"]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:342:11",variant:"default",onClick:Je,children:[e.jsx(ds,{"code-path":"src/components/deploy/PipelineEditor.tsx:342:61",className:"w-4 h-4 mr-1"}),"运行"]})]})]}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:347:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:348:9",className:"p-3 flex items-center gap-3",children:[e.jsx(je,{"code-path":"src/components/deploy/PipelineEditor.tsx:349:11",className:"w-4 h-4 text-[var(--dg-text-secondary)]"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:350:11",className:"text-sm text-[var(--dg-text-secondary)]",children:"部署环境:"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:351:11",value:String(L),onValueChange:s=>de(s==="__none"?"":s),children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:352:13",className:"w-40 h-8 text-sm",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:352:57",placeholder:"选择环境"})}),e.jsxs(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:353:13",children:[e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:354:15",value:"__none",children:"未指定"}),Y.map(s=>e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:356:17",value:String(s.id),children:e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:357:19",className:"flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:358:21",className:"w-2 h-2 rounded-full inline-block",style:{backgroundColor:s.color}}),s.display_name]})},s.id))]})]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:365:11",className:"text-xs text-[var(--dg-text-secondary)] opacity-70",children:"选择后流水线执行记录会关联到对应环境"})]})}),e.jsxs(ss,{"code-path":"src/components/deploy/PipelineEditor.tsx:369:7",value:Se,onValueChange:_e,children:[e.jsxs(ts,{"code-path":"src/components/deploy/PipelineEditor.tsx:370:9",children:[e.jsx(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:371:11",value:"flow",children:"流程配置"}),e.jsx(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:372:11",value:"triggers",children:"触发设置"}),e.jsx(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:373:11",value:"variables",children:"变量"}),e.jsxs(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:374:11",value:"runs",children:["发布记录 (",F.length,")"]}),e.jsxs(C,{"code-path":"src/components/deploy/PipelineEditor.tsx:375:11",value:"members",children:["成员管理 (",J.length,")"]})]}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:379:9",value:"flow",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:380:11",className:"flex gap-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:381:13",className:"flex-1 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:382:15",className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:383:17",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:["流水线阶段 (",a.length,")"]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:384:17",size:"sm",onClick:Ie,children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:384:60",className:"w-3.5 h-3.5 mr-1"}),"添加阶段"]})]}),a.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:387:17",className:"text-center py-12 border-2 border-dashed rounded-lg text-[var(--dg-text-secondary)]",children:"点击「添加阶段」开始"}):a.map((s,n)=>{const o=ke[s.id]!==!1;return e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:392:19",className:"space-y-1",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:393:21",className:"flex items-center gap-2 px-3 py-2 bg-[var(--dg-bg-tertiary)] rounded-t-md border border-b-0 border-[var(--dg-border)] cursor-pointer",onClick:()=>I(t=>({...t,[s.id]:!o})),children:[e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:397:23",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:t=>{t.stopPropagation(),I(l=>({...l,[s.id]:!o}))},children:o?e.jsx(Pe,{"code-path":"src/components/deploy/PipelineEditor.tsx:398:39",className:"w-3.5 h-3.5"}):e.jsx(Ee,{"code-path":"src/components/deploy/PipelineEditor.tsx:398:81",className:"w-3.5 h-3.5"})}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:400:23",value:s.name,onChange:t=>x(l=>l.map((ge,Ke)=>Ke===n?{...ge,name:t.target.value}:ge)),className:"h-7 text-sm font-medium border-none bg-transparent shadow-none flex-1 px-1",onClick:t=>t.stopPropagation()}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:406:23",className:"text-xs text-[var(--dg-text-secondary)]",children:[s.tasks.length," 任务"]}),e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:407:23",variant:"secondary",className:"text-xs",children:us[s.type]||s.type}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:408:23",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:t=>{t.stopPropagation(),he(n,-1)},disabled:n===0,children:e.jsx(is,{"code-path":"src/components/deploy/PipelineEditor.tsx:408:168",className:"w-3.5 h-3.5"})}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:409:23",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:t=>{t.stopPropagation(),he(n,1)},disabled:n===a.length-1,children:e.jsx(Pe,{"code-path":"src/components/deploy/PipelineEditor.tsx:409:183",className:"w-3.5 h-3.5"})}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:410:23",variant:"ghost",size:"icon",className:"h-6 w-6 text-red-500",onClick:t=>{t.stopPropagation(),We(n)},children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:410:158",className:"w-3.5 h-3.5"})})]}),o&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:413:21",className:"border border-[var(--dg-border)] rounded-b-md p-3 space-y-2",children:[s.tasks.map(t=>e.jsx(Ns,{"code-path":"src/components/deploy/PipelineEditor.tsx:414:46",task:t,selected:_===t.id,onSelect:()=>T(_===t.id?null:t.id),onDelete:()=>Be(t.id)},t.id)),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:415:23",variant:"outline",size:"sm",className:"w-full h-8 text-xs",onClick:()=>Ve(n),children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:415:125",className:"w-3 h-3 mr-1"}),"添加任务"]})]}),nT(null),children:"关闭"})]}),e.jsx(bs,{"code-path":"src/components/deploy/PipelineEditor.tsx:426:15",task:me,onUpdate:Oe,onClose:()=>T(null)})]})]})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:432:9",value:"triggers",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:433:11",className:"space-y-4 max-w-lg",children:[e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:434:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:434:85",className:"pt-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:435:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:435:66",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(R,{"code-path":"src/components/deploy/PipelineEditor.tsx:435:137",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:435:184",className:"font-medium",children:"Git Push 触发"})]}),e.jsx(G,{"code-path":"src/components/deploy/PipelineEditor.tsx:435:238",checked:N==="git_push",onCheckedChange:s=>M(s?"git_push":"manual")})]}),N==="git_push"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:436:46",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:436:73",children:"监听分支"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:436:92",value:ee,onChange:s=>se(s.target.value),placeholder:"master, release/*",className:"h-9"})]})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:438:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:438:85",className:"pt-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:439:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:439:66",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ue,{"code-path":"src/components/deploy/PipelineEditor.tsx:439:137",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:439:180",className:"font-medium",children:"定时触发"})]}),e.jsx(G,{"code-path":"src/components/deploy/PipelineEditor.tsx:439:227",checked:N==="cron",onCheckedChange:s=>M(s?"cron":"manual")})]}),N==="cron"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:440:42",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:440:69",children:"Cron 表达式"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:440:92",value:te,onChange:s=>oe(s.target.value),placeholder:"0 2 * * *",className:"h-9 font-mono"})]})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:442:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:442:85",className:"pt-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:443:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:443:66",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(ve,{"code-path":"src/components/deploy/PipelineEditor.tsx:443:137",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:443:182",className:"font-medium",children:"Webhook 触发"})]}),e.jsx(G,{"code-path":"src/components/deploy/PipelineEditor.tsx:443:235",checked:N==="webhook",onCheckedChange:s=>M(s?"webhook":"manual")})]}),N==="webhook"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:444:45",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:444:72",children:"Secret Token"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:444:99",value:ne,onChange:s=>ce(s.target.value),type:"password",placeholder:"输入签名密钥",className:"h-9"})]})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:85",className:"pt-6",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:446:115",className:"flex items-center gap-2 text-[var(--dg-text-primary)]",children:[e.jsx(Ne,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:186",className:"w-5 h-5 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:446:228",className:"font-medium",children:"手动触发"}),e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:446:269",variant:"secondary",className:"text-xs",children:"默认启用"})]})})})]})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:451:9",value:"variables",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:452:11",className:"max-w-lg space-y-3",children:[b.map(([s,n],o)=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:454:15",className:"flex gap-2 items-center",children:[e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:455:17",value:s,onChange:t=>{const l=[...b];l[o][0]=t.target.value,f(l)},placeholder:"KEY",className:"h-9 w-40 font-mono text-sm"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:456:17",className:"text-[var(--dg-text-secondary)]",children:"="}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:457:17",value:n,onChange:t=>{const l=[...b];l[o][1]=t.target.value,f(l)},placeholder:"VALUE",className:"h-9 flex-1"}),e.jsx(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:458:17",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-500",onClick:()=>f(b.filter((t,l)=>l!==o)),children:e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:458:152",className:"w-3.5 h-3.5"})})]},o)),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:461:13",variant:"outline",size:"sm",onClick:()=>f([...b,["",""]]),children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:461:104",className:"w-3.5 h-3.5 mr-1"}),"添加变量"]})]})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:466:9",value:"runs",className:"mt-3",children:F.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:468:13",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:"暂无执行记录"}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:470:13",className:"rounded-md border border-[var(--dg-border)] overflow-hidden",children:e.jsxs("table",{"code-path":"src/components/deploy/PipelineEditor.tsx:471:15",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/PipelineEditor.tsx:472:17",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/PipelineEditor.tsx:473:19",children:[e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:474:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"#"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:475:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:476:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"触发方式"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:477:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"触发人"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:478:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"分支"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:479:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"耗时"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:480:21",className:"px-3 py-2 text-left text-[var(--dg-text-secondary)]",children:"时间"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineEditor.tsx:481:21",className:"px-3 py-2 text-right text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/PipelineEditor.tsx:484:17",children:F.map(s=>e.jsxs("tr",{"code-path":"src/components/deploy/PipelineEditor.tsx:486:21",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:487:23",className:"px-3 py-2 font-medium text-[var(--dg-text-primary)]",children:["#",s.build_number||s.id]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:488:23",className:"px-3 py-2",children:s.status==="success"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:489:51",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:[e.jsx(rs,{"code-path":"src/components/deploy/PipelineEditor.tsx:489:127",className:"w-3 h-3 mr-0.5"}),"成功"]}):s.status==="failed"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:490:50",className:"bg-red-500/20 text-red-400 border-red-500/30",children:[e.jsx(as,{"code-path":"src/components/deploy/PipelineEditor.tsx:490:114",className:"w-3 h-3 mr-0.5"}),"失败"]}):s.status==="running"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:491:51",className:"bg-blue-500/20 text-blue-400 border-blue-500/30",children:[e.jsx(H,{"code-path":"src/components/deploy/PipelineEditor.tsx:491:118",className:"w-3 h-3 animate-spin mr-0.5"}),"执行中"]}):s.status==="cancelled"?e.jsxs(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:492:53",className:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",children:[e.jsx(be,{"code-path":"src/components/deploy/PipelineEditor.tsx:492:126",className:"w-3 h-3 mr-0.5"}),"已停止"]}):e.jsx(j,{"code-path":"src/components/deploy/PipelineEditor.tsx:493:26",variant:"secondary",className:"text-[var(--dg-text-secondary)]",children:s.status})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:495:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] text-xs",children:[s.trigger_mode==="manual"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:496:57",className:"flex items-center gap-1",children:[e.jsx(Ne,{"code-path":"src/components/deploy/PipelineEditor.tsx:496:99",className:"w-3 h-3"}),"手动"]}),s.trigger_mode==="cron"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:497:55",className:"flex items-center gap-1",children:[e.jsx(ue,{"code-path":"src/components/deploy/PipelineEditor.tsx:497:97",className:"w-3 h-3"}),"定时"]}),s.trigger_mode==="webhook"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:498:58",className:"flex items-center gap-1",children:[e.jsx(ve,{"code-path":"src/components/deploy/PipelineEditor.tsx:498:100",className:"w-3 h-3"}),"Webhook"]}),s.trigger_mode==="git_push"&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:499:59",className:"flex items-center gap-1",children:[e.jsx(R,{"code-path":"src/components/deploy/PipelineEditor.tsx:499:101",className:"w-3 h-3"}),"Git Push"]}),!s.trigger_mode&&(s.triggered_by||"手动")]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:502:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] text-xs",children:s.triggered_by||"admin"}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:503:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] font-mono text-xs",children:s.branch||"-"}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:504:23",className:"px-3 py-2 text-[var(--dg-text-secondary)]",children:Ce(s.duration)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:505:23",className:"px-3 py-2 text-[var(--dg-text-secondary)] text-xs",children:s.created_at?new Date(s.created_at).toLocaleString("zh-CN"):"-"}),e.jsx("td",{"code-path":"src/components/deploy/PipelineEditor.tsx:506:23",className:"px-3 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:507:25",className:"flex items-center justify-end gap-1",children:[e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:508:27",variant:"ghost",size:"sm",className:"h-7 text-xs text-blue-400 hover:text-blue-300",onClick:()=>Ge(s),children:[e.jsx(ps,{"code-path":"src/components/deploy/PipelineEditor.tsx:508:152",className:"w-3.5 h-3.5 mr-1"}),"日志"]}),(s.status==="running"||s.status==="pending")&&e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:510:29",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>Ue(s.id),children:[e.jsx(be,{"code-path":"src/components/deploy/PipelineEditor.tsx:510:152",className:"w-3.5 h-3.5 mr-1"}),"停止"]})]})})]},s.id))})]})})}),e.jsx(k,{"code-path":"src/components/deploy/PipelineEditor.tsx:523:9",value:"members",className:"mt-3",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:524:11",className:"max-w-xl space-y-4",children:[e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:526:13",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:527:15",className:"p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:528:17",className:"flex items-center gap-3",children:[e.jsx(ls,{"code-path":"src/components/deploy/PipelineEditor.tsx:529:19",className:"w-4 h-4 text-blue-500"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:530:19",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:"添加用户"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:532:17",className:"flex items-end gap-3 mt-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:533:19",className:"flex-1 space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:534:21",className:"text-xs",children:"用户名"}),e.jsx(u,{"code-path":"src/components/deploy/PipelineEditor.tsx:535:21",value:U,onChange:s=>ie(s.target.value),placeholder:"输入用户名",className:"h-9"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:537:19",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/PipelineEditor.tsx:538:21",className:"text-xs",children:"角色"}),e.jsxs($,{"code-path":"src/components/deploy/PipelineEditor.tsx:539:21",value:re,onValueChange:ze,children:[e.jsx(O,{"code-path":"src/components/deploy/PipelineEditor.tsx:540:23",className:"h-9 w-28",children:e.jsx(V,{"code-path":"src/components/deploy/PipelineEditor.tsx:540:59"})}),e.jsxs(B,{"code-path":"src/components/deploy/PipelineEditor.tsx:541:23",children:[e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:542:25",value:"owner",children:"拥有者"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:543:25",value:"editor",children:"编辑者"}),e.jsx(h,{"code-path":"src/components/deploy/PipelineEditor.tsx:544:25",value:"viewer",children:"查看者"})]})]})]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:548:19",onClick:He,className:"h-9",children:[e.jsx(D,{"code-path":"src/components/deploy/PipelineEditor.tsx:548:69",className:"w-4 h-4 mr-1"}),"添加"]})]})]})}),(()=>{const s=J.filter(o=>o.username),n=J.filter(o=>o.group_id);return e.jsxs(e.Fragment,{children:[e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:560:19",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:561:21",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:562:23",className:"px-4 py-2 text-xs font-medium text-[var(--dg-text-secondary)] border-b border-[var(--dg-border)]",children:["👤 直接用户授权 (",s.length,")"]}),Le?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:566:25",className:"flex items-center justify-center py-6",children:e.jsx(H,{"code-path":"src/components/deploy/PipelineEditor.tsx:566:80",className:"w-5 h-5 animate-spin text-[var(--dg-text-secondary)]"})}):s.length===0?e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:568:25",className:"py-4 text-center text-[var(--dg-text-secondary)] text-xs",children:"暂无直接用户"}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:570:25",className:"divide-y divide-[var(--dg-border)]",children:s.map(o=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:572:29",className:"flex items-center justify-between px-4 py-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:573:31",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:574:33",className:"w-8 h-8 rounded-full bg-blue-500/20 flex items-center justify-center",children:e.jsx(xs,{"code-path":"src/components/deploy/PipelineEditor.tsx:574:119",className:"w-4 h-4 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:575:33",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:576:35",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.username}),e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:35",className:"text-xs text-[var(--dg-text-secondary)]",children:o.role==="owner"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:114",className:"text-amber-400",children:"拥有者"}):o.role==="editor"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:182",className:"text-blue-400",children:"编辑者"}):e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:577:227",className:"text-slate-400",children:"查看者"})})]})]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:580:31",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>ye(o.id),children:[e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:580:162",className:"w-3.5 h-3.5 mr-1"}),"移除"]})]},o.id))})]})}),e.jsx(P,{"code-path":"src/components/deploy/PipelineEditor.tsx:589:19",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsxs(E,{"code-path":"src/components/deploy/PipelineEditor.tsx:590:21",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:591:23",className:"px-4 py-2 text-xs font-medium text-[var(--dg-text-secondary)] border-b border-[var(--dg-border)]",children:["👥 用户组授权 (",n.length,")"]}),n.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:595:25",className:"py-4 text-center text-[var(--dg-text-secondary)] text-xs",children:["暂无组授权 — 在「",e.jsx("a",{"code-path":"src/components/deploy/PipelineEditor.tsx:596:37",href:"/deploy/groups",className:"text-blue-400 underline",children:"用户组管理"}),"」页面创建组后,可在此授权"]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:599:25",className:"divide-y divide-[var(--dg-border)]",children:n.map(o=>e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:601:29",className:"flex items-center justify-between px-4 py-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:602:31",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:603:33",className:"w-8 h-8 rounded-full bg-purple-500/20 flex items-center justify-center",children:e.jsx(je,{"code-path":"src/components/deploy/PipelineEditor.tsx:603:121",className:"w-4 h-4 text-purple-400"})}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:604:33",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:605:35",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.group?.name||`组 #${o.group_id}`}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:35",className:"text-xs text-[var(--dg-text-secondary)]",children:[o.role==="owner"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:114",className:"text-amber-400",children:"拥有者"}):o.role==="editor"?e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:182",className:"text-blue-400",children:"编辑者"}):e.jsx("span",{"code-path":"src/components/deploy/PipelineEditor.tsx:606:227",className:"text-slate-400",children:"查看者"})," · 组内全体成员"]})]})]}),e.jsxs(p,{"code-path":"src/components/deploy/PipelineEditor.tsx:609:31",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>ye(o.id),children:[e.jsx(S,{"code-path":"src/components/deploy/PipelineEditor.tsx:609:162",className:"w-3.5 h-3.5 mr-1"}),"撤销授权"]})]},o.id))})]})})]})})()]})})]}),e.jsx(fs,{"code-path":"src/components/deploy/PipelineEditor.tsx:624:7",open:Ae,onClose:()=>ae(!1),run:De,logs:$e})]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineEditor.tsx:326:25",className:"text-center py-20 text-[var(--dg-text-secondary)]",children:"流水线不存在"})}export{Vs as default}; diff --git a/backend/static/assets/PipelineManager-C_oAjTIU.js b/backend/static/assets/PipelineManager-DilP4thh.js similarity index 93% rename from backend/static/assets/PipelineManager-C_oAjTIU.js rename to backend/static/assets/PipelineManager-DilP4thh.js index 8241e82..dedc769 100644 --- a/backend/static/assets/PipelineManager-C_oAjTIU.js +++ b/backend/static/assets/PipelineManager-DilP4thh.js @@ -1 +1 @@ -import{j as e,r as o}from"./vendor-codemirror-C7mXSpXt.js";import{G as Ge,B as v,D as Me,a as Ee,b as Be,c as Te,t as N,i as Oe,f as Qe}from"./index-LZWfu62c.js";import{I as f}from"./input-BdDauX3U.js";import{p as L}from"./pipeline-Lgvc2XUS.js";import{u as Ve,q as We,b as Je}from"./unwrap-BmWy-KM2.js";import{u as ce}from"./useMutation-Bp3lz5hm.js";import{C as Ke,a as Ie}from"./card-B-RtdR4H.js";import{B as D}from"./badge-B0F5ZNtn.js";import{L as H,a as Y,y as ae,J as U,ad as He,k as ie,ar as Z,as as Le,a2 as de,F as _e,b as ee,ae as I,aT as Ue,N as he,h as ye,G as ue,z as Xe,aq as Ye,Q as Ze,f as me,T as Fe,q as ea,P as xe,S as aa,aU as na,ac as sa,aV as ta}from"./vendor-icons-Aso0-eeY.js";import{T as oa}from"./textarea-BdtIagjy.js";import{L as h}from"./label-u-lNUbKh.js";import{S as se,a as te,b as oe,c as re,d as T}from"./select-4xU_9B3_.js";import{d as ra}from"./config-DAXaHuse.js";import{c as la}from"./credential-CwQY-4Ba.js";import"./index-CYARH0Cq.js";function ia(n={page:1,page_size:100}){return Ve({queryKey:We.pipelines(n),queryFn:async()=>{const p=await L.getPipelines(n);return Je(p)},staleTime:2e4})}function pa(){const n=Ge(),p=()=>n.invalidateQueries({queryKey:["pipelines"]}),P=ce({mutationFn:d=>L.triggerByCode(d),onSuccess:p}),b=ce({mutationFn:d=>L.deletePipeline(d),onSuccess:p}),j=ce({mutationFn:({code:d,runId:y})=>L.stopRunByCode(d,y)});return{triggerMutation:P,deleteMutation:b,stopRunMutation:j,invalidate:p}}function ca(n){return n.toLowerCase().replace(/[^a-z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||`pipeline-${Date.now()}`}function da(n){switch(n){case"success":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:49:9",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx(ae,{"code-path":"src/components/deploy/pipeline-helpers.tsx:50:11",className:"h-3 w-3 mr-1"}),"成功"]});case"failed":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:56:9",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-helpers.tsx:57:11",className:"h-3 w-3 mr-1"}),"失败"]});case"running":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:63:9",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 animate-pulse",children:[e.jsx(H,{"code-path":"src/components/deploy/pipeline-helpers.tsx:64:11",className:"h-3 w-3 mr-1 animate-spin"}),"运行中"]});default:return e.jsx(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:70:9",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"从未运行"})}}const le=[{key:"checkout",label:"代码检出",icon:U,color:"#6366F1",order:1,needs:["repo"],desc:"从 Git 仓库拉取代码"},{key:"build",label:"构建",icon:He,color:"#F59E0B",order:2,needs:[],desc:"编译/打包项目"},{key:"test",label:"测试",icon:ae,color:"#10B981",order:3,needs:[],desc:"运行单元/集成测试"},{key:"image",label:"镜像打包",icon:ie,color:"#06B6D4",order:4,needs:["registry"],desc:"Docker 构建 & 推送"},{key:"deploy",label:"部署",icon:Z,color:"#EF4444",order:5,needs:[],desc:"部署到目标环境"},{key:"verify",label:"验证",icon:Le,color:"#3B82F6",order:6,needs:[],desc:"部署后健康检查"}].sort((n,p)=>n.order-p.order);function ge(n){if(!n)return"-";if(n<60)return`${n}s`;const p=Math.floor(n/60),P=n%60;return P>0?`${p}分${P}秒`:`${p}分`}function ma(n){if(!n)return[];try{const p=typeof n=="string"?JSON.parse(n):n;return Array.isArray(p)?p:[]}catch{return[]}}function xa({pipeline:n}){const[p,P]=o.useState(null),[b,j]=o.useState(!1),d=n.code||n.id,y=async()=>{if(d){j(!0);try{const i=await L.getQueue(d);P(i?.data||i)}catch{P(null)}finally{j(!1)}}};o.useEffect(()=>{y();const i=setInterval(y,1e4);return()=>clearInterval(i)},[d]);const M=async i=>{try{await L.removeFromQueue(d,i),N.success("已取消"),y()}catch{N.error("取消失败")}},w=p?.running||0,u=p?.queued||0,C=p?.queue_ids||[],R=n.max_executors||2,t=p?.pending_runs||[];return b&&!p||w===0&&u===0?null:e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:69:5",className:"px-4 py-2 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:70:7",className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:71:9",className:"text-[var(--dg-text-secondary)]",children:"构建执行状态"}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:72:9",className:"font-bold text-[var(--dg-text-primary)]",children:[w,"/",R]}),u>0&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:74:11",className:"text-[var(--dg-text-secondary)] ml-2",children:["构建队列 ",e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:75:18",className:"font-bold text-amber-400",children:["(",u,")"]})]})]}),u>0&&t.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:81:9",className:"space-y-1",children:t.map(i=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:83:13",className:"flex items-center justify-between bg-[var(--dg-bg-tertiary)] rounded px-3 py-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:84:15",className:"flex items-center gap-2 text-xs",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:85:17",className:"h-3 w-3 text-amber-400"}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:86:17",className:"text-[var(--dg-text-secondary)] font-mono",children:["#",String(i.build_number??i.id??"")]}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:87:17",className:"text-[var(--dg-text-secondary)]",children:String(i.branch||"-")}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:88:17",className:"text-[var(--dg-text-secondary)] opacity-50",children:String(i.triggered_by||"-")})]}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:90:15",variant:"ghost",size:"sm",className:"h-6 text-xs text-red-400 hover:text-red-300",onClick:()=>M(i.id),children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:91:17",className:"h-3 w-3 mr-1"}),"取消"]})]},i.id))}),u>0&&t.length===0&&C.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:99:9",className:"space-y-1",children:C.map(i=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:101:13",className:"flex items-center justify-between bg-[var(--dg-bg-tertiary)] rounded px-3 py-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:102:15",className:"flex items-center gap-2 text-xs",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:103:17",className:"h-3 w-3 text-amber-400"}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:104:17",className:"text-[var(--dg-text-muted)] font-mono",children:["Run #",i]})]}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:106:15",variant:"ghost",size:"sm",className:"h-6 text-xs text-red-400 hover:text-red-300",onClick:()=>M(i),children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:107:17",className:"h-3 w-3 mr-1"}),"取消"]})]},i))})]})}function ga({pipeline:n,pipelineRuns:p,isLoadingRuns:P,onStopRun:b}){const[j,d]=o.useState(!1),[y,M]=o.useState(null),[w,u]=o.useState([]),C=n.code||n.id,R=async t=>{M(t),d(!0);try{const i=await L.getRunLog(C,t.id);u(i?.logs||[])}catch{u([])}};return e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:136:5",className:"border-t border-[var(--dg-border)]",children:[e.jsx(xa,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:137:7",pipeline:n}),P?e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:140:9",className:"flex items-center justify-center py-6",children:e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:141:11",className:"h-5 w-5 animate-spin text-[var(--dg-text-secondary)]"})}):p.length===0?e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:144:9",className:"py-6 text-center text-[var(--dg-text-secondary)] text-sm",children:"暂无执行记录"}):e.jsxs("table",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:146:9",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:147:11",className:"border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:148:13",className:"bg-[var(--dg-bg-tertiary)]",children:[e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:149:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"#"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:150:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:151:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"触发人"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:152:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"耗时"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:153:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"时间"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:154:15",className:"px-4 py-2 text-right text-xs font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:157:11",children:p.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:159:15",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:160:17",className:"px-4 py-2 font-medium text-[var(--dg-text-primary)]",children:["#",String(t.build_number??t.id??"")]}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:161:17",className:"px-4 py-2",children:t.status==="success"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:163:21",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30 text-[11px]",children:[e.jsx(ae,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:164:23",className:"h-3 w-3 mr-0.5"}),"成功"]}):t.status==="failed"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:167:21",className:"bg-red-500/20 text-red-400 border-red-500/30 text-[11px]",children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:168:23",className:"h-3 w-3 mr-0.5"}),"失败"]}):t.status==="running"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:171:21",className:"bg-blue-500/20 text-blue-400 border-blue-500/30 text-[11px]",children:[e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:172:23",className:"h-3 w-3 animate-spin mr-0.5"}),"执行中"]}):t.status==="cancelled"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:175:21",className:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30 text-[11px]",children:[e.jsx(de,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:176:23",className:"h-3 w-3 mr-0.5"}),"已停止"]}):e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:179:21",variant:"secondary",className:"text-[11px]",children:String(t.status)})}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:182:17",className:"px-4 py-2 text-[var(--dg-text-secondary)] text-xs",children:String(t.triggered_by||"admin")}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:183:17",className:"px-4 py-2 text-[var(--dg-text-secondary)] text-xs",children:ge(t.duration)}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:184:17",className:"px-4 py-2 text-[var(--dg-text-secondary)] text-xs",children:t.created_at?new Date(t.created_at).toLocaleString("zh-CN"):"-"}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:187:17",className:"px-4 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:188:19",className:"flex items-center justify-end gap-1",children:[e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:189:21",variant:"ghost",size:"sm",className:"h-7 text-xs text-blue-400 hover:text-blue-300",onClick:()=>R(t),children:[e.jsx(_e,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:190:23",className:"h-3.5 w-3.5 mr-1"}),"日志"]}),(t.status==="running"||t.status==="pending")&&e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:193:23",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>b(t.id),children:[e.jsx(de,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:194:25",className:"h-3.5 w-3.5 mr-1"}),"停止"]})]})})]},t.id))})]}),e.jsx(Me,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:205:7",open:j,onOpenChange:d,children:e.jsxs(Ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:206:9",className:"max-w-3xl max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsx(Be,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:207:11",children:e.jsxs(Te,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:208:13",className:"flex items-center gap-2",children:[e.jsx(_e,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:209:15",className:"h-5 w-5"}),"执行日志 #",String(y?.build_number??y?.id??"")]})}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:212:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:213:13",className:"flex flex-wrap gap-3 text-sm text-[var(--dg-text-secondary)]",children:[e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:214:15",children:["触发方式: ",String(y?.triggered_by||"manual")]}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:215:15",children:["分支: ",String(y?.branch||"-")]}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:216:15",children:["耗时: ",ge(y?.duration)]})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:218:13",className:"bg-slate-950 rounded-md p-3 max-h-[50vh] overflow-y-auto font-mono text-xs",children:w.length===0?e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:220:17",className:"text-slate-500 py-4 text-center",children:"暂无日志"}):w.map((t,i)=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:223:19",className:"flex gap-2 py-0.5",children:[e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:224:21",className:"text-slate-500 shrink-0",children:["[",t.time,"]"]}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:225:21",className:t.level==="error"?"text-red-400":t.level==="warn"?"text-yellow-400":t.level==="success"?"text-green-400":"text-slate-300",children:[t.level==="success"?"✓":t.level==="error"?"✗":t.level==="warn"?"!":">"," ",t.message]})]},i))})]})]})})]})}function ha({pipeline:n,isExpanded:p,isLoadingRuns:P,pipelineRuns:b,onToggleExpand:j,onTrigger:d,onStopRunning:y,onDelete:M,onStopRun:w}){const u=Oe(),C=ma(n.stages),R=n.repo,t=n.registry,i=n.environment,A=n.code||n.id;return e.jsx(Ke,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:61:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] overflow-hidden",children:e.jsxs(Ie,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:62:7",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:63:9",className:"px-4 py-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:64:11",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:65:13",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:66:15",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:67:17",className:"font-semibold text-[var(--dg-text-primary)]",children:String(n.name)}),n.run_count>0&&e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:69:19",variant:"outline",className:"text-[11px] text-[var(--dg-text-secondary)] border-[var(--dg-border)]",children:["#",String(n.run_count)]}),da(n.last_status),i&&e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:75:19",style:{backgroundColor:`${i.color}20`,color:i.color},className:"text-xs",children:String(i.display_name)}),n.job_name&&e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:83:19",variant:"secondary",className:"text-xs font-mono opacity-60",children:String(n.job_name)})]}),e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:86:15",className:"text-xs text-[var(--dg-text-secondary)] mt-1 line-clamp-1",children:String(n.description||"暂无描述")}),(n.last_run_branch||n.last_commit_id||n.last_image_tag)&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:91:17",className:"flex items-center gap-1 mt-1.5 text-xs font-mono",children:[n.last_run_branch&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:93:21",className:"flex items-center gap-0.5 text-indigo-400",children:[e.jsx(U,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:94:23",className:"h-3 w-3"}),String(n.last_run_branch)]}),n.last_run_branch&&n.last_commit_id&&e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:98:21",className:"text-[var(--dg-text-secondary)] opacity-50 text-[10px] mx-0.5",children:"+"}),n.last_commit_id&&e.jsx("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:101:21",className:"text-amber-400 bg-amber-400/10 px-1 py-0.5 rounded text-[11px]",children:String(n.last_commit_id).slice(0,8)}),(n.last_run_branch||n.last_commit_id)&&n.last_image_tag&&e.jsx(I,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:106:21",className:"h-3 w-3 text-[var(--dg-text-secondary)] opacity-40 mx-0.5"}),n.last_image_tag&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:109:21",className:"flex items-center gap-0.5 text-cyan-400",children:[e.jsx(Ue,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:110:23",className:"h-3 w-3"}),e.jsx("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:111:23",className:"bg-cyan-400/10 px-1 py-0.5 rounded text-[11px]",children:String(n.last_image_tag)})]}),n.last_duration>0&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:115:21",className:"flex items-center gap-0.5 ml-auto text-[var(--dg-text-secondary)] opacity-50",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:116:23",className:"h-3 w-3"}),ge(n.last_duration)]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:121:15",className:"flex items-center gap-3 mt-1.5 text-xs text-[var(--dg-text-secondary)] opacity-60",children:[e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:122:17",className:"flex items-center gap-1",children:[e.jsx(U,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:123:19",className:"h-3 w-3"}),n.deploy_mode==="tag"?"Tag发版":String(n.branch||"main")]}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:126:17",className:"flex items-center gap-1",children:(n.deploy_target||"ssh")==="k8s"?e.jsxs(e.Fragment,{children:[e.jsx(he,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:128:23",className:"h-3 w-3"}),"Kubernetes"]}):e.jsxs(e.Fragment,{children:[e.jsx(ye,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:130:23",className:"h-3 w-3"}),"SSH 主机"]})}),R&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:133:26",className:"flex items-center gap-1",children:[e.jsx(ue,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:133:68",className:"h-3 w-3"}),String(R.name)]}),t&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:134:30",className:"flex items-center gap-1",children:[e.jsx(ie,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:134:72",className:"h-3 w-3"}),String(t.name)]}),n.last_run_at&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:136:19",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:136:25",className:"h-3 w-3 inline mr-0.5"}),new Date(n.last_run_at).toLocaleString("zh-CN")]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:140:13",className:"flex items-center gap-1 ml-4 shrink-0",children:[n.last_status==="running"?e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:142:17",variant:"destructive",size:"sm",className:"h-8",onClick:y,children:[e.jsx(de,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:143:19",className:"h-3.5 w-3.5 mr-1"}),"停止"]}):e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:146:17",variant:"default",size:"sm",className:"h-8",onClick:d,children:[e.jsx(Xe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:147:19",className:"h-3.5 w-3.5 mr-1"}),"执行"]}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:150:15",variant:"outline",size:"sm",className:"h-8",onClick:()=>u(`/pipelines/${A}`),children:"编辑"}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:151:15",variant:"outline",size:"sm",className:"h-8",onClick:()=>u(`/pipelines/${A}/runs`),children:[e.jsx(Ye,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:152:17",className:"h-3.5 w-3.5 mr-1"}),"记录"]}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:154:15",variant:"ghost",size:"sm",className:"h-8",onClick:j,children:p?e.jsx(Ze,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:155:31",className:"h-4 w-4"}):e.jsx(me,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:155:69",className:"h-4 w-4"})}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:157:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-500",onClick:M,children:e.jsx(Fe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:158:17",className:"h-4 w-4"})})]})]}),C.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:164:13",className:"flex items-center mt-2.5",children:C.map((g,E)=>{const Q=le.find(z=>z.label===g.name);let _="";if(n.last_run_stages)try{const z=typeof n.last_run_stages=="string"?JSON.parse(n.last_run_stages):n.last_run_stages,X=Array.isArray(z)?z.find(J=>J.name===g.name||J.type===Q?.key):null;_=String(X?.status||"")}catch{}const F=_==="success"||_==="completed",q=_==="running"||_==="in_progress",G=_==="failed"||_==="error",$=G?"#EF4444":q?"#3B82F6":F?"#10B981":"#6B7280",V=G?"#EF444428":q?"#3B82F628":F?"#10B98128":"#6B728018",W=G?e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:186:19",className:"h-3 w-3"}):q?e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:188:19",className:"h-3 w-3 animate-spin"}):F?e.jsx(ae,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:190:19",className:"h-3 w-3"}):e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:192:19",className:"text-[10px] opacity-40",children:"○"});return e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:195:19",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:196:21",className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] font-semibold border shadow-sm",style:{backgroundColor:V,borderColor:`${$}70`,color:$,borderRadius:E===0?"8px 0 0 8px":E===C.length-1?"0 8px 8px 0":"0"},children:[W,String(g.name)]}),E{try{const[a,c]=await Promise.all([ra.getEnvironments().catch(()=>({list:[]})),la.list({page_size:100}).catch(()=>({list:[]}))]);ze(Array.isArray(a?.list)?a.list:[]);const x=c?.list||[];X(x.filter(m=>m.secret_type==="api")),ne(x.filter(m=>m.secret_type==="docker"))}catch{}},[]);o.useEffect(()=>{n&&Re()},[n,Re]);const Ae=()=>{j(""),y(""),w(""),C(""),t("main"),A(""),E(["checkout","build","image","deploy"]),_("branch"),q("ssh"),$(""),r(""),B(""),S("manual"),ve(""),be(""),pe(""),fe(""),K([]),we(""),Se(2)},qe=async()=>{if(!b.trim()){N.error("请输入流水线名称");return}if(g.includes("checkout")&&!u.trim()){N.error("代码检出阶段需要填写 Git URL");return}if(g.includes("image")&&!l){N.error("镜像打包阶段需要关联 Docker 凭证");return}W(!0);try{const a=g.map(x=>le.find(m=>m.key===x)?.label||x),c=JSON.stringify(a.map((x,m)=>({id:`stage-${m+1}`,name:x,type:g[m]||"custom",tasks:[]})));await L.createPipeline({name:b,code:ca(b),job_name:d||void 0,description:M,source:u,branch:R,dockerfile:i,type:"deploy",stages:c,deploy_mode:Q,deploy_target:F,environment_id:G?Number(G):null,repo_id:null,registry_id:null,git_credential_id:s?Number(s):null,registry_credential_id:l?Number(l):null,trigger_mode:k,watch_branches:Pe||void 0,exclude_branch:je||void 0,cron_expr:Ne||void 0,webhook_token:Ce||void 0,variables:O.length>0?JSON.stringify(O):void 0,cache_paths:De||void 0,max_executors:ke}),N.success("流水线已创建"),p(!1),Ae(),P()}catch{N.error("创建失败")}finally{W(!1)}};return e.jsx(Me,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:153:5",open:n,onOpenChange:p,children:e.jsxs(Ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:154:7",className:"max-w-2xl max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsx(Be,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:155:9",children:e.jsxs(Te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:156:11",className:"flex items-center gap-2",children:[e.jsx(Z,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:156:60",className:"h-5 w-5"}),"新建流水线"]})}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:158:9",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:159:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:160:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:161:15",children:["名称 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:161:25",className:"text-red-400",children:"*"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:162:15",value:b,onChange:a=>j(a.target.value),placeholder:"例如: demo-jar 后端部署",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:164:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:165:15",children:["Job 名称 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:165:29",className:"text-xs text-[var(--dg-text-secondary)]",children:"(Webhook URL)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:166:15",value:d,onChange:a=>y(a.target.value),placeholder:"cex-admin-server",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9 font-mono text-sm"}),d&&e.jsxs("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:167:30",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-60",children:["Webhook: POST .../webhook/job/",e.jsx("b",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:167:130",children:d})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:170:11",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:171:13",children:"描述"}),e.jsx(oa,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:172:13",value:M,onChange:a=>w(a.target.value),placeholder:"流水线描述...",rows:2,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:175:11",className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:176:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:177:15",children:"部署模式"}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:178:15",className:"flex gap-1 bg-[var(--dg-bg-secondary)] rounded-lg p-1 border border-[var(--dg-border)]",children:[{key:"branch",label:"分支",icon:U},{key:"tag",label:"Tag 发版",icon:ea}].map(a=>{const c=Q===a.key;return e.jsxs("button",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:185:21",onClick:()=>_(a.key),className:`flex-1 flex items-center justify-center gap-1 px-2 py-1.5 rounded-md text-xs font-medium transition-all ${c?"bg-blue-500 text-white":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,children:[e.jsx(a.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:192:23",className:"h-3.5 w-3.5"}),a.label]},a.key)})})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:198:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:199:15",children:"部署目标"}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:200:15",className:"flex gap-1 bg-[var(--dg-bg-secondary)] rounded-lg p-1 border border-[var(--dg-border)]",children:[{key:"ssh",label:"SSH 主机",icon:ye},{key:"k8s",label:"Kubernetes 集群",icon:he}].map(a=>{const c=F===a.key;return e.jsxs("button",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:207:21",onClick:()=>q(a.key),className:`flex-1 flex items-center justify-center gap-1 px-2 py-1.5 rounded-md text-xs font-medium transition-all ${c?"bg-green-500 text-white":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,children:[e.jsx(a.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:214:23",className:"h-3.5 w-3.5"}),a.label]},a.key)})})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:220:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:221:15",children:"环境分组"}),e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:222:15",value:String(G),onValueChange:a=>$(a==="__none"?"":a),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:223:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:223:102",placeholder:"选择环境"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:224:17",children:[e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:225:19",value:"__none",children:"不指定"}),$e.map(a=>e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:227:21",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:228:23",className:"flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:229:25",className:"w-2 h-2 rounded-full inline-block",style:{backgroundColor:a.color}}),String(a.display_name)]})},a.id))]})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:239:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:240:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:241:15",children:["Git URL ",g.includes("checkout")&&e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:241:70",className:"text-red-400",children:"*"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:242:15",value:u,onChange:a=>C(a.target.value),placeholder:"https://gitee.com/user/repo.git",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9 font-mono text-xs"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:244:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:245:15",children:"分支 / Tag"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:246:15",value:R,onChange:a=>t(a.target.value),placeholder:Q==="tag"?"v1.0.0":"main",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:248:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:249:15",children:["Git 凭证 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:249:29",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:"(API Token)"})]}),e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:250:15",value:String(s),onValueChange:a=>r(a==="__none"?"":a),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:251:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:251:102",placeholder:"选择凭证"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:252:17",children:[e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:253:19",value:"__none",children:"不关联"}),z.map(a=>e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:255:21",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:256:23",className:"flex items-center gap-1.5",children:[e.jsx(ue,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:257:25",className:"h-3 w-3 opacity-60"}),String(a.name)," ",a.summary&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:257:96",className:"text-[10px] opacity-50",children:["(",String(a.summary),")"]})]})},a.id))]})]}),!s&&g.includes("checkout")&&e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:263:78",className:"text-xs text-amber-400",children:"建议关联凭证"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:265:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:266:15",children:["镜像仓库凭证 ",g.includes("image")&&e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:266:66",className:"text-red-400",children:"*"})]}),e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:267:15",value:String(l),onValueChange:a=>B(a==="__none"?"":a),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:268:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:268:102",placeholder:"选择 Docker 凭证"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:269:17",children:[e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:270:19",value:"__none",children:"不关联"}),J.map(a=>e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:272:21",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:273:23",className:"flex items-center gap-1.5",children:[e.jsx(ie,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:274:25",className:"h-3 w-3 opacity-60"}),String(a.name)," ",a.summary&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:274:100",className:"text-[10px] opacity-50",children:["(",String(a.summary),")"]})]})},a.id))]})]}),!l&&g.includes("image")&&e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:280:80",className:"text-xs text-amber-400",children:"需要关联 Docker 凭证"})]})]}),l&&d&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:285:13",className:"p-2.5 rounded-md bg-blue-500/5 border border-blue-500/20 text-xs text-[var(--dg-text-secondary)]",children:[e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:286:15",className:"text-blue-400",children:"镜像命名:"}),e.jsxs("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:287:15",className:"text-[var(--dg-text-primary)]",children:["{registry}","/","{namespace}","/","{","{JOB_BASE_NAME}","}",":","{","{tag}","}"]}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:288:15",className:"ml-2 opacity-60",children:"例:"}),e.jsxs("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:289:15",className:"opacity-60",children:["harbor.ast1001.com/test/",d,":latest"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:292:11",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:293:13",children:"Dockerfile 路径"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:294:13",value:i,onChange:a=>A(a.target.value),placeholder:"jar/Dockerfile",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9 font-mono text-xs"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:297:11",className:"space-y-2",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:298:13",children:["发布流程 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:298:25",className:"text-xs text-[var(--dg-text-secondary)] opacity-70 ml-1",children:"按顺序选择阶段"})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:299:13",className:"flex flex-wrap gap-2",children:le.map(a=>{const c=g.includes(a.key);return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:303:19",className:`cursor-pointer transition-all text-xs px-3 py-1.5 ${c?"border-current":"border-[var(--dg-border)] opacity-50 hover:opacity-80"}`,style:c?{backgroundColor:`${a.color}20`,color:a.color,borderColor:a.color}:{},onClick:()=>E(c?g.filter(x=>x!==a.key):[...g,a.key]),title:a.desc,children:[e.jsx(a.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:310:21",className:"h-3 w-3 mr-1"}),a.label," ",a.needs.includes("repo")?"🔗":"",a.needs.includes("registry")?"📦":""]},a.key)})}),g.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:316:15",className:"flex items-center mt-2",children:g.map((a,c)=>{const x=le.find(m=>m.key===a);return e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:320:21",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:321:23",className:"flex items-center gap-1 px-2 py-1 text-[11px] font-medium border",style:{backgroundColor:`${x.color}20`,borderColor:`${x.color}40`,color:x.color,borderRadius:c===0?"6px 0 0 6px":c===g.length-1?"0 6px 6px 0":"0"},children:[e.jsx(x.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:330:25",className:"h-3 w-3"}),x.label]}),c{const c=k===a.key;return e.jsx("button",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:355:19",onClick:()=>S(a.key),className:`flex-1 flex flex-col items-center gap-0.5 px-2 py-2 rounded-md text-xs font-medium transition-all ${c?"bg-blue-500 text-white":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,title:a.desc,children:a.label},a.key)})}),k==="git_push"&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:370:15",className:"mt-3 space-y-2 p-3 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:371:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:372:19",className:"text-xs",children:["监听分支 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:372:51",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(逗号分隔,支持 * 通配)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:373:19",value:Pe,onChange:a=>ve(a.target.value),placeholder:"release/*, main",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:375:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:376:19",className:"text-xs",children:["排除分支 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:376:51",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(不触发构建)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:377:19",value:je,onChange:a=>be(a.target.value),placeholder:"wip/*, draft/*",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]})]}),k==="cron"&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:383:15",className:"mt-3 space-y-2 p-3 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:384:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:385:19",className:"text-xs",children:["Cron 表达式 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:385:55",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(标准 5 位)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:386:19",value:Ne,onChange:a=>pe(a.target.value),placeholder:"0 2 * * *",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:388:17",className:"flex flex-wrap gap-1.5",children:[{expr:"*/5 * * * *",label:"每5分钟"},{expr:"0 * * * *",label:"每小时"},{expr:"0 2 * * *",label:"每天2点"},{expr:"0 0 * * 0",label:"每周日"}].map(a=>e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:395:21",variant:"outline",className:"cursor-pointer text-[10px] hover:bg-blue-500/10",onClick:()=>pe(a.expr),children:a.label},a.expr))})]}),k==="webhook"&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:404:15",className:"mt-3 space-y-2 p-3 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:405:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:406:19",className:"text-xs",children:["Webhook Token ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:406:60",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(签名验证,可选)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:407:19",value:Ce,onChange:a=>fe(a.target.value),placeholder:"随机字符串",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]}),e.jsxs("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:409:17",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-60",children:["Webhook URL: ",e.jsxs("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:410:32",className:"text-[var(--dg-blue)]",children:["POST /api/v1/webhook/pipeline/","{code}"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:416:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:417:13",className:"flex items-center justify-between mb-2",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:418:15",children:["环境变量 ",e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:418:27",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:["($","{VAR_NAME}"," 引用)"]})]}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:419:15",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>K([...O,{key:"",value:"",desc:""}]),children:[e.jsx(xe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:420:17",className:"h-3 w-3 mr-1"}),"添加变量"]})]}),O.length===0?e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:424:15",className:"text-xs text-[var(--dg-text-muted)] py-2",children:'暂无变量,点击"添加变量"新增'}):e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:426:15",className:"space-y-2",children:O.map((a,c)=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:428:19",className:"grid grid-cols-12 gap-2 items-start p-2 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:429:21",value:a.key,onChange:x=>{const m=[...O];m[c]={...m[c],key:x.target.value},K(m)},placeholder:"变量名",className:"col-span-3 h-8 text-xs font-mono bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:439:21",value:a.value,onChange:x=>{const m=[...O];m[c]={...m[c],value:x.target.value},K(m)},placeholder:"变量值",className:"col-span-4 h-8 text-xs font-mono bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:449:21",value:a.desc,onChange:x=>{const m=[...O];m[c]={...m[c],desc:x.target.value},K(m)},placeholder:"说明",className:"col-span-4 h-8 text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:459:21",variant:"ghost",size:"icon",className:"col-span-1 h-8 w-8 text-red-400",onClick:()=>K(O.filter((x,m)=>m!==c)),children:e.jsx(Fe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:460:23",className:"h-3.5 w-3.5"})})]},c))})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:468:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:469:13",className:"mb-2 block",children:["构建缓存 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:469:48",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:"(加速后续构建)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:470:13",value:De,onChange:a=>we(a.target.value),placeholder:"node_modules, .m2, target",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-8 text-xs font-mono"}),e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:471:13",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-50 mt-1",children:"多个路径用逗号分隔,相同的 Key 会命中已有缓存"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:474:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:475:13",className:"mb-2 block",children:["并发执行数 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:475:49",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:"(Number of executors)"})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:476:13",className:"flex items-center gap-2",children:e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:477:15",value:String(ke),onValueChange:a=>Se(Number(a)),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:478:17",className:"w-32 h-8 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:479:19"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:481:17",children:[e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:482:19",value:"1",children:"1 — 串行"}),e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:483:19",value:"2",children:"2"}),e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:484:19",value:"3",children:"3"}),e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:485:19",value:"4",children:"4"}),e.jsx(T,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:486:19",value:"5",children:"5"})]})]})}),e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:490:13",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-50 mt-1",children:"设为 1 则按顺序串行执行,默认 2 可并发构建"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:493:9",className:"flex justify-end gap-2 mt-4 pt-4 border-t border-[var(--dg-border)]",children:[e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:494:11",variant:"outline",onClick:()=>p(!1),children:"取消"}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:495:11",onClick:qe,disabled:V,children:[V?e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:496:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(Z,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:496:75",className:"h-4 w-4 mr-1"}),V?"创建中...":"创建流水线"]})]})]})})}function Ea(){const[n,p]=o.useState(""),{data:P=[],isLoading:b,refetch:j}=ia(),{triggerMutation:d,deleteMutation:y,stopRunMutation:M}=pa(),[w,u]=o.useState({}),[C,R]=o.useState({}),[t,i]=o.useState({}),[A,g]=o.useState("all"),[E,Q]=o.useState({}),[_,F]=o.useState(!1),q=Qe(),G=[{key:"all",label:"全部",icon:na,color:"#6B7280"},{key:"production",label:"生产",icon:Le,color:"#EF4444"},{key:"testing",label:"测试",icon:ae,color:"#F59E0B"},{key:"staging",label:"预发布",icon:ue,color:"#8B5CF6"},{key:"development",label:"开发",icon:sa,color:"#3B82F6"}];o.useEffect(()=>{P.forEach(s=>{const r=s.id;s.last_status==="running"&&!E[r]&&L.getRuns(s.code).then(l=>{const k=(l?.list||[]).find(S=>S.status==="running"||S.status==="pending");k&&Q(S=>({...S,[r]:k}))}).catch(()=>{})})},[P,E]);const $=async(s,r)=>{i(l=>({...l,[s]:!0}));try{const l=await L.getRuns(r);R(B=>({...B,[s]:l?.list||[]}))}catch{R(l=>({...l,[s]:[]}))}finally{i(l=>({...l,[s]:!1}))}},V=(s,r)=>{w[s]?u(l=>({...l,[s]:!1})):($(s,r),u(l=>({...l,[s]:!0})))},W=async(s,r)=>{try{await d.mutateAsync(r),N.success("已触发"),$(s,r),j()}catch{N.error("触发失败")}},z=async(s,r,l)=>{if(await q({title:"停止运行",description:"确定要停止此运行吗?",variant:"destructive"}))try{await M.mutateAsync({code:r,runId:l}),N.success("已停止"),$(s,r),Q(k=>{const S={...k};return delete S[s],S})}catch{N.error("停止失败")}},X=async(s,r)=>{const l=E[s];if(!l){try{const k=((await L.getRuns(r))?.list||[]).find(S=>S.status==="running"||S.status==="pending");k?await z(s,r,k.id):N.error("未找到运行中的任务")}catch{N.error("停止失败")}return}await z(s,r,l.id)},J=async s=>{if(await q({title:"删除流水线",description:`确定删除「${s.name}」?`,variant:"destructive"}))try{await y.mutateAsync(s.id),N.success("已删除"),j()}catch{N.error("删除失败")}},ne=P.filter(s=>{const r=String(s.name||"").toLowerCase().includes(n.toLowerCase())||String(s.description||"").toLowerCase().includes(n.toLowerCase()),l=s.environment,B=A==="all"||(l?.type||"")===A;return r&&B});return e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:157:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:158:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:159:9",children:[e.jsx("h1",{"code-path":"src/components/deploy/PipelineManager.tsx:160:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"流水线"}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:161:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"CI/CD 构建 · 部署 · 发布一体化"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:163:9",className:"flex items-center gap-2",children:[e.jsxs(v,{"code-path":"src/components/deploy/PipelineManager.tsx:164:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>j(),children:[e.jsx(ee,{"code-path":"src/components/deploy/PipelineManager.tsx:165:13",className:`h-4 w-4 mr-2 ${b?"animate-spin":""}`}),"刷新"]}),e.jsxs(v,{"code-path":"src/components/deploy/PipelineManager.tsx:167:11",onClick:()=>F(!0),children:[e.jsx(xe,{"code-path":"src/components/deploy/PipelineManager.tsx:167:52",className:"h-4 w-4 mr-2"}),"新建流水线"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:172:7",className:"flex items-stretch gap-3 px-4 py-3 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:173:9",className:"flex-1 space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:174:11",className:"flex items-center gap-1.5",children:[e.jsx(U,{"code-path":"src/components/deploy/PipelineManager.tsx:175:13",className:"h-3 w-3 text-indigo-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:176:13",className:"text-[10px] font-semibold text-indigo-400",children:"构建"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:177:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsx(Z,{"code-path":"src/components/deploy/PipelineManager.tsx:178:13",className:"h-3 w-3 text-red-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:179:13",className:"text-[10px] font-semibold text-red-400",children:"部署"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:180:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:181:13",className:"flex items-center gap-1 px-2 py-0.5 rounded bg-blue-400/10 border border-blue-400/20",children:[e.jsx(ye,{"code-path":"src/components/deploy/PipelineManager.tsx:182:15",className:"h-3 w-3 text-blue-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:183:15",className:"text-[10px] font-medium text-blue-400",children:"SSH 主机"})]})]}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:186:11",className:"text-[9px] text-[var(--dg-text-secondary)] opacity-40 pl-1",children:"传统主机 SCP 部署 · 无需镜像仓库"})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:188:9",className:"w-px bg-[var(--dg-border)]"}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:189:9",className:"flex-1 space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:190:11",className:"flex items-center gap-1.5",children:[e.jsx(U,{"code-path":"src/components/deploy/PipelineManager.tsx:191:13",className:"h-3 w-3 text-indigo-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:192:13",className:"text-[10px] font-semibold text-indigo-400",children:"构建"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:193:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsx(ie,{"code-path":"src/components/deploy/PipelineManager.tsx:194:13",className:"h-3 w-3 text-cyan-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:195:13",className:"text-[10px] font-semibold text-cyan-400",children:"镜像仓库"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:196:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsx(Z,{"code-path":"src/components/deploy/PipelineManager.tsx:197:13",className:"h-3 w-3 text-red-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:198:13",className:"text-[10px] font-semibold text-red-400",children:"部署"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:199:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:200:13",className:"flex items-center gap-1 px-2 py-0.5 rounded bg-emerald-400/10 border border-emerald-400/20",children:[e.jsx(he,{"code-path":"src/components/deploy/PipelineManager.tsx:201:15",className:"h-3 w-3 text-emerald-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:202:15",className:"text-[10px] font-medium text-emerald-400",children:"Kubernetes"})]})]}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:205:11",className:"text-[9px] text-[var(--dg-text-secondary)] opacity-40 pl-1",children:"容器化部署 · 需镜像仓库推送"})]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:207:9",className:"self-center ml-2 text-[10px] text-[var(--dg-text-secondary)] opacity-30 tracking-wide whitespace-nowrap",children:"全流程可视化"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:210:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:211:9",className:"relative max-w-md flex-1",children:[e.jsx(aa,{"code-path":"src/components/deploy/PipelineManager.tsx:212:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-secondary)]"}),e.jsx(f,{"code-path":"src/components/deploy/PipelineManager.tsx:213:11",placeholder:"搜索流水线...",value:n,onChange:s=>p(s.target.value),className:"pl-10 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:220:9",className:"flex items-center gap-1 bg-[var(--dg-bg-secondary)] rounded-lg p-1 border border-[var(--dg-border)]",children:G.map(s=>{const r=A===s.key,l=s.icon;return e.jsxs("button",{"code-path":"src/components/deploy/PipelineManager.tsx:225:15",onClick:()=>g(s.key),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all ${r?"text-white shadow-sm":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,style:r?{backgroundColor:s.color}:{},children:[e.jsx(l,{"code-path":"src/components/deploy/PipelineManager.tsx:233:17",className:"h-3.5 w-3.5"}),s.label]},s.key)})})]}),b?e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:241:9",className:"flex items-center justify-center py-12",children:e.jsx(H,{"code-path":"src/components/deploy/PipelineManager.tsx:242:11",className:"h-6 w-6 text-[var(--dg-text-secondary)] animate-spin"})}):ne.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:245:9",className:"text-center py-16 text-[var(--dg-text-secondary)]",children:[e.jsx(ta,{"code-path":"src/components/deploy/PipelineManager.tsx:246:11",className:"h-10 w-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:247:11",className:"text-sm",children:"暂无流水线"}),e.jsxs(v,{"code-path":"src/components/deploy/PipelineManager.tsx:248:11",variant:"outline",className:"mt-4",onClick:()=>F(!0),children:[e.jsx(xe,{"code-path":"src/components/deploy/PipelineManager.tsx:249:13",className:"h-4 w-4 mr-1"}),"创建第一个流水线"]})]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:253:9",className:"space-y-3",children:ne.map(s=>{const r=s.id,l=s.code||s.id;return e.jsx(ha,{"code-path":"src/components/deploy/PipelineManager.tsx:258:15",pipeline:s,isExpanded:!!w[r],isLoadingRuns:!!t[r],pipelineRuns:C[r]||[],onToggleExpand:()=>V(r,l),onTrigger:()=>W(r,l),onStopRunning:()=>X(r,l),onDelete:()=>J(s),onStopRun:B=>z(r,l,B)},r)})}),e.jsx(ya,{"code-path":"src/components/deploy/PipelineManager.tsx:275:7",open:_,onOpenChange:F,onCreated:j})]})}export{Ea as PipelineManager}; +import{j as e,r as o}from"./vendor-codemirror-B1SGo4xl.js";import{G as Ge,B as v,D as Me,a as Ee,b as Be,c as Le,t as N,i as Qe,f as Oe}from"./index-Bp-M7P_8.js";import{I as f}from"./input-Bnlm--la.js";import{p as T}from"./pipeline-BGteNHr0.js";import{u as We,q as Ve,b as Je}from"./unwrap-D6sbt6TG.js";import{u as ce}from"./useMutation-DTWI9Q1n.js";import{C as Ke,a as Ie}from"./card-BHSBTtub.js";import{B as D}from"./badge-B00SZHvE.js";import{L as H,a as Y,y as ae,J as U,ad as He,k as ie,ar as Z,as as Te,a2 as de,F as _e,b as ee,ae as I,aQ as Ue,N as he,h as ye,G as ue,z as Xe,aq as Ye,Q as Ze,f as me,T as Fe,q as ea,P as xe,S as aa,aR as na,ac as sa,aS as ta}from"./vendor-icons-BWk-DH7F.js";import{T as oa}from"./textarea-BvOVhaCD.js";import{L as h}from"./label-NkONM5Mp.js";import{S as se,a as te,b as oe,c as re,d as L}from"./select-DbhcBWnH.js";import{d as ra}from"./config-CBy2SxR-.js";import{c as la}from"./credential-Df-OY-sx.js";import"./index-5FEebgvX.js";function ia(n={page:1,page_size:100}){return We({queryKey:Ve.pipelines(n),queryFn:async()=>{const p=await T.getPipelines(n);return Je(p)},staleTime:2e4})}function pa(){const n=Ge(),p=()=>n.invalidateQueries({queryKey:["pipelines"]}),P=ce({mutationFn:d=>T.triggerByCode(d),onSuccess:p}),b=ce({mutationFn:d=>T.deletePipeline(d),onSuccess:p}),j=ce({mutationFn:({code:d,runId:y})=>T.stopRunByCode(d,y)});return{triggerMutation:P,deleteMutation:b,stopRunMutation:j,invalidate:p}}function ca(n){return n.toLowerCase().replace(/[^a-z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")||`pipeline-${Date.now()}`}function da(n){switch(n){case"success":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:49:9",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx(ae,{"code-path":"src/components/deploy/pipeline-helpers.tsx:50:11",className:"h-3 w-3 mr-1"}),"成功"]});case"failed":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:56:9",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-helpers.tsx:57:11",className:"h-3 w-3 mr-1"}),"失败"]});case"running":return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:63:9",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 animate-pulse",children:[e.jsx(H,{"code-path":"src/components/deploy/pipeline-helpers.tsx:64:11",className:"h-3 w-3 mr-1 animate-spin"}),"运行中"]});default:return e.jsx(D,{"code-path":"src/components/deploy/pipeline-helpers.tsx:70:9",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"从未运行"})}}const le=[{key:"checkout",label:"代码检出",icon:U,color:"#6366F1",order:1,needs:["repo"],desc:"从 Git 仓库拉取代码"},{key:"build",label:"构建",icon:He,color:"#F59E0B",order:2,needs:[],desc:"编译/打包项目"},{key:"test",label:"测试",icon:ae,color:"#10B981",order:3,needs:[],desc:"运行单元/集成测试"},{key:"image",label:"镜像打包",icon:ie,color:"#06B6D4",order:4,needs:["registry"],desc:"Docker 构建 & 推送"},{key:"deploy",label:"部署",icon:Z,color:"#EF4444",order:5,needs:[],desc:"部署到目标环境"},{key:"verify",label:"验证",icon:Te,color:"#3B82F6",order:6,needs:[],desc:"部署后健康检查"}].sort((n,p)=>n.order-p.order);function ge(n){if(!n)return"-";if(n<60)return`${n}s`;const p=Math.floor(n/60),P=n%60;return P>0?`${p}分${P}秒`:`${p}分`}function ma(n){if(!n)return[];try{const p=typeof n=="string"?JSON.parse(n):n;return Array.isArray(p)?p:[]}catch{return[]}}function xa({pipeline:n}){const[p,P]=o.useState(null),[b,j]=o.useState(!1),d=n.code||n.id,y=async()=>{if(d){j(!0);try{const i=await T.getQueue(d);P(i?.data||i)}catch{P(null)}finally{j(!1)}}};o.useEffect(()=>{y();const i=setInterval(y,1e4);return()=>clearInterval(i)},[d]);const M=async i=>{try{await T.removeFromQueue(d,i),N.success("已取消"),y()}catch{N.error("取消失败")}},w=p?.running||0,u=p?.queued||0,C=p?.queue_ids||[],R=n.max_executors||2,t=p?.pending_runs||[];return b&&!p||w===0&&u===0?null:e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:69:5",className:"px-4 py-2 space-y-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:70:7",className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:71:9",className:"text-[var(--dg-text-secondary)]",children:"构建执行状态"}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:72:9",className:"font-bold text-[var(--dg-text-primary)]",children:[w,"/",R]}),u>0&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:74:11",className:"text-[var(--dg-text-secondary)] ml-2",children:["构建队列 ",e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:75:18",className:"font-bold text-amber-400",children:["(",u,")"]})]})]}),u>0&&t.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:81:9",className:"space-y-1",children:t.map(i=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:83:13",className:"flex items-center justify-between bg-[var(--dg-bg-tertiary)] rounded px-3 py-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:84:15",className:"flex items-center gap-2 text-xs",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:85:17",className:"h-3 w-3 text-amber-400"}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:86:17",className:"text-[var(--dg-text-secondary)] font-mono",children:["#",String(i.build_number??i.id??"")]}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:87:17",className:"text-[var(--dg-text-secondary)]",children:String(i.branch||"-")}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:88:17",className:"text-[var(--dg-text-secondary)] opacity-50",children:String(i.triggered_by||"-")})]}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:90:15",variant:"ghost",size:"sm",className:"h-6 text-xs text-red-400 hover:text-red-300",onClick:()=>M(i.id),children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:91:17",className:"h-3 w-3 mr-1"}),"取消"]})]},i.id))}),u>0&&t.length===0&&C.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:99:9",className:"space-y-1",children:C.map(i=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:101:13",className:"flex items-center justify-between bg-[var(--dg-bg-tertiary)] rounded px-3 py-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:102:15",className:"flex items-center gap-2 text-xs",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:103:17",className:"h-3 w-3 text-amber-400"}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:104:17",className:"text-[var(--dg-text-muted)] font-mono",children:["Run #",i]})]}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:106:15",variant:"ghost",size:"sm",className:"h-6 text-xs text-red-400 hover:text-red-300",onClick:()=>M(i),children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:107:17",className:"h-3 w-3 mr-1"}),"取消"]})]},i))})]})}function ga({pipeline:n,pipelineRuns:p,isLoadingRuns:P,onStopRun:b}){const[j,d]=o.useState(!1),[y,M]=o.useState(null),[w,u]=o.useState([]),C=n.code||n.id,R=async t=>{M(t),d(!0);try{const i=await T.getRunLog(C,t.id);u(i?.logs||[])}catch{u([])}};return e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:136:5",className:"border-t border-[var(--dg-border)]",children:[e.jsx(xa,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:137:7",pipeline:n}),P?e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:140:9",className:"flex items-center justify-center py-6",children:e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:141:11",className:"h-5 w-5 animate-spin text-[var(--dg-text-secondary)]"})}):p.length===0?e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:144:9",className:"py-6 text-center text-[var(--dg-text-secondary)] text-sm",children:"暂无执行记录"}):e.jsxs("table",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:146:9",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:147:11",className:"border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:148:13",className:"bg-[var(--dg-bg-tertiary)]",children:[e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:149:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"#"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:150:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:151:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"触发人"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:152:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"耗时"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:153:15",className:"px-4 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"时间"}),e.jsx("th",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:154:15",className:"px-4 py-2 text-right text-xs font-medium text-[var(--dg-text-secondary)]",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:157:11",children:p.map(t=>e.jsxs("tr",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:159:15",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-tertiary)]/50",children:[e.jsxs("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:160:17",className:"px-4 py-2 font-medium text-[var(--dg-text-primary)]",children:["#",String(t.build_number??t.id??"")]}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:161:17",className:"px-4 py-2",children:t.status==="success"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:163:21",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30 text-[11px]",children:[e.jsx(ae,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:164:23",className:"h-3 w-3 mr-0.5"}),"成功"]}):t.status==="failed"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:167:21",className:"bg-red-500/20 text-red-400 border-red-500/30 text-[11px]",children:[e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:168:23",className:"h-3 w-3 mr-0.5"}),"失败"]}):t.status==="running"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:171:21",className:"bg-blue-500/20 text-blue-400 border-blue-500/30 text-[11px]",children:[e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:172:23",className:"h-3 w-3 animate-spin mr-0.5"}),"执行中"]}):t.status==="cancelled"?e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:175:21",className:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30 text-[11px]",children:[e.jsx(de,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:176:23",className:"h-3 w-3 mr-0.5"}),"已停止"]}):e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:179:21",variant:"secondary",className:"text-[11px]",children:String(t.status)})}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:182:17",className:"px-4 py-2 text-[var(--dg-text-secondary)] text-xs",children:String(t.triggered_by||"admin")}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:183:17",className:"px-4 py-2 text-[var(--dg-text-secondary)] text-xs",children:ge(t.duration)}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:184:17",className:"px-4 py-2 text-[var(--dg-text-secondary)] text-xs",children:t.created_at?new Date(t.created_at).toLocaleString("zh-CN"):"-"}),e.jsx("td",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:187:17",className:"px-4 py-2 text-right",children:e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:188:19",className:"flex items-center justify-end gap-1",children:[e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:189:21",variant:"ghost",size:"sm",className:"h-7 text-xs text-blue-400 hover:text-blue-300",onClick:()=>R(t),children:[e.jsx(_e,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:190:23",className:"h-3.5 w-3.5 mr-1"}),"日志"]}),(t.status==="running"||t.status==="pending")&&e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:193:23",variant:"ghost",size:"sm",className:"h-7 text-xs text-red-400 hover:text-red-300",onClick:()=>b(t.id),children:[e.jsx(de,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:194:25",className:"h-3.5 w-3.5 mr-1"}),"停止"]})]})})]},t.id))})]}),e.jsx(Me,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:205:7",open:j,onOpenChange:d,children:e.jsxs(Ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:206:9",className:"max-w-3xl max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsx(Be,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:207:11",children:e.jsxs(Le,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:208:13",className:"flex items-center gap-2",children:[e.jsx(_e,{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:209:15",className:"h-5 w-5"}),"执行日志 #",String(y?.build_number??y?.id??"")]})}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:212:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:213:13",className:"flex flex-wrap gap-3 text-sm text-[var(--dg-text-secondary)]",children:[e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:214:15",children:["触发方式: ",String(y?.triggered_by||"manual")]}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:215:15",children:["分支: ",String(y?.branch||"-")]}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:216:15",children:["耗时: ",ge(y?.duration)]})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:218:13",className:"bg-slate-950 rounded-md p-3 max-h-[50vh] overflow-y-auto font-mono text-xs",children:w.length===0?e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:220:17",className:"text-slate-500 py-4 text-center",children:"暂无日志"}):w.map((t,i)=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:223:19",className:"flex gap-2 py-0.5",children:[e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:224:21",className:"text-slate-500 shrink-0",children:["[",t.time,"]"]}),e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineRunPanel.tsx:225:21",className:t.level==="error"?"text-red-400":t.level==="warn"?"text-yellow-400":t.level==="success"?"text-green-400":"text-slate-300",children:[t.level==="success"?"✓":t.level==="error"?"✗":t.level==="warn"?"!":">"," ",t.message]})]},i))})]})]})})]})}function ha({pipeline:n,isExpanded:p,isLoadingRuns:P,pipelineRuns:b,onToggleExpand:j,onTrigger:d,onStopRunning:y,onDelete:M,onStopRun:w}){const u=Qe(),C=ma(n.stages),R=n.repo,t=n.registry,i=n.environment,A=n.code||n.id;return e.jsx(Ke,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:61:5",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] overflow-hidden",children:e.jsxs(Ie,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:62:7",className:"p-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:63:9",className:"px-4 py-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:64:11",className:"flex items-start justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:65:13",className:"flex-1 min-w-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:66:15",className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:67:17",className:"font-semibold text-[var(--dg-text-primary)]",children:String(n.name)}),n.run_count>0&&e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:69:19",variant:"outline",className:"text-[11px] text-[var(--dg-text-secondary)] border-[var(--dg-border)]",children:["#",String(n.run_count)]}),da(n.last_status),i&&e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:75:19",style:{backgroundColor:`${i.color}20`,color:i.color},className:"text-xs",children:String(i.display_name)}),n.job_name&&e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:83:19",variant:"secondary",className:"text-xs font-mono opacity-60",children:String(n.job_name)})]}),e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:86:15",className:"text-xs text-[var(--dg-text-secondary)] mt-1 line-clamp-1",children:String(n.description||"暂无描述")}),(n.last_run_branch||n.last_commit_id||n.last_image_tag)&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:91:17",className:"flex items-center gap-1 mt-1.5 text-xs font-mono",children:[n.last_run_branch&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:93:21",className:"flex items-center gap-0.5 text-indigo-400",children:[e.jsx(U,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:94:23",className:"h-3 w-3"}),String(n.last_run_branch)]}),n.last_run_branch&&n.last_commit_id&&e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:98:21",className:"text-[var(--dg-text-secondary)] opacity-50 text-[10px] mx-0.5",children:"+"}),n.last_commit_id&&e.jsx("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:101:21",className:"text-amber-400 bg-amber-400/10 px-1 py-0.5 rounded text-[11px]",children:String(n.last_commit_id).slice(0,8)}),(n.last_run_branch||n.last_commit_id)&&n.last_image_tag&&e.jsx(I,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:106:21",className:"h-3 w-3 text-[var(--dg-text-secondary)] opacity-40 mx-0.5"}),n.last_image_tag&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:109:21",className:"flex items-center gap-0.5 text-cyan-400",children:[e.jsx(Ue,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:110:23",className:"h-3 w-3"}),e.jsx("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:111:23",className:"bg-cyan-400/10 px-1 py-0.5 rounded text-[11px]",children:String(n.last_image_tag)})]}),n.last_duration>0&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:115:21",className:"flex items-center gap-0.5 ml-auto text-[var(--dg-text-secondary)] opacity-50",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:116:23",className:"h-3 w-3"}),ge(n.last_duration)]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:121:15",className:"flex items-center gap-3 mt-1.5 text-xs text-[var(--dg-text-secondary)] opacity-60",children:[e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:122:17",className:"flex items-center gap-1",children:[e.jsx(U,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:123:19",className:"h-3 w-3"}),n.deploy_mode==="tag"?"Tag发版":String(n.branch||"main")]}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:126:17",className:"flex items-center gap-1",children:(n.deploy_target||"ssh")==="k8s"?e.jsxs(e.Fragment,{children:[e.jsx(he,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:128:23",className:"h-3 w-3"}),"Kubernetes"]}):e.jsxs(e.Fragment,{children:[e.jsx(ye,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:130:23",className:"h-3 w-3"}),"SSH 主机"]})}),R&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:133:26",className:"flex items-center gap-1",children:[e.jsx(ue,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:133:68",className:"h-3 w-3"}),String(R.name)]}),t&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:134:30",className:"flex items-center gap-1",children:[e.jsx(ie,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:134:72",className:"h-3 w-3"}),String(t.name)]}),n.last_run_at&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:136:19",children:[e.jsx(ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:136:25",className:"h-3 w-3 inline mr-0.5"}),new Date(n.last_run_at).toLocaleString("zh-CN")]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:140:13",className:"flex items-center gap-1 ml-4 shrink-0",children:[n.last_status==="running"?e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:142:17",variant:"destructive",size:"sm",className:"h-8",onClick:y,children:[e.jsx(de,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:143:19",className:"h-3.5 w-3.5 mr-1"}),"停止"]}):e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:146:17",variant:"default",size:"sm",className:"h-8",onClick:d,children:[e.jsx(Xe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:147:19",className:"h-3.5 w-3.5 mr-1"}),"执行"]}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:150:15",variant:"outline",size:"sm",className:"h-8",onClick:()=>u(`/pipelines/${A}`),children:"编辑"}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:151:15",variant:"outline",size:"sm",className:"h-8",onClick:()=>u(`/pipelines/${A}/runs`),children:[e.jsx(Ye,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:152:17",className:"h-3.5 w-3.5 mr-1"}),"记录"]}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:154:15",variant:"ghost",size:"sm",className:"h-8",onClick:j,children:p?e.jsx(Ze,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:155:31",className:"h-4 w-4"}):e.jsx(me,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:155:69",className:"h-4 w-4"})}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:157:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-500",onClick:M,children:e.jsx(Fe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:158:17",className:"h-4 w-4"})})]})]}),C.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:164:13",className:"flex items-center mt-2.5",children:C.map((g,E)=>{const O=le.find(z=>z.label===g.name);let _="";if(n.last_run_stages)try{const z=typeof n.last_run_stages=="string"?JSON.parse(n.last_run_stages):n.last_run_stages,X=Array.isArray(z)?z.find(J=>J.name===g.name||J.type===O?.key):null;_=String(X?.status||"")}catch{}const F=_==="success"||_==="completed",q=_==="running"||_==="in_progress",G=_==="failed"||_==="error",$=G?"#EF4444":q?"#3B82F6":F?"#10B981":"#6B7280",W=G?"#EF444428":q?"#3B82F628":F?"#10B98128":"#6B728018",V=G?e.jsx(Y,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:186:19",className:"h-3 w-3"}):q?e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:188:19",className:"h-3 w-3 animate-spin"}):F?e.jsx(ae,{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:190:19",className:"h-3 w-3"}):e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:192:19",className:"text-[10px] opacity-40",children:"○"});return e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:195:19",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCard.tsx:196:21",className:"flex items-center gap-1.5 px-2.5 py-1.5 text-[11px] font-semibold border shadow-sm",style:{backgroundColor:W,borderColor:`${$}70`,color:$,borderRadius:E===0?"8px 0 0 8px":E===C.length-1?"0 8px 8px 0":"0"},children:[V,String(g.name)]}),E{try{const[a,c]=await Promise.all([ra.getEnvironments().catch(()=>({list:[]})),la.list({page_size:100}).catch(()=>({list:[]}))]);ze(Array.isArray(a?.list)?a.list:[]);const x=c?.list||[];X(x.filter(m=>m.secret_type==="api")),ne(x.filter(m=>m.secret_type==="docker"))}catch{}},[]);o.useEffect(()=>{n&&Re()},[n,Re]);const Ae=()=>{j(""),y(""),w(""),C(""),t("main"),A(""),E(["checkout","build","image","deploy"]),_("branch"),q("ssh"),$(""),r(""),B(""),S("manual"),ve(""),be(""),pe(""),fe(""),K([]),we(""),Se(2)},qe=async()=>{if(!b.trim()){N.error("请输入流水线名称");return}if(g.includes("checkout")&&!u.trim()){N.error("代码检出阶段需要填写 Git URL");return}if(g.includes("image")&&!l){N.error("镜像打包阶段需要关联 Docker 凭证");return}V(!0);try{const a=g.map(x=>le.find(m=>m.key===x)?.label||x),c=JSON.stringify(a.map((x,m)=>({id:`stage-${m+1}`,name:x,type:g[m]||"custom",tasks:[]})));await T.createPipeline({name:b,code:ca(b),job_name:d||void 0,description:M,source:u,branch:R,dockerfile:i,type:"deploy",stages:c,deploy_mode:O,deploy_target:F,environment_id:G?Number(G):null,repo_id:null,registry_id:null,git_credential_id:s?Number(s):null,registry_credential_id:l?Number(l):null,trigger_mode:k,watch_branches:Pe||void 0,exclude_branch:je||void 0,cron_expr:Ne||void 0,webhook_token:Ce||void 0,variables:Q.length>0?JSON.stringify(Q):void 0,cache_paths:De||void 0,max_executors:ke}),N.success("流水线已创建"),p(!1),Ae(),P()}catch{N.error("创建失败")}finally{V(!1)}};return e.jsx(Me,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:153:5",open:n,onOpenChange:p,children:e.jsxs(Ee,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:154:7",className:"max-w-2xl max-h-[85vh] overflow-y-auto bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsx(Be,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:155:9",children:e.jsxs(Le,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:156:11",className:"flex items-center gap-2",children:[e.jsx(Z,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:156:60",className:"h-5 w-5"}),"新建流水线"]})}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:158:9",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:159:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:160:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:161:15",children:["名称 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:161:25",className:"text-red-400",children:"*"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:162:15",value:b,onChange:a=>j(a.target.value),placeholder:"例如: demo-jar 后端部署",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:164:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:165:15",children:["Job 名称 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:165:29",className:"text-xs text-[var(--dg-text-secondary)]",children:"(Webhook URL)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:166:15",value:d,onChange:a=>y(a.target.value),placeholder:"cex-admin-server",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9 font-mono text-sm"}),d&&e.jsxs("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:167:30",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-60",children:["Webhook: POST .../webhook/job/",e.jsx("b",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:167:130",children:d})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:170:11",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:171:13",children:"描述"}),e.jsx(oa,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:172:13",value:M,onChange:a=>w(a.target.value),placeholder:"流水线描述...",rows:2,className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:175:11",className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:176:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:177:15",children:"部署模式"}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:178:15",className:"flex gap-1 bg-[var(--dg-bg-secondary)] rounded-lg p-1 border border-[var(--dg-border)]",children:[{key:"branch",label:"分支",icon:U},{key:"tag",label:"Tag 发版",icon:ea}].map(a=>{const c=O===a.key;return e.jsxs("button",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:185:21",onClick:()=>_(a.key),className:`flex-1 flex items-center justify-center gap-1 px-2 py-1.5 rounded-md text-xs font-medium transition-all ${c?"bg-blue-500 text-white":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,children:[e.jsx(a.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:192:23",className:"h-3.5 w-3.5"}),a.label]},a.key)})})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:198:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:199:15",children:"部署目标"}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:200:15",className:"flex gap-1 bg-[var(--dg-bg-secondary)] rounded-lg p-1 border border-[var(--dg-border)]",children:[{key:"ssh",label:"SSH 主机",icon:ye},{key:"k8s",label:"Kubernetes 集群",icon:he}].map(a=>{const c=F===a.key;return e.jsxs("button",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:207:21",onClick:()=>q(a.key),className:`flex-1 flex items-center justify-center gap-1 px-2 py-1.5 rounded-md text-xs font-medium transition-all ${c?"bg-green-500 text-white":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,children:[e.jsx(a.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:214:23",className:"h-3.5 w-3.5"}),a.label]},a.key)})})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:220:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:221:15",children:"环境分组"}),e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:222:15",value:String(G),onValueChange:a=>$(a==="__none"?"":a),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:223:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:223:102",placeholder:"选择环境"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:224:17",children:[e.jsx(L,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:225:19",value:"__none",children:"不指定"}),$e.map(a=>e.jsx(L,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:227:21",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:228:23",className:"flex items-center gap-1.5",children:[e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:229:25",className:"w-2 h-2 rounded-full inline-block",style:{backgroundColor:a.color}}),String(a.display_name)]})},a.id))]})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:239:11",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:240:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:241:15",children:["Git URL ",g.includes("checkout")&&e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:241:70",className:"text-red-400",children:"*"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:242:15",value:u,onChange:a=>C(a.target.value),placeholder:"https://gitee.com/user/repo.git",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9 font-mono text-xs"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:244:13",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:245:15",children:"分支 / Tag"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:246:15",value:R,onChange:a=>t(a.target.value),placeholder:O==="tag"?"v1.0.0":"main",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:248:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:249:15",children:["Git 凭证 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:249:29",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:"(API Token)"})]}),e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:250:15",value:String(s),onValueChange:a=>r(a==="__none"?"":a),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:251:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:251:102",placeholder:"选择凭证"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:252:17",children:[e.jsx(L,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:253:19",value:"__none",children:"不关联"}),z.map(a=>e.jsx(L,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:255:21",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:256:23",className:"flex items-center gap-1.5",children:[e.jsx(ue,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:257:25",className:"h-3 w-3 opacity-60"}),String(a.name)," ",a.summary&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:257:96",className:"text-[10px] opacity-50",children:["(",String(a.summary),")"]})]})},a.id))]})]}),!s&&g.includes("checkout")&&e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:263:78",className:"text-xs text-amber-400",children:"建议关联凭证"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:265:13",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:266:15",children:["镜像仓库凭证 ",g.includes("image")&&e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:266:66",className:"text-red-400",children:"*"})]}),e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:267:15",value:String(l),onValueChange:a=>B(a==="__none"?"":a),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:268:17",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:268:102",placeholder:"选择 Docker 凭证"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:269:17",children:[e.jsx(L,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:270:19",value:"__none",children:"不关联"}),J.map(a=>e.jsx(L,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:272:21",value:String(a.id),children:e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:273:23",className:"flex items-center gap-1.5",children:[e.jsx(ie,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:274:25",className:"h-3 w-3 opacity-60"}),String(a.name)," ",a.summary&&e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:274:100",className:"text-[10px] opacity-50",children:["(",String(a.summary),")"]})]})},a.id))]})]}),!l&&g.includes("image")&&e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:280:80",className:"text-xs text-amber-400",children:"需要关联 Docker 凭证"})]})]}),l&&d&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:285:13",className:"p-2.5 rounded-md bg-blue-500/5 border border-blue-500/20 text-xs text-[var(--dg-text-secondary)]",children:[e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:286:15",className:"text-blue-400",children:"镜像命名:"}),e.jsxs("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:287:15",className:"text-[var(--dg-text-primary)]",children:["{registry}","/","{namespace}","/","{","{JOB_BASE_NAME}","}",":","{","{tag}","}"]}),e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:288:15",className:"ml-2 opacity-60",children:"例:"}),e.jsxs("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:289:15",className:"opacity-60",children:["harbor.ast1001.com/test/",d,":latest"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:292:11",className:"space-y-1",children:[e.jsx(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:293:13",children:"Dockerfile 路径"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:294:13",value:i,onChange:a=>A(a.target.value),placeholder:"jar/Dockerfile",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-9 font-mono text-xs"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:297:11",className:"space-y-2",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:298:13",children:["发布流程 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:298:25",className:"text-xs text-[var(--dg-text-secondary)] opacity-70 ml-1",children:"按顺序选择阶段"})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:299:13",className:"flex flex-wrap gap-2",children:le.map(a=>{const c=g.includes(a.key);return e.jsxs(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:303:19",className:`cursor-pointer transition-all text-xs px-3 py-1.5 ${c?"border-current":"border-[var(--dg-border)] opacity-50 hover:opacity-80"}`,style:c?{backgroundColor:`${a.color}20`,color:a.color,borderColor:a.color}:{},onClick:()=>E(c?g.filter(x=>x!==a.key):[...g,a.key]),title:a.desc,children:[e.jsx(a.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:310:21",className:"h-3 w-3 mr-1"}),a.label," ",a.needs.includes("repo")?"🔗":"",a.needs.includes("registry")?"📦":""]},a.key)})}),g.length>0&&e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:316:15",className:"flex items-center mt-2",children:g.map((a,c)=>{const x=le.find(m=>m.key===a);return e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:320:21",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:321:23",className:"flex items-center gap-1 px-2 py-1 text-[11px] font-medium border",style:{backgroundColor:`${x.color}20`,borderColor:`${x.color}40`,color:x.color,borderRadius:c===0?"6px 0 0 6px":c===g.length-1?"0 6px 6px 0":"0"},children:[e.jsx(x.icon,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:330:25",className:"h-3 w-3"}),x.label]}),c{const c=k===a.key;return e.jsx("button",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:355:19",onClick:()=>S(a.key),className:`flex-1 flex flex-col items-center gap-0.5 px-2 py-2 rounded-md text-xs font-medium transition-all ${c?"bg-blue-500 text-white":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,title:a.desc,children:a.label},a.key)})}),k==="git_push"&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:370:15",className:"mt-3 space-y-2 p-3 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:371:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:372:19",className:"text-xs",children:["监听分支 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:372:51",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(逗号分隔,支持 * 通配)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:373:19",value:Pe,onChange:a=>ve(a.target.value),placeholder:"release/*, main",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:375:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:376:19",className:"text-xs",children:["排除分支 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:376:51",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(不触发构建)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:377:19",value:je,onChange:a=>be(a.target.value),placeholder:"wip/*, draft/*",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]})]}),k==="cron"&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:383:15",className:"mt-3 space-y-2 p-3 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:384:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:385:19",className:"text-xs",children:["Cron 表达式 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:385:55",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(标准 5 位)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:386:19",value:Ne,onChange:a=>pe(a.target.value),placeholder:"0 2 * * *",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:388:17",className:"flex flex-wrap gap-1.5",children:[{expr:"*/5 * * * *",label:"每5分钟"},{expr:"0 * * * *",label:"每小时"},{expr:"0 2 * * *",label:"每天2点"},{expr:"0 0 * * 0",label:"每周日"}].map(a=>e.jsx(D,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:395:21",variant:"outline",className:"cursor-pointer text-[10px] hover:bg-blue-500/10",onClick:()=>pe(a.expr),children:a.label},a.expr))})]}),k==="webhook"&&e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:404:15",className:"mt-3 space-y-2 p-3 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:405:17",className:"space-y-1",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:406:19",className:"text-xs",children:["Webhook Token ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:406:60",className:"text-[var(--dg-text-secondary)] opacity-60",children:"(签名验证,可选)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:407:19",value:Ce,onChange:a=>fe(a.target.value),placeholder:"随机字符串",className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] h-8 font-mono text-xs"})]}),e.jsxs("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:409:17",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-60",children:["Webhook URL: ",e.jsxs("code",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:410:32",className:"text-[var(--dg-blue)]",children:["POST /api/v1/webhook/pipeline/","{code}"]})]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:416:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:417:13",className:"flex items-center justify-between mb-2",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:418:15",children:["环境变量 ",e.jsxs("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:418:27",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:["($","{VAR_NAME}"," 引用)"]})]}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:419:15",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>K([...Q,{key:"",value:"",desc:""}]),children:[e.jsx(xe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:420:17",className:"h-3 w-3 mr-1"}),"添加变量"]})]}),Q.length===0?e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:424:15",className:"text-xs text-[var(--dg-text-muted)] py-2",children:'暂无变量,点击"添加变量"新增'}):e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:426:15",className:"space-y-2",children:Q.map((a,c)=>e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:428:19",className:"grid grid-cols-12 gap-2 items-start p-2 rounded-md bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:429:21",value:a.key,onChange:x=>{const m=[...Q];m[c]={...m[c],key:x.target.value},K(m)},placeholder:"变量名",className:"col-span-3 h-8 text-xs font-mono bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:439:21",value:a.value,onChange:x=>{const m=[...Q];m[c]={...m[c],value:x.target.value},K(m)},placeholder:"变量值",className:"col-span-4 h-8 text-xs font-mono bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:449:21",value:a.desc,onChange:x=>{const m=[...Q];m[c]={...m[c],desc:x.target.value},K(m)},placeholder:"说明",className:"col-span-4 h-8 text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"}),e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:459:21",variant:"ghost",size:"icon",className:"col-span-1 h-8 w-8 text-red-400",onClick:()=>K(Q.filter((x,m)=>m!==c)),children:e.jsx(Fe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:460:23",className:"h-3.5 w-3.5"})})]},c))})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:468:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:469:13",className:"mb-2 block",children:["构建缓存 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:469:48",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:"(加速后续构建)"})]}),e.jsx(f,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:470:13",value:De,onChange:a=>we(a.target.value),placeholder:"node_modules, .m2, target",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] h-8 text-xs font-mono"}),e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:471:13",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-50 mt-1",children:"多个路径用逗号分隔,相同的 Key 会命中已有缓存"})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:474:11",className:"border-t border-[var(--dg-border)] pt-4",children:[e.jsxs(h,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:475:13",className:"mb-2 block",children:["并发执行数 ",e.jsx("span",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:475:49",className:"text-xs text-[var(--dg-text-secondary)] opacity-60",children:"(Number of executors)"})]}),e.jsx("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:476:13",className:"flex items-center gap-2",children:e.jsxs(se,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:477:15",value:String(ke),onValueChange:a=>Se(Number(a)),children:[e.jsx(te,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:478:17",className:"w-32 h-8 text-xs bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:e.jsx(oe,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:479:19"})}),e.jsxs(re,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:481:17",children:[e.jsx(L,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:482:19",value:"1",children:"1 — 串行"}),e.jsx(L,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:483:19",value:"2",children:"2"}),e.jsx(L,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:484:19",value:"3",children:"3"}),e.jsx(L,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:485:19",value:"4",children:"4"}),e.jsx(L,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:486:19",value:"5",children:"5"})]})]})}),e.jsx("p",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:490:13",className:"text-[10px] text-[var(--dg-text-secondary)] opacity-50 mt-1",children:"设为 1 则按顺序串行执行,默认 2 可并发构建"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:493:9",className:"flex justify-end gap-2 mt-4 pt-4 border-t border-[var(--dg-border)]",children:[e.jsx(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:494:11",variant:"outline",onClick:()=>p(!1),children:"取消"}),e.jsxs(v,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:495:11",onClick:qe,disabled:W,children:[W?e.jsx(H,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:496:23",className:"h-4 w-4 animate-spin mr-1"}):e.jsx(Z,{"code-path":"src/components/deploy/pipeline-manager/PipelineCreateDialog.tsx:496:75",className:"h-4 w-4 mr-1"}),W?"创建中...":"创建流水线"]})]})]})})}function Ea(){const[n,p]=o.useState(""),{data:P=[],isLoading:b,refetch:j}=ia(),{triggerMutation:d,deleteMutation:y,stopRunMutation:M}=pa(),[w,u]=o.useState({}),[C,R]=o.useState({}),[t,i]=o.useState({}),[A,g]=o.useState("all"),[E,O]=o.useState({}),[_,F]=o.useState(!1),q=Oe(),G=[{key:"all",label:"全部",icon:na,color:"#6B7280"},{key:"production",label:"生产",icon:Te,color:"#EF4444"},{key:"testing",label:"测试",icon:ae,color:"#F59E0B"},{key:"staging",label:"预发布",icon:ue,color:"#8B5CF6"},{key:"development",label:"开发",icon:sa,color:"#3B82F6"}];o.useEffect(()=>{P.forEach(s=>{const r=s.id;s.last_status==="running"&&!E[r]&&T.getRuns(s.code).then(l=>{const k=(l?.list||[]).find(S=>S.status==="running"||S.status==="pending");k&&O(S=>({...S,[r]:k}))}).catch(()=>{})})},[P,E]);const $=async(s,r)=>{i(l=>({...l,[s]:!0}));try{const l=await T.getRuns(r);R(B=>({...B,[s]:l?.list||[]}))}catch{R(l=>({...l,[s]:[]}))}finally{i(l=>({...l,[s]:!1}))}},W=(s,r)=>{w[s]?u(l=>({...l,[s]:!1})):($(s,r),u(l=>({...l,[s]:!0})))},V=async(s,r)=>{try{await d.mutateAsync(r),N.success("已触发"),$(s,r),j()}catch{N.error("触发失败")}},z=async(s,r,l)=>{if(await q({title:"停止运行",description:"确定要停止此运行吗?",variant:"destructive"}))try{await M.mutateAsync({code:r,runId:l}),N.success("已停止"),$(s,r),O(k=>{const S={...k};return delete S[s],S})}catch{N.error("停止失败")}},X=async(s,r)=>{const l=E[s];if(!l){try{const k=((await T.getRuns(r))?.list||[]).find(S=>S.status==="running"||S.status==="pending");k?await z(s,r,k.id):N.error("未找到运行中的任务")}catch{N.error("停止失败")}return}await z(s,r,l.id)},J=async s=>{if(await q({title:"删除流水线",description:`确定删除「${s.name}」?`,variant:"destructive"}))try{await y.mutateAsync(s.id),N.success("已删除"),j()}catch{N.error("删除失败")}},ne=P.filter(s=>{const r=String(s.name||"").toLowerCase().includes(n.toLowerCase())||String(s.description||"").toLowerCase().includes(n.toLowerCase()),l=s.environment,B=A==="all"||(l?.type||"")===A;return r&&B});return e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:157:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:158:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:159:9",children:[e.jsx("h1",{"code-path":"src/components/deploy/PipelineManager.tsx:160:11",className:"text-2xl font-bold text-[var(--dg-text-primary)]",children:"流水线"}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:161:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"CI/CD 构建 · 部署 · 发布一体化"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:163:9",className:"flex items-center gap-2",children:[e.jsxs(v,{"code-path":"src/components/deploy/PipelineManager.tsx:164:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>j(),children:[e.jsx(ee,{"code-path":"src/components/deploy/PipelineManager.tsx:165:13",className:`h-4 w-4 mr-2 ${b?"animate-spin":""}`}),"刷新"]}),e.jsxs(v,{"code-path":"src/components/deploy/PipelineManager.tsx:167:11",onClick:()=>F(!0),children:[e.jsx(xe,{"code-path":"src/components/deploy/PipelineManager.tsx:167:52",className:"h-4 w-4 mr-2"}),"新建流水线"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:172:7",className:"flex items-stretch gap-3 px-4 py-3 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:173:9",className:"flex-1 space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:174:11",className:"flex items-center gap-1.5",children:[e.jsx(U,{"code-path":"src/components/deploy/PipelineManager.tsx:175:13",className:"h-3 w-3 text-indigo-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:176:13",className:"text-[10px] font-semibold text-indigo-400",children:"构建"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:177:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsx(Z,{"code-path":"src/components/deploy/PipelineManager.tsx:178:13",className:"h-3 w-3 text-red-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:179:13",className:"text-[10px] font-semibold text-red-400",children:"部署"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:180:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:181:13",className:"flex items-center gap-1 px-2 py-0.5 rounded bg-blue-400/10 border border-blue-400/20",children:[e.jsx(ye,{"code-path":"src/components/deploy/PipelineManager.tsx:182:15",className:"h-3 w-3 text-blue-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:183:15",className:"text-[10px] font-medium text-blue-400",children:"SSH 主机"})]})]}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:186:11",className:"text-[9px] text-[var(--dg-text-secondary)] opacity-40 pl-1",children:"传统主机 SCP 部署 · 无需镜像仓库"})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:188:9",className:"w-px bg-[var(--dg-border)]"}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:189:9",className:"flex-1 space-y-1.5",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:190:11",className:"flex items-center gap-1.5",children:[e.jsx(U,{"code-path":"src/components/deploy/PipelineManager.tsx:191:13",className:"h-3 w-3 text-indigo-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:192:13",className:"text-[10px] font-semibold text-indigo-400",children:"构建"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:193:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsx(ie,{"code-path":"src/components/deploy/PipelineManager.tsx:194:13",className:"h-3 w-3 text-cyan-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:195:13",className:"text-[10px] font-semibold text-cyan-400",children:"镜像仓库"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:196:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsx(Z,{"code-path":"src/components/deploy/PipelineManager.tsx:197:13",className:"h-3 w-3 text-red-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:198:13",className:"text-[10px] font-semibold text-red-400",children:"部署"}),e.jsx(I,{"code-path":"src/components/deploy/PipelineManager.tsx:199:13",className:"h-2.5 w-2.5 text-[var(--dg-text-secondary)] opacity-30"}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:200:13",className:"flex items-center gap-1 px-2 py-0.5 rounded bg-emerald-400/10 border border-emerald-400/20",children:[e.jsx(he,{"code-path":"src/components/deploy/PipelineManager.tsx:201:15",className:"h-3 w-3 text-emerald-400"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:202:15",className:"text-[10px] font-medium text-emerald-400",children:"Kubernetes"})]})]}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:205:11",className:"text-[9px] text-[var(--dg-text-secondary)] opacity-40 pl-1",children:"容器化部署 · 需镜像仓库推送"})]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineManager.tsx:207:9",className:"self-center ml-2 text-[10px] text-[var(--dg-text-secondary)] opacity-30 tracking-wide whitespace-nowrap",children:"全流程可视化"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:210:7",className:"flex items-center gap-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:211:9",className:"relative max-w-md flex-1",children:[e.jsx(aa,{"code-path":"src/components/deploy/PipelineManager.tsx:212:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-[var(--dg-text-secondary)]"}),e.jsx(f,{"code-path":"src/components/deploy/PipelineManager.tsx:213:11",placeholder:"搜索流水线...",value:n,onChange:s=>p(s.target.value),className:"pl-10 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:220:9",className:"flex items-center gap-1 bg-[var(--dg-bg-secondary)] rounded-lg p-1 border border-[var(--dg-border)]",children:G.map(s=>{const r=A===s.key,l=s.icon;return e.jsxs("button",{"code-path":"src/components/deploy/PipelineManager.tsx:225:15",onClick:()=>g(s.key),className:`flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all ${r?"text-white shadow-sm":"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]"}`,style:r?{backgroundColor:s.color}:{},children:[e.jsx(l,{"code-path":"src/components/deploy/PipelineManager.tsx:233:17",className:"h-3.5 w-3.5"}),s.label]},s.key)})})]}),b?e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:241:9",className:"flex items-center justify-center py-12",children:e.jsx(H,{"code-path":"src/components/deploy/PipelineManager.tsx:242:11",className:"h-6 w-6 text-[var(--dg-text-secondary)] animate-spin"})}):ne.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineManager.tsx:245:9",className:"text-center py-16 text-[var(--dg-text-secondary)]",children:[e.jsx(ta,{"code-path":"src/components/deploy/PipelineManager.tsx:246:11",className:"h-10 w-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/deploy/PipelineManager.tsx:247:11",className:"text-sm",children:"暂无流水线"}),e.jsxs(v,{"code-path":"src/components/deploy/PipelineManager.tsx:248:11",variant:"outline",className:"mt-4",onClick:()=>F(!0),children:[e.jsx(xe,{"code-path":"src/components/deploy/PipelineManager.tsx:249:13",className:"h-4 w-4 mr-1"}),"创建第一个流水线"]})]}):e.jsx("div",{"code-path":"src/components/deploy/PipelineManager.tsx:253:9",className:"space-y-3",children:ne.map(s=>{const r=s.id,l=s.code||s.id;return e.jsx(ha,{"code-path":"src/components/deploy/PipelineManager.tsx:258:15",pipeline:s,isExpanded:!!w[r],isLoadingRuns:!!t[r],pipelineRuns:C[r]||[],onToggleExpand:()=>W(r,l),onTrigger:()=>V(r,l),onStopRunning:()=>X(r,l),onDelete:()=>J(s),onStopRun:B=>z(r,l,B)},r)})}),e.jsx(ya,{"code-path":"src/components/deploy/PipelineManager.tsx:275:7",open:_,onOpenChange:F,onCreated:j})]})}export{Ea as PipelineManager}; diff --git a/backend/static/assets/PipelineRunDetail-C9e6xlUh.js b/backend/static/assets/PipelineRunDetail-C0WxXVPh.js similarity index 99% rename from backend/static/assets/PipelineRunDetail-C9e6xlUh.js rename to backend/static/assets/PipelineRunDetail-C0WxXVPh.js index 13d15f6..3542660 100644 --- a/backend/static/assets/PipelineRunDetail-C9e6xlUh.js +++ b/backend/static/assets/PipelineRunDetail-C0WxXVPh.js @@ -1,3 +1,3 @@ -import{r as n,j as e,a as me}from"./vendor-codemirror-C7mXSpXt.js";import{D as he,a as ue,m as ge,c as ye,d as be,o as fe,g as De,t as S,B as E}from"./index-LZWfu62c.js";import{B as A}from"./badge-B0F5ZNtn.js";import{C as je,b as Ne,c as ve,a as we}from"./card-B-RtdR4H.js";import{p as C}from"./pipeline-Lgvc2XUS.js";import{am as J,an as Re,ao as Pe,X as Be,ap as Fe,f as ee,m as ke,F as Se,v as Ce,aq as Z,T as $e,R as ze,z as _e,J as Ee,ad as Ae,C as T,k as Le,ar as Te,as as Ie,L as $,ab as Oe,b as te,a as G,U as Ue,at as Me}from"./vendor-icons-Aso0-eeY.js";function We(s){return s===0?"-":s<1024?s+" B":s<1024*1024?(s/1024).toFixed(1)+" KB":(s/(1024*1024)).toFixed(1)+" MB"}function Je({open:s,onOpenChange:o,runId:u,buildNumber:c}){const[x,a]=n.useState(null),[P,B]=n.useState(!1),[N,L]=n.useState(""),[v,i]=n.useState(""),[w,z]=n.useState(!1),F=async r=>{if(u){B(!0),L("");try{const m=await C.listRunFiles(u,r||void 0);a(m),i(m?.current||"")}catch(m){L(m?.message||"加载失败"),a(null)}finally{B(!1)}}};n.useEffect(()=>{s&&u&&(i(""),F(""))},[s,u]);const y=async r=>{const m=fe.getState().token||"",b=`${location.protocol}//${location.host}/api/v1/pipelines/runs/${u}/files/download?path=${encodeURIComponent(r.path)}&token=${encodeURIComponent(m)}`;window.open(b,"_blank")},R=v?v.split("/").filter(Boolean):[],I=[""].concat(R.map((r,m)=>"/"+R.slice(0,m+1).join("/")));return e.jsx(he,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:104:5",open:s,onOpenChange:o,children:e.jsxs(ue,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:105:7",showCloseButton:!1,className:ge("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",w?"!max-w-none !w-screen !h-screen !rounded-none":""),style:w?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"700px",width:"85vw"},children:[e.jsxs(ye,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:116:9",className:"sr-only",children:["文件浏览器 #",c]}),e.jsx(be,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:117:9",className:"sr-only",children:"流水线构建目录文件浏览"}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:120:9",className:"flex items-center justify-between px-4 py-2.5 border-b border-[var(--dg-border)] shrink-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:121:11",className:"flex items-center gap-2 min-w-0",children:[e.jsx(J,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:122:13",className:"h-4 w-4 text-[var(--dg-text-secondary)] shrink-0"}),e.jsxs("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:123:13",className:"text-[var(--dg-text-primary)] font-medium text-sm",children:["#",c," 工作区文件"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:127:11",className:"flex items-center gap-1",children:[e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:128:13",onClick:()=>z(!w),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:w?e.jsx(Re,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:29",className:"h-4 w-4"}):e.jsx(Pe,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:134:13",onClick:()=>o(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(Be,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:138:15",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:144:9",className:"flex items-center gap-0.5 px-4 py-2 text-xs border-b border-[var(--dg-border)] bg-[var(--dg-bg-primary)] overflow-x-auto shrink-0",children:I.map((r,m)=>e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:146:13",className:"flex items-center gap-0.5",children:m===0?e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:148:17",onClick:()=>F(""),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] p-0.5",children:e.jsx(Fe,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:152:19",className:"h-3.5 w-3.5"})}):e.jsxs(e.Fragment,{children:[e.jsx(ee,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:156:19",className:"h-3 w-3 text-[var(--dg-text-muted)] shrink-0"}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:157:19",onClick:()=>F(r),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] truncate max-w-[120px]",children:R[m-1]})]})},r))}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:170:9",className:"overflow-y-auto",style:{height:w?"calc(100vh - 110px)":"420px"},children:[P&&e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:172:13",className:"flex items-center justify-center h-full text-[var(--dg-text-muted)] text-sm",children:"加载中..."}),N&&e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:178:13",className:"flex items-center justify-center h-full text-red-400 text-sm",children:N}),x&&!P&&e.jsxs("table",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:184:13",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:185:15",className:"sticky top-0 bg-[var(--dg-bg-primary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:186:17",className:"text-left text-[var(--dg-text-muted)] text-xs",children:[e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:187:19",className:"py-2 pl-4 pr-2 font-medium",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:188:19",className:"py-2 px-2 font-medium w-24 text-right",children:"大小"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:189:19",className:"py-2 pr-4 pl-2 font-medium w-40 hidden sm:table-cell",children:"修改时间"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:190:19",className:"py-2 pr-4 pl-2 font-medium w-16"})]})}),e.jsxs("tbody",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:193:15",children:[v&&e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:196:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)] cursor-pointer",onClick:()=>{const r=v.split("/").slice(0,-1).join("/");F(r)},children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:203:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(ke,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:204:23",className:"h-4 w-4 text-[var(--dg-text-secondary)]"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:205:23",className:"text-[var(--dg-text-secondary)]",children:".."})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:207:21",className:"py-2 px-2 text-right"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:208:21",className:"py-2 pr-4 pl-2 hidden sm:table-cell"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:209:21",className:"py-2 pr-4 pl-2"})]}),x.dirs?.map(r=>e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:215:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)] cursor-pointer",onClick:()=>F(r.path),children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:220:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(J,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:221:23",className:"h-4 w-4 text-amber-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:222:23",className:"text-[var(--dg-text-primary)]",children:r.name})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:224:21",className:"py-2 px-2 text-right text-[var(--dg-text-muted)]",children:"-"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:225:21",className:"py-2 pr-4 pl-2 text-[var(--dg-text-muted)] hidden sm:table-cell",children:r.mod_time}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:226:21",className:"py-2 pr-4 pl-2"})]},r.path)),x.files?.map(r=>e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:232:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)]",children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:236:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(Se,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:237:23",className:"h-4 w-4 text-sky-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:238:23",className:"text-[var(--dg-text-primary)]",children:r.name})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:240:21",className:"py-2 px-2 text-right text-[var(--dg-text-muted)]",children:We(r.size)}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:241:21",className:"py-2 pr-4 pl-2 text-[var(--dg-text-muted)] hidden sm:table-cell",children:r.mod_time}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:242:21",className:"py-2 pr-4 pl-2",children:e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:243:23",onClick:m=>{m.stopPropagation(),y(r)},className:"p-1 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)] hover:text-white",title:"下载",children:e.jsx(Ce,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:248:25",className:"h-3.5 w-3.5"})})})]},r.path)),x.dirs?.length===0&&x.files?.length===0&&!v&&e.jsx("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:256:19",children:e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:257:21",colSpan:4,className:"py-8 text-center text-[var(--dg-text-muted)]",children:P?"加载中...":"目录为空"})})]})]})]})]})})}const j=[{key:"checkout",label:"代码检出",icon:Ee,color:"#6366F1",order:1},{key:"build",label:"构建",icon:Ae,color:"#F59E0B",order:2},{key:"test",label:"测试",icon:T,color:"#10B981",order:3},{key:"image",label:"镜像打包",icon:Le,color:"#06B6D4",order:4},{key:"deploy",label:"部署",icon:Te,color:"#EF4444",order:5},{key:"verify",label:"验证",icon:Ie,color:"#3B82F6",order:6}].sort((s,o)=>s.order-o.order),Ge={success:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",failed:"bg-red-500/20 text-red-400 border-red-500/30",running:"bg-blue-500/20 text-blue-400 border-blue-500/30",pending:"bg-slate-500/20 text-slate-400 border-slate-500/30",cancelled:"bg-amber-500/20 text-amber-400 border-amber-500/30"},He={success:T,failed:G,running:$,pending:te,cancelled:Oe};function qe(s){if(!s)return"-";if(s<60)return`${s}秒`;const o=Math.floor(s/60),u=s%60;return`${o}分${u}秒`}function Xe(s){return s?new Date(s).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"-"}function Ke(s){if(!s)return[];try{const o=typeof s=="string"?JSON.parse(s):s;return Array.isArray(o)?o:[]}catch{return[]}}function Ve(s){const o=new Map;return s&&(Ke(s.stages).forEach(c=>{if(c.name||c.type){const x=c.type||j.find(a=>a.label===c.name)?.key;x&&o.set(x,c.status)}}),o.size===0&&s.status==="success"?j.forEach(c=>o.set(c.key,"success")):o.size===0&&s.status==="failed"?j.forEach((c,x)=>o.set(c.key,x===0?"success":"pending")):o.size===0&&s.status==="running"&&o.set("checkout","running")),o}function Qe(s,o){const u=s.find(x=>x.stage===o);if(u)return u.message;const c=j.find(x=>x.key===o);return c?`${c.label}...`:""}function nt(){const{code:s}=De(),[o,u]=n.useState(null),[c,x]=n.useState([]),[a,P]=n.useState(null),[B,N]=n.useState([]),[L,v]=n.useState(!1),[i,w]=n.useState(null),[z,F]=n.useState(10),[y,R]=n.useState(new Set),[I,r]=n.useState(!1),m=n.useRef(null),b=n.useRef(null),[se,H]=n.useState(!1),[q,oe]=n.useState(null),ne=n.useCallback(async()=>{try{const t=await C.getByCode(s);u(t?.data||t)}catch{}},[s]),f=n.useCallback(async()=>{v(!0);try{const d=(await C.getRunsByCode(s,z))?.list||[];x(d),!a&&d.length>0&&P(d[0])}catch{S.error("获取执行记录失败")}finally{v(!1)}},[s,z]);n.useEffect(()=>{ne(),f()},[]),n.useEffect(()=>{f()},[z]),n.useEffect(()=>{if(!c.some(l=>l.status==="running"))return;const d=setInterval(f,5e3);return()=>clearInterval(d)},[c,f]);const X=n.useCallback(async t=>{try{const d=await C.getRunLogStream(t.id);if(d?.logs){const l=typeof d.logs=="string"?JSON.parse(d.logs):d.logs;N(Array.isArray(l)?l:[])}else N([]);t.status==="running"&&ae(t.id)}catch{N([])}},[]),ae=t=>{b.current&&b.current.close();const d=window.location.protocol==="https:"?"wss:":"ws:",l=localStorage.getItem("token"),p=new WebSocket(`${d}//${window.location.host}/ws/pipeline/${t}/log?token=${l}`);p.onmessage=k=>{try{const h=JSON.parse(k.data);if(h.type==="init"&&h.logs){const g=typeof h.logs=="string"?JSON.parse(h.logs):h.logs;N(Array.isArray(g)?g:[])}else h.type==="done"?(p.close(),f()):h.time&&h.level&&N(g=>[...g,h])}catch{}},p.onclose=()=>{b.current=null},p.onerror=()=>{b.current=null},b.current=p};n.useEffect(()=>(a&&(X(a),w(null)),()=>{b.current&&b.current.close()}),[a,X]),n.useEffect(()=>{m.current?.scrollIntoView({behavior:"smooth"})},[B]);const le=async()=>{try{await C.triggerByCode(s),S.success("已触发"),f()}catch{S.error("触发失败")}},ce=async t=>{try{await C.stopRunByCode(s,t),S.success("已停止"),f()}catch{S.error("停止失败")}},re=async()=>{if(y.size!==0){r(!0);try{await C.batchDeleteRuns(s,Array.from(y)),S.success(`已删除 ${y.size} 条记录`),R(new Set),f()}catch{S.error("批量删除失败")}finally{r(!1)}}},ie=t=>{R(d=>{const l=new Set(d);return l.has(t)?l.delete(t):l.add(t),l})},de=()=>{y.size===c.length?R(new Set):R(new Set(c.map(t=>t.id)))},K=t=>t.triggered_by==="system"?"Cron":t.triggered_by==="git"?"Git Push":t.triggered_by||"Manual",O=Ve(a),V=i?B.filter(t=>t.stage===i):B,Q=i?Qe(B,i):"";return e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:293:5",className:"space-y-4 h-full flex flex-col",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:295:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:296:9",children:[e.jsxs("h2",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:297:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:[e.jsx(Z,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:298:13",className:"w-5 h-5 inline mr-2"}),"流水线详情"]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:301:11",className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[o?.name&&e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:303:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.name}),o?.environment&&e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:308:15",className:"text-xs",style:{backgroundColor:o.environment.color+"20",color:o.environment.color},children:o.environment.display_name}),a&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:316:15",className:"text-sm text-[var(--dg-text-secondary)]",children:["发布 #",a.build_number]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:322:9",className:"flex gap-2 items-center",children:[y.size>0&&e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:324:13",variant:"destructive",size:"sm",onClick:re,disabled:I,children:[e.jsx($e,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:325:15",className:"w-4 h-4 mr-1"}),"删除 (",y.size,")"]}),e.jsxs("select",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:328:11",value:z,onChange:t=>F(Number(t.target.value)),className:"h-8 px-2 text-xs rounded border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)] text-[var(--dg-text-primary)]",children:[e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:333:13",value:10,children:"10条/页"}),e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:334:13",value:20,children:"20条/页"}),e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:335:13",value:30,children:"30条/页"})]}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:337:11",variant:"outline",size:"sm",onClick:f,children:[e.jsx(ze,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:338:13",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:340:11",size:"sm",onClick:le,children:[e.jsx(_e,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:341:13",className:"w-4 h-4 mr-1"}),"立即执行"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:347:7",className:"flex items-center gap-0 px-4 py-3 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] overflow-x-auto",children:[j.map((t,d)=>{const l=O.get(t.key)||"",p=l==="success"||l==="completed",k=l==="running"||l==="in_progress",h=l==="failed"||l==="error",g=i===t.key;t.key;const _=O.size>0,D=h?"#EF4444":k?"#3B82F6":p?"#207060":"#6B7280",U=h?"#EF444420":k?"#3B82F620":p?"#20706020":"#6B728010",M=g?D:D+"50",W=t.icon,pe=h?e.jsx(G,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:369:35",className:"h-3.5 w-3.5"}):k?e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:370:27",className:"h-3.5 w-3.5 animate-spin"}):p?e.jsx(T,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:371:27",className:"h-3.5 w-3.5"}):_?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:372:25",className:"text-[10px] opacity-40",children:"○"}):e.jsx(W,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:373:15",className:"h-3.5 w-3.5 opacity-40"}),Y=d===j.length-1,xe=d===0?"8px 0 0 8px":Y?"0 8px 8px 0":"0";return e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:379:13",className:"flex items-center",children:[e.jsxs("button",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:380:15",onClick:()=>w(i===t.key?null:t.key),title:`${t.label}${l?` (${l})`:""} — 点击查看日志`,className:`flex items-center gap-1.5 px-3 py-2 text-[12px] font-semibold border shadow-sm transition-all cursor-pointer +import{r as n,j as e,R as me}from"./vendor-codemirror-B1SGo4xl.js";import{D as he,a as ue,m as ge,c as ye,d as be,o as fe,g as De,t as S,B as E}from"./index-Bp-M7P_8.js";import{B as A}from"./badge-B00SZHvE.js";import{C as je,b as Ne,c as ve,a as we}from"./card-BHSBTtub.js";import{p as C}from"./pipeline-BGteNHr0.js";import{am as J,an as Re,ao as Pe,X as Be,ap as Fe,f as ee,m as ke,F as Se,v as Ce,aq as Z,T as $e,R as ze,z as _e,J as Ee,ad as Ae,C as T,k as Le,ar as Te,as as Ie,L as $,ab as Oe,b as te,a as G,U as Ue,at as Me}from"./vendor-icons-BWk-DH7F.js";function We(s){return s===0?"-":s<1024?s+" B":s<1024*1024?(s/1024).toFixed(1)+" KB":(s/(1024*1024)).toFixed(1)+" MB"}function Je({open:s,onOpenChange:o,runId:u,buildNumber:c}){const[x,a]=n.useState(null),[P,B]=n.useState(!1),[N,L]=n.useState(""),[v,i]=n.useState(""),[w,z]=n.useState(!1),F=async r=>{if(u){B(!0),L("");try{const m=await C.listRunFiles(u,r||void 0);a(m),i(m?.current||"")}catch(m){L(m?.message||"加载失败"),a(null)}finally{B(!1)}}};n.useEffect(()=>{s&&u&&(i(""),F(""))},[s,u]);const y=async r=>{const m=fe.getState().token||"",b=`${location.protocol}//${location.host}/api/v1/pipelines/runs/${u}/files/download?path=${encodeURIComponent(r.path)}&token=${encodeURIComponent(m)}`;window.open(b,"_blank")},R=v?v.split("/").filter(Boolean):[],I=[""].concat(R.map((r,m)=>"/"+R.slice(0,m+1).join("/")));return e.jsx(he,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:104:5",open:s,onOpenChange:o,children:e.jsxs(ue,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:105:7",showCloseButton:!1,className:ge("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",w?"!max-w-none !w-screen !h-screen !rounded-none":""),style:w?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"700px",width:"85vw"},children:[e.jsxs(ye,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:116:9",className:"sr-only",children:["文件浏览器 #",c]}),e.jsx(be,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:117:9",className:"sr-only",children:"流水线构建目录文件浏览"}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:120:9",className:"flex items-center justify-between px-4 py-2.5 border-b border-[var(--dg-border)] shrink-0",children:[e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:121:11",className:"flex items-center gap-2 min-w-0",children:[e.jsx(J,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:122:13",className:"h-4 w-4 text-[var(--dg-text-secondary)] shrink-0"}),e.jsxs("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:123:13",className:"text-[var(--dg-text-primary)] font-medium text-sm",children:["#",c," 工作区文件"]})]}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:127:11",className:"flex items-center gap-1",children:[e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:128:13",onClick:()=>z(!w),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:w?e.jsx(Re,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:29",className:"h-4 w-4"}):e.jsx(Pe,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:132:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:134:13",onClick:()=>o(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(Be,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:138:15",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:144:9",className:"flex items-center gap-0.5 px-4 py-2 text-xs border-b border-[var(--dg-border)] bg-[var(--dg-bg-primary)] overflow-x-auto shrink-0",children:I.map((r,m)=>e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:146:13",className:"flex items-center gap-0.5",children:m===0?e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:148:17",onClick:()=>F(""),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] p-0.5",children:e.jsx(Fe,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:152:19",className:"h-3.5 w-3.5"})}):e.jsxs(e.Fragment,{children:[e.jsx(ee,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:156:19",className:"h-3 w-3 text-[var(--dg-text-muted)] shrink-0"}),e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:157:19",onClick:()=>F(r),className:"text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] truncate max-w-[120px]",children:R[m-1]})]})},r))}),e.jsxs("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:170:9",className:"overflow-y-auto",style:{height:w?"calc(100vh - 110px)":"420px"},children:[P&&e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:172:13",className:"flex items-center justify-center h-full text-[var(--dg-text-muted)] text-sm",children:"加载中..."}),N&&e.jsx("div",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:178:13",className:"flex items-center justify-center h-full text-red-400 text-sm",children:N}),x&&!P&&e.jsxs("table",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:184:13",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:185:15",className:"sticky top-0 bg-[var(--dg-bg-primary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:186:17",className:"text-left text-[var(--dg-text-muted)] text-xs",children:[e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:187:19",className:"py-2 pl-4 pr-2 font-medium",children:"名称"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:188:19",className:"py-2 px-2 font-medium w-24 text-right",children:"大小"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:189:19",className:"py-2 pr-4 pl-2 font-medium w-40 hidden sm:table-cell",children:"修改时间"}),e.jsx("th",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:190:19",className:"py-2 pr-4 pl-2 font-medium w-16"})]})}),e.jsxs("tbody",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:193:15",children:[v&&e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:196:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)] cursor-pointer",onClick:()=>{const r=v.split("/").slice(0,-1).join("/");F(r)},children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:203:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(ke,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:204:23",className:"h-4 w-4 text-[var(--dg-text-secondary)]"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:205:23",className:"text-[var(--dg-text-secondary)]",children:".."})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:207:21",className:"py-2 px-2 text-right"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:208:21",className:"py-2 pr-4 pl-2 hidden sm:table-cell"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:209:21",className:"py-2 pr-4 pl-2"})]}),x.dirs?.map(r=>e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:215:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)] cursor-pointer",onClick:()=>F(r.path),children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:220:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(J,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:221:23",className:"h-4 w-4 text-amber-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:222:23",className:"text-[var(--dg-text-primary)]",children:r.name})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:224:21",className:"py-2 px-2 text-right text-[var(--dg-text-muted)]",children:"-"}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:225:21",className:"py-2 pr-4 pl-2 text-[var(--dg-text-muted)] hidden sm:table-cell",children:r.mod_time}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:226:21",className:"py-2 pr-4 pl-2"})]},r.path)),x.files?.map(r=>e.jsxs("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:232:19",className:"border-b border-[var(--dg-border)] hover:bg-[var(--dg-bg-hover)]",children:[e.jsxs("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:236:21",className:"py-2 pl-4 pr-2 flex items-center gap-2",children:[e.jsx(Se,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:237:23",className:"h-4 w-4 text-sky-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:238:23",className:"text-[var(--dg-text-primary)]",children:r.name})]}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:240:21",className:"py-2 px-2 text-right text-[var(--dg-text-muted)]",children:We(r.size)}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:241:21",className:"py-2 pr-4 pl-2 text-[var(--dg-text-muted)] hidden sm:table-cell",children:r.mod_time}),e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:242:21",className:"py-2 pr-4 pl-2",children:e.jsx("button",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:243:23",onClick:m=>{m.stopPropagation(),y(r)},className:"p-1 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)] hover:text-white",title:"下载",children:e.jsx(Ce,{"code-path":"src/components/deploy/FileBrowserDialog.tsx:248:25",className:"h-3.5 w-3.5"})})})]},r.path)),x.dirs?.length===0&&x.files?.length===0&&!v&&e.jsx("tr",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:256:19",children:e.jsx("td",{"code-path":"src/components/deploy/FileBrowserDialog.tsx:257:21",colSpan:4,className:"py-8 text-center text-[var(--dg-text-muted)]",children:P?"加载中...":"目录为空"})})]})]})]})]})})}const j=[{key:"checkout",label:"代码检出",icon:Ee,color:"#6366F1",order:1},{key:"build",label:"构建",icon:Ae,color:"#F59E0B",order:2},{key:"test",label:"测试",icon:T,color:"#10B981",order:3},{key:"image",label:"镜像打包",icon:Le,color:"#06B6D4",order:4},{key:"deploy",label:"部署",icon:Te,color:"#EF4444",order:5},{key:"verify",label:"验证",icon:Ie,color:"#3B82F6",order:6}].sort((s,o)=>s.order-o.order),Ge={success:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",failed:"bg-red-500/20 text-red-400 border-red-500/30",running:"bg-blue-500/20 text-blue-400 border-blue-500/30",pending:"bg-slate-500/20 text-slate-400 border-slate-500/30",cancelled:"bg-amber-500/20 text-amber-400 border-amber-500/30"},He={success:T,failed:G,running:$,pending:te,cancelled:Oe};function qe(s){if(!s)return"-";if(s<60)return`${s}秒`;const o=Math.floor(s/60),u=s%60;return`${o}分${u}秒`}function Xe(s){return s?new Date(s).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"-"}function Ke(s){if(!s)return[];try{const o=typeof s=="string"?JSON.parse(s):s;return Array.isArray(o)?o:[]}catch{return[]}}function Ve(s){const o=new Map;return s&&(Ke(s.stages).forEach(c=>{if(c.name||c.type){const x=c.type||j.find(a=>a.label===c.name)?.key;x&&o.set(x,c.status)}}),o.size===0&&s.status==="success"?j.forEach(c=>o.set(c.key,"success")):o.size===0&&s.status==="failed"?j.forEach((c,x)=>o.set(c.key,x===0?"success":"pending")):o.size===0&&s.status==="running"&&o.set("checkout","running")),o}function Qe(s,o){const u=s.find(x=>x.stage===o);if(u)return u.message;const c=j.find(x=>x.key===o);return c?`${c.label}...`:""}function nt(){const{code:s}=De(),[o,u]=n.useState(null),[c,x]=n.useState([]),[a,P]=n.useState(null),[B,N]=n.useState([]),[L,v]=n.useState(!1),[i,w]=n.useState(null),[z,F]=n.useState(10),[y,R]=n.useState(new Set),[I,r]=n.useState(!1),m=n.useRef(null),b=n.useRef(null),[se,H]=n.useState(!1),[q,oe]=n.useState(null),ne=n.useCallback(async()=>{try{const t=await C.getByCode(s);u(t?.data||t)}catch{}},[s]),f=n.useCallback(async()=>{v(!0);try{const d=(await C.getRunsByCode(s,z))?.list||[];x(d),!a&&d.length>0&&P(d[0])}catch{S.error("获取执行记录失败")}finally{v(!1)}},[s,z]);n.useEffect(()=>{ne(),f()},[]),n.useEffect(()=>{f()},[z]),n.useEffect(()=>{if(!c.some(l=>l.status==="running"))return;const d=setInterval(f,5e3);return()=>clearInterval(d)},[c,f]);const X=n.useCallback(async t=>{try{const d=await C.getRunLogStream(t.id);if(d?.logs){const l=typeof d.logs=="string"?JSON.parse(d.logs):d.logs;N(Array.isArray(l)?l:[])}else N([]);t.status==="running"&&ae(t.id)}catch{N([])}},[]),ae=t=>{b.current&&b.current.close();const d=window.location.protocol==="https:"?"wss:":"ws:",l=localStorage.getItem("token"),p=new WebSocket(`${d}//${window.location.host}/ws/pipeline/${t}/log?token=${l}`);p.onmessage=k=>{try{const h=JSON.parse(k.data);if(h.type==="init"&&h.logs){const g=typeof h.logs=="string"?JSON.parse(h.logs):h.logs;N(Array.isArray(g)?g:[])}else h.type==="done"?(p.close(),f()):h.time&&h.level&&N(g=>[...g,h])}catch{}},p.onclose=()=>{b.current=null},p.onerror=()=>{b.current=null},b.current=p};n.useEffect(()=>(a&&(X(a),w(null)),()=>{b.current&&b.current.close()}),[a,X]),n.useEffect(()=>{m.current?.scrollIntoView({behavior:"smooth"})},[B]);const le=async()=>{try{await C.triggerByCode(s),S.success("已触发"),f()}catch{S.error("触发失败")}},ce=async t=>{try{await C.stopRunByCode(s,t),S.success("已停止"),f()}catch{S.error("停止失败")}},re=async()=>{if(y.size!==0){r(!0);try{await C.batchDeleteRuns(s,Array.from(y)),S.success(`已删除 ${y.size} 条记录`),R(new Set),f()}catch{S.error("批量删除失败")}finally{r(!1)}}},ie=t=>{R(d=>{const l=new Set(d);return l.has(t)?l.delete(t):l.add(t),l})},de=()=>{y.size===c.length?R(new Set):R(new Set(c.map(t=>t.id)))},K=t=>t.triggered_by==="system"?"Cron":t.triggered_by==="git"?"Git Push":t.triggered_by||"Manual",O=Ve(a),V=i?B.filter(t=>t.stage===i):B,Q=i?Qe(B,i):"";return e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:293:5",className:"space-y-4 h-full flex flex-col",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:295:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:296:9",children:[e.jsxs("h2",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:297:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:[e.jsx(Z,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:298:13",className:"w-5 h-5 inline mr-2"}),"流水线详情"]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:301:11",className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[o?.name&&e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:303:15",className:"text-sm font-medium text-[var(--dg-text-primary)]",children:o.name}),o?.environment&&e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:308:15",className:"text-xs",style:{backgroundColor:o.environment.color+"20",color:o.environment.color},children:o.environment.display_name}),a&&e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:316:15",className:"text-sm text-[var(--dg-text-secondary)]",children:["发布 #",a.build_number]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:322:9",className:"flex gap-2 items-center",children:[y.size>0&&e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:324:13",variant:"destructive",size:"sm",onClick:re,disabled:I,children:[e.jsx($e,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:325:15",className:"w-4 h-4 mr-1"}),"删除 (",y.size,")"]}),e.jsxs("select",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:328:11",value:z,onChange:t=>F(Number(t.target.value)),className:"h-8 px-2 text-xs rounded border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)] text-[var(--dg-text-primary)]",children:[e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:333:13",value:10,children:"10条/页"}),e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:334:13",value:20,children:"20条/页"}),e.jsx("option",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:335:13",value:30,children:"30条/页"})]}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:337:11",variant:"outline",size:"sm",onClick:f,children:[e.jsx(ze,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:338:13",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:340:11",size:"sm",onClick:le,children:[e.jsx(_e,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:341:13",className:"w-4 h-4 mr-1"}),"立即执行"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:347:7",className:"flex items-center gap-0 px-4 py-3 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)] overflow-x-auto",children:[j.map((t,d)=>{const l=O.get(t.key)||"",p=l==="success"||l==="completed",k=l==="running"||l==="in_progress",h=l==="failed"||l==="error",g=i===t.key;t.key;const _=O.size>0,D=h?"#EF4444":k?"#3B82F6":p?"#207060":"#6B7280",U=h?"#EF444420":k?"#3B82F620":p?"#20706020":"#6B728010",M=g?D:D+"50",W=t.icon,pe=h?e.jsx(G,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:369:35",className:"h-3.5 w-3.5"}):k?e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:370:27",className:"h-3.5 w-3.5 animate-spin"}):p?e.jsx(T,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:371:27",className:"h-3.5 w-3.5"}):_?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:372:25",className:"text-[10px] opacity-40",children:"○"}):e.jsx(W,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:373:15",className:"h-3.5 w-3.5 opacity-40"}),Y=d===j.length-1,xe=d===0?"8px 0 0 8px":Y?"0 8px 8px 0":"0";return e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:379:13",className:"flex items-center",children:[e.jsxs("button",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:380:15",onClick:()=>w(i===t.key?null:t.key),title:`${t.label}${l?` (${l})`:""} — 点击查看日志`,className:`flex items-center gap-1.5 px-3 py-2 text-[12px] font-semibold border shadow-sm transition-all cursor-pointer ${g?"ring-1 ring-offset-0 scale-[1.02]":"hover:brightness-110"}`,style:{backgroundColor:U,borderColor:M,color:D,borderRadius:xe},children:[pe,e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:393:17",children:t.label})]}),!Y&&e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:396:17",className:"flex items-center justify-center w-5 h-5 -mx-px z-10",children:e.jsx(ee,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:397:19",className:"h-3.5 w-3.5",style:{color:D+"99"}})})]},t.key)}),a&&e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:404:11",className:"ml-auto text-[10px] text-[var(--dg-text-secondary)] opacity-40 shrink-0 pl-3 whitespace-nowrap",children:i?j.find(t=>t.key===i)?.label:"全阶段"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:411:7",className:"flex-1 flex flex-col min-h-0",children:[e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:413:9",className:"rounded-md border border-[var(--dg-border)] overflow-hidden mb-4",children:L&&c.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:415:13",className:"text-center py-12",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:416:15",className:"w-6 h-6 animate-spin mx-auto mb-2 text-[var(--dg-text-muted)]"}),"加载中..."]}):c.length===0?e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:420:13",className:"text-center py-12 border border-dashed border-[var(--dg-border)] rounded-lg m-4",children:[e.jsx(Z,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:421:15",className:"w-10 h-10 mx-auto mb-3 text-[var(--dg-text-muted)]"}),e.jsx("p",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:422:15",className:"text-[var(--dg-text-secondary)]",children:'暂无执行记录,点击"立即执行"触发构建'})]}):e.jsxs("table",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:425:13",className:"w-full text-sm",children:[e.jsx("thead",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:426:15",className:"bg-[var(--dg-bg-tertiary)] border-b border-[var(--dg-border)]",children:e.jsxs("tr",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:427:17",children:[e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:428:19",className:"px-2 py-2.5 w-10",children:e.jsx("input",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:429:21",type:"checkbox",checked:y.size===c.length&&c.length>0,onChange:de,className:"rounded"})}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:432:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] w-16",children:"构建"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:433:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] w-20",children:"状态"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:434:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"触发方式"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:435:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"用户"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:436:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)]",children:"耗时"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:437:19",className:"px-3 py-2.5 text-left font-medium text-[var(--dg-text-secondary)] hidden md:table-cell",children:"时间"}),e.jsx("th",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:438:19",className:"px-3 py-2.5 text-right font-medium text-[var(--dg-text-secondary)] w-32",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:441:15",children:c.map(t=>{const d=He[t.status]||te;return e.jsxs("tr",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:445:21",className:`border-b border-[var(--dg-border)] cursor-pointer transition-colors ${a?.id===t.id?"bg-[var(--dg-blue)]/10":"hover:bg-[var(--dg-bg-tertiary)]/50"}`,onClick:()=>{P(t)},children:[e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:449:23",className:"px-2 py-2.5",onClick:l=>l.stopPropagation(),children:e.jsx("input",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:450:25",type:"checkbox",checked:y.has(t.id),onChange:()=>ie(t.id),className:"rounded"})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:453:23",className:"px-3 py-2.5 font-mono font-semibold text-[var(--dg-text-primary)]",children:["#",t.build_number]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:456:23",className:"px-3 py-2.5",children:e.jsxs(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:457:25",className:`text-xs ${Ge[t.status]||""} flex items-center gap-1 w-fit`,children:[e.jsx(d,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:458:27",className:`w-3 h-3 ${t.status==="running"?"animate-spin":""}`}),t.status==="success"?"成功":t.status==="failed"?"失败":t.status==="running"?"执行中":t.status==="cancelled"?"已取消":"待执行"]})}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:466:23",className:"px-3 py-2.5",children:e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:467:25",variant:"outline",className:"text-xs",children:K(t)})}),e.jsxs("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:469:23",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] flex items-center gap-1",children:[e.jsx(Ue,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:470:25",className:"w-3 h-3"}),t.triggered_by||"admin"]}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:473:23",className:"px-3 py-2.5 text-[var(--dg-text-secondary)] font-mono text-xs",children:t.status==="running"?e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:475:27",className:"flex items-center gap-1 text-blue-400",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:476:29",className:"w-3 h-3 animate-spin"}),"执行中..."]}):qe(t.duration)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:480:23",className:"px-3 py-2.5 text-[var(--dg-text-muted)] text-xs hidden md:table-cell",children:Xe(t.created_at)}),e.jsx("td",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:483:23",className:"px-3 py-2.5 text-right",onClick:l=>l.stopPropagation(),children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:484:25",className:"flex justify-end gap-1",children:[e.jsx(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:485:27",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>P(t),children:"日志"}),e.jsxs(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:489:27",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{oe({id:t.id,buildNumber:t.build_number}),H(!0)},children:[e.jsx(J,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:491:29",className:"w-3.5 h-3.5 mr-1"}),"浏览"]}),t.status==="running"&&e.jsx(E,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:494:29",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-500",onClick:()=>ce(t.id),children:e.jsx(Me,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:496:31",className:"w-3.5 h-3.5"})})]})})]},t.id)})})]})}),a&&e.jsxs(je,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:511:11",className:"flex-1 flex flex-col min-h-0 border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsxs(Ne,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:512:13",className:"py-3 px-4 flex flex-row items-center justify-between border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:513:15",className:"flex items-center gap-3",children:[e.jsxs(ve,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:514:17",className:"text-sm font-mono",children:[o?.name||`#${s}`," #",a.build_number]}),a.status==="running"&&e.jsxs(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:518:19",className:"bg-blue-500/20 text-blue-400 border-blue-500/30 text-xs",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:519:21",className:"w-3 h-3 animate-spin mr-1"}),"实时"]}),i&&e.jsx(A,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:523:19",className:"text-xs border-[var(--dg-border)]",variant:"outline",children:j.find(t=>t.key===i)?.label||i})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:528:15",className:"flex items-center gap-2 text-xs text-[var(--dg-text-muted)]",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:529:17",children:["触发: ",K(a)," (",a.triggered_by||"admin",")"]}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:530:17",className:"opacity-40",children:"|"}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:531:17",children:["分支: ",a.branch||"-"]}),a.commit_id&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:534:21",className:"opacity-40",children:"|"}),e.jsx("code",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:535:21",className:"bg-amber-400/10 text-amber-400 px-1 py-0.5 rounded text-[10px]",children:a.commit_id.slice(0,8)})]}),a.image_tag&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:542:21",className:"opacity-40",children:"|"}),e.jsxs("code",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:543:21",className:"bg-cyan-400/10 text-cyan-400 px-1 py-0.5 rounded text-[10px]",children:["📦 ",a.image_tag]})]})]})]}),e.jsxs(we,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:550:13",className:"flex-1 p-0 overflow-hidden min-h-0",children:[i&&Q&&e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:553:17",className:"px-4 py-2 border-b border-[var(--dg-border)] bg-[var(--dg-bg-tertiary)]/30",children:e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:554:19",className:"flex items-center gap-2",children:[e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:555:21",className:"text-[11px] font-semibold text-[var(--dg-text-secondary)]",children:["[",j.find(t=>t.key===i)?.label||i,"]"]}),(()=>{const t=O.get(i);return t==="success"||t==="completed"?e.jsx(T,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:560:74",className:"h-3.5 w-3.5 text-emerald-400"}):t==="failed"||t==="error"?e.jsx(G,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:561:69",className:"h-3.5 w-3.5 text-red-400"}):t==="running"||t==="in_progress"?e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:562:76",className:"h-3.5 w-3.5 text-blue-400 animate-spin"}):null})(),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:565:21",className:"text-xs text-[var(--dg-text-muted)] truncate font-mono",children:Q})]})}),e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:571:15",className:"h-full overflow-y-auto bg-[#0d1117] font-mono text-xs leading-5 p-4",style:{minHeight:280},children:V.length===0&&a.status!=="running"?e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:573:19",className:"text-center py-12 text-slate-500",children:i?"该阶段暂无日志输出":"暂无日志输出"}):e.jsxs(e.Fragment,{children:[(()=>{let t="";const d={checkout:"border-indigo-500 bg-indigo-500/10",build:"border-amber-500 bg-amber-500/10",test:"border-emerald-500 bg-emerald-500/10",image:"border-cyan-500 bg-cyan-500/10",deploy:"border-red-500 bg-red-500/10",verify:"border-blue-500 bg-blue-500/10"},l={checkout:"⬇",build:"⚙",test:"✓",image:"📦",deploy:"🚀",verify:"🛡"};return V.map((p,k)=>{const h=!i&&p.stage&&p.stage!==t;h&&(t=p.stage||"");const g=p.level==="error",_=p.level==="warn",D=p.level==="success",U=g?"border-l-2 border-red-500 bg-red-500/10":_?"border-l-2 border-amber-500 bg-amber-500/10":D?"border-l-2 border-emerald-500 bg-emerald-500/5":"",M=g?"text-red-200":_?"text-amber-200":D?"text-emerald-200":"text-slate-300",W=g?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:605:29",className:"shrink-0 px-1.5 py-px rounded text-[10px] font-bold bg-red-600/40 text-red-200",children:"ERR"}):_?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:607:29",className:"shrink-0 px-1.5 py-px rounded text-[10px] font-bold bg-amber-600/40 text-amber-200",children:"WARN"}):D?e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:609:29",className:"shrink-0 px-1.5 py-px rounded text-[10px] font-bold bg-emerald-600/30 text-emerald-200",children:" OK "}):e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:610:29",className:"shrink-0 px-1.5 py-px rounded text-[10px] bg-slate-600/30 text-slate-400",children:"INFO"});return e.jsxs(me.Fragment,{children:[h&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:614:31",className:`flex items-center gap-2 my-2 py-1 px-2 border-l-4 rounded-r ${d[p.stage||""]||"border-slate-500 bg-slate-500/10"}`,children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:615:33",className:"text-xs",children:l[p.stage||""]||"▸"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:616:33",className:"text-[11px] font-semibold tracking-wider text-slate-200",children:p.stage}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:617:33",className:"flex-1 border-t border-slate-700/50"})]}),e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:620:29",className:`flex items-start gap-2 px-2 py-0.5 -mx-1 rounded-sm ${U} ${!g&&!_&&!D?"hover:bg-white/[0.03]":""}`,children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:621:31",className:"text-slate-600 shrink-0 w-14 text-right text-[10px] pt-px",children:p.time}),W,e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:623:31",className:`break-all ${M}`,children:p.message})]})]},k)})})(),a.status==="running"&&e.jsxs("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:630:23",className:"flex items-center gap-2 mt-2 py-1.5 px-3 bg-blue-500/10 border-l-4 border-blue-500 rounded-r",children:[e.jsx($,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:631:25",className:"w-3 h-3 animate-spin text-blue-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:632:25",className:"text-[11px] text-blue-300 font-medium",children:"流水线执行中,实时输出..."}),e.jsxs("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:633:25",className:"flex gap-1 ml-1",children:[e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:634:27",className:"w-1 h-1 rounded-full bg-blue-400 animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:635:27",className:"w-1 h-1 rounded-full bg-blue-400 animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:636:27",className:"w-1 h-1 rounded-full bg-blue-400 animate-bounce",style:{animationDelay:"300ms"}})]})]}),e.jsx("div",{"code-path":"src/components/deploy/PipelineRunDetail.tsx:640:21",ref:m})]})})]})]})]}),e.jsx(Je,{"code-path":"src/components/deploy/PipelineRunDetail.tsx:650:7",open:se,onOpenChange:H,runId:q?.id??null,buildNumber:q?.buildNumber??0})]})}export{nt as default}; diff --git a/backend/static/assets/PlatformManager-CsXWkkgm.js b/backend/static/assets/PlatformManager-qy5AE7fT.js similarity index 97% rename from backend/static/assets/PlatformManager-CsXWkkgm.js rename to backend/static/assets/PlatformManager-qy5AE7fT.js index d55a2cc..8858604 100644 --- a/backend/static/assets/PlatformManager-CsXWkkgm.js +++ b/backend/static/assets/PlatformManager-qy5AE7fT.js @@ -1 +1 @@ -import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{B as d,D as k,a as L,b as E,c as I,d as T,e as B}from"./index-LZWfu62c.js";import{I as m}from"./input-BdDauX3U.js";import{L as r}from"./label-u-lNUbKh.js";import{B as j}from"./badge-B0F5ZNtn.js";import{S as P,a as M,b as v,c as b,d as o}from"./select-4xU_9B3_.js";import{p as x}from"./platform-g_u95ryi.js";import{S as K,P as U,L as O,e as V,E as W,d as Y,T as Z,C as $,a as ee}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const ae={public:"公有云",private:"私有云",hybrid:"混合云"},se={public:"text-blue-400",private:"text-purple-400",hybrid:"text-cyan-400"};function ie(){const[F,N]=t.useState([]),[Q,y]=t.useState(!0),[h,A]=t.useState(""),[u,H]=t.useState("all"),[R,l]=t.useState(!1),[n,w]=t.useState(null),[C,S]=t.useState(!1),[s,c]=t.useState({name:"",code:"",type:"public",status:"active",website:"",description:""}),p=t.useCallback(async()=>{y(!0);try{const f=(await x.list())?.list||[];N(f)}catch{N([])}finally{y(!1)}},[]);t.useEffect(()=>{p()},[p]);const D=F.filter(a=>{const f=a.name?.toLowerCase().includes(h.toLowerCase())||a.code?.toLowerCase().includes(h.toLowerCase()),J=u==="all"||a.type===u;return f&&J}),X=()=>{w(null),c({name:"",code:"",type:"public",status:"active",website:"",description:""}),l(!0)},_=a=>{w(a),c({name:a.name||"",code:a.code||"",type:a.type||"public",status:a.status||"active",website:a.website||"",description:a.description||""}),l(!0)},q=async()=>{if(!(!s.name.trim()||!s.code.trim())){S(!0);try{n?await x.update(n.id,s):await x.create(s),l(!1),p()}catch{}finally{S(!1)}}},[g,i]=t.useState(null),z=a=>i(a),G=async()=>{g!==null&&(await x.delete(g),i(null),p())};return e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:124:5",className:"p-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:126:7",className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:127:9",className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:128:11",className:"relative w-72",children:[e.jsx(K,{"code-path":"src/components/cloud/PlatformManager.tsx:129:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:130:13",placeholder:"搜索平台名称或编码...",value:h,onChange:a=>A(a.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700"})]}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:137:11",value:u,onValueChange:H,children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:138:13",className:"w-32 h-9 bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:139:15"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:141:13",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:142:15",value:"all",children:"全部类型"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:143:15",value:"public",children:"公有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:144:15",value:"private",children:"私有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:145:15",value:"hybrid",children:"混合云"})]})]})]}),e.jsxs(d,{"code-path":"src/components/cloud/PlatformManager.tsx:149:9",onClick:X,className:"gap-2",children:[e.jsx(U,{"code-path":"src/components/cloud/PlatformManager.tsx:150:11",className:"h-4 w-4"}),"添加平台"]})]}),Q?e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:157:9",className:"flex justify-center py-20",children:e.jsx(O,{"code-path":"src/components/cloud/PlatformManager.tsx:158:11",className:"h-6 w-6 animate-spin text-slate-500"})}):D.length===0?e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:161:9",className:"text-center py-20 text-slate-500",children:[e.jsx(V,{"code-path":"src/components/cloud/PlatformManager.tsx:162:11",className:"h-12 w-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:163:11",children:"暂无云平台数据"})]}):e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:166:9",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:D.map(a=>e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:168:13",className:"bg-slate-800/30 rounded-lg p-4 hover:bg-slate-800/50 transition-colors group",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:172:15",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:173:17",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:174:19",className:"w-10 h-10 rounded-lg bg-blue-500/20 flex items-center justify-center",children:e.jsx(V,{"code-path":"src/components/cloud/PlatformManager.tsx:175:21",className:"h-5 w-5 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:177:19",children:[e.jsx("h3",{"code-path":"src/components/cloud/PlatformManager.tsx:178:21",className:"font-medium text-slate-100",children:a.name}),e.jsx("span",{"code-path":"src/components/cloud/PlatformManager.tsx:179:21",className:"text-xs text-slate-500 font-mono",children:a.code})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:182:17",className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.website&&e.jsx("a",{"code-path":"src/components/cloud/PlatformManager.tsx:184:21",href:a.website,target:"_blank",rel:"noreferrer",className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-slate-200",children:e.jsx(W,{"code-path":"src/components/cloud/PlatformManager.tsx:185:23",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/cloud/PlatformManager.tsx:188:19",onClick:()=>_(a),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-slate-200",children:e.jsx(Y,{"code-path":"src/components/cloud/PlatformManager.tsx:189:21",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/cloud/PlatformManager.tsx:191:19",onClick:()=>z(a.id),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-red-400",children:e.jsx(Z,{"code-path":"src/components/cloud/PlatformManager.tsx:192:21",className:"h-3.5 w-3.5"})})]})]}),a.description&&e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:198:17",className:"text-sm text-slate-400 mb-3 line-clamp-2",children:a.description}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:201:15",className:"flex items-center gap-2 flex-wrap",children:[e.jsx(j,{"code-path":"src/components/cloud/PlatformManager.tsx:202:17",variant:"outline",className:se[a.type]||"text-slate-400",children:ae[a.type]||a.type}),a.status==="active"?e.jsxs(j,{"code-path":"src/components/cloud/PlatformManager.tsx:206:19",className:"bg-emerald-500/20 text-emerald-400 gap-1",children:[e.jsx($,{"code-path":"src/components/cloud/PlatformManager.tsx:207:21",className:"h-3 w-3"})," 启用"]}):e.jsxs(j,{"code-path":"src/components/cloud/PlatformManager.tsx:210:19",className:"bg-slate-500/20 text-slate-400 gap-1",children:[e.jsx(ee,{"code-path":"src/components/cloud/PlatformManager.tsx:211:21",className:"h-3 w-3"})," 禁用"]})]})]},a.id))}),e.jsx(k,{"code-path":"src/components/cloud/PlatformManager.tsx:221:7",open:R,onOpenChange:l,children:e.jsxs(L,{"code-path":"src/components/cloud/PlatformManager.tsx:222:9",children:[e.jsxs(E,{"code-path":"src/components/cloud/PlatformManager.tsx:223:11",children:[e.jsx(I,{"code-path":"src/components/cloud/PlatformManager.tsx:224:13",children:n?"编辑云平台":"添加云平台"}),e.jsx(T,{"code-path":"src/components/cloud/PlatformManager.tsx:225:13",className:"sr-only",children:"描述"})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:227:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:228:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:229:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:230:17",children:"平台名称 *"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:231:17",value:s.name,onChange:a=>c({...s,name:a.target.value}),placeholder:"如:阿里云",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:238:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:239:17",children:"编码 *"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:240:17",value:s.code,onChange:a=>c({...s,code:a.target.value}),placeholder:"如:aliyun",className:"bg-slate-800/50 border-slate-700",disabled:!!n})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:249:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:250:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:251:17",children:"类型"}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:252:17",value:s.type,onValueChange:a=>c({...s,type:a}),children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:253:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:254:21"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:256:19",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:257:21",value:"public",children:"公有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:258:21",value:"private",children:"私有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:259:21",value:"hybrid",children:"混合云"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:263:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:264:17",children:"状态"}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:265:17",value:s.status,onValueChange:a=>c({...s,status:a}),children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:266:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:267:21"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:269:19",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:270:21",value:"active",children:"启用"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:271:21",value:"inactive",children:"禁用"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:276:13",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:277:15",children:"官网地址"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:278:15",value:s.website,onChange:a=>c({...s,website:a.target.value}),placeholder:"https://...",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:285:13",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:286:15",children:"描述"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:287:15",value:s.description,onChange:a=>c({...s,description:a.target.value}),placeholder:"平台描述...",className:"bg-slate-800/50 border-slate-700"})]})]}),e.jsxs(B,{"code-path":"src/components/cloud/PlatformManager.tsx:295:11",children:[e.jsx(d,{"code-path":"src/components/cloud/PlatformManager.tsx:296:13",variant:"ghost",onClick:()=>l(!1),children:"取消"}),e.jsxs(d,{"code-path":"src/components/cloud/PlatformManager.tsx:297:13",onClick:q,disabled:C||!s.name.trim()||!s.code.trim(),children:[C&&e.jsx(O,{"code-path":"src/components/cloud/PlatformManager.tsx:298:30",className:"h-4 w-4 mr-1 animate-spin"}),n?"保存":"创建"]})]})]})}),e.jsx(k,{"code-path":"src/components/cloud/PlatformManager.tsx:306:7",open:g!==null,onOpenChange:a=>!a&&i(null),children:e.jsxs(L,{"code-path":"src/components/cloud/PlatformManager.tsx:307:9",className:"max-w-sm",children:[e.jsxs(E,{"code-path":"src/components/cloud/PlatformManager.tsx:308:11",children:[e.jsx(I,{"code-path":"src/components/cloud/PlatformManager.tsx:309:13",children:"确认删除"}),e.jsx(T,{"code-path":"src/components/cloud/PlatformManager.tsx:310:13",className:"sr-only",children:"描述"})]}),e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:312:11",className:"text-sm text-slate-400",children:"确定删除此云平台?此操作不可撤销。"}),e.jsxs(B,{"code-path":"src/components/cloud/PlatformManager.tsx:313:11",children:[e.jsx(d,{"code-path":"src/components/cloud/PlatformManager.tsx:314:13",variant:"ghost",onClick:()=>i(null),children:"取消"}),e.jsx(d,{"code-path":"src/components/cloud/PlatformManager.tsx:315:13",variant:"destructive",onClick:G,children:"删除"})]})]})})]})}export{ie as PlatformManager}; +import{r as t,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{B as d,D as k,a as L,b as E,c as I,d as T,e as B}from"./index-Bp-M7P_8.js";import{I as m}from"./input-Bnlm--la.js";import{L as r}from"./label-NkONM5Mp.js";import{B as j}from"./badge-B00SZHvE.js";import{S as P,a as M,b as v,c as b,d as o}from"./select-DbhcBWnH.js";import{p as x}from"./platform-lu-CBYjL.js";import{S as K,P as U,L as O,e as V,E as W,d as Y,T as Z,C as $,a as ee}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";const ae={public:"公有云",private:"私有云",hybrid:"混合云"},se={public:"text-blue-400",private:"text-purple-400",hybrid:"text-cyan-400"};function ie(){const[F,N]=t.useState([]),[Q,y]=t.useState(!0),[h,A]=t.useState(""),[u,H]=t.useState("all"),[R,l]=t.useState(!1),[n,w]=t.useState(null),[C,S]=t.useState(!1),[s,c]=t.useState({name:"",code:"",type:"public",status:"active",website:"",description:""}),p=t.useCallback(async()=>{y(!0);try{const f=(await x.list())?.list||[];N(f)}catch{N([])}finally{y(!1)}},[]);t.useEffect(()=>{p()},[p]);const D=F.filter(a=>{const f=a.name?.toLowerCase().includes(h.toLowerCase())||a.code?.toLowerCase().includes(h.toLowerCase()),J=u==="all"||a.type===u;return f&&J}),X=()=>{w(null),c({name:"",code:"",type:"public",status:"active",website:"",description:""}),l(!0)},_=a=>{w(a),c({name:a.name||"",code:a.code||"",type:a.type||"public",status:a.status||"active",website:a.website||"",description:a.description||""}),l(!0)},q=async()=>{if(!(!s.name.trim()||!s.code.trim())){S(!0);try{n?await x.update(n.id,s):await x.create(s),l(!1),p()}catch{}finally{S(!1)}}},[g,i]=t.useState(null),z=a=>i(a),G=async()=>{g!==null&&(await x.delete(g),i(null),p())};return e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:124:5",className:"p-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:126:7",className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:127:9",className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:128:11",className:"relative w-72",children:[e.jsx(K,{"code-path":"src/components/cloud/PlatformManager.tsx:129:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:130:13",placeholder:"搜索平台名称或编码...",value:h,onChange:a=>A(a.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700"})]}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:137:11",value:u,onValueChange:H,children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:138:13",className:"w-32 h-9 bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:139:15"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:141:13",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:142:15",value:"all",children:"全部类型"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:143:15",value:"public",children:"公有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:144:15",value:"private",children:"私有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:145:15",value:"hybrid",children:"混合云"})]})]})]}),e.jsxs(d,{"code-path":"src/components/cloud/PlatformManager.tsx:149:9",onClick:X,className:"gap-2",children:[e.jsx(U,{"code-path":"src/components/cloud/PlatformManager.tsx:150:11",className:"h-4 w-4"}),"添加平台"]})]}),Q?e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:157:9",className:"flex justify-center py-20",children:e.jsx(O,{"code-path":"src/components/cloud/PlatformManager.tsx:158:11",className:"h-6 w-6 animate-spin text-slate-500"})}):D.length===0?e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:161:9",className:"text-center py-20 text-slate-500",children:[e.jsx(V,{"code-path":"src/components/cloud/PlatformManager.tsx:162:11",className:"h-12 w-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:163:11",children:"暂无云平台数据"})]}):e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:166:9",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:D.map(a=>e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:168:13",className:"bg-slate-800/30 rounded-lg p-4 hover:bg-slate-800/50 transition-colors group",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:172:15",className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:173:17",className:"flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/cloud/PlatformManager.tsx:174:19",className:"w-10 h-10 rounded-lg bg-blue-500/20 flex items-center justify-center",children:e.jsx(V,{"code-path":"src/components/cloud/PlatformManager.tsx:175:21",className:"h-5 w-5 text-blue-400"})}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:177:19",children:[e.jsx("h3",{"code-path":"src/components/cloud/PlatformManager.tsx:178:21",className:"font-medium text-slate-100",children:a.name}),e.jsx("span",{"code-path":"src/components/cloud/PlatformManager.tsx:179:21",className:"text-xs text-slate-500 font-mono",children:a.code})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:182:17",className:"flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[a.website&&e.jsx("a",{"code-path":"src/components/cloud/PlatformManager.tsx:184:21",href:a.website,target:"_blank",rel:"noreferrer",className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-slate-200",children:e.jsx(W,{"code-path":"src/components/cloud/PlatformManager.tsx:185:23",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/cloud/PlatformManager.tsx:188:19",onClick:()=>_(a),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-slate-200",children:e.jsx(Y,{"code-path":"src/components/cloud/PlatformManager.tsx:189:21",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/cloud/PlatformManager.tsx:191:19",onClick:()=>z(a.id),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-red-400",children:e.jsx(Z,{"code-path":"src/components/cloud/PlatformManager.tsx:192:21",className:"h-3.5 w-3.5"})})]})]}),a.description&&e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:198:17",className:"text-sm text-slate-400 mb-3 line-clamp-2",children:a.description}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:201:15",className:"flex items-center gap-2 flex-wrap",children:[e.jsx(j,{"code-path":"src/components/cloud/PlatformManager.tsx:202:17",variant:"outline",className:se[a.type]||"text-slate-400",children:ae[a.type]||a.type}),a.status==="active"?e.jsxs(j,{"code-path":"src/components/cloud/PlatformManager.tsx:206:19",className:"bg-emerald-500/20 text-emerald-400 gap-1",children:[e.jsx($,{"code-path":"src/components/cloud/PlatformManager.tsx:207:21",className:"h-3 w-3"})," 启用"]}):e.jsxs(j,{"code-path":"src/components/cloud/PlatformManager.tsx:210:19",className:"bg-slate-500/20 text-slate-400 gap-1",children:[e.jsx(ee,{"code-path":"src/components/cloud/PlatformManager.tsx:211:21",className:"h-3 w-3"})," 禁用"]})]})]},a.id))}),e.jsx(k,{"code-path":"src/components/cloud/PlatformManager.tsx:221:7",open:R,onOpenChange:l,children:e.jsxs(L,{"code-path":"src/components/cloud/PlatformManager.tsx:222:9",children:[e.jsxs(E,{"code-path":"src/components/cloud/PlatformManager.tsx:223:11",children:[e.jsx(I,{"code-path":"src/components/cloud/PlatformManager.tsx:224:13",children:n?"编辑云平台":"添加云平台"}),e.jsx(T,{"code-path":"src/components/cloud/PlatformManager.tsx:225:13",className:"sr-only",children:"描述"})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:227:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:228:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:229:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:230:17",children:"平台名称 *"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:231:17",value:s.name,onChange:a=>c({...s,name:a.target.value}),placeholder:"如:阿里云",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:238:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:239:17",children:"编码 *"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:240:17",value:s.code,onChange:a=>c({...s,code:a.target.value}),placeholder:"如:aliyun",className:"bg-slate-800/50 border-slate-700",disabled:!!n})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:249:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:250:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:251:17",children:"类型"}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:252:17",value:s.type,onValueChange:a=>c({...s,type:a}),children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:253:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:254:21"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:256:19",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:257:21",value:"public",children:"公有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:258:21",value:"private",children:"私有云"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:259:21",value:"hybrid",children:"混合云"})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:263:15",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:264:17",children:"状态"}),e.jsxs(P,{"code-path":"src/components/cloud/PlatformManager.tsx:265:17",value:s.status,onValueChange:a=>c({...s,status:a}),children:[e.jsx(M,{"code-path":"src/components/cloud/PlatformManager.tsx:266:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(v,{"code-path":"src/components/cloud/PlatformManager.tsx:267:21"})}),e.jsxs(b,{"code-path":"src/components/cloud/PlatformManager.tsx:269:19",children:[e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:270:21",value:"active",children:"启用"}),e.jsx(o,{"code-path":"src/components/cloud/PlatformManager.tsx:271:21",value:"inactive",children:"禁用"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:276:13",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:277:15",children:"官网地址"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:278:15",value:s.website,onChange:a=>c({...s,website:a.target.value}),placeholder:"https://...",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/PlatformManager.tsx:285:13",className:"space-y-1.5",children:[e.jsx(r,{"code-path":"src/components/cloud/PlatformManager.tsx:286:15",children:"描述"}),e.jsx(m,{"code-path":"src/components/cloud/PlatformManager.tsx:287:15",value:s.description,onChange:a=>c({...s,description:a.target.value}),placeholder:"平台描述...",className:"bg-slate-800/50 border-slate-700"})]})]}),e.jsxs(B,{"code-path":"src/components/cloud/PlatformManager.tsx:295:11",children:[e.jsx(d,{"code-path":"src/components/cloud/PlatformManager.tsx:296:13",variant:"ghost",onClick:()=>l(!1),children:"取消"}),e.jsxs(d,{"code-path":"src/components/cloud/PlatformManager.tsx:297:13",onClick:q,disabled:C||!s.name.trim()||!s.code.trim(),children:[C&&e.jsx(O,{"code-path":"src/components/cloud/PlatformManager.tsx:298:30",className:"h-4 w-4 mr-1 animate-spin"}),n?"保存":"创建"]})]})]})}),e.jsx(k,{"code-path":"src/components/cloud/PlatformManager.tsx:306:7",open:g!==null,onOpenChange:a=>!a&&i(null),children:e.jsxs(L,{"code-path":"src/components/cloud/PlatformManager.tsx:307:9",className:"max-w-sm",children:[e.jsxs(E,{"code-path":"src/components/cloud/PlatformManager.tsx:308:11",children:[e.jsx(I,{"code-path":"src/components/cloud/PlatformManager.tsx:309:13",children:"确认删除"}),e.jsx(T,{"code-path":"src/components/cloud/PlatformManager.tsx:310:13",className:"sr-only",children:"描述"})]}),e.jsx("p",{"code-path":"src/components/cloud/PlatformManager.tsx:312:11",className:"text-sm text-slate-400",children:"确定删除此云平台?此操作不可撤销。"}),e.jsxs(B,{"code-path":"src/components/cloud/PlatformManager.tsx:313:11",children:[e.jsx(d,{"code-path":"src/components/cloud/PlatformManager.tsx:314:13",variant:"ghost",onClick:()=>i(null),children:"取消"}),e.jsx(d,{"code-path":"src/components/cloud/PlatformManager.tsx:315:13",variant:"destructive",onClick:G,children:"删除"})]})]})})]})}export{ie as PlatformManager}; diff --git a/backend/static/assets/PodFileBrowser-Bs6KRfHw.js b/backend/static/assets/PodFileBrowser-Bs6KRfHw.js deleted file mode 100644 index c91e4a2..0000000 --- a/backend/static/assets/PodFileBrowser-Bs6KRfHw.js +++ /dev/null @@ -1,14 +0,0 @@ -import{r as u,y as le,E as G,j as e,R as J,o as K}from"./vendor-codemirror-C7mXSpXt.js";import{a8 as re,B as j,D as de,a as me,m as H,c as ue,d as xe}from"./index-LZWfu62c.js";import{u as ae}from"./use-toast-CkA38LVP.js";import{k as D}from"./index-Z0O8nAcG.js";import{w as q,aF as X,ay as L,L as _,$ as Z,X as O,r as he,ad as pe,aK as fe,an as be,ao as we,H as ke,m as ge,f as je,ah as ve,R as Ne,aL as Pe,aM as ye,v as Se}from"./vendor-icons-Aso0-eeY.js";import{S as Q,a as ee,b as te,c as se,d as ne}from"./select-4xU_9B3_.js";import{x as Ee,a as Fe}from"./vendor-xterm-20M9KZE1.js";import{B as Be}from"./badge-B0F5ZNtn.js";function oe(r){if(!r)return"";const s=r.replace(/\r\n/g,` -`).split(` -`),o=[];let n=0;const g=new Set(["uid","resourceVersion","creationTimestamp","generation","selfLink","clusterName","generateName"]),A=new Set(["managedFields","ownerReferences"]),R={dnsPolicy:["ClusterFirst"],restartPolicy:["Always"],schedulerName:["default-scheduler"],terminationGracePeriodSeconds:["30"],serviceAccountName:["default"],enableServiceLinks:["true"],progressDeadlineSeconds:["600"],revisionHistoryLimit:["10"]},E={imagePullPolicy:["Always","IfNotPresent"],terminationMessagePath:["/dev/termination-log"],terminationMessagePolicy:["File"]},M=new Set(["kubectl.kubernetes.io/last-applied-configuration","deployment.kubernetes.io/revision","kubectl.kubernetes.io/restartedAt","control-plane.alpha.kubernetes.io/leader","autoscaling.alpha.kubernetes.io/conditions"]),h=["kube-api-access-","default-token-","kube-"];let b=!1,S=!1,F=!1,Y=!1,w=!1,B=!1,v=!1,T=!1,N=0;function f(x){return x.length-x.trimStart().length}function P(x){const a=x.trimStart().match(/^([a-zA-Z_][a-zA-Z0-9_./-]*)\s*:/);return a?a[1]:null}function V(x){const a=x.trim().split(":").slice(1).join(":").trim();return a!==""&&!/^[>|]/.test(a)}function C(x){for(n++;na.startsWith(i)):!1}for(;n=2&&i<=4&&a.startsWith("pod-template-hash")&&a.includes(":")){n++;continue}if(i===2&&c&&g.has(c)){V(x)?n++:C(2);continue}if(i===2&&c&&A.has(c)){for(n++;n2||d===2&&t.startsWith("-")){n++;continue}break}continue}if(S&&i>2&&c&&M.has(c)){if(V(x))n++;else{const l=a.split(":").slice(1).join(":").trim();/^[>|]/.test(l)?C(i):n++}continue}}if(F){if(i===2&&c==="template"){o.push(x),n++;continue}if(i===2&&c&&R[c]){const p=a.split(":").slice(1).join(":").trim();if(R[c].includes(p)){n++;continue}}if(i===2&&c==="nodeName"){n++;continue}if(i===2&&c==="spec"){Y=!0,N=i,o.push(x),n++;continue}}if(Y&&i>N){if(c==="containers"){w=!0,B=!1,o.push(x),n++;continue}if(c==="initContainers"){B=!0,w=!1,o.push(x),n++;continue}if(c==="volumes"){T=!0,o.push(x),n++;continue}if(c&&R[c]){const p=a.split(":").slice(1).join(":").trim();if(R[c].includes(p)){n++;continue}}if(c==="nodeName"){n++;continue}if(c==="serviceAccount"&&a.endsWith(":")){V(x)?n++:C(i);continue}}if((w||B)&&i>=6){if(c&&E[c]){const p=a.split(":").slice(1).join(":").trim();if(E[c].includes(p)){n++;continue}}if(c==="volumeMounts"&&(v=!0),v&&a.startsWith("- name:")){let p=[x],l=n+1,t=!1;for(;l=4&&a.startsWith("- name:")&&k(a)){const p=i;for(n++;n0&&o[o.length-1].trim()===""){n++;continue}o.push(x),n++}return o.join(` -`).replace(/\n{3,}/g,` - -`).trimEnd()+` -`}function Te(r){return r.includes("mountPath:")&&(r.includes("/var/run/secrets/kubernetes.io")||r.includes("/var/run/secrets/sa"))}const I={green:"#10b981",orange:"#f59e0b",red:"#ef4444",blue:"#326CE5"};function Ie(r){if(!r)return"#64748b";const s=r.toLowerCase();return["running","available","ready","active","completed","succeeded"].includes(s)?I.green:["pending","updating","progressing","containercreating"].includes(s)?I.orange:["failed","error","crashloopbackoff","imagepullbackoff","errimageneverpull"].includes(s)?I.red:I.blue}function Oe(r){if(!r)return"-";const s=new Date(r);if(isNaN(s.getTime()))return r;const o=n=>String(n).padStart(2,"0");return`${s.getFullYear()}-${o(s.getMonth()+1)}-${o(s.getDate())} ${o(s.getHours())}:${o(s.getMinutes())}:${o(s.getSeconds())}`}function We(r,s){if(!r||!s)return null;const o=new Date(r).getTime(),n=new Date(s).getTime();return isNaN(o)||isNaN(n)||nimport("./js-yaml-37NdyH6G.js"),[])).load(r);return o&&typeof o=="object"?o:null}catch{return null}}async function U(r){return(await re(()=>import("./js-yaml-37NdyH6G.js"),[])).dump(r,{lineWidth:120,noRefs:!0})}async function ie(r){const s=await ce(r);if(!s)return{manifest:null,yaml:r};const o=W(s);return{manifest:o,yaml:await U(o)}}async function Ye(r){const s=await U(W(r));return oe(s)}const Ge=Object.freeze(Object.defineProperty({__proto__:null,dumpManifest:U,parseEditableManifest:ie,parseManifest:ce,prepareManifestForSave:Ye,stripRuntimeFields:W},Symbol.toStringTag,{value:"Module"}));function Je({clusterCode:r,namespace:s,resource:o,name:n,onClose:g,onSaved:A,cleanBeforeEdit:R=!1,autoEdit:E=!1,inline:M=!1,initialYaml:h}){const{toast:b}=ae(),[S,F]=u.useState(h||""),[Y,w]=u.useState(""),[B,v]=u.useState(!h),[T,N]=u.useState(!1),[f,P]=u.useState(E),[V,C]=u.useState(!1),k=R||E,z=async m=>{if(!k)return m;const{yaml:$}=await ie(m);return $},x=async()=>{if(h){F(h),w(await z(h)),v(!1);return}v(!0);try{const m=await D.getResourceYaml(r,s,o,n);F(m),w(await z(m))}catch(m){b({title:"获取YAML失败",description:m.message,variant:"destructive"});const $=`# Error: ${m.message}`;F($),w($)}finally{v(!1)}},a=async()=>{w(await z(S)),P(!0),k&&b({title:"已清理只读字段",description:"已剥离 status / managedFields / uid 等"})},[i,c]=u.useState(!1),p=async()=>{N(!0);try{await D.updateResourceYaml(r,s,o,n,Y),b({title:"YAML已应用",description:`${o}/${n} 更新成功`}),P(!1),F(Y),A?.()}catch(m){b({title:"保存失败",description:m.message,variant:"destructive"})}finally{N(!1)}},l=async()=>{const m=f?Y:S;await navigator.clipboard.writeText(m),C(!0),setTimeout(()=>C(!1),2e3)};u.useEffect(()=>{x()},[]);const t=f?Y:k&&!i?oe(S):S,d=u.useMemo(()=>[le(),G.lineWrapping,...f?[]:[G.editable.of(!1)]],[f]);return M?e.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:119:7",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:120:9",className:"flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/kubernetes/YamlViewer.tsx:121:11",className:"text-xs text-slate-500",children:[e.jsxs("code",{"code-path":"src/components/kubernetes/YamlViewer.tsx:122:13",className:"text-slate-400",children:[o,"/",n]})," · ",s," · ",r]}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:124:11",className:"flex items-center gap-2",children:[e.jsxs(j,{"code-path":"src/components/kubernetes/YamlViewer.tsx:125:13",variant:"outline",size:"sm",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:l,children:[V?e.jsx(q,{"code-path":"src/components/kubernetes/YamlViewer.tsx:126:25",className:"h-3 w-3 mr-1 text-emerald-400"}):e.jsx(X,{"code-path":"src/components/kubernetes/YamlViewer.tsx:126:79",className:"h-3 w-3 mr-1"}),V?"已复制":"复制"]}),k&&!f&&e.jsxs(j,{"code-path":"src/components/kubernetes/YamlViewer.tsx:130:15",variant:"outline",size:"sm",className:`h-7 text-xs ${i?"border-slate-700 text-slate-500":"border-emerald-700/50 text-emerald-400"}`,onClick:()=>c(m=>!m),title:"切换 精简/原始 视图",children:[e.jsx(L,{"code-path":"src/components/kubernetes/YamlViewer.tsx:132:17",className:"h-3 w-3 mr-1"}),i?"原始":"精简"]}),f?e.jsxs(e.Fragment,{children:[e.jsx(j,{"code-path":"src/components/kubernetes/YamlViewer.tsx:150:17",variant:"outline",size:"sm",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>{P(!1),x()},children:"取消"}),e.jsxs(j,{"code-path":"src/components/kubernetes/YamlViewer.tsx:153:17",size:"sm",className:"h-7 bg-blue-600 hover:bg-blue-700 text-xs",onClick:p,disabled:T,children:[T?e.jsx(_,{"code-path":"src/components/kubernetes/YamlViewer.tsx:154:29",className:"h-3 w-3 animate-spin mr-1"}):e.jsx(Z,{"code-path":"src/components/kubernetes/YamlViewer.tsx:154:81",className:"h-3 w-3 mr-1"}),"保存"]})]}):e.jsxs(e.Fragment,{children:[k&&e.jsxs(j,{"code-path":"src/components/kubernetes/YamlViewer.tsx:138:19",variant:"outline",size:"sm",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:a,title:"清理 status / managedFields 等只读字段后编辑",children:[e.jsx(L,{"code-path":"src/components/kubernetes/YamlViewer.tsx:139:19",className:"h-3 w-3 mr-1 text-amber-400"}),"编辑"]}),!k&&e.jsx(j,{"code-path":"src/components/kubernetes/YamlViewer.tsx:143:19",variant:"outline",size:"sm",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>P(!0),children:"编辑"})]})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:161:9",className:"border border-slate-700 rounded-lg overflow-hidden",children:B?e.jsx("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:163:13",className:"flex items-center justify-center h-96",children:e.jsx(_,{"code-path":"src/components/kubernetes/YamlViewer.tsx:163:68",className:"h-6 w-6 animate-spin text-slate-500"})}):e.jsx(J,{"code-path":"src/components/kubernetes/YamlViewer.tsx:165:13",value:t,height:"600px",theme:K,extensions:d,onChange:m=>f&&w(m),basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:f,highlightActiveLineGutter:f,autocompletion:!0,bracketMatching:!0,closeBrackets:!0,indentOnInput:!0},style:{fontSize:"12px"}})})]}):e.jsx("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:191:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:g,children:e.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:192:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[92vw] max-w-5xl h-[88vh] flex flex-col shadow-2xl",onClick:m=>m.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:194:9",className:"flex items-center justify-between p-4 border-b border-slate-700",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:195:11",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/YamlViewer.tsx:196:13",className:"text-lg font-bold text-slate-100",children:[f?"YAML 编辑":"YAML 查看"," — ",o,"/",n]}),e.jsxs("p",{"code-path":"src/components/kubernetes/YamlViewer.tsx:197:13",className:"text-xs text-slate-500",children:[s," · ",r,f?" · 已清理只读字段":""]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:199:11",className:"flex items-center gap-2",children:[e.jsxs(j,{"code-path":"src/components/kubernetes/YamlViewer.tsx:200:13",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300",onClick:l,children:[V?e.jsx(q,{"code-path":"src/components/kubernetes/YamlViewer.tsx:201:25",className:"h-3 w-3 mr-1 text-emerald-400"}):e.jsx(X,{"code-path":"src/components/kubernetes/YamlViewer.tsx:201:79",className:"h-3 w-3 mr-1"}),V?"已复制":"复制"]}),k&&!f&&e.jsxs(j,{"code-path":"src/components/kubernetes/YamlViewer.tsx:205:15",variant:"outline",size:"sm",className:`h-8 text-xs ${i?"border-slate-700 text-slate-500":"border-emerald-700/50 text-emerald-400"}`,onClick:()=>c(m=>!m),title:"切换 精简/原始 视图",children:[e.jsx(L,{"code-path":"src/components/kubernetes/YamlViewer.tsx:207:17",className:"h-3 w-3 mr-1"}),i?"原始":"精简"]}),f?e.jsxs(e.Fragment,{children:[e.jsx(j,{"code-path":"src/components/kubernetes/YamlViewer.tsx:225:17",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300",onClick:()=>{P(!1),x()},children:"取消"}),e.jsxs(j,{"code-path":"src/components/kubernetes/YamlViewer.tsx:228:17",size:"sm",className:"h-8 bg-blue-600 hover:bg-blue-700",onClick:p,disabled:T,children:[T?e.jsx(_,{"code-path":"src/components/kubernetes/YamlViewer.tsx:229:29",className:"h-3 w-3 animate-spin mr-1"}):e.jsx(Z,{"code-path":"src/components/kubernetes/YamlViewer.tsx:229:81",className:"h-3 w-3 mr-1"}),"保存"]})]}):e.jsxs(e.Fragment,{children:[k&&e.jsxs(j,{"code-path":"src/components/kubernetes/YamlViewer.tsx:213:19",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300",onClick:a,title:"清理 status / managedFields 等只读字段后编辑",children:[e.jsx(L,{"code-path":"src/components/kubernetes/YamlViewer.tsx:214:21",className:"h-3 w-3 mr-1 text-amber-400"}),"清理并编辑"]}),!k&&e.jsx(j,{"code-path":"src/components/kubernetes/YamlViewer.tsx:218:19",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300",onClick:()=>P(!0),children:"编辑"})]}),e.jsx(j,{"code-path":"src/components/kubernetes/YamlViewer.tsx:234:13",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400",onClick:g,children:e.jsx(O,{"code-path":"src/components/kubernetes/YamlViewer.tsx:234:102",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:238:9",className:"flex-1 min-h-0 overflow-hidden p-4",children:B?e.jsx("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:240:13",className:"flex items-center justify-center h-full",children:e.jsx(_,{"code-path":"src/components/kubernetes/YamlViewer.tsx:240:70",className:"h-6 w-6 animate-spin text-slate-500"})}):e.jsx(J,{"code-path":"src/components/kubernetes/YamlViewer.tsx:242:13",value:t,height:"100%",theme:K,extensions:d,onChange:m=>f&&w(m),basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:f,highlightActiveLineGutter:f,autocompletion:!0,bracketMatching:!0,closeBrackets:!0,indentOnInput:!0},style:{fontSize:"13px",height:"100%"}})})]})})}const Ve=[{value:"sh",label:"/bin/sh"},{value:"bash",label:"/bin/bash"}];function Ke({open:r,onOpenChange:s,clusterId:o,namespace:n,podName:g,containers:A=[],initialContainer:R}){const{toast:E}=ae(),M=u.useRef(null),h=u.useRef(null),b=u.useRef(null),S=u.useRef(null),F=u.useRef(!1),Y=u.useRef(!1),[w,B]=u.useState("idle"),[v,T]=u.useState(!1),[N,f]=u.useState(R||A[0]||""),[P,V]=u.useState("sh");u.useEffect(()=>{r||(T(!1),F.current=!1)},[r]),u.useEffect(()=>{r&&!N&&A.length>0&&f(R||A[0])},[r,A,R,N]);const C=u.useCallback(()=>{if(!h.current){console.error("[PodExec:connect] ABORT: termRef.current is null");return}const a=h.current;if(b.current){try{b.current.close()}catch{}b.current=null}B("connecting"),a.clear(),a.writeln(`\x1B[36m[正在连接 ${g}${N?"/"+N:""} shell=${P} ...]\x1B[0m`);const i=D.buildPodExecWsUrl(o,n,g,N||void 0,P),c=new WebSocket(i);b.current=c,c.onopen=()=>{B("connected"),a.reset();try{const{cols:l,rows:t}=a;c.send(JSON.stringify({status:1,cols:l,rows:t}))}catch(l){console.error("[PodExec:connect] resize error:",l)}const p=()=>{try{a.focus()}catch{}};p(),setTimeout(p,100),setTimeout(p,300)},c.onmessage=p=>{try{const l=JSON.parse(p.data);if(l.status===0&&typeof l.data=="string")a.write(l.data);else if(l.status===2||l.error){const t=l.data||l.message||l.error||"执行错误";if(t.includes("not found")&&P==="bash"){a.writeln(`\r -\x1B[33m⚠ bash 不可用,请切换 /bin/sh 后重连。\x1B[0m`),Y.current=!0;return}a.write(t.includes("\x1B")?t:`\r -\x1B[31m${t}\x1B[0m\r -`)}}catch{typeof p.data=="string"&&a.write(p.data)}},c.onclose=p=>{B(l=>l==="error"?l:"closed"),Y.current||a.write(`\r -\x1B[33m[连接已关闭]\x1B[0m\r -`)},c.onerror=p=>{console.error("[PodExec:connect] WS error event fired, readyState=",c.readyState,"type=",p.type),B("error"),a.write(`\r -\x1B[31m[连接发生错误]\x1B[0m\r -`)}},[o,n,g,N,P]);u.useEffect(()=>{if(!r)return;if(!o){console.error("[PodExec:initEffect] ABORT: clusterId is falsy:",o);return}if(!g){console.error("[PodExec:initEffect] ABORT: podName is falsy:",g);return}let a=!1,i=0;const c=performance.now(),p=()=>{if(a)return;const l=M.current;if(!l){i++,i<20?requestAnimationFrame(p):console.error("[PodExec:tryInit] FAILED: containerRef still null after 20 retries (",Math.round(performance.now()-c),"ms)");return}const t=new Ee.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,scrollback:5e3,theme:{background:"#0f172a",foreground:"#e2e8f0",cursor:"#38bdf8",selectionBackground:"#1e40af",black:"#1e293b",red:"#ef4444",green:"#10b981",yellow:"#f59e0b",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e2e8f0",brightBlack:"#475569",brightRed:"#f87171",brightGreen:"#34d399",brightYellow:"#fbbf24",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#f8fafc"}}),d=new Fe.FitAddon;t.loadAddon(d),h.current=t,S.current=d,t.onData(m=>{b.current&&b.current.readyState===WebSocket.OPEN?b.current.send(JSON.stringify({status:0,data:m})):console.warn("[PodExec:term] TX dropped — WS not open, readyState=",b.current?.readyState)}),t.open(l),requestAnimationFrame(()=>{try{d.fit()}catch{}}),F.current=!0,C()};return requestAnimationFrame(p),()=>{a=!0}},[r,o,g]),u.useEffect(()=>{if(!r){try{b.current?.close()}catch{}try{h.current?.dispose()}catch{}h.current=null,b.current=null,S.current=null,F.current=!1,B("idle")}},[r]),u.useEffect(()=>{r&&h.current&&F.current&&C()},[N,P]),u.useEffect(()=>{if(!r)return;const a=M.current;if(!a)return;let i;const c=new ResizeObserver(()=>{clearTimeout(i),i=setTimeout(()=>{if(S.current&&h.current)try{S.current.fit(),h.current.focus();const{cols:p,rows:l}=h.current;b.current?.readyState===WebSocket.OPEN&&b.current.send(JSON.stringify({status:1,cols:p,rows:l}))}catch{}},60)});return c.observe(a),()=>{clearTimeout(i),c.disconnect()}},[r,v]);const k=w==="connected"?"bg-emerald-400":w==="error"?"bg-red-400":w==="closed"?"bg-slate-500":"bg-amber-400",z=w==="connected"?"已连接":w==="connecting"?"连接中":w==="error"?"连接错误":w==="closed"?"已断开":"空闲",x=u.useCallback(()=>{try{h.current?.focus()}catch{}},[]);return e.jsx(de,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:279:5",open:r,onOpenChange:s,children:e.jsxs(me,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:280:7",showCloseButton:!1,className:H("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",v?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:v?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"960px",width:"92vw"},children:[e.jsxs(ue,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:289:9",className:"sr-only",children:["exec — ",g]}),e.jsx(xe,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:290:9",className:"sr-only",children:"进入 Pod 容器执行命令"}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:293:9",className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-[var(--dg-border)] flex-wrap",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:294:11",className:"flex items-center gap-2 text-sm min-w-0",children:[e.jsx("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:295:13",className:H("w-2 h-2 rounded-full shrink-0",k),title:z}),e.jsx(he,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:296:13",className:"h-4 w-4 text-blue-400 shrink-0"}),e.jsxs("span",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:297:13",className:"text-[var(--dg-text-primary)] font-medium truncate",children:["exec — ",g]}),w==="connecting"&&e.jsx(_,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:298:44",className:"h-3 w-3 animate-spin text-[var(--dg-text-muted)]"}),e.jsx("span",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:299:13",className:"text-xs text-[var(--dg-text-muted)]",children:z})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:301:11",className:"flex items-center gap-2",children:[A.length>0&&e.jsxs(Q,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:303:15",value:N,onValueChange:f,children:[e.jsxs(ee,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:304:17",className:"h-8 w-[150px] text-xs bg-[var(--dg-bg-hover)] border-[var(--dg-border)]",children:[e.jsx(pe,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:305:19",className:"h-3 w-3 mr-1 text-[var(--dg-text-muted)]"}),e.jsx(te,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:306:19",placeholder:"容器"})]}),e.jsx(se,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:308:17",children:A.map(a=>e.jsx(ne,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:308:55",value:a,children:a},a))})]}),e.jsxs(Q,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:311:13",value:P,onValueChange:V,children:[e.jsx(ee,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:312:15",className:"h-8 w-[110px] text-xs bg-[var(--dg-bg-hover)] border-[var(--dg-border)]",children:e.jsx(te,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:313:17"})}),e.jsx(se,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:315:15",children:Ve.map(a=>e.jsx(ne,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:315:47",value:a.value,children:a.label},a.value))})]}),e.jsx(j,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:317:13",variant:"ghost",size:"sm",className:"h-8 px-2 text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]",onClick:()=>{C(),E({title:"正在重连…"})},title:"重连",children:e.jsx(fe,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:319:15",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:321:13",onClick:()=>T(!v),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",title:v?"退出全屏":"全屏",children:v?e.jsx(be,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:322:29",className:"h-4 w-4"}):e.jsx(we,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:322:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:324:13",onClick:()=>s(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",title:"关闭",children:e.jsx(O,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:325:15",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:331:9",ref:M,className:"bg-[#0f172a] cursor-text",style:{height:v?"calc(100vh - 49px)":"480px"},onClick:x})]})})}function He({open:r,onOpenChange:s,clusterCode:o,namespace:n,podName:g,containers:A=[],initialContainer:R}){const[E,M]=u.useState(R||A[0]||""),[h,b]=u.useState("/"),[S,F]=u.useState([]),[Y,w]=u.useState(!1),[B,v]=u.useState(""),[T,N]=u.useState(null),[f,P]=u.useState(!1),V=u.useRef(null),C=u.useRef(!1),k=u.useCallback(async t=>{w(!0),v(""),N(null);try{const d=await D.listPodFiles(o,n,g,t,E||void 0),$=(d?.entries||d?.files||d?.data?.entries||d?.data?.files||(Array.isArray(d)?d:[])).map(y=>({name:y.name??y.Name??"",isDir:!!(y.isDir??y.is_dir??y.IsDir??y.dir??y.directory),size:typeof y.size=="number"?y.size:y.Size?Number(y.Size):void 0,modTime:y.modTime??y.mod_time??y.ModTime??y.mtime??y.modified})).filter(y=>y.name&&y.name!==".");F($),b(t)}catch(d){v(d.message||"加载文件列表失败"),F([])}finally{w(!1)}},[o,n,g,E]);u.useEffect(()=>{r?(async()=>{if(C.current){k(h);return}w(!0);try{const d=await D.execPod(o,n,g,["pwd"],E||void 0),m=(d?.stdout||d?.data?.stdout||"").trim(),$=m&&m.startsWith("/")?m:"/";C.current=!0,b($),k($)}catch{C.current=!0,k("/")}})():C.current=!1},[r,E]);const z=t=>{if(t.isDir){const d=h==="/"?`/${t.name}`:`${h}/${t.name}`;k(d)}else x(t.name)},x=async t=>{const d=h==="/"?`/${t}`:`${h}/${t}`;try{const m=await D.readPodFileText(o,n,g,d,E||void 0);N({file:t,content:m})}catch(m){N({file:t,content:`读取失败: ${m.message}`})}},a=t=>{const d=h==="/"?`/${t}`:`${h}/${t}`,m=D.buildPodFileDownloadUrl(o,n,g,d,E||void 0);window.open(m,"_blank")},i=async t=>{const d=t.target.files?.[0];if(d){P(!0);try{await D.uploadPodFile(o,n,g,h,d,E||void 0),k(h)}catch(m){v(`上传失败: ${m.message}`)}finally{P(!1),V.current&&(V.current.value="")}}},c=()=>{if(h==="/")return;const t=h.split("/").filter(Boolean);t.pop(),k(t.length===0?"/":`/${t.join("/")}`)},p=t=>t==null?"-":t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,l=h.split("/").filter(Boolean);return r?e.jsx("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:163:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:()=>s(!1),children:e.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:164:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[90vw] max-w-5xl h-[80vh] flex flex-col shadow-2xl",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:169:9",className:"flex items-center justify-between p-3 border-b border-slate-700 shrink-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:170:11",className:"flex items-center gap-2",children:[e.jsx(ke,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:171:13",className:"h-4 w-4 text-amber-400"}),e.jsxs("span",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:172:13",className:"text-sm font-semibold text-slate-200",children:["文件浏览器: ",g]}),e.jsx(Be,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:173:13",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:n})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:175:11",className:"flex items-center gap-2",children:[A.length>0&&e.jsx("select",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:177:15",value:E,onChange:t=>{M(t.target.value)},className:"bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2 py-1",children:A.map(t=>e.jsx("option",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:182:40",value:t,children:t},t))}),e.jsx(j,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:185:13",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:()=>s(!1),children:e.jsx(O,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:186:15",className:"h-4 w-4"})})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:192:9",className:"flex items-center justify-between p-2 border-b border-slate-800 shrink-0",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:193:11",className:"flex items-center gap-1 text-xs text-slate-400",children:[e.jsx(j,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:194:13",variant:"ghost",size:"icon",className:"h-6 w-6 text-slate-500",onClick:c,disabled:h==="/",children:e.jsx(ge,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:195:15",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:197:13",className:"hover:text-slate-200",onClick:()=>k("/"),children:"root"}),l.map((t,d)=>{const m=`/${l.slice(0,d+1).join("/")}`;return e.jsxs("span",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:201:17",className:"flex items-center gap-1",children:[e.jsx(je,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:202:19",className:"h-3 w-3"}),e.jsx("button",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:203:19",className:"hover:text-slate-200",onClick:()=>k(m),children:t})]},m)})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:208:11",className:"flex items-center gap-2",children:[e.jsx("input",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:209:13",type:"file",ref:V,className:"hidden",onChange:i}),e.jsxs(j,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:210:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>V.current?.click(),disabled:f,children:[f?e.jsx(_,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:211:28",className:"h-3 w-3 animate-spin mr-1"}):e.jsx(ve,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:211:80",className:"h-3 w-3 mr-1"}),"上传"]}),e.jsx(j,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:213:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>k(h),disabled:Y,children:Y?e.jsx(_,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:214:26",className:"h-3 w-3 animate-spin"}):e.jsx(Ne,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:214:73",className:"h-3 w-3"})})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:220:9",className:"flex-1 overflow-hidden flex",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:222:11",className:`${T?"w-1/2":"w-full"} overflow-auto p-2 border-r border-slate-800`,children:[B&&e.jsx("p",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:223:23",className:"text-xs text-red-400 p-2",children:B}),Y?e.jsx("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:225:15",className:"flex items-center justify-center h-32",children:e.jsx(_,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:225:70",className:"h-5 w-5 animate-spin text-slate-500"})}):S.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:227:15",className:"text-xs text-slate-500 p-4 text-center",children:"空目录"}):e.jsx("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:229:15",className:"space-y-0.5",children:S.sort((t,d)=>t.isDir===d.isDir?t.name.localeCompare(d.name):t.isDir?-1:1).map(t=>e.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:231:19",className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-slate-800/50 cursor-pointer group",onClick:()=>z(t),children:[t.isDir?e.jsx(Pe,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:237:23",className:"h-4 w-4 text-blue-400 shrink-0"}):e.jsx(ye,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:239:23",className:"h-4 w-4 text-slate-500 shrink-0"}),e.jsx("span",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:241:21",className:`text-xs truncate ${t.isDir?"text-blue-300":"text-slate-300"}`,children:t.name}),!t.isDir&&e.jsx("span",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:245:23",className:"text-[10px] text-slate-600 ml-auto shrink-0",children:p(t.size)}),!t.isDir&&e.jsx(j,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:248:23",variant:"ghost",size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 text-slate-400 hover:text-emerald-400 shrink-0",onClick:d=>{d.stopPropagation(),a(t.name)},title:"下载",children:e.jsx(Se,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:253:25",className:"h-3 w-3"})})]},t.name))})]}),T&&e.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:264:13",className:"w-1/2 flex flex-col overflow-hidden",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:265:15",className:"flex items-center justify-between p-2 border-b border-slate-800 shrink-0",children:[e.jsx("span",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:266:17",className:"text-xs text-slate-300 font-mono",children:T.file}),e.jsx(j,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:267:17",variant:"ghost",size:"icon",className:"h-6 w-6 text-slate-400",onClick:()=>N(null),children:e.jsx(O,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:268:19",className:"h-3.5 w-3.5"})})]}),e.jsx("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:271:15",className:"flex-1 overflow-auto p-3",children:e.jsx("pre",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:272:17",className:"text-xs text-slate-300 font-mono whitespace-pre-wrap break-all bg-slate-950 rounded p-3",children:T.content||"(空文件)"})})]})]})]})}):null}export{Ke as P,I as S,Je as Y,He as a,ce as b,oe as c,U as d,Ye as e,Oe as f,We as g,Ue as h,Ge as k,ie as p,Ie as s}; diff --git a/backend/static/assets/PodFileBrowser-CVjj8HxI.js b/backend/static/assets/PodFileBrowser-CVjj8HxI.js new file mode 100644 index 0000000..8427112 --- /dev/null +++ b/backend/static/assets/PodFileBrowser-CVjj8HxI.js @@ -0,0 +1,8 @@ +import{j as t,r as a,y as ye,E as H,a as ge,o as ve}from"./vendor-codemirror-B1SGo4xl.js";import{Y as je,ae as le,B as Y,D as Pe,a as Ee,m as ee,c as Ne,d as Se}from"./index-Bp-M7P_8.js";import{u as ie}from"./use-toast-DNZLibQY.js";import{k as O,d as Te}from"./index-BkulU9RM.js";import{c as de}from"./k8s-yaml-utils-4KZB_Bq_.js";import{w as Fe,aF as Be,v as ue,d as Ce,L as V,$ as Ye,X as I,r as Ae,ad as Re,aU as Me,an as De,ao as Oe,H as _e,m as $e,f as Le,ah as Ve,R as ze,aV as Ie,aW as Ue}from"./vendor-icons-BWk-DH7F.js";import{S as te,a as se,b as re,c as oe,d as ne}from"./select-DbhcBWnH.js";import{x as We,a as He}from"./vendor-xterm-20M9KZE1.js";import{B as Je}from"./badge-B00SZHvE.js";function Ke({onClose:e,children:s,zIndex:r=100}){return je.createPortal(t.jsx("div",{"code-path":"src/components/ui/modal-overlay.tsx:13:5",className:"fixed inset-0 overflow-y-auto bg-black/60",style:{zIndex:r},onClick:e,children:t.jsx("div",{"code-path":"src/components/ui/modal-overlay.tsx:18:7",className:"flex min-h-full items-center justify-center p-4",children:s})}),document.body)}const Ge=new Set(["kubectl.kubernetes.io/last-applied-configuration","kubectl.kubernetes.io/change-cause","kubectl.kubernetes.io/restartedAt","deployment.kubernetes.io/revision","deployment.kubernetes.io/desired-replicas","deployment.kubernetes.io/max-replicas","control-plane.alpha.kubernetes.io/leader","autoscaling.alpha.kubernetes.io/conditions","kubernetes.io/config.hash","kubeadm.kubernetes.io/etcd.advertise-client-urls","pv.kubernetes.io/bind-completed","pv.kubernetes.io/bound-by-controller"]),qe=["managedFields","resourceVersion","uid","creationTimestamp","generation","selfLink","deletionTimestamp","ownerReferences","finalizers","clusterName","generateName"],Xe=new Set(["pod-template-hash","controller-revision-hash"]),Qe=["kube-api-access-","default-token-","kube-root-ca.crt"],Ze=["/var/run/secrets/kubernetes.io/serviceaccount","/var/run/secrets/sa"],et={dnsPolicy:"ClusterFirst",restartPolicy:"Always",schedulerName:"default-scheduler",terminationGracePeriodSeconds:30,enableServiceLinks:!0,serviceAccountName:"default",automountServiceAccountToken:!0,priority:0,preemptionPolicy:"PreemptLowerPriority"},tt={progressDeadlineSeconds:600,revisionHistoryLimit:10},st={terminationMessagePath:"/dev/termination-log",terminationMessagePolicy:"File",stdin:!1,tty:!1,stdinOnce:!1},rt={sessionAffinity:"None",externalTrafficPolicy:"Cluster",internalTrafficPolicy:"Cluster",ipFamilyPolicy:"SingleStack",allocateLoadBalancerNodePorts:!0},ot=["clusterIP","clusterIPs","ipFamilies","healthCheckNodePort"];function U(e){return Array.isArray(e)?e.length===0:e&&typeof e=="object"?Object.keys(e).length===0:!1}function nt(e,s){return s===e||typeof s=="number"&&typeof e=="string"&&String(s)===e?!0:typeof s=="boolean"&&typeof e=="string"?s&&e==="true"||!s&&e==="false":!1}function J(e){if(!(!e||typeof e!="object")){for(const s of qe)delete e[s];if(e.annotations){for(const s of Object.keys(e.annotations))Ge.has(s)&&delete e.annotations[s];Object.keys(e.annotations).length===0&&delete e.annotations}if(e.labels){for(const s of Xe)delete e.labels[s];Object.keys(e.labels).length===0&&delete e.labels}}}function K(e){if(!e||typeof e!="object")return;if(Array.isArray(e)){for(let r=e.length-1;r>=0;r--)K(e[r]),U(e[r])&&e.splice(r,1);return}const s=e;for(const r of Object.keys(s)){const n=s[r];n&&typeof n=="object"&&K(n),U(n)&&delete s[r]}}function W(e,s){if(!(!e||typeof e!="object"))for(const[r,n]of Object.entries(s))r in e&&nt(e[r],n)&&delete e[r]}function ae(e){return Qe.some(s=>e.startsWith(s)||e===s)}function at(e){return Ze.some(s=>e===s||e.startsWith(`${s}/`))}function ct(e){if(!e||typeof e!="object")return;const s=e.volumes;if(Array.isArray(s)){const r=new Set(s.filter(c=>c?.name&&ae(c.name)).map(c=>c.name));e.volumes=s.filter(c=>!c?.name||!ae(c.name)),e.volumes.length===0&&delete e.volumes;const n=c=>{if(Array.isArray(c))for(const x of c)Array.isArray(x.volumeMounts)&&(x.volumeMounts=x.volumeMounts.filter(N=>!(N?.name&&r.has(N.name)||N?.mountPath&&at(String(N.mountPath)))),x.volumeMounts.length===0&&delete x.volumeMounts)};n(e.containers),n(e.initContainers),n(e.ephemeralContainers)}}function lt(e){if(!(!e||typeof e!="object")){if(W(e,st),e.imagePullPolicy){const s=String(e.image||"").split(":").pop()||"",n=!String(e.image||"").includes(":")||s==="latest"?"Always":"IfNotPresent";e.imagePullPolicy===n&&delete e.imagePullPolicy}e.resources&&U(e.resources)&&delete e.resources,e.securityContext&&U(e.securityContext)&&delete e.securityContext}}function me(e){if(!(!e||typeof e!="object")){W(e,et),"serviceAccount"in e&&delete e.serviceAccount,e.nodeName&&delete e.nodeName,ct(e);for(const s of["containers","initContainers","ephemeralContainers"]){const r=e[s];if(Array.isArray(r))for(const n of r)lt(n)}}}function it(e){if(!e?.strategy||e.strategy.type!=="RollingUpdate")return;const s=e.strategy.rollingUpdate;if(!s||typeof s!="object")return;const r=s.maxUnavailable,n=s.maxSurge;(r==="25%"||r===0||r==="0")&&(n==="25%"||n===1||n==="1")&&Object.keys(s).length<=2&&delete e.strategy}function dt(e){if(!e||typeof e!="object")return;for(const r of ot)delete e[r];W(e,rt);const s=e.type||"ClusterIP";if(Array.isArray(e.ports))for(const r of e.ports)!r||typeof r!="object"||((s==="ClusterIP"||r.nodePort===0)&&delete r.nodePort,r.protocol==="TCP"&&Object.keys(r).length===3&&delete r.protocol)}function ut(e){!e||typeof e!="object"||e.ingressClassName||delete e.ingressClassName}function mt(e){if(!e?.template||typeof e.template!="object")return;e.template.metadata&&J(e.template.metadata);const s=e.template.spec;s&&me(s)}function xt(e){const s=String(e.kind||"").toLowerCase();e.spec&&((s==="deployment"||s==="statefulset"||s==="daemonset")&&(W(e.spec,tt),s==="deployment"&&it(e.spec),mt(e.spec)),s==="service"&&dt(e.spec),s==="ingress"&&ut(e.spec),s==="pod"&&me(e.spec))}function G(e){const s=JSON.parse(JSON.stringify(e));delete s.status,J(s.metadata);const r=s.spec?.template;return r?.metadata&&J(r.metadata),xt(s),K(s),s}async function q(e){if(!e?.trim())return null;try{return JSON.parse(e)}catch{}try{const r=(await le(()=>import("./js-yaml-37NdyH6G.js"),[])).load(e);return r&&typeof r=="object"?r:null}catch{return null}}async function xe(e){return(await le(()=>import("./js-yaml-37NdyH6G.js"),[])).dump(e,{lineWidth:120,noRefs:!0,sortKeys:!1})}async function X(e){const s=G(e),r=await xe(s);return de(r)}async function pe(e){const s=await q(e);if(!s)return{manifest:null,yaml:e};const r=G(s),n=await X(r);return{manifest:r,yaml:n}}async function fe(e){return X(e)}async function he(e){const s=await q(e);return s?fe(s):de(e)}const Tt=Object.freeze(Object.defineProperty({__proto__:null,dumpManifest:xe,manifestToEditableYaml:X,parseEditableManifest:pe,parseManifest:q,prepareManifestForSave:fe,prepareYamlForSave:he,stripRuntimeFields:G},Symbol.toStringTag,{value:"Module"})),pt={deployments:{label:"Deployment",exportFolder:"deployments",readOnly:!1,visualEdit:!1},pods:{label:"Pod",exportFolder:"pods",readOnly:!0,visualEdit:!1},services:{label:"Service",exportFolder:"services",readOnly:!1,visualEdit:!0},ingresses:{label:"Ingress",exportFolder:"ingresses",readOnly:!1,visualEdit:!0}};function be(e){const s=e.replace(/\/$/,"").toLowerCase();return pt[s]??{label:s,exportFolder:s,readOnly:!1,visualEdit:!1}}function ce(e,s,r){const n=be(e);return`${s}-${n.exportFolder}-${r}.yaml`}function ft({editing:e,saving:s=!1,copied:r=!1,showRaw:n=!1,compact:c=!1,readOnly:x=!1,showRawToggle:N=!0,onCopy:b,onDownload:v,onEdit:i,onCancel:m,onSave:F,onToggleRaw:j}){const g=c?"h-7 text-xs":"h-8";return t.jsxs("div",{"code-path":"src/components/kubernetes/YamlEditorToolbar.tsx:28:5",className:"flex items-center gap-2 flex-wrap",children:[t.jsxs(Y,{"code-path":"src/components/kubernetes/YamlEditorToolbar.tsx:29:7",variant:"outline",size:"sm",className:`${g} border-slate-700 text-slate-300`,onClick:b,children:[r?t.jsx(Fe,{"code-path":"src/components/kubernetes/YamlEditorToolbar.tsx:30:19",className:"h-3 w-3 mr-1 text-emerald-400"}):t.jsx(Be,{"code-path":"src/components/kubernetes/YamlEditorToolbar.tsx:30:73",className:"h-3 w-3 mr-1"}),r?"已复制":"复制"]}),v&&t.jsxs(Y,{"code-path":"src/components/kubernetes/YamlEditorToolbar.tsx:34:9",variant:"outline",size:"sm",className:`${g} border-slate-700 text-slate-300`,onClick:v,children:[t.jsx(ue,{"code-path":"src/components/kubernetes/YamlEditorToolbar.tsx:35:11",className:"h-3 w-3 mr-1"}),"下载"]}),!x&&(e?t.jsxs(t.Fragment,{children:[t.jsx(Y,{"code-path":"src/components/kubernetes/YamlEditorToolbar.tsx:45:13",variant:"outline",size:"sm",className:`${g} border-slate-700 text-slate-300`,onClick:m,children:"取消"}),t.jsxs(Y,{"code-path":"src/components/kubernetes/YamlEditorToolbar.tsx:46:13",size:"sm",className:`${g} bg-blue-600 hover:bg-blue-700`,onClick:F,disabled:s,children:[s?t.jsx(V,{"code-path":"src/components/kubernetes/YamlEditorToolbar.tsx:47:25",className:"h-3 w-3 animate-spin mr-1"}):t.jsx(Ye,{"code-path":"src/components/kubernetes/YamlEditorToolbar.tsx:47:77",className:"h-3 w-3 mr-1"}),"保存"]})]}):t.jsxs(Y,{"code-path":"src/components/kubernetes/YamlEditorToolbar.tsx:40:11",variant:"outline",size:"sm",className:`${g} border-slate-700 text-slate-300`,onClick:i,children:[t.jsx(Ce,{"code-path":"src/components/kubernetes/YamlEditorToolbar.tsx:41:13",className:"h-3 w-3 mr-1"}),"编辑"]})),N&&j&&t.jsx("button",{"code-path":"src/components/kubernetes/YamlEditorToolbar.tsx:54:9",type:"button",onClick:j,className:"text-[11px] text-slate-500 hover:text-slate-300 underline-offset-2 hover:underline",children:n?"精简视图":"原始 YAML"})]})}const ht=H.theme({"&":{height:"100%"},".cm-scroller":{overflow:"auto"}});function bt({value:e,onChange:s,editing:r=!0,fill:n=!1,height:c="480px",className:x="",fontSize:N="13px"}){const b=a.useRef(null),[v,i]=a.useState(400);a.useEffect(()=>{if(!n||!b.current)return;const g=b.current,w=()=>i(Math.max(200,g.clientHeight)),S=new ResizeObserver(w);return S.observe(g),w(),()=>S.disconnect()},[n]);const m=a.useMemo(()=>[ye(),H.lineWrapping,ht,...r?[]:[H.editable.of(!1)]],[r]),F=n?`${v}px`:c,j=t.jsx(ge,{"code-path":"src/components/kubernetes/YamlCodeMirror.tsx:57:5",value:e,height:F,theme:ve,extensions:m,onChange:s,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:r,highlightActiveLineGutter:r,autocompletion:r,bracketMatching:!0,closeBrackets:r,indentOnInput:r},style:{fontSize:N}});return n?t.jsx("div",{"code-path":"src/components/kubernetes/YamlCodeMirror.tsx:79:7",ref:b,className:`flex-1 min-h-0 h-full overflow-hidden rounded-lg border border-slate-700 ${x}`,children:j}):t.jsx("div",{"code-path":"src/components/kubernetes/YamlCodeMirror.tsx:86:5",className:`overflow-auto rounded-lg border border-slate-700 ${x}`,children:j})}function Ft({clusterCode:e,namespace:s,resource:r,name:n,onClose:c,onSaved:x,autoEdit:N=!1,inline:b=!1,initialYaml:v,readOnly:i}){const{toast:m}=ie(),F=be(r),j=i??F.readOnly,[g,w]=a.useState(v||""),[S,T]=a.useState(""),[A,k]=a.useState(""),[_,C]=a.useState(!v),[M,R]=a.useState(!1),[P,D]=a.useState(N&&!j),[z,d]=a.useState(!1),[B,E]=a.useState(!1),p=a.useCallback(async h=>{const{yaml:L}=await pe(h);return T(L),k(L),L},[]),u=a.useCallback(async()=>{if(v){w(v),await p(v),C(!1);return}C(!0);try{const h=await O.getResourceYaml(e,s,r,n);w(h),await p(h)}catch(h){m({title:"获取YAML失败",description:h.message,variant:"destructive"});const L=`# Error: ${h.message}`;w(L),T(L),k(L)}finally{C(!1)}},[e,s,r,n,v,p,m]);a.useEffect(()=>{u()},[u]);const o=()=>{k(S),D(!0),E(!1)},l=async()=>{D(!1),await u()},y=async()=>{R(!0);try{const h=await he(A);await O.updateResourceYaml(e,s,r,n,h),m({title:"保存成功",description:`${r}/${n} 已更新`}),D(!1),w(h),T(h),k(h),x?.()}catch(h){m({title:"保存失败",description:h?.message||String(h),variant:"destructive"})}finally{R(!1)}},$=()=>P?A:B?g:S,f=async()=>{await navigator.clipboard.writeText($()),d(!0),setTimeout(()=>d(!1),2e3)},we=()=>{Te(ce(r,s,n),$()),m({title:"已下载",description:ce(r,s,n)})},ke=P?A:B?g:S,Q=t.jsx(ft,{"code-path":"src/components/kubernetes/YamlViewer.tsx:117:5",editing:P,saving:M,copied:z,showRaw:B,compact:b,readOnly:j,onCopy:f,onDownload:we,onEdit:o,onCancel:l,onSave:y,onToggleRaw:()=>E(h=>!h)}),Z=_?t.jsx("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:134:5",className:"flex items-center justify-center h-full min-h-[200px]",children:t.jsx(V,{"code-path":"src/components/kubernetes/YamlViewer.tsx:135:7",className:"h-6 w-6 animate-spin text-slate-500"})}):t.jsx(bt,{"code-path":"src/components/kubernetes/YamlViewer.tsx:138:5",value:ke,editing:P,fill:!0,fontSize:b?"12px":"13px",onChange:h=>P&&k(h)});return b?t.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:149:7",className:"flex flex-col gap-3 min-h-[400px] h-[calc(100vh-220px)] max-h-[720px]",children:[t.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:150:9",className:"flex items-center justify-between gap-3 flex-wrap shrink-0",children:[t.jsxs("p",{"code-path":"src/components/kubernetes/YamlViewer.tsx:151:11",className:"text-xs text-slate-500",children:[t.jsxs("code",{"code-path":"src/components/kubernetes/YamlViewer.tsx:152:13",className:"text-slate-400",children:[r,"/",n]})," · ",s]}),Q]}),t.jsx("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:156:9",className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:Z})]}):t.jsx(Ke,{"code-path":"src/components/kubernetes/YamlViewer.tsx:162:5",onClose:c,children:t.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:163:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[92vw] max-w-5xl h-[85vh] flex flex-col shadow-2xl",onClick:h=>h.stopPropagation(),children:[t.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:167:9",className:"flex items-center justify-between p-4 border-b border-slate-700 gap-3 shrink-0",children:[t.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:168:11",className:"min-w-0",children:[t.jsxs("h2",{"code-path":"src/components/kubernetes/YamlViewer.tsx:169:13",className:"text-lg font-bold text-slate-100 truncate",children:[F.label," YAML — ",n,j&&t.jsx("span",{"code-path":"src/components/kubernetes/YamlViewer.tsx:171:28",className:"ml-2 text-xs font-normal text-slate-500",children:"只读"})]}),t.jsxs("p",{"code-path":"src/components/kubernetes/YamlViewer.tsx:173:13",className:"text-xs text-slate-500",children:[s," · ",e]})]}),t.jsxs("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:175:11",className:"flex items-center gap-2 shrink-0",children:[Q,t.jsx(Y,{"code-path":"src/components/kubernetes/YamlViewer.tsx:177:13",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400",onClick:c,children:t.jsx(I,{"code-path":"src/components/kubernetes/YamlViewer.tsx:177:102",className:"h-4 w-4"})})]})]}),t.jsx("div",{"code-path":"src/components/kubernetes/YamlViewer.tsx:180:9",className:"flex-1 min-h-0 flex flex-col overflow-hidden p-4",children:Z})]})})}const wt=[{value:"sh",label:"/bin/sh"},{value:"bash",label:"/bin/bash"}];function Bt({open:e,onOpenChange:s,clusterId:r,namespace:n,podName:c,containers:x=[],initialContainer:N}){const{toast:b}=ie(),v=a.useRef(null),i=a.useRef(null),m=a.useRef(null),F=a.useRef(null),j=a.useRef(!1),g=a.useRef(!1),[w,S]=a.useState("idle"),[T,A]=a.useState(!1),[k,_]=a.useState(N||x[0]||""),[C,M]=a.useState("sh");a.useEffect(()=>{e||(A(!1),j.current=!1)},[e]),a.useEffect(()=>{e&&!k&&x.length>0&&_(N||x[0])},[e,x,N,k]);const R=a.useCallback(()=>{if(!i.current){console.error("[PodExec:connect] ABORT: termRef.current is null");return}const d=i.current;if(m.current){try{m.current.close()}catch{}m.current=null}S("connecting"),d.clear(),d.writeln(`\x1B[36m[正在连接 ${c}${k?"/"+k:""} shell=${C} ...]\x1B[0m`);const B=O.buildPodExecWsUrl(r,n,c,k||void 0,C),E=new WebSocket(B);m.current=E,E.onopen=()=>{S("connected"),d.reset();try{const{cols:u,rows:o}=d;E.send(JSON.stringify({status:1,cols:u,rows:o}))}catch(u){console.error("[PodExec:connect] resize error:",u)}const p=()=>{try{d.focus()}catch{}};p(),setTimeout(p,100),setTimeout(p,300)},E.onmessage=p=>{try{const u=JSON.parse(p.data);if(u.status===0&&typeof u.data=="string")d.write(u.data);else if(u.status===2||u.error){const o=u.data||u.message||u.error||"执行错误";if(o.includes("not found")&&C==="bash"){d.writeln(`\r +\x1B[33m⚠ bash 不可用,请切换 /bin/sh 后重连。\x1B[0m`),g.current=!0;return}d.write(o.includes("\x1B")?o:`\r +\x1B[31m${o}\x1B[0m\r +`)}}catch{typeof p.data=="string"&&d.write(p.data)}},E.onclose=p=>{S(u=>u==="error"?u:"closed"),g.current||d.write(`\r +\x1B[33m[连接已关闭]\x1B[0m\r +`)},E.onerror=p=>{console.error("[PodExec:connect] WS error event fired, readyState=",E.readyState,"type=",p.type),S("error"),d.write(`\r +\x1B[31m[连接发生错误]\x1B[0m\r +`)}},[r,n,c,k,C]);a.useEffect(()=>{if(!e)return;if(!r){console.error("[PodExec:initEffect] ABORT: clusterId is falsy:",r);return}if(!c){console.error("[PodExec:initEffect] ABORT: podName is falsy:",c);return}let d=!1,B=0;const E=performance.now(),p=()=>{if(d)return;const u=v.current;if(!u){B++,B<20?requestAnimationFrame(p):console.error("[PodExec:tryInit] FAILED: containerRef still null after 20 retries (",Math.round(performance.now()-E),"ms)");return}const o=new We.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,scrollback:5e3,theme:{background:"#0f172a",foreground:"#e2e8f0",cursor:"#38bdf8",selectionBackground:"#1e40af",black:"#1e293b",red:"#ef4444",green:"#10b981",yellow:"#f59e0b",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e2e8f0",brightBlack:"#475569",brightRed:"#f87171",brightGreen:"#34d399",brightYellow:"#fbbf24",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#f8fafc"}}),l=new He.FitAddon;o.loadAddon(l),i.current=o,F.current=l,o.onData(y=>{m.current&&m.current.readyState===WebSocket.OPEN?m.current.send(JSON.stringify({status:0,data:y})):console.warn("[PodExec:term] TX dropped — WS not open, readyState=",m.current?.readyState)}),o.open(u),requestAnimationFrame(()=>{try{l.fit()}catch{}}),j.current=!0,R()};return requestAnimationFrame(p),()=>{d=!0}},[e,r,c]),a.useEffect(()=>{if(!e){try{m.current?.close()}catch{}try{i.current?.dispose()}catch{}i.current=null,m.current=null,F.current=null,j.current=!1,S("idle")}},[e]),a.useEffect(()=>{e&&i.current&&j.current&&R()},[k,C]),a.useEffect(()=>{if(!e)return;const d=v.current;if(!d)return;let B;const E=new ResizeObserver(()=>{clearTimeout(B),B=setTimeout(()=>{if(F.current&&i.current)try{F.current.fit(),i.current.focus();const{cols:p,rows:u}=i.current;m.current?.readyState===WebSocket.OPEN&&m.current.send(JSON.stringify({status:1,cols:p,rows:u}))}catch{}},60)});return E.observe(d),()=>{clearTimeout(B),E.disconnect()}},[e,T]);const P=w==="connected"?"bg-emerald-400":w==="error"?"bg-red-400":w==="closed"?"bg-slate-500":"bg-amber-400",D=w==="connected"?"已连接":w==="connecting"?"连接中":w==="error"?"连接错误":w==="closed"?"已断开":"空闲",z=a.useCallback(()=>{try{i.current?.focus()}catch{}},[]);return t.jsx(Pe,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:279:5",open:e,onOpenChange:s,children:t.jsxs(Ee,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:280:7",showCloseButton:!1,className:ee("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",T?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:T?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"960px",width:"92vw"},children:[t.jsxs(Ne,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:289:9",className:"sr-only",children:["exec — ",c]}),t.jsx(Se,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:290:9",className:"sr-only",children:"进入 Pod 容器执行命令"}),t.jsxs("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:293:9",className:"flex items-center justify-between gap-2 px-4 py-2 border-b border-[var(--dg-border)] flex-wrap",children:[t.jsxs("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:294:11",className:"flex items-center gap-2 text-sm min-w-0",children:[t.jsx("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:295:13",className:ee("w-2 h-2 rounded-full shrink-0",P),title:D}),t.jsx(Ae,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:296:13",className:"h-4 w-4 text-blue-400 shrink-0"}),t.jsxs("span",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:297:13",className:"text-[var(--dg-text-primary)] font-medium truncate",children:["exec — ",c]}),w==="connecting"&&t.jsx(V,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:298:44",className:"h-3 w-3 animate-spin text-[var(--dg-text-muted)]"}),t.jsx("span",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:299:13",className:"text-xs text-[var(--dg-text-muted)]",children:D})]}),t.jsxs("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:301:11",className:"flex items-center gap-2",children:[x.length>0&&t.jsxs(te,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:303:15",value:k,onValueChange:_,children:[t.jsxs(se,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:304:17",className:"h-8 w-[150px] text-xs bg-[var(--dg-bg-hover)] border-[var(--dg-border)]",children:[t.jsx(Re,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:305:19",className:"h-3 w-3 mr-1 text-[var(--dg-text-muted)]"}),t.jsx(re,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:306:19",placeholder:"容器"})]}),t.jsx(oe,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:308:17",children:x.map(d=>t.jsx(ne,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:308:55",value:d,children:d},d))})]}),t.jsxs(te,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:311:13",value:C,onValueChange:M,children:[t.jsx(se,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:312:15",className:"h-8 w-[110px] text-xs bg-[var(--dg-bg-hover)] border-[var(--dg-border)]",children:t.jsx(re,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:313:17"})}),t.jsx(oe,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:315:15",children:wt.map(d=>t.jsx(ne,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:315:47",value:d.value,children:d.label},d.value))})]}),t.jsx(Y,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:317:13",variant:"ghost",size:"sm",className:"h-8 px-2 text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)]",onClick:()=>{R(),b({title:"正在重连…"})},title:"重连",children:t.jsx(Me,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:319:15",className:"h-3.5 w-3.5"})}),t.jsx("button",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:321:13",onClick:()=>A(!T),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",title:T?"退出全屏":"全屏",children:T?t.jsx(De,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:322:29",className:"h-4 w-4"}):t.jsx(Oe,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:322:65",className:"h-4 w-4"})}),t.jsx("button",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:324:13",onClick:()=>s(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",title:"关闭",children:t.jsx(I,{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:325:15",className:"h-4 w-4"})})]})]}),t.jsx("div",{"code-path":"src/components/kubernetes/PodExecTerminal.tsx:331:9",ref:v,className:"bg-[#0f172a] cursor-text",style:{height:T?"calc(100vh - 49px)":"480px"},onClick:z})]})})}function Ct({open:e,onOpenChange:s,clusterCode:r,namespace:n,podName:c,containers:x=[],initialContainer:N}){const[b,v]=a.useState(N||x[0]||""),[i,m]=a.useState("/"),[F,j]=a.useState([]),[g,w]=a.useState(!1),[S,T]=a.useState(""),[A,k]=a.useState(null),[_,C]=a.useState(!1),M=a.useRef(null),R=a.useRef(!1),P=a.useCallback(async o=>{w(!0),T(""),k(null);try{const l=await O.listPodFiles(r,n,c,o,b||void 0),$=(l?.entries||l?.files||l?.data?.entries||l?.data?.files||(Array.isArray(l)?l:[])).map(f=>({name:f.name??f.Name??"",isDir:!!(f.isDir??f.is_dir??f.IsDir??f.dir??f.directory),size:typeof f.size=="number"?f.size:f.Size?Number(f.Size):void 0,modTime:f.modTime??f.mod_time??f.ModTime??f.mtime??f.modified})).filter(f=>f.name&&f.name!==".");j($),m(o)}catch(l){T(l.message||"加载文件列表失败"),j([])}finally{w(!1)}},[r,n,c,b]);a.useEffect(()=>{e?(async()=>{if(R.current){P(i);return}w(!0);try{const l=await O.execPod(r,n,c,["pwd"],b||void 0),y=(l?.stdout||l?.data?.stdout||"").trim(),$=y&&y.startsWith("/")?y:"/";R.current=!0,m($),P($)}catch{R.current=!0,P("/")}})():R.current=!1},[e,b]);const D=o=>{if(o.isDir){const l=i==="/"?`/${o.name}`:`${i}/${o.name}`;P(l)}else z(o.name)},z=async o=>{const l=i==="/"?`/${o}`:`${i}/${o}`;try{const y=await O.readPodFileText(r,n,c,l,b||void 0);k({file:o,content:y})}catch(y){k({file:o,content:`读取失败: ${y.message}`})}},d=o=>{const l=i==="/"?`/${o}`:`${i}/${o}`,y=O.buildPodFileDownloadUrl(r,n,c,l,b||void 0);window.open(y,"_blank")},B=async o=>{const l=o.target.files?.[0];if(l){C(!0);try{await O.uploadPodFile(r,n,c,i,l,b||void 0),P(i)}catch(y){T(`上传失败: ${y.message}`)}finally{C(!1),M.current&&(M.current.value="")}}},E=()=>{if(i==="/")return;const o=i.split("/").filter(Boolean);o.pop(),P(o.length===0?"/":`/${o.join("/")}`)},p=o=>o==null?"-":o<1024?`${o} B`:o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/(1024*1024)).toFixed(1)} MB`,u=i.split("/").filter(Boolean);return e?t.jsx("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:163:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70",onClick:()=>s(!1),children:t.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:164:7",className:"bg-slate-900 border border-slate-700 rounded-xl w-[90vw] max-w-5xl h-[80vh] flex flex-col shadow-2xl",onClick:o=>o.stopPropagation(),children:[t.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:169:9",className:"flex items-center justify-between p-3 border-b border-slate-700 shrink-0",children:[t.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:170:11",className:"flex items-center gap-2",children:[t.jsx(_e,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:171:13",className:"h-4 w-4 text-amber-400"}),t.jsxs("span",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:172:13",className:"text-sm font-semibold text-slate-200",children:["文件浏览器: ",c]}),t.jsx(Je,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:173:13",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px]",children:n})]}),t.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:175:11",className:"flex items-center gap-2",children:[x.length>0&&t.jsx("select",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:177:15",value:b,onChange:o=>{v(o.target.value)},className:"bg-slate-800 border border-slate-700 rounded text-xs text-slate-300 px-2 py-1",children:x.map(o=>t.jsx("option",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:182:40",value:o,children:o},o))}),t.jsx(Y,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:185:13",variant:"ghost",size:"icon",className:"h-7 w-7 text-slate-400",onClick:()=>s(!1),children:t.jsx(I,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:186:15",className:"h-4 w-4"})})]})]}),t.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:192:9",className:"flex items-center justify-between p-2 border-b border-slate-800 shrink-0",children:[t.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:193:11",className:"flex items-center gap-1 text-xs text-slate-400",children:[t.jsx(Y,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:194:13",variant:"ghost",size:"icon",className:"h-6 w-6 text-slate-500",onClick:E,disabled:i==="/",children:t.jsx($e,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:195:15",className:"h-3.5 w-3.5"})}),t.jsx("button",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:197:13",className:"hover:text-slate-200",onClick:()=>P("/"),children:"root"}),u.map((o,l)=>{const y=`/${u.slice(0,l+1).join("/")}`;return t.jsxs("span",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:201:17",className:"flex items-center gap-1",children:[t.jsx(Le,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:202:19",className:"h-3 w-3"}),t.jsx("button",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:203:19",className:"hover:text-slate-200",onClick:()=>P(y),children:o})]},y)})]}),t.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:208:11",className:"flex items-center gap-2",children:[t.jsx("input",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:209:13",type:"file",ref:M,className:"hidden",onChange:B}),t.jsxs(Y,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:210:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>M.current?.click(),disabled:_,children:[_?t.jsx(V,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:211:28",className:"h-3 w-3 animate-spin mr-1"}):t.jsx(Ve,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:211:80",className:"h-3 w-3 mr-1"}),"上传"]}),t.jsx(Y,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:213:13",size:"sm",variant:"outline",className:"h-7 border-slate-700 text-slate-300 text-xs",onClick:()=>P(i),disabled:g,children:g?t.jsx(V,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:214:26",className:"h-3 w-3 animate-spin"}):t.jsx(ze,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:214:73",className:"h-3 w-3"})})]})]}),t.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:220:9",className:"flex-1 overflow-hidden flex",children:[t.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:222:11",className:`${A?"w-1/2":"w-full"} overflow-auto p-2 border-r border-slate-800`,children:[S&&t.jsx("p",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:223:23",className:"text-xs text-red-400 p-2",children:S}),g?t.jsx("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:225:15",className:"flex items-center justify-center h-32",children:t.jsx(V,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:225:70",className:"h-5 w-5 animate-spin text-slate-500"})}):F.length===0?t.jsx("p",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:227:15",className:"text-xs text-slate-500 p-4 text-center",children:"空目录"}):t.jsx("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:229:15",className:"space-y-0.5",children:F.sort((o,l)=>o.isDir===l.isDir?o.name.localeCompare(l.name):o.isDir?-1:1).map(o=>t.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:231:19",className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-slate-800/50 cursor-pointer group",onClick:()=>D(o),children:[o.isDir?t.jsx(Ie,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:237:23",className:"h-4 w-4 text-blue-400 shrink-0"}):t.jsx(Ue,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:239:23",className:"h-4 w-4 text-slate-500 shrink-0"}),t.jsx("span",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:241:21",className:`text-xs truncate ${o.isDir?"text-blue-300":"text-slate-300"}`,children:o.name}),!o.isDir&&t.jsx("span",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:245:23",className:"text-[10px] text-slate-600 ml-auto shrink-0",children:p(o.size)}),!o.isDir&&t.jsx(Y,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:248:23",variant:"ghost",size:"icon",className:"h-5 w-5 opacity-0 group-hover:opacity-100 text-slate-400 hover:text-emerald-400 shrink-0",onClick:l=>{l.stopPropagation(),d(o.name)},title:"下载",children:t.jsx(ue,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:253:25",className:"h-3 w-3"})})]},o.name))})]}),A&&t.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:264:13",className:"w-1/2 flex flex-col overflow-hidden",children:[t.jsxs("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:265:15",className:"flex items-center justify-between p-2 border-b border-slate-800 shrink-0",children:[t.jsx("span",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:266:17",className:"text-xs text-slate-300 font-mono",children:A.file}),t.jsx(Y,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:267:17",variant:"ghost",size:"icon",className:"h-6 w-6 text-slate-400",onClick:()=>k(null),children:t.jsx(I,{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:268:19",className:"h-3.5 w-3.5"})})]}),t.jsx("div",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:271:15",className:"flex-1 overflow-auto p-3",children:t.jsx("pre",{"code-path":"src/components/kubernetes/PodFileBrowser.tsx:272:17",className:"text-xs text-slate-300 font-mono whitespace-pre-wrap break-all bg-slate-950 rounded p-3",children:A.content||"(空文件)"})})]})]})]})}):null}export{Ke as M,Bt as P,Ft as Y,Ct as a,bt as b,pe as c,ft as d,q as e,he as f,be as g,xe as h,Tt as k,fe as p,ce as y}; diff --git a/backend/static/assets/PodMetricsPage-NkW2J2Qd.js b/backend/static/assets/PodMetricsPage-62zYmxhb.js similarity index 94% rename from backend/static/assets/PodMetricsPage-NkW2J2Qd.js rename to backend/static/assets/PodMetricsPage-62zYmxhb.js index 8691f0e..f790a9f 100644 --- a/backend/static/assets/PodMetricsPage-NkW2J2Qd.js +++ b/backend/static/assets/PodMetricsPage-62zYmxhb.js @@ -1 +1 @@ -import{r as c,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as i,a as x}from"./card-B-RtdR4H.js";import{g as H,i as L,L as N,B as U}from"./index-LZWfu62c.js";import{B as V}from"./badge-B0F5ZNtn.js";import{S as f,a as v,b as C,c as y,d as P}from"./select-4xU_9B3_.js";import{T as W,a as F,b as u,c as d,d as z,e as n}from"./table-BPFYQwjr.js";import{k as b}from"./index-Z0O8nAcG.js";import{f as S,A as D,R as G,g as K,H as q}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";function te(){const{clusterCode:w}=H(),g=L(),[m,M]=c.useState(!1),[p,k]=c.useState([]),[A,T]=c.useState([]),[$,E]=c.useState([]),[l,B]=c.useState("all"),[a,j]=c.useState(w||"");c.useEffect(()=>{b.getClusters().then(s=>{const t=s?.list||[];if(T(t),!a&&t.length>0){const r=t[0].code||String(t[0].id);j(r),g(`/kubernetes/${r}/metrics/pods`,{replace:!0})}}).catch(()=>{})},[]),c.useEffect(()=>{a&&b.getNamespaces(a).then(s=>{E(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const h=c.useCallback(async()=>{if(a){M(!0);try{const s=l==="all"?void 0:l,t=await b.getPodMetrics(a,s);k(Array.isArray(t)?t:t?.list||[])}catch{k([])}finally{M(!1)}}},[a,l]);c.useEffect(()=>{h()},[h]);const o=c.useMemo(()=>p.flatMap(s=>(s.containers||[]).map(t=>({pod:s.name,namespace:s.namespace,container:t.name,cpu:t.cpu||"0m",memory:t.memory||"0Mi"}))),[p]),I=c.useMemo(()=>o.reduce((s,t)=>s+(parseInt(t.cpu)||0),0),[o]),R=c.useMemo(()=>{let s=0;return o.forEach(t=>{const r=t.memory;r.endsWith("Mi")?s+=parseInt(r):r.endsWith("Ki")?s+=parseInt(r)/1024:r.endsWith("Gi")&&(s+=parseInt(r)*1024)}),s},[o]);return e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:82:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(N,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:83:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(S,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:84:29",className:"h-3 w-3"}),e.jsx(N,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:84:65",to:`/kubernetes/${a}`,className:"hover:text-slate-300",children:a})]}),e.jsx(S,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:85:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:85:45",className:"text-slate-300",children:"Pod 资源用量"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:88:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:89:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(D,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:89:86",className:"h-5 w-5 text-blue-400"}),"Pod 资源用量"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:90:9",className:"flex items-center gap-2",children:[e.jsxs(f,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:91:11",value:a,onValueChange:s=>{j(s),g(`/kubernetes/${s}/metrics/pods`)},children:[e.jsx(v,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:92:13",className:"w-44 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(C,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:92:87"})}),e.jsx(y,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:93:13",className:"bg-slate-800 border-slate-700",children:A.map(s=>e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:94:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(f,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:97:11",value:l,onValueChange:B,children:[e.jsx(v,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:98:13",className:"w-36 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(C,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:98:87",placeholder:"所有命名空间"})}),e.jsxs(y,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:99:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:100:15",value:"all",className:"text-xs",children:"所有命名空间"}),$.map(s=>e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:101:36",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(U,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:104:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:h,disabled:m,children:[e.jsx(G,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:105:13",className:`h-3 w-3 mr-1 ${m?"animate-spin":""}`}),"刷新"]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:111:7",className:"grid grid-cols-3 gap-3",children:[e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:112:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:112:57",className:"p-3 text-center",children:[e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:113:11",className:"text-xs text-slate-500",children:"Pod 数"}),e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:113:58",className:"text-xl font-bold text-slate-200",children:p.length})]})}),e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:115:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:115:57",className:"p-3 text-center",children:[e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:116:11",className:"text-xs text-slate-500",children:"总 CPU"}),e.jsxs("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:116:58",className:"text-xl font-bold text-blue-400",children:[I,"m"]})]})}),e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:118:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:118:57",className:"p-3 text-center",children:[e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:119:11",className:"text-xs text-slate-500",children:"总内存"}),e.jsxs("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:119:56",className:"text-xl font-bold text-emerald-400",children:[R.toFixed(0),"Mi"]})]})})]}),e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:123:7",className:"bg-slate-900 border-slate-800",children:e.jsx(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:124:9",className:"p-0",children:e.jsxs(W,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:125:11",children:[e.jsx(F,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:126:13",children:e.jsxs(u,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:126:26",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:127:15",className:"text-slate-400",children:"Pod"}),e.jsx(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:128:15",className:"text-slate-400",children:"命名空间"}),e.jsx(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:129:15",className:"text-slate-400",children:"容器"}),e.jsxs(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:130:15",className:"text-slate-400",children:[e.jsx(K,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:130:53",className:"h-3 w-3 inline mr-1"}),"CPU"]}),e.jsxs(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:131:15",className:"text-slate-400",children:[e.jsx(q,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:131:53",className:"h-3 w-3 inline mr-1"}),"Memory"]})]})}),e.jsx(z,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:133:13",children:o.length===0?e.jsx(u,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:135:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:135:27",colSpan:5,className:"text-center text-slate-500 py-8",children:["暂无数据",m?e.jsx("span",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:135:109",className:"animate-spin inline-block ml-2",children:"⏳"}):""]})}):o.map((s,t)=>e.jsxs(u,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:137:17",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:138:19",className:"font-medium text-slate-200 text-sm",children:s.pod}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:139:19",children:e.jsx(V,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:139:30",variant:"outline",className:"border-slate-700 text-slate-400 text-xs",children:s.namespace})}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:140:19",className:"text-sm text-slate-400",children:s.container}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:141:19",className:"text-sm text-blue-400",children:s.cpu}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:142:19",className:"text-sm text-emerald-400",children:s.memory})]},`${s.pod}-${s.container}-${t}`))})]})})})]})}export{te as default}; +import{r as c,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as i,a as x}from"./card-BHSBTtub.js";import{g as H,i as L,L as N,B as U}from"./index-Bp-M7P_8.js";import{B as V}from"./badge-B00SZHvE.js";import{S as f,a as v,b as C,c as y,d as P}from"./select-DbhcBWnH.js";import{T as W,a as F,b as u,c as d,d as z,e as n}from"./table-u8V9iTZf.js";import{k as b}from"./index-BkulU9RM.js";import{f as S,A as D,R as G,g as K,H as q}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";function te(){const{clusterCode:w}=H(),g=L(),[m,M]=c.useState(!1),[p,k]=c.useState([]),[A,T]=c.useState([]),[$,E]=c.useState([]),[l,B]=c.useState("all"),[a,j]=c.useState(w||"");c.useEffect(()=>{b.getClusters().then(s=>{const t=s?.list||[];if(T(t),!a&&t.length>0){const r=t[0].code||String(t[0].id);j(r),g(`/kubernetes/${r}/metrics/pods`,{replace:!0})}}).catch(()=>{})},[]),c.useEffect(()=>{a&&b.getNamespaces(a).then(s=>{E(Array.isArray(s)?s:s?.list||s?.data||[])}).catch(()=>{})},[a]);const h=c.useCallback(async()=>{if(a){M(!0);try{const s=l==="all"?void 0:l,t=await b.getPodMetrics(a,s);k(Array.isArray(t)?t:t?.list||[])}catch{k([])}finally{M(!1)}}},[a,l]);c.useEffect(()=>{h()},[h]);const o=c.useMemo(()=>p.flatMap(s=>(s.containers||[]).map(t=>({pod:s.name,namespace:s.namespace,container:t.name,cpu:t.cpu||"0m",memory:t.memory||"0Mi"}))),[p]),I=c.useMemo(()=>o.reduce((s,t)=>s+(parseInt(t.cpu)||0),0),[o]),R=c.useMemo(()=>{let s=0;return o.forEach(t=>{const r=t.memory;r.endsWith("Mi")?s+=parseInt(r):r.endsWith("Ki")?s+=parseInt(r)/1024:r.endsWith("Gi")&&(s+=parseInt(r)*1024)}),s},[o]);return e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:82:7",className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx(N,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:83:9",to:"/kubernetes",className:"hover:text-slate-300",children:"集群"}),a&&e.jsxs(e.Fragment,{children:[e.jsx(S,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:84:29",className:"h-3 w-3"}),e.jsx(N,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:84:65",to:`/kubernetes/${a}`,className:"hover:text-slate-300",children:a})]}),e.jsx(S,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:85:9",className:"h-3 w-3"}),e.jsx("span",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:85:45",className:"text-slate-300",children:"Pod 资源用量"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:88:7",className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsxs("h2",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:89:9",className:"text-lg font-semibold text-slate-100 flex items-center gap-2",children:[e.jsx(D,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:89:86",className:"h-5 w-5 text-blue-400"}),"Pod 资源用量"]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:90:9",className:"flex items-center gap-2",children:[e.jsxs(f,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:91:11",value:a,onValueChange:s=>{j(s),g(`/kubernetes/${s}/metrics/pods`)},children:[e.jsx(v,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:92:13",className:"w-44 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(C,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:92:87"})}),e.jsx(y,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:93:13",className:"bg-slate-800 border-slate-700",children:A.map(s=>e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:94:42",value:s.code||String(s.id),className:"text-xs",children:s.name||s.code},s.id))})]}),e.jsxs(f,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:97:11",value:l,onValueChange:B,children:[e.jsx(v,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:98:13",className:"w-36 h-8 text-xs bg-slate-800 border-slate-700",children:e.jsx(C,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:98:87",placeholder:"所有命名空间"})}),e.jsxs(y,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:99:13",className:"bg-slate-800 border-slate-700",children:[e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:100:15",value:"all",className:"text-xs",children:"所有命名空间"}),$.map(s=>e.jsx(P,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:101:36",value:s,className:"text-xs",children:s},s))]})]}),e.jsxs(U,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:104:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 text-xs",onClick:h,disabled:m,children:[e.jsx(G,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:105:13",className:`h-3 w-3 mr-1 ${m?"animate-spin":""}`}),"刷新"]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:111:7",className:"grid grid-cols-3 gap-3",children:[e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:112:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:112:57",className:"p-3 text-center",children:[e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:113:11",className:"text-xs text-slate-500",children:"Pod 数"}),e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:113:58",className:"text-xl font-bold text-slate-200",children:p.length})]})}),e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:115:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:115:57",className:"p-3 text-center",children:[e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:116:11",className:"text-xs text-slate-500",children:"总 CPU"}),e.jsxs("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:116:58",className:"text-xl font-bold text-blue-400",children:[I,"m"]})]})}),e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:118:9",className:"bg-slate-900 border-slate-800",children:e.jsxs(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:118:57",className:"p-3 text-center",children:[e.jsx("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:119:11",className:"text-xs text-slate-500",children:"总内存"}),e.jsxs("p",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:119:56",className:"text-xl font-bold text-emerald-400",children:[R.toFixed(0),"Mi"]})]})})]}),e.jsx(i,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:123:7",className:"bg-slate-900 border-slate-800",children:e.jsx(x,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:124:9",className:"p-0",children:e.jsxs(W,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:125:11",children:[e.jsx(F,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:126:13",children:e.jsxs(u,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:126:26",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:127:15",className:"text-slate-400",children:"Pod"}),e.jsx(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:128:15",className:"text-slate-400",children:"命名空间"}),e.jsx(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:129:15",className:"text-slate-400",children:"容器"}),e.jsxs(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:130:15",className:"text-slate-400",children:[e.jsx(K,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:130:53",className:"h-3 w-3 inline mr-1"}),"CPU"]}),e.jsxs(d,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:131:15",className:"text-slate-400",children:[e.jsx(q,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:131:53",className:"h-3 w-3 inline mr-1"}),"Memory"]})]})}),e.jsx(z,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:133:13",children:o.length===0?e.jsx(u,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:135:17",children:e.jsxs(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:135:27",colSpan:5,className:"text-center text-slate-500 py-8",children:["暂无数据",m?e.jsx("span",{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:135:109",className:"animate-spin inline-block ml-2",children:"⏳"}):""]})}):o.map((s,t)=>e.jsxs(u,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:137:17",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:138:19",className:"font-medium text-slate-200 text-sm",children:s.pod}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:139:19",children:e.jsx(V,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:139:30",variant:"outline",className:"border-slate-700 text-slate-400 text-xs",children:s.namespace})}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:140:19",className:"text-sm text-slate-400",children:s.container}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:141:19",className:"text-sm text-blue-400",children:s.cpu}),e.jsx(n,{"code-path":"src/components/kubernetes/PodMetricsPage.tsx:142:19",className:"text-sm text-emerald-400",children:s.memory})]},`${s.pod}-${s.container}-${t}`))})]})})})]})}export{te as default}; diff --git a/backend/static/assets/RegionManager-BFFP324K.js b/backend/static/assets/RegionManager-C0q8qzzP.js similarity index 96% rename from backend/static/assets/RegionManager-BFFP324K.js rename to backend/static/assets/RegionManager-C0q8qzzP.js index e38072a..b499a6a 100644 --- a/backend/static/assets/RegionManager-BFFP324K.js +++ b/backend/static/assets/RegionManager-C0q8qzzP.js @@ -1 +1 @@ -import{r as t,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{f as ee,B as u,D as se,a as ae,b as oe,c as te,d as ce,e as ne,t as N}from"./index-LZWfu62c.js";import{I as j}from"./input-BdDauX3U.js";import{L as i}from"./label-u-lNUbKh.js";import{B as O}from"./badge-B0F5ZNtn.js";import{C as A}from"./checkbox-DL3onEGv.js";import{T as re,a as le,b as V,c as r,d as de,e as l}from"./table-BPFYQwjr.js";import{S as y,a as C,b as w,c as S,d as R}from"./select-4xU_9B3_.js";import{r as M}from"./region-BZBRxF2X.js";import{S as ie,P as pe,T as H,L as $,M as ge,C as xe,a as he,d as me}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const k={aws:"AWS",aliyun:"阿里云",tencent:"腾讯云",huawei:"华为云",azure:"Azure"},ue={aws:"text-orange-400",aliyun:"text-orange-400",tencent:"text-blue-400",huawei:"text-red-400",azure:"text-blue-400"};function ke(){const D=ee(),[T,L]=t.useState([]),[F,I]=t.useState(!0),[b,Q]=t.useState(""),[f,W]=t.useState("all"),[c,d]=t.useState([]),[X,p]=t.useState(!1),[g,P]=t.useState(null),[B,z]=t.useState(!1),[a,n]=t.useState({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),x=t.useCallback(async()=>{I(!0);try{const o=(await M.list())?.list||[];L(o)}catch{L([])}finally{I(!1)}},[]);t.useEffect(()=>{x()},[x]);const h=T.filter(s=>{const o=s.name?.toLowerCase().includes(b.toLowerCase())||s.code?.toLowerCase().includes(b.toLowerCase()),v=f==="all"||s.provider===f;return o&&v}),E=h.length>0&&h.every(s=>c.includes(s.id)),q=()=>{d(E?[]:h.map(s=>s.id))},G=s=>{d(o=>o.includes(s)?o.filter(v=>v!==s):[...o,s])},J=()=>{P(null),n({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),p(!0)},K=s=>{P(s),n({name:s.name||"",code:s.code||"",provider:s.provider||"aliyun",location:s.location||"",status:s.status||"active",endpoint:s.endpoint||""}),p(!0)},U=async()=>{if(!(!a.name.trim()||!a.code.trim())){z(!0);try{g?await M.update(g.id,a):await M.create(a),p(!1),x()}catch{}finally{z(!1)}}},Y=async s=>{const o=T.find(m=>m.id===s);if(await D({title:"删除区域",description:`确定删除「${o?.name||s}」吗?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{await M.delete(s),N.success("区域已删除"),d(m=>m.filter(_=>_!==s)),x()}catch(m){console.error("删除区域失败:",m),N.error("删除失败")}},Z=async()=>{if(!(c.length===0||!await D({title:"批量删除区域",description:`确定删除选中的 ${c.length} 个区域吗?此操作不可撤销。`,confirmText:"批量删除",variant:"destructive"})))try{await M.batchDelete(c),N.success(`已删除 ${c.length} 个区域`),d([]),x()}catch(o){console.error("批量删除失败:",o),N.error("批量删除失败")}};return e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:185:5",className:"p-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:187:7",className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:188:9",className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:189:11",className:"relative w-72",children:[e.jsx(ie,{"code-path":"src/components/cloud/RegionManager.tsx:190:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:191:13",placeholder:"搜索区域名称或编码...",value:b,onChange:s=>Q(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700"})]}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:198:11",value:f,onValueChange:W,children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:199:13",className:"w-32 h-9 bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:200:15"})}),e.jsxs(S,{"code-path":"src/components/cloud/RegionManager.tsx:202:13",children:[e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:203:15",value:"all",children:"全部云商"}),Object.entries(k).map(([s,o])=>e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:205:17",value:s,children:o},s))]})]})]}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:210:9",onClick:J,className:"gap-2",children:[e.jsx(pe,{"code-path":"src/components/cloud/RegionManager.tsx:211:11",className:"h-4 w-4"}),"添加区域"]})]}),c.length>0&&e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:218:9",className:"flex items-center justify-between gap-4 px-4 py-2.5 rounded-lg bg-slate-800/50 border border-slate-700",children:[e.jsxs("span",{"code-path":"src/components/cloud/RegionManager.tsx:219:11",className:"text-sm text-slate-300",children:["已选择 ",e.jsx("span",{"code-path":"src/components/cloud/RegionManager.tsx:220:17",className:"font-semibold text-slate-100",children:c.length})," 个区域"]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:222:11",className:"flex items-center gap-2",children:[e.jsx(u,{"code-path":"src/components/cloud/RegionManager.tsx:223:13",variant:"ghost",size:"sm",onClick:()=>d([]),className:"text-slate-400 hover:text-slate-200",children:"取消选择"}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:226:13",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:Z,children:[e.jsx(H,{"code-path":"src/components/cloud/RegionManager.tsx:232:15",className:"h-4 w-4 mr-1.5"}),"批量删除"]})]})]}),F?e.jsx("div",{"code-path":"src/components/cloud/RegionManager.tsx:241:9",className:"flex justify-center py-20",children:e.jsx($,{"code-path":"src/components/cloud/RegionManager.tsx:242:11",className:"h-6 w-6 animate-spin text-slate-500"})}):h.length===0?e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:245:9",className:"text-center py-20 text-slate-500",children:[e.jsx(ge,{"code-path":"src/components/cloud/RegionManager.tsx:246:11",className:"h-12 w-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/components/cloud/RegionManager.tsx:247:11",children:"暂无区域数据"})]}):e.jsx("div",{"code-path":"src/components/cloud/RegionManager.tsx:250:9",className:"rounded-lg overflow-hidden",children:e.jsxs(re,{"code-path":"src/components/cloud/RegionManager.tsx:251:11",children:[e.jsx(le,{"code-path":"src/components/cloud/RegionManager.tsx:252:13",children:e.jsxs(V,{"code-path":"src/components/cloud/RegionManager.tsx:253:15",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:254:17",className:"w-10",children:e.jsx(A,{"code-path":"src/components/cloud/RegionManager.tsx:255:19",checked:E,onCheckedChange:q,className:"border-slate-600"})}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:261:17",className:"text-slate-400",children:"区域名称"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:262:17",className:"text-slate-400",children:"编码"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:263:17",className:"text-slate-400",children:"云商"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:264:17",className:"text-slate-400",children:"位置"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:265:17",className:"text-slate-400",children:"接入端点"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:266:17",className:"text-slate-400",children:"状态"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:267:17",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(de,{"code-path":"src/components/cloud/RegionManager.tsx:270:13",children:h.map(s=>e.jsxs(V,{"code-path":"src/components/cloud/RegionManager.tsx:272:17",className:"border-slate-800/50 group",children:[e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:273:19",children:e.jsx(A,{"code-path":"src/components/cloud/RegionManager.tsx:274:21",checked:c.includes(s.id),onCheckedChange:()=>G(s.id),className:"border-slate-600"})}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:280:19",className:"font-medium text-slate-200",children:s.name}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:281:19",className:"font-mono text-sm text-slate-400",children:s.code}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:282:19",children:e.jsx("span",{"code-path":"src/components/cloud/RegionManager.tsx:283:21",className:ue[s.provider]||"text-slate-400",children:k[s.provider]||s.provider})}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:287:19",className:"text-slate-400",children:s.location||"-"}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:288:19",className:"max-w-[200px] truncate font-mono text-xs text-slate-400",title:s.endpoint,children:s.endpoint||"-"}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:289:19",children:s.status==="active"?e.jsxs(O,{"code-path":"src/components/cloud/RegionManager.tsx:291:23",className:"bg-emerald-500/20 text-emerald-400 gap-1",children:[e.jsx(xe,{"code-path":"src/components/cloud/RegionManager.tsx:292:25",className:"h-3 w-3"})," 启用"]}):e.jsxs(O,{"code-path":"src/components/cloud/RegionManager.tsx:295:23",className:"bg-slate-500/20 text-slate-400 gap-1",children:[e.jsx(he,{"code-path":"src/components/cloud/RegionManager.tsx:296:25",className:"h-3 w-3"})," 禁用"]})}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:300:19",children:e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:301:21",className:"flex justify-end gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{"code-path":"src/components/cloud/RegionManager.tsx:302:23",onClick:()=>K(s),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-slate-200",children:e.jsx(me,{"code-path":"src/components/cloud/RegionManager.tsx:303:25",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/cloud/RegionManager.tsx:305:23",onClick:()=>Y(s.id),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-red-400",children:e.jsx(H,{"code-path":"src/components/cloud/RegionManager.tsx:306:25",className:"h-3.5 w-3.5"})})]})})]},s.id))})]})}),e.jsx(se,{"code-path":"src/components/cloud/RegionManager.tsx:318:7",open:X,onOpenChange:p,children:e.jsxs(ae,{"code-path":"src/components/cloud/RegionManager.tsx:319:9",children:[e.jsxs(oe,{"code-path":"src/components/cloud/RegionManager.tsx:320:11",children:[e.jsx(te,{"code-path":"src/components/cloud/RegionManager.tsx:321:13",children:g?"编辑区域":"添加区域"}),e.jsx(ce,{"code-path":"src/components/cloud/RegionManager.tsx:322:13",className:"sr-only",children:"描述"})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:324:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:325:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:326:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:327:17",children:"区域名称 *"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:328:17",value:a.name,onChange:s=>n({...a,name:s.target.value}),placeholder:"如:华北-北京",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:335:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:336:17",children:"编码 *"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:337:17",value:a.code,onChange:s=>n({...a,code:s.target.value}),placeholder:"如:cn-north-1",className:"bg-slate-800/50 border-slate-700 font-mono",disabled:!!g})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:346:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:347:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:348:17",children:"云商"}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:349:17",value:a.provider,onValueChange:s=>n({...a,provider:s}),children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:350:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:351:21"})}),e.jsx(S,{"code-path":"src/components/cloud/RegionManager.tsx:353:19",children:Object.entries(k).map(([s,o])=>e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:355:23",value:s,children:o},s))})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:360:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:361:17",children:"状态"}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:362:17",value:a.status,onValueChange:s=>n({...a,status:s}),children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:363:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:364:21"})}),e.jsxs(S,{"code-path":"src/components/cloud/RegionManager.tsx:366:19",children:[e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:367:21",value:"active",children:"启用"}),e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:368:21",value:"inactive",children:"禁用"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:373:13",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:374:15",children:"地理位置"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:375:15",value:a.location,onChange:s=>n({...a,location:s.target.value}),placeholder:"如:中国北京",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:382:13",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:383:15",children:"接入端点"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:384:15",value:a.endpoint,onChange:s=>n({...a,endpoint:s.target.value}),placeholder:"如:ecs.cn-north-1.aliyuncs.com",className:"bg-slate-800/50 border-slate-700 font-mono text-sm"})]})]}),e.jsxs(ne,{"code-path":"src/components/cloud/RegionManager.tsx:392:11",children:[e.jsx(u,{"code-path":"src/components/cloud/RegionManager.tsx:393:13",variant:"ghost",onClick:()=>p(!1),children:"取消"}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:394:13",onClick:U,disabled:B||!a.name.trim()||!a.code.trim(),children:[B&&e.jsx($,{"code-path":"src/components/cloud/RegionManager.tsx:395:30",className:"h-4 w-4 mr-1 animate-spin"}),g?"保存":"创建"]})]})]})})]})}export{ke as RegionManager}; +import{r as t,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{f as ee,B as u,D as se,a as ae,b as oe,c as te,d as ce,e as ne,t as N}from"./index-Bp-M7P_8.js";import{I as j}from"./input-Bnlm--la.js";import{L as i}from"./label-NkONM5Mp.js";import{B as O}from"./badge-B00SZHvE.js";import{C as A}from"./checkbox-Bsb-ZRm9.js";import{T as re,a as le,b as V,c as r,d as de,e as l}from"./table-u8V9iTZf.js";import{S as y,a as C,b as w,c as S,d as R}from"./select-DbhcBWnH.js";import{r as M}from"./region-D3lxTXmh.js";import{S as ie,P as pe,T as H,L as $,M as ge,C as xe,a as he,d as me}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";const k={aws:"AWS",aliyun:"阿里云",tencent:"腾讯云",huawei:"华为云",azure:"Azure"},ue={aws:"text-orange-400",aliyun:"text-orange-400",tencent:"text-blue-400",huawei:"text-red-400",azure:"text-blue-400"};function ke(){const D=ee(),[T,L]=t.useState([]),[F,I]=t.useState(!0),[b,Q]=t.useState(""),[f,W]=t.useState("all"),[c,d]=t.useState([]),[X,p]=t.useState(!1),[g,P]=t.useState(null),[B,z]=t.useState(!1),[a,n]=t.useState({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),x=t.useCallback(async()=>{I(!0);try{const o=(await M.list())?.list||[];L(o)}catch{L([])}finally{I(!1)}},[]);t.useEffect(()=>{x()},[x]);const h=T.filter(s=>{const o=s.name?.toLowerCase().includes(b.toLowerCase())||s.code?.toLowerCase().includes(b.toLowerCase()),v=f==="all"||s.provider===f;return o&&v}),E=h.length>0&&h.every(s=>c.includes(s.id)),q=()=>{d(E?[]:h.map(s=>s.id))},G=s=>{d(o=>o.includes(s)?o.filter(v=>v!==s):[...o,s])},J=()=>{P(null),n({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),p(!0)},K=s=>{P(s),n({name:s.name||"",code:s.code||"",provider:s.provider||"aliyun",location:s.location||"",status:s.status||"active",endpoint:s.endpoint||""}),p(!0)},U=async()=>{if(!(!a.name.trim()||!a.code.trim())){z(!0);try{g?await M.update(g.id,a):await M.create(a),p(!1),x()}catch{}finally{z(!1)}}},Y=async s=>{const o=T.find(m=>m.id===s);if(await D({title:"删除区域",description:`确定删除「${o?.name||s}」吗?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{await M.delete(s),N.success("区域已删除"),d(m=>m.filter(_=>_!==s)),x()}catch(m){console.error("删除区域失败:",m),N.error("删除失败")}},Z=async()=>{if(!(c.length===0||!await D({title:"批量删除区域",description:`确定删除选中的 ${c.length} 个区域吗?此操作不可撤销。`,confirmText:"批量删除",variant:"destructive"})))try{await M.batchDelete(c),N.success(`已删除 ${c.length} 个区域`),d([]),x()}catch(o){console.error("批量删除失败:",o),N.error("批量删除失败")}};return e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:185:5",className:"p-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:187:7",className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:188:9",className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:189:11",className:"relative w-72",children:[e.jsx(ie,{"code-path":"src/components/cloud/RegionManager.tsx:190:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:191:13",placeholder:"搜索区域名称或编码...",value:b,onChange:s=>Q(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700"})]}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:198:11",value:f,onValueChange:W,children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:199:13",className:"w-32 h-9 bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:200:15"})}),e.jsxs(S,{"code-path":"src/components/cloud/RegionManager.tsx:202:13",children:[e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:203:15",value:"all",children:"全部云商"}),Object.entries(k).map(([s,o])=>e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:205:17",value:s,children:o},s))]})]})]}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:210:9",onClick:J,className:"gap-2",children:[e.jsx(pe,{"code-path":"src/components/cloud/RegionManager.tsx:211:11",className:"h-4 w-4"}),"添加区域"]})]}),c.length>0&&e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:218:9",className:"flex items-center justify-between gap-4 px-4 py-2.5 rounded-lg bg-slate-800/50 border border-slate-700",children:[e.jsxs("span",{"code-path":"src/components/cloud/RegionManager.tsx:219:11",className:"text-sm text-slate-300",children:["已选择 ",e.jsx("span",{"code-path":"src/components/cloud/RegionManager.tsx:220:17",className:"font-semibold text-slate-100",children:c.length})," 个区域"]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:222:11",className:"flex items-center gap-2",children:[e.jsx(u,{"code-path":"src/components/cloud/RegionManager.tsx:223:13",variant:"ghost",size:"sm",onClick:()=>d([]),className:"text-slate-400 hover:text-slate-200",children:"取消选择"}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:226:13",variant:"outline",size:"sm",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:Z,children:[e.jsx(H,{"code-path":"src/components/cloud/RegionManager.tsx:232:15",className:"h-4 w-4 mr-1.5"}),"批量删除"]})]})]}),F?e.jsx("div",{"code-path":"src/components/cloud/RegionManager.tsx:241:9",className:"flex justify-center py-20",children:e.jsx($,{"code-path":"src/components/cloud/RegionManager.tsx:242:11",className:"h-6 w-6 animate-spin text-slate-500"})}):h.length===0?e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:245:9",className:"text-center py-20 text-slate-500",children:[e.jsx(ge,{"code-path":"src/components/cloud/RegionManager.tsx:246:11",className:"h-12 w-12 mx-auto mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/components/cloud/RegionManager.tsx:247:11",children:"暂无区域数据"})]}):e.jsx("div",{"code-path":"src/components/cloud/RegionManager.tsx:250:9",className:"rounded-lg overflow-hidden",children:e.jsxs(re,{"code-path":"src/components/cloud/RegionManager.tsx:251:11",children:[e.jsx(le,{"code-path":"src/components/cloud/RegionManager.tsx:252:13",children:e.jsxs(V,{"code-path":"src/components/cloud/RegionManager.tsx:253:15",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:254:17",className:"w-10",children:e.jsx(A,{"code-path":"src/components/cloud/RegionManager.tsx:255:19",checked:E,onCheckedChange:q,className:"border-slate-600"})}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:261:17",className:"text-slate-400",children:"区域名称"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:262:17",className:"text-slate-400",children:"编码"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:263:17",className:"text-slate-400",children:"云商"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:264:17",className:"text-slate-400",children:"位置"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:265:17",className:"text-slate-400",children:"接入端点"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:266:17",className:"text-slate-400",children:"状态"}),e.jsx(r,{"code-path":"src/components/cloud/RegionManager.tsx:267:17",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(de,{"code-path":"src/components/cloud/RegionManager.tsx:270:13",children:h.map(s=>e.jsxs(V,{"code-path":"src/components/cloud/RegionManager.tsx:272:17",className:"border-slate-800/50 group",children:[e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:273:19",children:e.jsx(A,{"code-path":"src/components/cloud/RegionManager.tsx:274:21",checked:c.includes(s.id),onCheckedChange:()=>G(s.id),className:"border-slate-600"})}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:280:19",className:"font-medium text-slate-200",children:s.name}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:281:19",className:"font-mono text-sm text-slate-400",children:s.code}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:282:19",children:e.jsx("span",{"code-path":"src/components/cloud/RegionManager.tsx:283:21",className:ue[s.provider]||"text-slate-400",children:k[s.provider]||s.provider})}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:287:19",className:"text-slate-400",children:s.location||"-"}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:288:19",className:"max-w-[200px] truncate font-mono text-xs text-slate-400",title:s.endpoint,children:s.endpoint||"-"}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:289:19",children:s.status==="active"?e.jsxs(O,{"code-path":"src/components/cloud/RegionManager.tsx:291:23",className:"bg-emerald-500/20 text-emerald-400 gap-1",children:[e.jsx(xe,{"code-path":"src/components/cloud/RegionManager.tsx:292:25",className:"h-3 w-3"})," 启用"]}):e.jsxs(O,{"code-path":"src/components/cloud/RegionManager.tsx:295:23",className:"bg-slate-500/20 text-slate-400 gap-1",children:[e.jsx(he,{"code-path":"src/components/cloud/RegionManager.tsx:296:25",className:"h-3 w-3"})," 禁用"]})}),e.jsx(l,{"code-path":"src/components/cloud/RegionManager.tsx:300:19",children:e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:301:21",className:"flex justify-end gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{"code-path":"src/components/cloud/RegionManager.tsx:302:23",onClick:()=>K(s),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-slate-200",children:e.jsx(me,{"code-path":"src/components/cloud/RegionManager.tsx:303:25",className:"h-3.5 w-3.5"})}),e.jsx("button",{"code-path":"src/components/cloud/RegionManager.tsx:305:23",onClick:()=>Y(s.id),className:"p-1.5 rounded hover:bg-slate-700 text-slate-400 hover:text-red-400",children:e.jsx(H,{"code-path":"src/components/cloud/RegionManager.tsx:306:25",className:"h-3.5 w-3.5"})})]})})]},s.id))})]})}),e.jsx(se,{"code-path":"src/components/cloud/RegionManager.tsx:318:7",open:X,onOpenChange:p,children:e.jsxs(ae,{"code-path":"src/components/cloud/RegionManager.tsx:319:9",children:[e.jsxs(oe,{"code-path":"src/components/cloud/RegionManager.tsx:320:11",children:[e.jsx(te,{"code-path":"src/components/cloud/RegionManager.tsx:321:13",children:g?"编辑区域":"添加区域"}),e.jsx(ce,{"code-path":"src/components/cloud/RegionManager.tsx:322:13",className:"sr-only",children:"描述"})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:324:11",className:"space-y-4 py-2",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:325:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:326:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:327:17",children:"区域名称 *"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:328:17",value:a.name,onChange:s=>n({...a,name:s.target.value}),placeholder:"如:华北-北京",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:335:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:336:17",children:"编码 *"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:337:17",value:a.code,onChange:s=>n({...a,code:s.target.value}),placeholder:"如:cn-north-1",className:"bg-slate-800/50 border-slate-700 font-mono",disabled:!!g})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:346:13",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:347:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:348:17",children:"云商"}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:349:17",value:a.provider,onValueChange:s=>n({...a,provider:s}),children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:350:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:351:21"})}),e.jsx(S,{"code-path":"src/components/cloud/RegionManager.tsx:353:19",children:Object.entries(k).map(([s,o])=>e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:355:23",value:s,children:o},s))})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:360:15",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:361:17",children:"状态"}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:362:17",value:a.status,onValueChange:s=>n({...a,status:s}),children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:363:19",className:"bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:364:21"})}),e.jsxs(S,{"code-path":"src/components/cloud/RegionManager.tsx:366:19",children:[e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:367:21",value:"active",children:"启用"}),e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:368:21",value:"inactive",children:"禁用"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:373:13",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:374:15",children:"地理位置"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:375:15",value:a.location,onChange:s=>n({...a,location:s.target.value}),placeholder:"如:中国北京",className:"bg-slate-800/50 border-slate-700"})]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:382:13",className:"space-y-1.5",children:[e.jsx(i,{"code-path":"src/components/cloud/RegionManager.tsx:383:15",children:"接入端点"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:384:15",value:a.endpoint,onChange:s=>n({...a,endpoint:s.target.value}),placeholder:"如:ecs.cn-north-1.aliyuncs.com",className:"bg-slate-800/50 border-slate-700 font-mono text-sm"})]})]}),e.jsxs(ne,{"code-path":"src/components/cloud/RegionManager.tsx:392:11",children:[e.jsx(u,{"code-path":"src/components/cloud/RegionManager.tsx:393:13",variant:"ghost",onClick:()=>p(!1),children:"取消"}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:394:13",onClick:U,disabled:B||!a.name.trim()||!a.code.trim(),children:[B&&e.jsx($,{"code-path":"src/components/cloud/RegionManager.tsx:395:30",className:"h-4 w-4 mr-1 animate-spin"}),g?"保存":"创建"]})]})]})})]})}export{ke as RegionManager}; diff --git a/backend/static/assets/ResourceVisualEditor-B64kRCHd.js b/backend/static/assets/ResourceVisualEditor-B64kRCHd.js new file mode 100644 index 0000000..e60e925 --- /dev/null +++ b/backend/static/assets/ResourceVisualEditor-B64kRCHd.js @@ -0,0 +1 @@ +import{r as h,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{B as j}from"./index-Bp-M7P_8.js";import{p as B,c as Z,g as ie,M as le,d as ue,b as xe,e as pe,f as me,y as he}from"./PodFileBrowser-CVjj8HxI.js";import{I as E}from"./input-Bnlm--la.js";import{L as S}from"./label-NkONM5Mp.js";import{T as be}from"./textarea-BvOVhaCD.js";import{S as F,a as G,b as W,c as q,d as Y}from"./select-DbhcBWnH.js";import{u as ve}from"./use-toast-DNZLibQY.js";import{k as _,d as ge}from"./index-BkulU9RM.js";import{D as ke,f as Re,N as Ee,j as ye,F as je,X as Ve,L as I,P as z,T as O,$}from"./vendor-icons-BWk-DH7F.js";function ee(i,b,c){switch(i){case"services":return{apiVersion:"v1",kind:"Service",metadata:{name:c,namespace:b},spec:{type:"ClusterIP",selector:{},ports:[{name:"http",port:80,targetPort:80,protocol:"TCP"}]}};case"ingresses":return{apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:c,namespace:b},spec:{ingressClassName:"nginx",rules:[{host:"",http:{paths:[{path:"/",pathType:"Prefix",backend:{service:{name:"",port:{number:80}}}}]}}]}};case"configmaps":return{apiVersion:"v1",kind:"ConfigMap",metadata:{name:c,namespace:b},data:{}};case"secrets":return{apiVersion:"v1",kind:"Secret",metadata:{name:c,namespace:b},type:"Opaque",data:{}};case"pvcs":return{apiVersion:"v1",kind:"PersistentVolumeClaim",metadata:{name:c,namespace:b},spec:{accessModes:["ReadWriteOnce"],resources:{requests:{storage:"1Gi"}}}};default:return{apiVersion:"v1",kind:"Unknown",metadata:{name:c,namespace:b}}}}function Ae({clusterCode:i,namespace:b,resource:c,name:y,onClose:k,onSaved:f,isCreate:v=!1}){const{toast:d}=ve(),[w,m]=h.useState(!0),[g,V]=h.useState(!1),[N,r]=h.useState(""),[t,x]=h.useState(null),[R,P]=h.useState("visual"),[l,n]=h.useState(""),[p,s]=h.useState(""),[o,a]=h.useState(!1),[C,A]=h.useState(!1),[se,U]=h.useState(!1),H=h.useCallback(async()=>{m(!0);try{if(v){const K=ee(c,b,y||""),Q=await B(K);x(K),n(Q),s(Q),r(""),a(!0);return}const u=await _.getResourceYaml(i,b,c,y);r(u);const{manifest:T,yaml:M}=await Z(u);n(M),s(M),a(!1),A(!1),x(T),T||(P("yaml"),d({title:"可视化编辑不可用",description:"无法解析资源结构,已切换到 YAML 编辑模式"}))}catch(u){d({title:"加载失败",description:u.message,variant:"destructive"})}finally{m(!1)}},[i,b,c,y,v]);h.useEffect(()=>{H()},[H]);const L=async u=>{V(!0);try{const T=await B(u),M=u?.metadata?.name||y;if(v){if(!M?.trim()){d({title:"请填写名称",variant:"destructive"});return}await _.applyYAML(i,T),d({title:"创建成功",description:`${c}/${M}`})}else await _.updateResourceYaml(i,b,c,y,T),d({title:"保存成功",description:`${c}/${y} 已更新`});f?.(),k()}catch(T){d({title:v?"创建失败":"保存失败",description:T.message,variant:"destructive"})}finally{V(!1)}},te=async()=>{V(!0);try{const u=await me(p);v?(await _.applyYAML(i,u),d({title:"创建成功",description:"YAML 已应用"})):(await _.updateResourceYaml(i,b,c,y,u),d({title:"保存成功",description:`${c}/${y} 已更新`})),a(!1),n(u),s(u),v||r(u),f?.(),k()}catch(u){d({title:"保存失败",description:u.message,variant:"destructive"})}finally{V(!1)}},re=async()=>{const u=await pe(p);if(!u){d({title:"无法解析 YAML",description:"请检查语法后继续用 YAML 模式",variant:"destructive"});return}x(u),P("visual")},oe=async()=>{if(t){const u=await B(t);n(u),s(u)}a(!1),A(!1),P("yaml")},X=()=>o?p:C?N:l,ae=async()=>{await navigator.clipboard.writeText(X()),U(!0),setTimeout(()=>U(!1),2e3)},ce=()=>{const u=he(c,b,y||t?.metadata?.name||"resource");ge(u,X()),d({title:"已下载",description:u})},ne=ie(c),J={configmaps:{title:"ConfigMap",icon:je,color:"text-blue-400"},secrets:{title:"Secret",icon:ye,color:"text-amber-400"},services:{title:"Service",icon:Ee,color:"text-cyan-400"},ingresses:{title:"Ingress",icon:Re,color:"text-purple-400"},pvcs:{title:"PersistentVolumeClaim",icon:ke,color:"text-emerald-400"}},D=J[c]||J.configmaps,de=D.icon;return e.jsx(le,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:169:5",onClose:k,children:e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:170:7",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[90vw] max-w-3xl h-[85vh] flex flex-col shadow-2xl",onClick:u=>u.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:175:9",className:"flex items-center justify-between p-4 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:176:11",className:"flex items-center gap-2",children:[e.jsx(de,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:177:13",className:`h-5 w-5 ${D.color}`}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:178:13",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:179:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:v?`新建 ${D.title}`:`${D.title} 编辑`}),e.jsxs("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:180:15",className:"text-xs text-[var(--dg-text-muted)]",children:[v?b:y," · ",b," · ",i]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:183:11",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:185:13",className:"flex rounded-lg border border-[var(--dg-border)] overflow-hidden",children:[e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:186:15",className:`px-3 py-1.5 text-xs font-medium transition-colors ${R==="visual"?"bg-blue-600 text-white":"bg-transparent text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>{R==="yaml"?re():P("visual")},disabled:!t&&R!=="yaml",children:"可视化编辑"}),e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:191:15",className:`px-3 py-1.5 text-xs font-medium transition-colors ${R==="yaml"?"bg-blue-600 text-white":"bg-transparent text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>{R==="visual"?oe():P("yaml")},children:"YAML 编辑"})]}),e.jsx(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:196:13",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)]",onClick:k,children:e.jsx(Ve,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:196:119",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:201:9",className:`flex-1 min-h-0 p-4 ${R==="yaml"?"flex flex-col overflow-hidden":"overflow-auto"}`,children:w?e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:203:13",className:"flex items-center justify-center h-full py-20",children:e.jsx(I,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:203:76",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):R==="yaml"?e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:205:13",className:"flex flex-col flex-1 min-h-0 gap-3",children:[e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:206:15",className:"flex justify-end shrink-0",children:e.jsx(ue,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:207:17",editing:o,saving:g,copied:se,showRaw:C,compact:!0,readOnly:ne.readOnly,showRawToggle:!v&&!!N,onCopy:ae,onDownload:ce,onEdit:()=>{s(l),a(!0),A(!1)},onCancel:async()=>{if(a(!1),v){const T=ee(c,b,y||""),M=await B(T);n(M),s(M);return}const{yaml:u}=await Z(N);n(u),s(u)},onSave:te,onToggleRaw:()=>A(u=>!u)})}),e.jsx(xe,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:235:15",value:o?p:C?N:l,editing:o,fill:!0,fontSize:"12px",onChange:u=>o&&s(u)})]}):t?e.jsxs(e.Fragment,{children:[c==="configmaps"&&e.jsx(Ne,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:245:45",manifest:t,onSave:L,saving:g,isCreate:v}),c==="secrets"&&e.jsx(fe,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:246:42",manifest:t,onSave:L,saving:g,isCreate:v}),c==="services"&&e.jsx(we,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:247:43",manifest:t,onSave:L,saving:g,isCreate:v}),c==="ingresses"&&e.jsx(Se,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:248:44",manifest:t,onSave:L,saving:g,isCreate:v}),c==="pvcs"&&e.jsx(Ce,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:249:39",manifest:t,onSave:L,saving:g,isCreate:v}),!["configmaps","secrets","services","ingresses","pvcs"].includes(c)&&e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:251:17",className:"text-center py-12 text-[var(--dg-text-muted)]",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:252:19",children:"该资源类型暂不支持可视化编辑"}),e.jsx(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:253:19",variant:"outline",size:"sm",className:"mt-4",onClick:()=>P("yaml"),children:"切换到 YAML 编辑"})]})]}):e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:258:13",className:"text-center py-12 text-[var(--dg-text-muted)]",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:259:15",children:"无法解析资源结构"}),e.jsx(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:260:15",variant:"outline",size:"sm",className:"mt-4",onClick:()=>P("yaml"),children:"切换到 YAML 编辑"})]})})]})})}function Ne({manifest:i,onSave:b,saving:c,isCreate:y}){const k=i?.data||{},[f,v]=h.useState(i?.metadata?.name||""),[d,w]=h.useState(Object.entries(k).map(([r,t])=>({key:r,value:String(t)}))),m=(r,t,x)=>{const R=[...d];R[r]={...R[r],[t]:x},w(R)},g=()=>w([...d,{key:"",value:""}]),V=r=>w(d.filter((t,x)=>x!==r)),N=()=>{const r={};d.forEach(t=>{t.key.trim()&&(r[t.key.trim()]=t.value)}),b({...i,metadata:{...i.metadata,name:f.trim()},data:r})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:297:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:298:7",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:299:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:300:9",value:f,onChange:r=>v(r.target.value),readOnly:!y,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:302:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:303:9",className:"flex items-center justify-between mb-2",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:304:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"配置数据 (键值对)"}),e.jsxs(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:305:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:g,children:[e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:305:88",className:"h-3 w-3 mr-1"}),"添加"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:307:9",className:"space-y-2 max-h-[45vh] overflow-y-auto pr-1",children:[d.map((r,t)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:309:13",className:"flex items-start gap-2 p-2 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:310:15",value:r.key,onChange:x=>m(t,"key",x.target.value),placeholder:"键名 (如 LOG_LEVEL)",className:"flex-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(be,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:316:15",value:r.value,onChange:x=>m(t,"value",x.target.value),placeholder:"值",className:"flex-[2] font-mono text-xs min-h-[36px] max-h-[120px] bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:322:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300 shrink-0",onClick:()=>V(t),children:e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:323:17",className:"h-3.5 w-3.5"})})]},t)),d.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:328:13",className:"text-center py-8 text-[var(--dg-text-muted)] text-xs",children:"暂无配置数据,点击「添加」创建"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:332:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:333:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:N,disabled:c,children:[c?e.jsx(I,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:334:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx($,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:334:77",className:"h-3.5 w-3.5 mr-1"}),"保存配置"]})})]})}function fe({manifest:i,onSave:b,saving:c,isCreate:y}){const k=i?.data||{},[f,v]=h.useState(i?.metadata?.name||""),[d,w]=h.useState(Object.entries(k).map(([r,t])=>{const x=String(t);try{const R=atob(x);return{key:r,value:R,encoded:!0}}catch{return{key:r,value:x,encoded:!1}}})),m=(r,t,x)=>{const R=[...d];R[r]={...R[r],[t]:x},w(R)},g=()=>w([...d,{key:"",value:"",encoded:!0}]),V=r=>w(d.filter((t,x)=>x!==r)),N=()=>{const r={};d.forEach(t=>{t.key.trim()&&(r[t.key.trim()]=t.encoded?btoa(t.value):t.value)}),b({...i,metadata:{...i.metadata,name:f.trim()},data:r})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:383:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:384:7",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:385:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:386:9",value:f,onChange:r=>v(r.target.value),readOnly:!y,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:388:7",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:389:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"类型"}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:390:9",value:i?.type||"Opaque",readOnly:!0,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:392:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:393:9",className:"flex items-center justify-between mb-2",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:394:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"密钥数据 (已自动解码 Base64)"}),e.jsxs(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:395:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:g,children:[e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:395:88",className:"h-3 w-3 mr-1"}),"添加"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:397:9",className:"space-y-2 max-h-[45vh] overflow-y-auto pr-1",children:[d.map((r,t)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:399:13",className:"flex items-start gap-2 p-2 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:400:15",value:r.key,onChange:x=>m(t,"key",x.target.value),placeholder:"键名 (如 password)",className:"flex-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:406:15",value:r.value,onChange:x=>m(t,"value",x.target.value),placeholder:"明文值",className:"flex-[2] font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:412:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300 shrink-0",onClick:()=>V(t),children:e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:413:17",className:"h-3.5 w-3.5"})})]},t)),d.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:418:13",className:"text-center py-8 text-[var(--dg-text-muted)] text-xs",children:"暂无密钥数据,点击「添加」创建"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:422:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:423:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:N,disabled:c,children:[c?e.jsx(I,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:424:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx($,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:424:77",className:"h-3.5 w-3.5 mr-1"}),"保存密钥"]})})]})}function we({manifest:i,onSave:b,saving:c,isCreate:y}){const k=i?.spec||{},[f,v]=h.useState(i?.metadata?.name||""),[d,w]=h.useState(k.type||"ClusterIP"),[m,g]=h.useState((k.ports||[]).map(s=>({name:s.name||"",port:String(s.port||""),targetPort:String(s.targetPort||""),protocol:s.protocol||"TCP",nodePort:s.nodePort?String(s.nodePort):""}))),[V,N]=h.useState(Object.entries(k.selector||{}).map(([s,o])=>({key:s,value:String(o)}))),r=(s,o,a)=>{const C=[...m];C[s]={...C[s],[o]:a},g(C)},t=()=>g([...m,{name:"",port:"",targetPort:"",protocol:"TCP",nodePort:""}]),x=s=>g(m.filter((o,a)=>a!==s)),R=(s,o,a)=>{const C=[...V];C[s]={...C[s],[o]:a},N(C)},P=()=>N([...V,{key:"",value:""}]),l=s=>N(V.filter((o,a)=>a!==s)),n=()=>{const s={...k};s.type=d,s.ports=m.map(a=>{const C={port:parseInt(a.port)||80,targetPort:parseInt(a.targetPort)||parseInt(a.port)||80,protocol:a.protocol};return a.name&&(C.name=a.name),a.nodePort&&d==="NodePort"&&(C.nodePort=parseInt(a.nodePort)),C});const o={};V.forEach(a=>{a.key.trim()&&(o[a.key.trim()]=a.value)}),s.selector=o,b({...i,metadata:{...i.metadata,name:f.trim()},spec:s})},p=[{value:"ClusterIP",label:"ClusterIP"},{value:"NodePort",label:"NodePort"},{value:"LoadBalancer",label:"LoadBalancer"}];return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:494:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:495:7",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:496:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"服务名称"}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:497:9",value:f,onChange:s=>v(s.target.value),readOnly:!y,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:499:7",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:500:9",className:"text-[var(--dg-text-secondary)] text-xs mb-2 block",children:"服务类型"}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:501:9",className:"flex rounded-lg border border-[var(--dg-border)] overflow-hidden w-fit",children:p.map(s=>e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:503:13",type:"button",className:`px-3 py-1.5 text-xs transition-colors ${d===s.value?"bg-blue-600 text-white":"text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>w(s.value),children:s.label},s.value))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:516:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:517:9",className:"flex items-center justify-between mb-2",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:518:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"端口映射"}),e.jsxs(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:519:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:t,children:[e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:519:89",className:"h-3 w-3 mr-1"}),"添加端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:521:9",className:"space-y-2",children:[m.map((s,o)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:523:13",className:"grid grid-cols-[1fr_80px_80px_80px_80px_32px] gap-2 items-center",children:[e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:524:15",value:s.name,onChange:a=>r(o,"name",a.target.value),placeholder:"名称",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:525:15",value:s.port,onChange:a=>r(o,"port",a.target.value),placeholder:"端口",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:526:15",value:s.targetPort,onChange:a=>r(o,"targetPort",a.target.value),placeholder:"目标",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsxs(F,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:527:15",value:s.protocol,onValueChange:a=>r(o,"protocol",a),children:[e.jsx(G,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:528:17",className:"h-7 text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(W,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:528:139"})}),e.jsxs(q,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:529:17",children:[e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:529:32",value:"TCP",children:"TCP"}),e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:529:72",value:"UDP",children:"UDP"})]})]}),d==="NodePort"?e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:532:17",value:s.nodePort,onChange:a=>r(o,"nodePort",a.target.value),placeholder:"NodePort",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}):e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:533:19"}),e.jsx(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:534:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>x(o),children:e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:534:133",className:"h-3 w-3"})})]},o)),m.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:537:34",className:"text-center py-4 text-[var(--dg-text-muted)] text-xs",children:"暂无端口,点击「添加端口」"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:542:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:543:9",className:"flex items-center justify-between mb-2",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:544:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"选择器 (Selector)"}),e.jsxs(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:545:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:P,children:[e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:545:93",className:"h-3 w-3 mr-1"}),"添加标签"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:547:9",className:"space-y-2",children:[V.map((s,o)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:549:13",className:"flex items-center gap-2",children:[e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:550:15",value:s.key,onChange:a=>R(o,"key",a.target.value),placeholder:"键 (如 app)",className:"flex-1 font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx("span",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:551:15",className:"text-[var(--dg-text-muted)] text-xs",children:"="}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:552:15",value:s.value,onChange:a=>R(o,"value",a.target.value),placeholder:"值 (如 nginx)",className:"flex-1 font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:553:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>l(o),children:e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:553:137",className:"h-3 w-3"})})]},o)),V.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:556:37",className:"text-center py-4 text-[var(--dg-text-muted)] text-xs",children:"暂无选择器"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:560:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:561:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:n,disabled:c,children:[c?e.jsx(I,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:562:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx($,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:562:77",className:"h-3.5 w-3.5 mr-1"}),"保存 Service"]})})]})}function Se({manifest:i,onSave:b,saving:c,isCreate:y}){const k=i?.spec||{},[f,v]=h.useState(i?.metadata?.name||""),[d,w]=h.useState(k.ingressClassName||"nginx"),[m,g]=h.useState((k.rules||[]).map(l=>({host:l.host||"",paths:l.http?.backend?.servicePort!=null?[{path:"/",pathType:"Prefix",serviceName:l.http?.backend?.serviceName||"",servicePort:String(l.http?.backend?.servicePort||"80")}]:(l.http?.paths||[]).map(n=>({path:n.path||"/",pathType:n.pathType||"Prefix",serviceName:n.backend?.service?.name||n.backend?.serviceName||"",servicePort:String(n.backend?.service?.port?.number??n.backend?.servicePort??"80")}))}))),V=(l,n)=>{const p=[...m];p[l]={...p[l],host:n},g(p)},N=()=>g([...m,{host:"",paths:[{path:"/",pathType:"Prefix",serviceName:"",servicePort:"80"}]}]),r=l=>g(m.filter((n,p)=>p!==l)),t=(l,n,p,s)=>{const o=[...m];o[l].paths[n]={...o[l].paths[n],[p]:s},g(o)},x=l=>{const n=[...m];n[l].paths.push({path:"/",pathType:"Prefix",serviceName:"",servicePort:"80"}),g(n)},R=(l,n)=>{const p=[...m];p[l].paths=p[l].paths.filter((s,o)=>o!==n),g(p)},P=()=>{const l=m.map(p=>({host:p.host,http:{paths:p.paths.map(s=>({path:s.path,pathType:s.pathType,backend:{service:{name:s.serviceName,port:{number:parseInt(s.servicePort)||80}}}}))}})),n={...k,rules:l};d.trim()?n.ingressClassName=d.trim():delete n.ingressClassName,b({...i,metadata:{...i.metadata,name:f.trim()},spec:n})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:635:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:636:7",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:637:9",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:638:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:639:11",value:f,onChange:l=>v(l.target.value),readOnly:!y,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:641:9",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:642:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"Ingress Class"}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:643:11",value:d,onChange:l=>w(l.target.value),placeholder:"nginx / alb",className:"mt-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:646:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:647:9",className:"flex items-center justify-between mb-2",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:648:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"路由规则"}),e.jsxs(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:649:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:N,children:[e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:649:89",className:"h-3 w-3 mr-1"}),"添加 Host"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:651:9",className:"space-y-3 max-h-[50vh] overflow-y-auto pr-1",children:[m.map((l,n)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:653:13",className:"p-3 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)] space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:654:15",className:"flex items-center gap-2",children:[e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:655:17",value:l.host,onChange:p=>V(n,p.target.value),placeholder:"域名 (如 api.example.com)",className:"flex-1 font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:661:17",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>r(n),children:e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:661:136",className:"h-3 w-3"})})]}),l.paths.map((p,s)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:664:17",className:"grid grid-cols-[1fr_100px_1fr_60px_28px] gap-1.5 items-center pl-4",children:[e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:665:19",value:p.path,onChange:o=>t(n,s,"path",o.target.value),placeholder:"路径 /",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsxs(F,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:666:19",value:p.pathType,onValueChange:o=>t(n,s,"pathType",o),children:[e.jsx(G,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:667:21",className:"h-7 text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(W,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:667:143"})}),e.jsxs(q,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:668:21",children:[e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:668:36",value:"Prefix",children:"Prefix"}),e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:668:82",value:"Exact",children:"Exact"})]})]}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:670:19",value:p.serviceName,onChange:o=>t(n,s,"serviceName",o.target.value),placeholder:"Service",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:671:19",value:p.servicePort,onChange:o=>t(n,s,"servicePort",o.target.value),placeholder:"端口",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:672:19",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>R(n,s),children:e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:672:142",className:"h-3 w-3"})})]},s)),e.jsxs(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:675:15",variant:"ghost",size:"sm",className:"h-6 text-xs text-[var(--dg-text-muted)]",onClick:()=>x(n),children:[e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:675:129",className:"h-3 w-3 mr-1"}),"添加路径"]})]},n)),m.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:678:34",className:"text-center py-4 text-[var(--dg-text-muted)] text-xs",children:"暂无路由规则,点击「添加 Host」"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:681:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:682:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:P,disabled:c,children:[c?e.jsx(I,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:683:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx($,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:683:77",className:"h-3.5 w-3.5 mr-1"}),"保存 Ingress"]})})]})}function Ce({manifest:i,onSave:b,saving:c,isCreate:y}){const k=i?.spec||{},f=k.resources?.requests||{},[v,d]=h.useState(i?.metadata?.name||""),[w,m]=h.useState(f.storage||"1Gi"),[g,V]=h.useState(k.accessModes?.[0]||"ReadWriteOnce"),[N,r]=h.useState(k.storageClassName||""),t=()=>{b({...i,metadata:{...i.metadata,name:v.trim()},spec:{...k,accessModes:[g],storageClassName:N||void 0,resources:{requests:{storage:w}}}})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:716:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:717:7",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:718:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:719:9",value:v,onChange:x=>d(x.target.value),readOnly:!y,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:721:7",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:722:9",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:723:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"存储大小"}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:724:11",value:w,onChange:x=>m(x.target.value),placeholder:"如 10Gi",className:"mt-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:730:11",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:"单位:Gi (GiB), Mi (MiB), Ti (TiB)"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:732:9",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:733:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"访问模式"}),e.jsxs(F,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:734:11",value:g,onValueChange:V,children:[e.jsx(G,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:735:13",className:"mt-1 h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] text-xs",children:e.jsx(W,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:736:15"})}),e.jsxs(q,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:738:13",children:[e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:739:15",value:"ReadWriteOnce",children:"ReadWriteOnce (单节点读写)"}),e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:740:15",value:"ReadOnlyMany",children:"ReadOnlyMany (多节点只读)"}),e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:741:15",value:"ReadWriteMany",children:"ReadWriteMany (多节点读写)"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:746:7",children:[e.jsx(S,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:747:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"StorageClass"}),e.jsx(E,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:748:9",value:N,onChange:x=>r(x.target.value),placeholder:"留空使用默认 StorageClass",className:"mt-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:755:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(j,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:756:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:t,disabled:c,children:[c?e.jsx(I,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:757:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx($,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:757:77",className:"h-3.5 w-3.5 mr-1"}),"保存 PVC"]})})]})}export{Ae as R}; diff --git a/backend/static/assets/ResourceVisualEditor-CXyg-7xn.js b/backend/static/assets/ResourceVisualEditor-CXyg-7xn.js deleted file mode 100644 index 5d9007e..0000000 --- a/backend/static/assets/ResourceVisualEditor-CXyg-7xn.js +++ /dev/null @@ -1 +0,0 @@ -import{r as v,j as e,R as H,y as J,o as X}from"./vendor-codemirror-C7mXSpXt.js";import{B as R}from"./index-LZWfu62c.js";import{I as k}from"./input-BdDauX3U.js";import{L as w}from"./label-u-lNUbKh.js";import{T as K}from"./textarea-BdtIagjy.js";import{S as D,a as B,b as G,c as W,d as T}from"./select-4xU_9B3_.js";import{u as Q}from"./use-toast-CkA38LVP.js";import{k as I}from"./index-Z0O8nAcG.js";import{p as Z,c as $,b as ee,d as se,e as te}from"./PodFileBrowser-Bs6KRfHw.js";import{D as re,f as oe,N as ae,j as ce,F as ne,X as de,L as z,$ as O,P as L,T as Y}from"./vendor-icons-Aso0-eeY.js";function ie(d,h,c){switch(d){case"services":return{apiVersion:"v1",kind:"Service",metadata:{name:c,namespace:h},spec:{type:"ClusterIP",selector:{},ports:[{name:"http",port:80,targetPort:80,protocol:"TCP"}]}};case"ingresses":return{apiVersion:"networking.k8s.io/v1",kind:"Ingress",metadata:{name:c,namespace:h},spec:{ingressClassName:"nginx",rules:[{host:"",http:{paths:[{path:"/",pathType:"Prefix",backend:{service:{name:"",port:{number:80}}}}]}}]}};case"configmaps":return{apiVersion:"v1",kind:"ConfigMap",metadata:{name:c,namespace:h},data:{}};case"secrets":return{apiVersion:"v1",kind:"Secret",metadata:{name:c,namespace:h},type:"Opaque",data:{}};case"pvcs":return{apiVersion:"v1",kind:"PersistentVolumeClaim",metadata:{name:c,namespace:h},spec:{accessModes:["ReadWriteOnce"],resources:{requests:{storage:"1Gi"}}}};default:return{apiVersion:"v1",kind:"Unknown",metadata:{name:c,namespace:h}}}}function Ne({clusterCode:d,namespace:h,resource:c,name:V,onClose:g,onSaved:N,isCreate:b=!1}){const{toast:i}=Q(),[f,x]=v.useState(!0),[m,y]=v.useState(!1),[S,r]=v.useState(""),[t,u]=v.useState(null),[j,P]=v.useState("visual"),[l,o]=v.useState(""),p=v.useCallback(async()=>{x(!0);try{if(b){const F=ie(c,h,V||"");u(F),o(JSON.stringify(F,null,2)),r("");return}const E=await I.getResourceYaml(d,h,c,V);r(E);const{manifest:M,yaml:A}=await Z(E);o(A),u(M),M||(P("yaml"),i({title:"可视化编辑不可用",description:"无法解析资源结构,已切换到 YAML 编辑模式"}))}catch(E){i({title:"加载失败",description:E.message,variant:"destructive"})}finally{x(!1)}},[d,h,c,V,b]);v.useEffect(()=>{p()},[p]);const s=async E=>{y(!0);try{const M=await te(E),A=E?.metadata?.name||V;if(b){if(!A?.trim()){i({title:"请填写名称",variant:"destructive"});return}await I.applyYAML(d,M),i({title:"创建成功",description:`${c}/${A}`})}else await I.updateResourceYaml(d,h,c,V,M),i({title:"保存成功",description:`${c}/${V} 已更新`});N?.(),g()}catch(M){i({title:b?"创建失败":"保存失败",description:M.message,variant:"destructive"})}finally{y(!1)}},a=async()=>{y(!0);try{const E=$(l);b?(await I.applyYAML(d,E),i({title:"创建成功",description:"YAML 已应用"})):(await I.updateResourceYaml(d,h,c,V,E),i({title:"YAML 已应用",description:`${c}/${V} 更新成功`})),N?.(),g()}catch(E){i({title:"保存失败",description:E.message,variant:"destructive"})}finally{y(!1)}},n=async()=>{const E=await ee(l);if(!E){i({title:"无法解析 YAML",description:"请检查语法后继续用 YAML 模式",variant:"destructive"});return}u(E),P("visual")},C=async()=>{if(t){const E=await se(t);o($(E))}P("yaml")},q={configmaps:{title:"ConfigMap",icon:ne,color:"text-blue-400"},secrets:{title:"Secret",icon:ce,color:"text-amber-400"},services:{title:"Service",icon:ae,color:"text-cyan-400"},ingresses:{title:"Ingress",icon:oe,color:"text-purple-400"},pvcs:{title:"PersistentVolumeClaim",icon:re,color:"text-emerald-400"}},_=q[c]||q.configmaps,U=_.icon;return e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:135:5",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:g,children:e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:136:7",className:"bg-[var(--dg-bg-primary)] border border-[var(--dg-border)] rounded-xl w-[90vw] max-w-3xl max-h-[85vh] flex flex-col shadow-2xl",onClick:E=>E.stopPropagation(),children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:138:9",className:"flex items-center justify-between p-4 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:139:11",className:"flex items-center gap-2",children:[e.jsx(U,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:140:13",className:`h-5 w-5 ${_.color}`}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:141:13",children:[e.jsx("h2",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:142:15",className:"text-lg font-bold text-[var(--dg-text-primary)]",children:b?`新建 ${_.title}`:`${_.title} 编辑`}),e.jsxs("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:143:15",className:"text-xs text-[var(--dg-text-muted)]",children:[b?h:V," · ",h," · ",d]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:146:11",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:148:13",className:"flex rounded-lg border border-[var(--dg-border)] overflow-hidden",children:[e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:149:15",className:`px-3 py-1.5 text-xs font-medium transition-colors ${j==="visual"?"bg-blue-600 text-white":"bg-transparent text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>{j==="yaml"?n():P("visual")},disabled:!t&&j!=="yaml",children:"可视化编辑"}),e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:154:15",className:`px-3 py-1.5 text-xs font-medium transition-colors ${j==="yaml"?"bg-blue-600 text-white":"bg-transparent text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>{j==="visual"?C():P("yaml")},children:"YAML 编辑"})]}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:159:13",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-secondary)]",onClick:g,children:e.jsx(de,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:159:119",className:"h-4 w-4"})})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:164:9",className:"flex-1 overflow-auto p-4",children:f?e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:166:13",className:"flex items-center justify-center h-full py-20",children:e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:166:76",className:"h-6 w-6 animate-spin text-[var(--dg-text-muted)]"})}):j==="yaml"?e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:168:13",className:"space-y-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:169:15",className:"text-xs text-amber-400/80",children:"⚠️ YAML 编辑模式 — 修改后点击保存。已自动清理只读字段(status/managedFields/uid)"}),e.jsx(H,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:170:15",value:l,height:"550px",theme:X,extensions:[J()],onChange:E=>o(E),basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,autocompletion:!0},style:{fontSize:"12px"}}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:179:15",className:"flex justify-end gap-2",children:[e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:180:17",variant:"outline",size:"sm",onClick:()=>{o($(S))},children:"重置"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:181:17",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:a,disabled:m,children:[m?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:182:29",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:182:85",className:"h-3.5 w-3.5 mr-1"}),"保存"]})]})]}):t?e.jsxs(e.Fragment,{children:[c==="configmaps"&&e.jsx(le,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:189:45",manifest:t,onSave:s,saving:m,isCreate:b}),c==="secrets"&&e.jsx(ue,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:190:42",manifest:t,onSave:s,saving:m,isCreate:b}),c==="services"&&e.jsx(xe,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:191:43",manifest:t,onSave:s,saving:m,isCreate:b}),c==="ingresses"&&e.jsx(pe,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:192:44",manifest:t,onSave:s,saving:m,isCreate:b}),c==="pvcs"&&e.jsx(me,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:193:39",manifest:t,onSave:s,saving:m,isCreate:b}),!["configmaps","secrets","services","ingresses","pvcs"].includes(c)&&e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:195:17",className:"text-center py-12 text-[var(--dg-text-muted)]",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:196:19",children:"该资源类型暂不支持可视化编辑"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:197:19",variant:"outline",size:"sm",className:"mt-4",onClick:()=>P("yaml"),children:"切换到 YAML 编辑"})]})]}):e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:202:13",className:"text-center py-12 text-[var(--dg-text-muted)]",children:[e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:203:15",children:"无法解析资源结构"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:204:15",variant:"outline",size:"sm",className:"mt-4",onClick:()=>P("yaml"),children:"切换到 YAML 编辑"})]})})]})})}function le({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.data||{},[N,b]=v.useState(d?.metadata?.name||""),[i,f]=v.useState(Object.entries(g).map(([r,t])=>({key:r,value:String(t)}))),x=(r,t,u)=>{const j=[...i];j[r]={...j[r],[t]:u},f(j)},m=()=>f([...i,{key:"",value:""}]),y=r=>f(i.filter((t,u)=>u!==r)),S=()=>{const r={};i.forEach(t=>{t.key.trim()&&(r[t.key.trim()]=t.value)}),h({...d,metadata:{...d.metadata,name:N.trim()},data:r})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:241:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:242:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:243:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:244:9",value:N,onChange:r=>b(r.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:246:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:247:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:248:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"配置数据 (键值对)"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:249:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:m,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:249:88",className:"h-3 w-3 mr-1"}),"添加"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:251:9",className:"space-y-2 max-h-[45vh] overflow-y-auto pr-1",children:[i.map((r,t)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:253:13",className:"flex items-start gap-2 p-2 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:254:15",value:r.key,onChange:u=>x(t,"key",u.target.value),placeholder:"键名 (如 LOG_LEVEL)",className:"flex-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(K,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:260:15",value:r.value,onChange:u=>x(t,"value",u.target.value),placeholder:"值",className:"flex-[2] font-mono text-xs min-h-[36px] max-h-[120px] bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:266:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300 shrink-0",onClick:()=>y(t),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:267:17",className:"h-3.5 w-3.5"})})]},t)),i.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:272:13",className:"text-center py-8 text-[var(--dg-text-muted)] text-xs",children:"暂无配置数据,点击「添加」创建"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:276:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:277:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:S,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:278:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:278:77",className:"h-3.5 w-3.5 mr-1"}),"保存配置"]})})]})}function ue({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.data||{},[N,b]=v.useState(d?.metadata?.name||""),[i,f]=v.useState(Object.entries(g).map(([r,t])=>{const u=String(t);try{const j=atob(u);return{key:r,value:j,encoded:!0}}catch{return{key:r,value:u,encoded:!1}}})),x=(r,t,u)=>{const j=[...i];j[r]={...j[r],[t]:u},f(j)},m=()=>f([...i,{key:"",value:"",encoded:!0}]),y=r=>f(i.filter((t,u)=>u!==r)),S=()=>{const r={};i.forEach(t=>{t.key.trim()&&(r[t.key.trim()]=t.encoded?btoa(t.value):t.value)}),h({...d,metadata:{...d.metadata,name:N.trim()},data:r})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:327:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:328:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:329:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:330:9",value:N,onChange:r=>b(r.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:332:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:333:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"类型"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:334:9",value:d?.type||"Opaque",readOnly:!0,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:336:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:337:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:338:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"密钥数据 (已自动解码 Base64)"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:339:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:m,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:339:88",className:"h-3 w-3 mr-1"}),"添加"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:341:9",className:"space-y-2 max-h-[45vh] overflow-y-auto pr-1",children:[i.map((r,t)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:343:13",className:"flex items-start gap-2 p-2 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)]",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:344:15",value:r.key,onChange:u=>x(t,"key",u.target.value),placeholder:"键名 (如 password)",className:"flex-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:350:15",value:r.value,onChange:u=>x(t,"value",u.target.value),placeholder:"明文值",className:"flex-[2] font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:356:15",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-400 hover:text-red-300 shrink-0",onClick:()=>y(t),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:357:17",className:"h-3.5 w-3.5"})})]},t)),i.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:362:13",className:"text-center py-8 text-[var(--dg-text-muted)] text-xs",children:"暂无密钥数据,点击「添加」创建"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:366:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:367:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:S,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:368:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:368:77",className:"h-3.5 w-3.5 mr-1"}),"保存密钥"]})})]})}function xe({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.spec||{},[N,b]=v.useState(d?.metadata?.name||""),[i,f]=v.useState(g.type||"ClusterIP"),[x,m]=v.useState((g.ports||[]).map(s=>({name:s.name||"",port:String(s.port||""),targetPort:String(s.targetPort||""),protocol:s.protocol||"TCP",nodePort:s.nodePort?String(s.nodePort):""}))),[y,S]=v.useState(Object.entries(g.selector||{}).map(([s,a])=>({key:s,value:String(a)}))),r=(s,a,n)=>{const C=[...x];C[s]={...C[s],[a]:n},m(C)},t=()=>m([...x,{name:"",port:"",targetPort:"",protocol:"TCP",nodePort:""}]),u=s=>m(x.filter((a,n)=>n!==s)),j=(s,a,n)=>{const C=[...y];C[s]={...C[s],[a]:n},S(C)},P=()=>S([...y,{key:"",value:""}]),l=s=>S(y.filter((a,n)=>n!==s)),o=()=>{const s={...g};s.type=i,s.ports=x.map(n=>{const C={port:parseInt(n.port)||80,targetPort:parseInt(n.targetPort)||parseInt(n.port)||80,protocol:n.protocol};return n.name&&(C.name=n.name),n.nodePort&&i==="NodePort"&&(C.nodePort=parseInt(n.nodePort)),C});const a={};y.forEach(n=>{n.key.trim()&&(a[n.key.trim()]=n.value)}),s.selector=a,h({...d,metadata:{...d.metadata,name:N.trim()},spec:s})},p=[{value:"ClusterIP",label:"ClusterIP"},{value:"NodePort",label:"NodePort"},{value:"LoadBalancer",label:"LoadBalancer"}];return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:438:5",className:"space-y-5",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:439:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:440:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"服务名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:441:9",value:N,onChange:s=>b(s.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:443:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:444:9",className:"text-[var(--dg-text-secondary)] text-xs mb-2 block",children:"服务类型"}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:445:9",className:"flex rounded-lg border border-[var(--dg-border)] overflow-hidden w-fit",children:p.map(s=>e.jsx("button",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:447:13",type:"button",className:`px-3 py-1.5 text-xs transition-colors ${i===s.value?"bg-blue-600 text-white":"text-[var(--dg-text-secondary)] hover:bg-[var(--dg-bg-tertiary)]"}`,onClick:()=>f(s.value),children:s.label},s.value))})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:460:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:461:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:462:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"端口映射"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:463:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:t,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:463:89",className:"h-3 w-3 mr-1"}),"添加端口"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:465:9",className:"space-y-2",children:[x.map((s,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:467:13",className:"grid grid-cols-[1fr_80px_80px_80px_80px_32px] gap-2 items-center",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:468:15",value:s.name,onChange:n=>r(a,"name",n.target.value),placeholder:"名称",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:469:15",value:s.port,onChange:n=>r(a,"port",n.target.value),placeholder:"端口",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:470:15",value:s.targetPort,onChange:n=>r(a,"targetPort",n.target.value),placeholder:"目标",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsxs(D,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:471:15",value:s.protocol,onValueChange:n=>r(a,"protocol",n),children:[e.jsx(B,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:472:17",className:"h-7 text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(G,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:472:139"})}),e.jsxs(W,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:473:17",children:[e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:473:32",value:"TCP",children:"TCP"}),e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:473:72",value:"UDP",children:"UDP"})]})]}),i==="NodePort"?e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:476:17",value:s.nodePort,onChange:n=>r(a,"nodePort",n.target.value),placeholder:"NodePort",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}):e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:477:19"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:478:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>u(a),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:478:133",className:"h-3 w-3"})})]},a)),x.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:481:34",className:"text-center py-4 text-[var(--dg-text-muted)] text-xs",children:"暂无端口,点击「添加端口」"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:486:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:487:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:488:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"选择器 (Selector)"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:489:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:P,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:489:93",className:"h-3 w-3 mr-1"}),"添加标签"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:491:9",className:"space-y-2",children:[y.map((s,a)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:493:13",className:"flex items-center gap-2",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:494:15",value:s.key,onChange:n=>j(a,"key",n.target.value),placeholder:"键 (如 app)",className:"flex-1 font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx("span",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:495:15",className:"text-[var(--dg-text-muted)] text-xs",children:"="}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:496:15",value:s.value,onChange:n=>j(a,"value",n.target.value),placeholder:"值 (如 nginx)",className:"flex-1 font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:497:15",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>l(a),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:497:137",className:"h-3 w-3"})})]},a)),y.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:500:37",className:"text-center py-4 text-[var(--dg-text-muted)] text-xs",children:"暂无选择器"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:504:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:505:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:o,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:506:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:506:77",className:"h-3.5 w-3.5 mr-1"}),"保存 Service"]})})]})}function pe({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.spec||{},[N,b]=v.useState(d?.metadata?.name||""),[i,f]=v.useState(g.ingressClassName||"nginx"),[x,m]=v.useState((g.rules||[]).map(l=>({host:l.host||"",paths:l.http?.backend?.servicePort!=null?[{path:"/",pathType:"Prefix",serviceName:l.http?.backend?.serviceName||"",servicePort:String(l.http?.backend?.servicePort||"80")}]:(l.http?.paths||[]).map(o=>({path:o.path||"/",pathType:o.pathType||"Prefix",serviceName:o.backend?.service?.name||o.backend?.serviceName||"",servicePort:String(o.backend?.service?.port?.number??o.backend?.servicePort??"80")}))}))),y=(l,o)=>{const p=[...x];p[l]={...p[l],host:o},m(p)},S=()=>m([...x,{host:"",paths:[{path:"/",pathType:"Prefix",serviceName:"",servicePort:"80"}]}]),r=l=>m(x.filter((o,p)=>p!==l)),t=(l,o,p,s)=>{const a=[...x];a[l].paths[o]={...a[l].paths[o],[p]:s},m(a)},u=l=>{const o=[...x];o[l].paths.push({path:"/",pathType:"Prefix",serviceName:"",servicePort:"80"}),m(o)},j=(l,o)=>{const p=[...x];p[l].paths=p[l].paths.filter((s,a)=>a!==o),m(p)},P=()=>{const l=x.map(p=>({host:p.host,http:{paths:p.paths.map(s=>({path:s.path,pathType:s.pathType,backend:{service:{name:s.serviceName,port:{number:parseInt(s.servicePort)||80}}}}))}})),o={...g,rules:l};i.trim()?o.ingressClassName=i.trim():delete o.ingressClassName,h({...d,metadata:{...d.metadata,name:N.trim()},spec:o})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:579:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:580:7",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:581:9",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:582:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:583:11",value:N,onChange:l=>b(l.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:585:9",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:586:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"Ingress Class"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:587:11",value:i,onChange:l=>f(l.target.value),placeholder:"nginx / alb",className:"mt-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)]"})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:590:7",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:591:9",className:"flex items-center justify-between mb-2",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:592:11",className:"text-[var(--dg-text-secondary)] text-sm",children:"路由规则"}),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:593:11",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:S,children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:593:89",className:"h-3 w-3 mr-1"}),"添加 Host"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:595:9",className:"space-y-3 max-h-[50vh] overflow-y-auto pr-1",children:[x.map((l,o)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:597:13",className:"p-3 rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-secondary)] space-y-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:598:15",className:"flex items-center gap-2",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:599:17",value:l.host,onChange:p=>y(o,p.target.value),placeholder:"域名 (如 api.example.com)",className:"flex-1 font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:605:17",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>r(o),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:605:136",className:"h-3 w-3"})})]}),l.paths.map((p,s)=>e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:608:17",className:"grid grid-cols-[1fr_100px_1fr_60px_28px] gap-1.5 items-center pl-4",children:[e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:609:19",value:p.path,onChange:a=>t(o,s,"path",a.target.value),placeholder:"路径 /",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsxs(D,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:610:19",value:p.pathType,onValueChange:a=>t(o,s,"pathType",a),children:[e.jsx(B,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:611:21",className:"h-7 text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:e.jsx(G,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:611:143"})}),e.jsxs(W,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:612:21",children:[e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:612:36",value:"Prefix",children:"Prefix"}),e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:612:82",value:"Exact",children:"Exact"})]})]}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:614:19",value:p.serviceName,onChange:a=>t(o,s,"serviceName",a.target.value),placeholder:"Service",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:615:19",value:p.servicePort,onChange:a=>t(o,s,"servicePort",a.target.value),placeholder:"端口",type:"number",className:"font-mono text-xs h-7 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:616:19",variant:"ghost",size:"icon",className:"h-7 w-7 text-red-400 hover:text-red-300",onClick:()=>j(o,s),children:e.jsx(Y,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:616:142",className:"h-3 w-3"})})]},s)),e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:619:15",variant:"ghost",size:"sm",className:"h-6 text-xs text-[var(--dg-text-muted)]",onClick:()=>u(o),children:[e.jsx(L,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:619:129",className:"h-3 w-3 mr-1"}),"添加路径"]})]},o)),x.length===0&&e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:622:34",className:"text-center py-4 text-[var(--dg-text-muted)] text-xs",children:"暂无路由规则,点击「添加 Host」"})]})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:625:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:626:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:P,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:627:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:627:77",className:"h-3.5 w-3.5 mr-1"}),"保存 Ingress"]})})]})}function me({manifest:d,onSave:h,saving:c,isCreate:V}){const g=d?.spec||{},N=g.resources?.requests||{},[b,i]=v.useState(d?.metadata?.name||""),[f,x]=v.useState(N.storage||"1Gi"),[m,y]=v.useState(g.accessModes?.[0]||"ReadWriteOnce"),[S,r]=v.useState(g.storageClassName||""),t=()=>{h({...d,metadata:{...d.metadata,name:b.trim()},spec:{...g,accessModes:[m],storageClassName:S||void 0,resources:{requests:{storage:f}}}})};return e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:660:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:661:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:662:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"名称"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:663:9",value:b,onChange:u=>i(u.target.value),readOnly:!V,className:"mt-1 font-mono text-xs bg-[var(--dg-bg-tertiary)]"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:665:7",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:666:9",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:667:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"存储大小"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:668:11",value:f,onChange:u=>x(u.target.value),placeholder:"如 10Gi",className:"mt-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"}),e.jsx("p",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:674:11",className:"text-[10px] text-[var(--dg-text-muted)] mt-1",children:"单位:Gi (GiB), Mi (MiB), Ti (TiB)"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:676:9",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:677:11",className:"text-[var(--dg-text-secondary)] text-xs",children:"访问模式"}),e.jsxs(D,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:678:11",value:m,onValueChange:y,children:[e.jsx(B,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:679:13",className:"mt-1 h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] text-xs",children:e.jsx(G,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:680:15"})}),e.jsxs(W,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:682:13",children:[e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:683:15",value:"ReadWriteOnce",children:"ReadWriteOnce (单节点读写)"}),e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:684:15",value:"ReadOnlyMany",children:"ReadOnlyMany (多节点只读)"}),e.jsx(T,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:685:15",value:"ReadWriteMany",children:"ReadWriteMany (多节点读写)"})]})]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:690:7",children:[e.jsx(w,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:691:9",className:"text-[var(--dg-text-secondary)] text-xs",children:"StorageClass"}),e.jsx(k,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:692:9",value:S,onChange:u=>r(u.target.value),placeholder:"留空使用默认 StorageClass",className:"mt-1 font-mono text-xs h-8 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:699:7",className:"flex justify-end gap-2 pt-2 border-t border-[var(--dg-border)]",children:e.jsxs(R,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:700:9",size:"sm",className:"bg-blue-600 hover:bg-blue-700",onClick:t,disabled:c,children:[c?e.jsx(z,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:701:21",className:"h-3.5 w-3.5 animate-spin mr-1"}):e.jsx(O,{"code-path":"src/components/kubernetes/ResourceVisualEditor.tsx:701:77",className:"h-3.5 w-3.5 mr-1"}),"保存 PVC"]})})]})}export{Ne as R}; diff --git a/backend/static/assets/ScriptManager-Dz9eHvUK.js b/backend/static/assets/ScriptManager-C1CLQVy5.js similarity index 97% rename from backend/static/assets/ScriptManager-Dz9eHvUK.js rename to backend/static/assets/ScriptManager-C1CLQVy5.js index 165107b..813fbaf 100644 --- a/backend/static/assets/ScriptManager-Dz9eHvUK.js +++ b/backend/static/assets/ScriptManager-C1CLQVy5.js @@ -1,4 +1,4 @@ -import{j as t,r as i}from"./vendor-codemirror-C7mXSpXt.js";import{D as $,a as B,b as P,c as O,d as A,e as I,B as p,q as Z,f as Lt,t as l}from"./index-LZWfu62c.js";import{I as D}from"./input-BdDauX3U.js";import{S as tt,a as et,b as ot,c as st,d as z}from"./select-4xU_9B3_.js";import{T as _t,a as zt,b as J,c as K}from"./tabs-kmtfM2I-.js";import{C as at}from"./checkbox-DL3onEGv.js";import{s as j,t as $t}from"./automation-BrmX02Sx.js";import{B as N}from"./badge-B0F5ZNtn.js";import{a as Bt,y as ct,L as V,b as Pt,o as nt,aE as rt,x as Ot,z as At,aF as It,T as it,n as pt,r as Vt,S as qt,P as Rt}from"./vendor-icons-Aso0-eeY.js";import{L as v}from"./label-u-lNUbKh.js";import{T as Ht}from"./textarea-BdtIagjy.js";import{C as lt,b as Qt,c as Ut,d as Xt,a as mt}from"./card-B-RtdR4H.js";import"./index-CYARH0Cq.js";function Gt(o){return{id:o.id,name:o.name,code:o.code||"",description:o.description||"",type:o.type||"shell",content:o.content||"",timeout:o.timeout||300,version:o.version||1,run_count:o.run_count||0,created_at:o.created_at,updated_at:o.updated_at}}const w=[{value:"shell",label:"Shell",sample:`#!/bin/bash +import{j as t,r as i}from"./vendor-codemirror-B1SGo4xl.js";import{D as $,a as B,b as P,c as O,d as A,e as I,B as p,q as Z,f as Lt,t as l}from"./index-Bp-M7P_8.js";import{I as D}from"./input-Bnlm--la.js";import{S as tt,a as et,b as ot,c as st,d as z}from"./select-DbhcBWnH.js";import{T as _t,a as zt,b as J,c as K}from"./tabs-DbNlmoQJ.js";import{C as at}from"./checkbox-Bsb-ZRm9.js";import{s as j,t as $t}from"./automation-BAtbOw0o.js";import{B as N}from"./badge-B00SZHvE.js";import{a as Bt,y as ct,L as V,b as Pt,o as nt,aE as rt,x as Ot,z as At,aF as It,T as it,n as pt,r as Vt,S as qt,P as Rt}from"./vendor-icons-BWk-DH7F.js";import{L as v}from"./label-NkONM5Mp.js";import{T as Ht}from"./textarea-BvOVhaCD.js";import{C as lt,b as Qt,c as Ut,d as Xt,a as mt}from"./card-BHSBTtub.js";import"./index-5FEebgvX.js";function Gt(o){return{id:o.id,name:o.name,code:o.code||"",description:o.description||"",type:o.type||"shell",content:o.content||"",timeout:o.timeout||300,version:o.version||1,run_count:o.run_count||0,created_at:o.created_at,updated_at:o.updated_at}}const w=[{value:"shell",label:"Shell",sample:`#!/bin/bash # 系统巡检脚本 echo "===== 系统信息 =====" uname -a diff --git a/backend/static/assets/ServerManager-D6Uxl03e.js b/backend/static/assets/ServerManager-TbveS5oM.js similarity index 98% rename from backend/static/assets/ServerManager-D6Uxl03e.js rename to backend/static/assets/ServerManager-TbveS5oM.js index e4b0043..e07c2e6 100644 --- a/backend/static/assets/ServerManager-D6Uxl03e.js +++ b/backend/static/assets/ServerManager-TbveS5oM.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D1_Nt40_.js","assets/index-LZWfu62c.js","assets/vendor-codemirror-C7mXSpXt.js","assets/vendor-icons-Aso0-eeY.js","assets/index-BzYDIT5o.css","assets/dashboard-7Sl2aero.js","assets/server-BUAZv7ZV.js","assets/region-BZBRxF2X.js","assets/index-Z0O8nAcG.js","assets/pipeline-Lgvc2XUS.js","assets/config-DAXaHuse.js","assets/credential-CwQY-4Ba.js","assets/automation-BrmX02Sx.js","assets/alert-C4MMKcUL.js","assets/alert-center-dJk4LGZM.js","assets/site-B-pRndoi.js","assets/trace-L8uY5gM3.js","assets/grafana-DTc3taUi.js","assets/datasource-DuIT0c1H.js","assets/metrics-Dj4l07HZ.js","assets/agent-g0Vk8FYK.js","assets/account-Dzyhyahe.js","assets/platform-g_u95ryi.js","assets/billing-9Cbmzl6K.js","assets/audit-BiL35K5G.js","assets/terminal-BchqP-zB.js","assets/approval-DmGRfKd6.js","assets/ai-BMSiZ3PN.js"])))=>i.map(i=>d[i]); -import{j as e,r as o}from"./vendor-codemirror-C7mXSpXt.js";import{G as ir,a8 as $r,D as Te,a as _e,b as Ke,c as Re,d as Me,B as j,e as Qe,o as vr,m as ie,t as G,v as Or,r as Lr,K as zr,s as Je,x as Hr,P as Ur,w as Dr,W as Vr,at as hr,a9 as gr,aa as ur,ab as br,ac as Sr,ad as qe,ae as he,f as Wr}from"./index-LZWfu62c.js";import{C as Fe,a as ke}from"./card-B-RtdR4H.js";import{I as W}from"./input-BdDauX3U.js";import{C as ge}from"./checkbox-DL3onEGv.js";import{b as Oe,e as Z,T as qr,a as Gr,c as ne,d as Kr}from"./table-BPFYQwjr.js";import{S as fe,a as we,b as Ce,c as Ie,d as U}from"./select-4xU_9B3_.js";import{u as Qr,q as jr,a as Jr,b as Xr}from"./unwrap-BmWy-KM2.js";import{u as $e}from"./useMutation-Bp3lz5hm.js";import{s as ee}from"./server-BUAZv7ZV.js";import{S as Yr}from"./stat-strip-BPzU38xY.js";import{B as O}from"./badge-B0F5ZNtn.js";import{c as ye}from"./account-Dzyhyahe.js";import{i as Nr,ag as Le,M as We,y as cr,w as ue,f as Ee,R as de,S as yr,ab as ze,h as He,b5 as Xe,an as fr,ao as wr,X as be,j as Cr,am as Ir,L as Ue,ah as Ye,b6 as Zr,ap as es,aL as nr,m as rs,aM as ss,v as Ze,T as er,b7 as Ge,Q as ts,$ as os,N as as,H as cs,r as dr,aP as ns,aE as ds,P as ls}from"./vendor-icons-Aso0-eeY.js";import{x as ps,a as ms}from"./vendor-xterm-20M9KZE1.js";import{m as xs,a as is,f as vs}from"./xterm-utils-slbfdUHf.js";import{c as rr,s as hs}from"./credential-CwQY-4Ba.js";import{r as gs}from"./region-BZBRxF2X.js";import{L as V}from"./label-u-lNUbKh.js";import{T as lr}from"./textarea-BdtIagjy.js";import"./index-CYARH0Cq.js";function us(r={page:1,page_size:100}){return Qr({queryKey:jr.servers(r),queryFn:async()=>{const p=await ee.getServers(r);return{list:Xr(p),total:Jr(p)}},staleTime:3e4})}function bs(){const r=ir(),p=()=>r.invalidateQueries({queryKey:["servers"]}),c=$e({mutationFn:u=>ee.createServer(u),onSuccess:p}),t=$e({mutationFn:({id:u,data:g})=>ee.updateServer(u,g),onSuccess:p}),a=$e({mutationFn:u=>ee.deleteServer(u),onSuccess:p}),v=$e({mutationFn:u=>ee.batchDelete(u),onSuccess:p});return{createMutation:c,updateMutation:t,deleteMutation:a,batchDeleteMutation:v,invalidate:p}}function Ss({servers:r}){const p=r.filter(a=>a.status==="running").length,c=r.filter(a=>a.status==="maintenance").length,t=r.filter(a=>a.status==="stopped").length;return e.jsx(Yr,{"code-path":"src/components/server/ServerStatsStrip.tsx:14:5",items:[{label:"服务器",value:r.length,color:"blue"},{label:"运行中",value:p,color:"emerald"},{label:"维护中",value:c,color:"amber"},{label:"已停止",value:t,color:"muted"}]})}const js=[{id:"aws",name:"AWS",color:"bg-orange-500",icon:"AWS"},{id:"aliyun",name:"阿里云",color:"bg-orange-600",icon:"AL"},{id:"tencent",name:"腾讯云",color:"bg-blue-500",icon:"TX"},{id:"huawei",name:"华为云",color:"bg-red-500",icon:"HW"},{id:"azure",name:"Azure",color:"bg-blue-600",icon:"AZ"}];function Ns({open:r,onClose:p}){const[c,t]=o.useState([]),[a,v]=o.useState(1),[u,g]=o.useState(""),[x,_]=o.useState(null),[S,E]=o.useState([]),[n,y]=o.useState([]),[f,R]=o.useState(""),[w,i]=o.useState(!1),[h,C]=o.useState([]),[I,D]=o.useState([]),[L,N]=o.useState(!1),[z,m]=o.useState([]),[b,M]=o.useState(!1),[F,A]=o.useState(null),[Y,q]=o.useState("22"),[re,l]=o.useState([]),[$,Q]=o.useState(""),J=async()=>{try{const s=await ye.getAccounts();t(s?.list||[])}catch(s){console.error("加载云账号失败:",s)}};o.useEffect(()=>{r&&(J(),$r(async()=>{const{credentialApi:s}=await import("./index-D1_Nt40_.js");return{credentialApi:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])).then(({credentialApi:s})=>{s.list().then(T=>l(T?.list||[])).catch(()=>l([]))}))},[r]);const B=c.filter(s=>s.provider===u&&s.status==="active"),X=o.useCallback(async s=>{try{return(await ye.getAccountRegions(s))?.list||[]}catch{return[]}},[]),K=o.useCallback(async s=>{i(!0);try{await ye.syncRegions(s);const T=await X(s);E(T)}catch(T){throw console.error("同步区域失败:",T),T}finally{i(!1)}},[X]),P=o.useCallback(async()=>{if(!x)return;const s=await X(x.id);if(E(s),s.length===0)try{await K(x.id)}catch{}},[x,X,K]),me=o.useCallback(async()=>{if(!(!x||n.length===0)){N(!0),m([]),C([]),D([]);try{const s=await ye.discoverInstances(x.id,n);C(s?.list||[]),m(s?.errors||[])}catch(s){console.error("发现主机失败:",s),m([s?.message||"发现主机失败"])}finally{N(!1)}}},[x,n]),se=async()=>{if(!(!x||I.length===0)){M(!0);try{const s=h.filter(ae=>I.includes(ae.instance_id)),T=await ye.importInstances(x.id,s,{default_port:Number(Y)||22,credential_id:$?Number($):void 0});A(T||{imported:0,skipped:0})}catch(s){console.error("导入失败:",s)}finally{M(!1)}}},H=()=>{a===2&&x&&a<4?(v(3),P()):a<4&&v(a+1)},Se=()=>{a>1&&v(a-1)},Be=()=>{n.length===S.length&&S.length>0?y([]):y(S.map(s=>s.code))},Ve=s=>{D(T=>T.includes(s)?T.filter(ae=>ae!==s):[...T,s])},Pe=()=>{I.length===h.length&&h.length>0?D([]):D(h.map(s=>s.instance_id))},je=()=>{p(),v(1),g(""),_(null),y([]),E([]),C([]),D([]),R(""),m([]),A(null),q("22"),Q("")},oe=S.filter(s=>!f||s.name?.toLowerCase().includes(f.toLowerCase())||s.code?.toLowerCase().includes(f.toLowerCase())),ve=[{id:1,title:"公有云",icon:Nr},{id:2,title:"访问凭据",icon:Le},{id:3,title:"选择区域",icon:We},{id:4,title:"导入确认",icon:cr}];return e.jsx(Te,{"code-path":"src/components/server/CloudServerImport.tsx:232:5",open:r,onOpenChange:je,children:e.jsxs(_e,{"code-path":"src/components/server/CloudServerImport.tsx:233:7",className:"max-w-3xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsxs(Ke,{"code-path":"src/components/server/CloudServerImport.tsx:234:9",children:[e.jsx(Re,{"code-path":"src/components/server/CloudServerImport.tsx:235:11",className:"text-xl",children:"导入云主机"}),e.jsx(Me,{"code-path":"src/components/server/CloudServerImport.tsx:236:11",className:"sr-only",children:"从云平台批量导入主机资产"})]}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:240:9",className:"flex items-center justify-center mb-6 flex-wrap gap-1",children:ve.map((s,T)=>e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:242:13",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:243:15",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm ${a===s.id?"bg-blue-600 text-white":a>s.id?"bg-emerald-600/20 text-emerald-400":"bg-[var(--dg-bg-secondary)] text-[var(--dg-text-muted)]"}`,children:[e.jsx(s.icon,{"code-path":"src/components/server/CloudServerImport.tsx:250:17",className:"h-4 w-4"}),e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:251:17",className:"font-medium hidden sm:inline",children:s.title}),a>s.id&&e.jsx(ue,{"code-path":"src/components/server/CloudServerImport.tsx:252:33",className:"h-3 w-3 ml-1"})]}),Te.jsx(Fe,{"code-path":"src/components/server/CloudServerImport.tsx:267:17",className:`cursor-pointer transition-all ${u===s.id?"border-blue-500 ring-2 ring-blue-500/30 bg-[var(--dg-bg-secondary)]":"border-[var(--dg-border)] hover:border-blue-500 bg-[var(--dg-bg-secondary)]"}`,onClick:()=>g(s.id),children:e.jsxs(ke,{"code-path":"src/components/server/CloudServerImport.tsx:276:19",className:"p-4 flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:277:21",className:`w-10 h-10 rounded-lg ${s.color} flex items-center justify-center text-white font-bold text-sm`,children:s.icon}),e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:280:21",className:"font-medium text-[var(--dg-text-primary)]",children:s.name})]})},s.id))})]}),a===2&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:290:11",className:"space-y-4",children:[e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:291:13",className:"text-[var(--dg-text-secondary)] text-sm",children:"请选择访问凭据(AccessKey)"}),B.length>0?e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:293:15",className:"space-y-2 max-h-[300px] overflow-y-auto",children:B.map(s=>e.jsx(Fe,{"code-path":"src/components/server/CloudServerImport.tsx:295:19",className:`cursor-pointer transition-all ${x?.id===s.id?"border-blue-500 ring-1 ring-blue-500/30 bg-[var(--dg-bg-secondary)]":"border-[var(--dg-border)] hover:border-blue-500 bg-[var(--dg-bg-secondary)]"}`,onClick:()=>_(s),children:e.jsxs(ke,{"code-path":"src/components/server/CloudServerImport.tsx:304:21",className:"p-3 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:305:23",className:"flex items-center gap-3",children:[e.jsx(Le,{"code-path":"src/components/server/CloudServerImport.tsx:306:25",className:"h-5 w-5 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:307:25",children:[e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:308:27",className:"font-medium text-[var(--dg-text-primary)]",children:s.name}),e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:309:27",className:"text-xs text-[var(--dg-text-muted)]",children:[(s.access_key||s.accessKey||"******").slice(0,20),"..."]})]})]}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:314:23",className:"text-right",children:[e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:315:25",className:"bg-emerald-500/20 text-emerald-400 border-0",children:[s.region_count??s.regionCount??0," 区域"]}),e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:318:25",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:[s.server_count??s.serverCount??0," 服务器"]})]})]})},s.id))}):e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:325:15",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[e.jsx(Le,{"code-path":"src/components/server/CloudServerImport.tsx:326:17",className:"h-12 w-12 mx-auto mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:327:17",children:"该云平台暂无有效的访问凭据"})]})]}),a===3&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:335:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:336:13",className:"flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:337:15",className:"text-[var(--dg-text-secondary)] text-sm",children:["请选择要同步的区域",S.length>0&&e.jsxs("span",{"code-path":"src/components/server/CloudServerImport.tsx:340:19",className:"ml-2 text-[var(--dg-text-muted)]",children:["(共 ",S.length," 个区域,已选 ",n.length," 个)"]})]}),e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:343:15",variant:"outline",size:"sm",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>x&&K(x.id),disabled:w,children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:350:17",className:`h-3 w-3 mr-1 ${w?"animate-spin":""}`}),w?"同步中...":"刷新区域"]})]}),w?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:356:15",className:"text-center py-12",children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:357:17",className:"h-8 w-8 mx-auto mb-3 animate-spin text-blue-400"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:358:17",className:"text-[var(--dg-text-secondary)]",children:"正在从云平台同步区域列表..."})]}):S.length===0?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:361:15",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[e.jsx(We,{"code-path":"src/components/server/CloudServerImport.tsx:362:17",className:"h-10 w-10 mx-auto mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:363:17",children:"暂无区域数据"}),e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:364:17",variant:"outline",size:"sm",className:"mt-3 border-[var(--dg-border)] text-blue-400",onClick:()=>x&&K(x.id),children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:370:19",className:"h-3 w-3 mr-1"}),"立即同步"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:377:17",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:378:19",className:"relative flex-1",children:[e.jsx(yr,{"code-path":"src/components/server/CloudServerImport.tsx:379:21",className:"h-4 w-4 absolute left-3 top-1/2 -translate-y-1/2 text-[var(--dg-text-muted)]"}),e.jsx(W,{"code-path":"src/components/server/CloudServerImport.tsx:380:21",placeholder:"搜索区域名称或编码...",value:f,onChange:s=>R(s.target.value),className:"pl-9 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]"})]}),e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:387:19",variant:"outline",size:"sm",onClick:Be,className:"border-[var(--dg-border)]",children:n.length===S.length&&S.length>0?"取消全选":"全选"})]}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:393:17",className:"border rounded-lg border-[var(--dg-border)] overflow-hidden max-h-[300px] overflow-y-auto",children:e.jsxs("table",{"code-path":"src/components/server/CloudServerImport.tsx:394:19",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/server/CloudServerImport.tsx:395:21",className:"bg-[var(--dg-bg-secondary)] sticky top-0",children:e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:396:23",children:[e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:397:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)] w-10",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:398:27",checked:n.length===S.length&&S.length>0,onCheckedChange:Be})}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:403:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"区域编码"}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:404:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"区域名称"}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:405:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"Endpoint"})]})}),e.jsx("tbody",{"code-path":"src/components/server/CloudServerImport.tsx:408:21",className:"divide-y divide-[var(--dg-border)]",children:oe.map(s=>e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:410:25",className:`cursor-pointer hover:bg-[var(--dg-bg-hover)] ${n.includes(s.code)?"bg-blue-500/10":""}`,onClick:()=>{y(T=>T.includes(s.code)?T.filter(ae=>ae!==s.code):[...T,s.code])},children:[e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:421:27",className:"px-3 py-2",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:422:29",checked:n.includes(s.code)})}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:424:27",className:"px-3 py-2 text-sm text-blue-400 font-mono",children:s.code}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:425:27",className:"px-3 py-2 text-sm text-[var(--dg-text-primary)]",children:s.name}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:426:27",className:"px-3 py-2 text-xs text-[var(--dg-text-muted)] font-mono truncate max-w-[200px]",children:s.endpoint||"-"})]},s.id||s.code))})]})})]})]}),a===4&&e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:439:11",className:"space-y-4",children:F?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:442:15",className:"text-center py-12",children:[e.jsx(cr,{"code-path":"src/components/server/CloudServerImport.tsx:443:17",className:"h-12 w-12 mx-auto mb-3 text-emerald-400"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:444:17",className:"text-lg font-medium text-[var(--dg-text-primary)]",children:"导入完成"}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:445:17",className:"flex items-center justify-center gap-6 mt-4",children:[e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:446:19",className:"bg-emerald-500/20 text-emerald-400 border-0 text-base px-4 py-1",children:["成功导入 ",F.imported," 台"]}),F.skipped>0&&e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:450:21",className:"bg-amber-500/20 text-amber-400 border-0 text-base px-4 py-1",children:["跳过 ",F.skipped," 台(已存在)"]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:458:17",className:"flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:459:19",className:"text-[var(--dg-text-secondary)] text-sm",children:["已选 ",n.length," 个区域",h.length>0&&e.jsxs("span",{"code-path":"src/components/server/CloudServerImport.tsx:462:23",className:"ml-2",children:["· 发现 ",h.length," 台主机"]})]}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:465:19",className:"flex items-center gap-2",children:[h.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:468:25",variant:"outline",size:"sm",onClick:Pe,className:"border-[var(--dg-border)]",children:I.length===h.length&&h.length>0?"取消全选":"全选"}),e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:471:25",className:"bg-blue-500/20 text-blue-400 border-0",children:["已选 ",I.length," 台"]})]}),e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:476:21",variant:"outline",size:"sm",onClick:me,disabled:L||n.length===0,className:"border-[var(--dg-border)] text-blue-400",children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:483:23",className:`h-3 w-3 mr-1 ${L?"animate-spin":""}`}),L?"发现中...":h.length>0?"重新发现":"发现主机"]})]})]}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:490:17",className:"flex flex-wrap gap-1",children:n.map(s=>{const T=S.find(ae=>ae.code===s);return e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:494:23",className:"bg-[var(--dg-bg-secondary)] text-[var(--dg-text-muted)] border border-[var(--dg-border)] text-xs",children:[e.jsx(We,{"code-path":"src/components/server/CloudServerImport.tsx:495:25",className:"h-3 w-3 mr-1"}),T?.name||s]},s)})}),z.length>0&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:504:19",className:"flex items-start gap-2 p-3 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-400 text-sm",children:[e.jsx(ze,{"code-path":"src/components/server/CloudServerImport.tsx:505:21",className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:506:21",children:[e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:507:23",className:"font-medium",children:"部分区域发现失败:"}),z.map((s,T)=>e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:509:25",className:"text-xs mt-1 opacity-80",children:s},T))]})]}),L?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:517:19",className:"text-center py-12",children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:518:21",className:"h-8 w-8 mx-auto mb-3 animate-spin text-blue-400"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:519:21",className:"text-[var(--dg-text-secondary)]",children:"正在发现云主机,请稍候..."}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:520:21",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"正在逐区域查询,可能需要数秒"})]}):h.length===0&&!L?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:523:19",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[e.jsx(He,{"code-path":"src/components/server/CloudServerImport.tsx:524:21",className:"h-10 w-10 mx-auto mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:525:21",children:'点击"发现主机"按钮,开始扫描所选区域'})]}):e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:528:19",className:"border rounded-lg border-[var(--dg-border)] overflow-hidden max-h-[300px] overflow-y-auto",children:e.jsxs("table",{"code-path":"src/components/server/CloudServerImport.tsx:529:21",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/server/CloudServerImport.tsx:530:23",className:"bg-[var(--dg-bg-secondary)] sticky top-0",children:e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:531:25",children:[e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:532:27",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)] w-10",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:533:29",checked:I.length===h.length&&h.length>0,onCheckedChange:Pe})}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:538:27",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"主机名"}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:539:27",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"IP地址"})]})}),e.jsx("tbody",{"code-path":"src/components/server/CloudServerImport.tsx:542:23",className:"divide-y divide-[var(--dg-border)]",children:h.map(s=>e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:544:27",className:`cursor-pointer hover:bg-[var(--dg-bg-hover)] ${I.includes(s.instance_id)?"bg-blue-500/10":""}`,onClick:()=>Ve(s.instance_id),children:[e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:549:29",className:"px-3 py-2",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:550:31",checked:I.includes(s.instance_id)})}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:552:29",className:"px-3 py-2 text-sm text-[var(--dg-text-primary)]",children:s.instance_name||s.hostname||"-"}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:553:29",className:"px-3 py-2 text-sm text-[var(--dg-text-secondary)]",children:s.private_ip||s.public_ip||"-"})]},s.instance_id))})]})}),h.length>0&&I.length>0&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:565:19",className:"grid grid-cols-2 gap-4 p-4 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:566:21",children:[e.jsxs("label",{"code-path":"src/components/server/CloudServerImport.tsx:567:23",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:["SSH 端口",e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:569:25",className:"text-[var(--dg-text-muted)] ml-1",children:"(导入时统一设置)"})]}),e.jsx(W,{"code-path":"src/components/server/CloudServerImport.tsx:571:23",type:"number",placeholder:"22",value:Y,onChange:s=>q(s.target.value),className:"w-32 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:579:21",children:[e.jsxs("label",{"code-path":"src/components/server/CloudServerImport.tsx:580:23",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:["关联凭证",e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:582:25",className:"text-[var(--dg-text-muted)] ml-1",children:"(可选,用于SSH远程管理)"})]}),e.jsxs("select",{"code-path":"src/components/server/CloudServerImport.tsx:584:23",value:$,onChange:s=>Q(s.target.value),className:"w-full px-3 py-1.5 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md text-[var(--dg-text-primary)] text-xs",children:[e.jsx("option",{"code-path":"src/components/server/CloudServerImport.tsx:589:25",value:"",children:"不使用凭据"}),re.map(s=>e.jsxs("option",{"code-path":"src/components/server/CloudServerImport.tsx:591:27",value:String(s.id),children:[s.type==="ssh_key"?"🔑":"🔒"," ",s.name]},s.id))]})]})]})]})}),e.jsxs(Qe,{"code-path":"src/components/server/CloudServerImport.tsx:605:9",className:"flex justify-between items-center",children:[e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:606:11",children:a>1&&!F&&e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:608:15",variant:"outline",onClick:Se,className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:[e.jsx(Xe,{"code-path":"src/components/server/CloudServerImport.tsx:609:17",className:"h-4 w-4 mr-1"}),"上一步"]})}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:614:11",className:"flex gap-2",children:F?e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:616:15",onClick:je,className:"bg-blue-600 hover:bg-blue-700",children:"完成"}):e.jsxs(e.Fragment,{children:[e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:621:17",variant:"outline",onClick:je,className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"取消"}),a<4?e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:625:19",onClick:H,disabled:a===1&&!u||a===2&&!x||a===3&&n.length===0,className:"bg-blue-600 hover:bg-blue-700",children:["下一步",e.jsx(Ee,{"code-path":"src/components/server/CloudServerImport.tsx:635:21",className:"h-4 w-4 ml-1"})]}):e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:638:19",onClick:se,disabled:I.length===0||b,className:"bg-emerald-600 hover:bg-emerald-700",children:b?e.jsxs(e.Fragment,{children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:645:25",className:"h-4 w-4 mr-1 animate-spin"}),"导入中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{"code-path":"src/components/server/CloudServerImport.tsx:650:25",className:"h-4 w-4 mr-1"}),"确认导入 (",I.length,")"]})})]})})]})]})})}function ys({open:r,onOpenChange:p,serverId:c,serverName:t,serverIp:a,hasAuth:v=!0}){const u=o.useRef(null),g=o.useRef(null),x=o.useRef(null),_=o.useRef(null),[S,E]=o.useState(!1),[n,y]=o.useState(!1),[f,R]=o.useState([]),[w,i]=o.useState(""),[h,C]=o.useState(!1),[I,D]=o.useState(v);o.useEffect(()=>{!r||v||rr.list().then(N=>R(N?.list||[])).catch(()=>{})},[r,v]);const L=async()=>{if(!(!w||!c))try{C(!0),await hs.assign(c,Number(w)),G.success("凭据已关联"),D(!0)}catch(N){G.error(N?.message||"关联失败")}finally{C(!1)}};return o.useEffect(()=>{r||(D(v),i(""))},[r,v]),o.useEffect(()=>{if(!r||!c||!I)return;const N=new ps.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,theme:{background:"#0a0e14",foreground:"#d6d6d6",cursor:"#d6d6d6",selectionBackground:"rgba(255,255,255,0.2)"}}),z=new ms.FitAddon;N.loadAddon(z),g.current=N,_.current=z;const m=location.protocol==="https:"?"wss":"ws",b=vr.getState().token||"",M=`${m}://${location.host}/ws/terminal?id=${c}&cols=80&rows=24&token=${encodeURIComponent(b)}`,F=new WebSocket(M);return x.current=F,N.onData(A=>{F.readyState===WebSocket.OPEN&&F.send(JSON.stringify({status:0,data:A}))}),F.onmessage=A=>{try{const Y=JSON.parse(A.data);Y.status===0&&typeof Y.data=="string"&&N.write(Y.data)}catch{N.write(typeof A.data=="string"?A.data:"")}},F.onopen=()=>{E(!0),xs(N,z,()=>u.current,F)},F.onclose=()=>{E(!1),N.write(`\r +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CoCXV_ZR.js","assets/index-Bp-M7P_8.js","assets/vendor-codemirror-B1SGo4xl.js","assets/vendor-icons-BWk-DH7F.js","assets/index-6V28XIIj.css","assets/dashboard-50x02M_T.js","assets/server-B7EY-8NK.js","assets/region-D3lxTXmh.js","assets/index-BkulU9RM.js","assets/pipeline-BGteNHr0.js","assets/config-CBy2SxR-.js","assets/credential-Df-OY-sx.js","assets/automation-BAtbOw0o.js","assets/alert-CRDraqCb.js","assets/alert-center-C9EzZkDY.js","assets/site-CjSdjBc1.js","assets/trace-L8uY5gM3.js","assets/grafana-DTc3taUi.js","assets/datasource-B9nxnUtk.js","assets/metrics-D_WSC7FH.js","assets/agent-BZUl25f5.js","assets/account-CeWzarwh.js","assets/platform-lu-CBYjL.js","assets/billing-D8MiPwwH.js","assets/audit-BQ_DomYe.js","assets/terminal-DMFQ_5h4.js","assets/approval-BivSGX8T.js","assets/ai-ACl4D1kQ.js"])))=>i.map(i=>d[i]); +import{j as e,r as o}from"./vendor-codemirror-B1SGo4xl.js";import{G as ir,ae as $r,D as Te,a as _e,b as Ke,c as Re,d as Me,B as j,e as Qe,o as vr,m as ie,t as G,v as Or,r as Lr,K as zr,s as Je,x as Hr,P as Ur,w as Dr,W as Vr,at as hr,a8 as gr,a9 as ur,aa as br,ab as Sr,ac as qe,ad as he,f as Wr}from"./index-Bp-M7P_8.js";import{C as Fe,a as ke}from"./card-BHSBTtub.js";import{I as W}from"./input-Bnlm--la.js";import{C as ge}from"./checkbox-Bsb-ZRm9.js";import{b as Oe,e as Z,T as qr,a as Gr,c as ne,d as Kr}from"./table-u8V9iTZf.js";import{S as fe,a as we,b as Ce,c as Ie,d as U}from"./select-DbhcBWnH.js";import{u as Qr,q as jr,a as Jr,b as Xr}from"./unwrap-D6sbt6TG.js";import{u as $e}from"./useMutation-DTWI9Q1n.js";import{s as ee}from"./server-B7EY-8NK.js";import{S as Yr}from"./stat-strip-CSMyyoYr.js";import{B as O}from"./badge-B00SZHvE.js";import{c as ye}from"./account-CeWzarwh.js";import{i as Nr,ag as Le,M as We,y as cr,w as ue,f as Ee,R as de,S as yr,ab as ze,h as He,b5 as Xe,an as fr,ao as wr,X as be,j as Cr,am as Ir,L as Ue,ah as Ye,b6 as Zr,ap as es,aV as nr,m as rs,aW as ss,v as Ze,T as er,b7 as Ge,Q as ts,$ as os,N as as,H as cs,r as dr,aM as ns,aE as ds,P as ls}from"./vendor-icons-BWk-DH7F.js";import{x as ps,a as ms}from"./vendor-xterm-20M9KZE1.js";import{m as xs,a as is,f as vs}from"./xterm-utils-slbfdUHf.js";import{c as rr,s as hs}from"./credential-Df-OY-sx.js";import{r as gs}from"./region-D3lxTXmh.js";import{L as V}from"./label-NkONM5Mp.js";import{T as lr}from"./textarea-BvOVhaCD.js";import"./index-5FEebgvX.js";function us(r={page:1,page_size:100}){return Qr({queryKey:jr.servers(r),queryFn:async()=>{const p=await ee.getServers(r);return{list:Xr(p),total:Jr(p)}},staleTime:3e4})}function bs(){const r=ir(),p=()=>r.invalidateQueries({queryKey:["servers"]}),c=$e({mutationFn:u=>ee.createServer(u),onSuccess:p}),t=$e({mutationFn:({id:u,data:g})=>ee.updateServer(u,g),onSuccess:p}),a=$e({mutationFn:u=>ee.deleteServer(u),onSuccess:p}),v=$e({mutationFn:u=>ee.batchDelete(u),onSuccess:p});return{createMutation:c,updateMutation:t,deleteMutation:a,batchDeleteMutation:v,invalidate:p}}function Ss({servers:r}){const p=r.filter(a=>a.status==="running").length,c=r.filter(a=>a.status==="maintenance").length,t=r.filter(a=>a.status==="stopped").length;return e.jsx(Yr,{"code-path":"src/components/server/ServerStatsStrip.tsx:14:5",items:[{label:"服务器",value:r.length,color:"blue"},{label:"运行中",value:p,color:"emerald"},{label:"维护中",value:c,color:"amber"},{label:"已停止",value:t,color:"muted"}]})}const js=[{id:"aws",name:"AWS",color:"bg-orange-500",icon:"AWS"},{id:"aliyun",name:"阿里云",color:"bg-orange-600",icon:"AL"},{id:"tencent",name:"腾讯云",color:"bg-blue-500",icon:"TX"},{id:"huawei",name:"华为云",color:"bg-red-500",icon:"HW"},{id:"azure",name:"Azure",color:"bg-blue-600",icon:"AZ"}];function Ns({open:r,onClose:p}){const[c,t]=o.useState([]),[a,v]=o.useState(1),[u,g]=o.useState(""),[x,_]=o.useState(null),[S,E]=o.useState([]),[n,y]=o.useState([]),[f,R]=o.useState(""),[w,i]=o.useState(!1),[h,C]=o.useState([]),[I,D]=o.useState([]),[L,N]=o.useState(!1),[z,m]=o.useState([]),[b,M]=o.useState(!1),[F,A]=o.useState(null),[Y,q]=o.useState("22"),[re,l]=o.useState([]),[$,Q]=o.useState(""),J=async()=>{try{const s=await ye.getAccounts();t(s?.list||[])}catch(s){console.error("加载云账号失败:",s)}};o.useEffect(()=>{r&&(J(),$r(async()=>{const{credentialApi:s}=await import("./index-CoCXV_ZR.js");return{credentialApi:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27])).then(({credentialApi:s})=>{s.list().then(T=>l(T?.list||[])).catch(()=>l([]))}))},[r]);const B=c.filter(s=>s.provider===u&&s.status==="active"),X=o.useCallback(async s=>{try{return(await ye.getAccountRegions(s))?.list||[]}catch{return[]}},[]),K=o.useCallback(async s=>{i(!0);try{await ye.syncRegions(s);const T=await X(s);E(T)}catch(T){throw console.error("同步区域失败:",T),T}finally{i(!1)}},[X]),P=o.useCallback(async()=>{if(!x)return;const s=await X(x.id);if(E(s),s.length===0)try{await K(x.id)}catch{}},[x,X,K]),me=o.useCallback(async()=>{if(!(!x||n.length===0)){N(!0),m([]),C([]),D([]);try{const s=await ye.discoverInstances(x.id,n);C(s?.list||[]),m(s?.errors||[])}catch(s){console.error("发现主机失败:",s),m([s?.message||"发现主机失败"])}finally{N(!1)}}},[x,n]),se=async()=>{if(!(!x||I.length===0)){M(!0);try{const s=h.filter(ae=>I.includes(ae.instance_id)),T=await ye.importInstances(x.id,s,{default_port:Number(Y)||22,credential_id:$?Number($):void 0});A(T||{imported:0,skipped:0})}catch(s){console.error("导入失败:",s)}finally{M(!1)}}},H=()=>{a===2&&x&&a<4?(v(3),P()):a<4&&v(a+1)},Se=()=>{a>1&&v(a-1)},Be=()=>{n.length===S.length&&S.length>0?y([]):y(S.map(s=>s.code))},Ve=s=>{D(T=>T.includes(s)?T.filter(ae=>ae!==s):[...T,s])},Pe=()=>{I.length===h.length&&h.length>0?D([]):D(h.map(s=>s.instance_id))},je=()=>{p(),v(1),g(""),_(null),y([]),E([]),C([]),D([]),R(""),m([]),A(null),q("22"),Q("")},oe=S.filter(s=>!f||s.name?.toLowerCase().includes(f.toLowerCase())||s.code?.toLowerCase().includes(f.toLowerCase())),ve=[{id:1,title:"公有云",icon:Nr},{id:2,title:"访问凭据",icon:Le},{id:3,title:"选择区域",icon:We},{id:4,title:"导入确认",icon:cr}];return e.jsx(Te,{"code-path":"src/components/server/CloudServerImport.tsx:232:5",open:r,onOpenChange:je,children:e.jsxs(_e,{"code-path":"src/components/server/CloudServerImport.tsx:233:7",className:"max-w-3xl bg-[var(--dg-bg-primary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]",children:[e.jsxs(Ke,{"code-path":"src/components/server/CloudServerImport.tsx:234:9",children:[e.jsx(Re,{"code-path":"src/components/server/CloudServerImport.tsx:235:11",className:"text-xl",children:"导入云主机"}),e.jsx(Me,{"code-path":"src/components/server/CloudServerImport.tsx:236:11",className:"sr-only",children:"从云平台批量导入主机资产"})]}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:240:9",className:"flex items-center justify-center mb-6 flex-wrap gap-1",children:ve.map((s,T)=>e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:242:13",className:"flex items-center",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:243:15",className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm ${a===s.id?"bg-blue-600 text-white":a>s.id?"bg-emerald-600/20 text-emerald-400":"bg-[var(--dg-bg-secondary)] text-[var(--dg-text-muted)]"}`,children:[e.jsx(s.icon,{"code-path":"src/components/server/CloudServerImport.tsx:250:17",className:"h-4 w-4"}),e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:251:17",className:"font-medium hidden sm:inline",children:s.title}),a>s.id&&e.jsx(ue,{"code-path":"src/components/server/CloudServerImport.tsx:252:33",className:"h-3 w-3 ml-1"})]}),Te.jsx(Fe,{"code-path":"src/components/server/CloudServerImport.tsx:267:17",className:`cursor-pointer transition-all ${u===s.id?"border-blue-500 ring-2 ring-blue-500/30 bg-[var(--dg-bg-secondary)]":"border-[var(--dg-border)] hover:border-blue-500 bg-[var(--dg-bg-secondary)]"}`,onClick:()=>g(s.id),children:e.jsxs(ke,{"code-path":"src/components/server/CloudServerImport.tsx:276:19",className:"p-4 flex items-center gap-3",children:[e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:277:21",className:`w-10 h-10 rounded-lg ${s.color} flex items-center justify-center text-white font-bold text-sm`,children:s.icon}),e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:280:21",className:"font-medium text-[var(--dg-text-primary)]",children:s.name})]})},s.id))})]}),a===2&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:290:11",className:"space-y-4",children:[e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:291:13",className:"text-[var(--dg-text-secondary)] text-sm",children:"请选择访问凭据(AccessKey)"}),B.length>0?e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:293:15",className:"space-y-2 max-h-[300px] overflow-y-auto",children:B.map(s=>e.jsx(Fe,{"code-path":"src/components/server/CloudServerImport.tsx:295:19",className:`cursor-pointer transition-all ${x?.id===s.id?"border-blue-500 ring-1 ring-blue-500/30 bg-[var(--dg-bg-secondary)]":"border-[var(--dg-border)] hover:border-blue-500 bg-[var(--dg-bg-secondary)]"}`,onClick:()=>_(s),children:e.jsxs(ke,{"code-path":"src/components/server/CloudServerImport.tsx:304:21",className:"p-3 flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:305:23",className:"flex items-center gap-3",children:[e.jsx(Le,{"code-path":"src/components/server/CloudServerImport.tsx:306:25",className:"h-5 w-5 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:307:25",children:[e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:308:27",className:"font-medium text-[var(--dg-text-primary)]",children:s.name}),e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:309:27",className:"text-xs text-[var(--dg-text-muted)]",children:[(s.access_key||s.accessKey||"******").slice(0,20),"..."]})]})]}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:314:23",className:"text-right",children:[e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:315:25",className:"bg-emerald-500/20 text-emerald-400 border-0",children:[s.region_count??s.regionCount??0," 区域"]}),e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:318:25",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:[s.server_count??s.serverCount??0," 服务器"]})]})]})},s.id))}):e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:325:15",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[e.jsx(Le,{"code-path":"src/components/server/CloudServerImport.tsx:326:17",className:"h-12 w-12 mx-auto mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:327:17",children:"该云平台暂无有效的访问凭据"})]})]}),a===3&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:335:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:336:13",className:"flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:337:15",className:"text-[var(--dg-text-secondary)] text-sm",children:["请选择要同步的区域",S.length>0&&e.jsxs("span",{"code-path":"src/components/server/CloudServerImport.tsx:340:19",className:"ml-2 text-[var(--dg-text-muted)]",children:["(共 ",S.length," 个区域,已选 ",n.length," 个)"]})]}),e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:343:15",variant:"outline",size:"sm",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>x&&K(x.id),disabled:w,children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:350:17",className:`h-3 w-3 mr-1 ${w?"animate-spin":""}`}),w?"同步中...":"刷新区域"]})]}),w?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:356:15",className:"text-center py-12",children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:357:17",className:"h-8 w-8 mx-auto mb-3 animate-spin text-blue-400"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:358:17",className:"text-[var(--dg-text-secondary)]",children:"正在从云平台同步区域列表..."})]}):S.length===0?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:361:15",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[e.jsx(We,{"code-path":"src/components/server/CloudServerImport.tsx:362:17",className:"h-10 w-10 mx-auto mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:363:17",children:"暂无区域数据"}),e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:364:17",variant:"outline",size:"sm",className:"mt-3 border-[var(--dg-border)] text-blue-400",onClick:()=>x&&K(x.id),children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:370:19",className:"h-3 w-3 mr-1"}),"立即同步"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:377:17",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:378:19",className:"relative flex-1",children:[e.jsx(yr,{"code-path":"src/components/server/CloudServerImport.tsx:379:21",className:"h-4 w-4 absolute left-3 top-1/2 -translate-y-1/2 text-[var(--dg-text-muted)]"}),e.jsx(W,{"code-path":"src/components/server/CloudServerImport.tsx:380:21",placeholder:"搜索区域名称或编码...",value:f,onChange:s=>R(s.target.value),className:"pl-9 bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]"})]}),e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:387:19",variant:"outline",size:"sm",onClick:Be,className:"border-[var(--dg-border)]",children:n.length===S.length&&S.length>0?"取消全选":"全选"})]}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:393:17",className:"border rounded-lg border-[var(--dg-border)] overflow-hidden max-h-[300px] overflow-y-auto",children:e.jsxs("table",{"code-path":"src/components/server/CloudServerImport.tsx:394:19",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/server/CloudServerImport.tsx:395:21",className:"bg-[var(--dg-bg-secondary)] sticky top-0",children:e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:396:23",children:[e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:397:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)] w-10",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:398:27",checked:n.length===S.length&&S.length>0,onCheckedChange:Be})}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:403:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"区域编码"}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:404:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"区域名称"}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:405:25",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"Endpoint"})]})}),e.jsx("tbody",{"code-path":"src/components/server/CloudServerImport.tsx:408:21",className:"divide-y divide-[var(--dg-border)]",children:oe.map(s=>e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:410:25",className:`cursor-pointer hover:bg-[var(--dg-bg-hover)] ${n.includes(s.code)?"bg-blue-500/10":""}`,onClick:()=>{y(T=>T.includes(s.code)?T.filter(ae=>ae!==s.code):[...T,s.code])},children:[e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:421:27",className:"px-3 py-2",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:422:29",checked:n.includes(s.code)})}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:424:27",className:"px-3 py-2 text-sm text-blue-400 font-mono",children:s.code}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:425:27",className:"px-3 py-2 text-sm text-[var(--dg-text-primary)]",children:s.name}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:426:27",className:"px-3 py-2 text-xs text-[var(--dg-text-muted)] font-mono truncate max-w-[200px]",children:s.endpoint||"-"})]},s.id||s.code))})]})})]})]}),a===4&&e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:439:11",className:"space-y-4",children:F?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:442:15",className:"text-center py-12",children:[e.jsx(cr,{"code-path":"src/components/server/CloudServerImport.tsx:443:17",className:"h-12 w-12 mx-auto mb-3 text-emerald-400"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:444:17",className:"text-lg font-medium text-[var(--dg-text-primary)]",children:"导入完成"}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:445:17",className:"flex items-center justify-center gap-6 mt-4",children:[e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:446:19",className:"bg-emerald-500/20 text-emerald-400 border-0 text-base px-4 py-1",children:["成功导入 ",F.imported," 台"]}),F.skipped>0&&e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:450:21",className:"bg-amber-500/20 text-amber-400 border-0 text-base px-4 py-1",children:["跳过 ",F.skipped," 台(已存在)"]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:458:17",className:"flex items-center justify-between",children:[e.jsxs("p",{"code-path":"src/components/server/CloudServerImport.tsx:459:19",className:"text-[var(--dg-text-secondary)] text-sm",children:["已选 ",n.length," 个区域",h.length>0&&e.jsxs("span",{"code-path":"src/components/server/CloudServerImport.tsx:462:23",className:"ml-2",children:["· 发现 ",h.length," 台主机"]})]}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:465:19",className:"flex items-center gap-2",children:[h.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:468:25",variant:"outline",size:"sm",onClick:Pe,className:"border-[var(--dg-border)]",children:I.length===h.length&&h.length>0?"取消全选":"全选"}),e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:471:25",className:"bg-blue-500/20 text-blue-400 border-0",children:["已选 ",I.length," 台"]})]}),e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:476:21",variant:"outline",size:"sm",onClick:me,disabled:L||n.length===0,className:"border-[var(--dg-border)] text-blue-400",children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:483:23",className:`h-3 w-3 mr-1 ${L?"animate-spin":""}`}),L?"发现中...":h.length>0?"重新发现":"发现主机"]})]})]}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:490:17",className:"flex flex-wrap gap-1",children:n.map(s=>{const T=S.find(ae=>ae.code===s);return e.jsxs(O,{"code-path":"src/components/server/CloudServerImport.tsx:494:23",className:"bg-[var(--dg-bg-secondary)] text-[var(--dg-text-muted)] border border-[var(--dg-border)] text-xs",children:[e.jsx(We,{"code-path":"src/components/server/CloudServerImport.tsx:495:25",className:"h-3 w-3 mr-1"}),T?.name||s]},s)})}),z.length>0&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:504:19",className:"flex items-start gap-2 p-3 rounded-lg bg-amber-500/10 border border-amber-500/30 text-amber-400 text-sm",children:[e.jsx(ze,{"code-path":"src/components/server/CloudServerImport.tsx:505:21",className:"h-4 w-4 mt-0.5 flex-shrink-0"}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:506:21",children:[e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:507:23",className:"font-medium",children:"部分区域发现失败:"}),z.map((s,T)=>e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:509:25",className:"text-xs mt-1 opacity-80",children:s},T))]})]}),L?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:517:19",className:"text-center py-12",children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:518:21",className:"h-8 w-8 mx-auto mb-3 animate-spin text-blue-400"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:519:21",className:"text-[var(--dg-text-secondary)]",children:"正在发现云主机,请稍候..."}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:520:21",className:"text-xs text-[var(--dg-text-muted)] mt-1",children:"正在逐区域查询,可能需要数秒"})]}):h.length===0&&!L?e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:523:19",className:"text-center py-8 text-[var(--dg-text-muted)]",children:[e.jsx(He,{"code-path":"src/components/server/CloudServerImport.tsx:524:21",className:"h-10 w-10 mx-auto mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/server/CloudServerImport.tsx:525:21",children:'点击"发现主机"按钮,开始扫描所选区域'})]}):e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:528:19",className:"border rounded-lg border-[var(--dg-border)] overflow-hidden max-h-[300px] overflow-y-auto",children:e.jsxs("table",{"code-path":"src/components/server/CloudServerImport.tsx:529:21",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/server/CloudServerImport.tsx:530:23",className:"bg-[var(--dg-bg-secondary)] sticky top-0",children:e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:531:25",children:[e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:532:27",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)] w-10",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:533:29",checked:I.length===h.length&&h.length>0,onCheckedChange:Pe})}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:538:27",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"主机名"}),e.jsx("th",{"code-path":"src/components/server/CloudServerImport.tsx:539:27",className:"px-3 py-2 text-left text-xs font-medium text-[var(--dg-text-secondary)]",children:"IP地址"})]})}),e.jsx("tbody",{"code-path":"src/components/server/CloudServerImport.tsx:542:23",className:"divide-y divide-[var(--dg-border)]",children:h.map(s=>e.jsxs("tr",{"code-path":"src/components/server/CloudServerImport.tsx:544:27",className:`cursor-pointer hover:bg-[var(--dg-bg-hover)] ${I.includes(s.instance_id)?"bg-blue-500/10":""}`,onClick:()=>Ve(s.instance_id),children:[e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:549:29",className:"px-3 py-2",children:e.jsx(ge,{"code-path":"src/components/server/CloudServerImport.tsx:550:31",checked:I.includes(s.instance_id)})}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:552:29",className:"px-3 py-2 text-sm text-[var(--dg-text-primary)]",children:s.instance_name||s.hostname||"-"}),e.jsx("td",{"code-path":"src/components/server/CloudServerImport.tsx:553:29",className:"px-3 py-2 text-sm text-[var(--dg-text-secondary)]",children:s.private_ip||s.public_ip||"-"})]},s.instance_id))})]})}),h.length>0&&I.length>0&&e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:565:19",className:"grid grid-cols-2 gap-4 p-4 rounded-lg bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:566:21",children:[e.jsxs("label",{"code-path":"src/components/server/CloudServerImport.tsx:567:23",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:["SSH 端口",e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:569:25",className:"text-[var(--dg-text-muted)] ml-1",children:"(导入时统一设置)"})]}),e.jsx(W,{"code-path":"src/components/server/CloudServerImport.tsx:571:23",type:"number",placeholder:"22",value:Y,onChange:s=>q(s.target.value),className:"w-32 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)]"})]}),e.jsxs("div",{"code-path":"src/components/server/CloudServerImport.tsx:579:21",children:[e.jsxs("label",{"code-path":"src/components/server/CloudServerImport.tsx:580:23",className:"block text-xs font-medium text-[var(--dg-text-secondary)] mb-1",children:["关联凭证",e.jsx("span",{"code-path":"src/components/server/CloudServerImport.tsx:582:25",className:"text-[var(--dg-text-muted)] ml-1",children:"(可选,用于SSH远程管理)"})]}),e.jsxs("select",{"code-path":"src/components/server/CloudServerImport.tsx:584:23",value:$,onChange:s=>Q(s.target.value),className:"w-full px-3 py-1.5 bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] rounded-md text-[var(--dg-text-primary)] text-xs",children:[e.jsx("option",{"code-path":"src/components/server/CloudServerImport.tsx:589:25",value:"",children:"不使用凭据"}),re.map(s=>e.jsxs("option",{"code-path":"src/components/server/CloudServerImport.tsx:591:27",value:String(s.id),children:[s.type==="ssh_key"?"🔑":"🔒"," ",s.name]},s.id))]})]})]})]})}),e.jsxs(Qe,{"code-path":"src/components/server/CloudServerImport.tsx:605:9",className:"flex justify-between items-center",children:[e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:606:11",children:a>1&&!F&&e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:608:15",variant:"outline",onClick:Se,className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:[e.jsx(Xe,{"code-path":"src/components/server/CloudServerImport.tsx:609:17",className:"h-4 w-4 mr-1"}),"上一步"]})}),e.jsx("div",{"code-path":"src/components/server/CloudServerImport.tsx:614:11",className:"flex gap-2",children:F?e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:616:15",onClick:je,className:"bg-blue-600 hover:bg-blue-700",children:"完成"}):e.jsxs(e.Fragment,{children:[e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:621:17",variant:"outline",onClick:je,className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:"取消"}),a<4?e.jsxs(j,{"code-path":"src/components/server/CloudServerImport.tsx:625:19",onClick:H,disabled:a===1&&!u||a===2&&!x||a===3&&n.length===0,className:"bg-blue-600 hover:bg-blue-700",children:["下一步",e.jsx(Ee,{"code-path":"src/components/server/CloudServerImport.tsx:635:21",className:"h-4 w-4 ml-1"})]}):e.jsx(j,{"code-path":"src/components/server/CloudServerImport.tsx:638:19",onClick:se,disabled:I.length===0||b,className:"bg-emerald-600 hover:bg-emerald-700",children:b?e.jsxs(e.Fragment,{children:[e.jsx(de,{"code-path":"src/components/server/CloudServerImport.tsx:645:25",className:"h-4 w-4 mr-1 animate-spin"}),"导入中..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{"code-path":"src/components/server/CloudServerImport.tsx:650:25",className:"h-4 w-4 mr-1"}),"确认导入 (",I.length,")"]})})]})})]})]})})}function ys({open:r,onOpenChange:p,serverId:c,serverName:t,serverIp:a,hasAuth:v=!0}){const u=o.useRef(null),g=o.useRef(null),x=o.useRef(null),_=o.useRef(null),[S,E]=o.useState(!1),[n,y]=o.useState(!1),[f,R]=o.useState([]),[w,i]=o.useState(""),[h,C]=o.useState(!1),[I,D]=o.useState(v);o.useEffect(()=>{!r||v||rr.list().then(N=>R(N?.list||[])).catch(()=>{})},[r,v]);const L=async()=>{if(!(!w||!c))try{C(!0),await hs.assign(c,Number(w)),G.success("凭据已关联"),D(!0)}catch(N){G.error(N?.message||"关联失败")}finally{C(!1)}};return o.useEffect(()=>{r||(D(v),i(""))},[r,v]),o.useEffect(()=>{if(!r||!c||!I)return;const N=new ps.Terminal({cursorBlink:!0,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,theme:{background:"#0a0e14",foreground:"#d6d6d6",cursor:"#d6d6d6",selectionBackground:"rgba(255,255,255,0.2)"}}),z=new ms.FitAddon;N.loadAddon(z),g.current=N,_.current=z;const m=location.protocol==="https:"?"wss":"ws",b=vr.getState().token||"",M=`${m}://${location.host}/ws/terminal?id=${c}&cols=80&rows=24&token=${encodeURIComponent(b)}`,F=new WebSocket(M);return x.current=F,N.onData(A=>{F.readyState===WebSocket.OPEN&&F.send(JSON.stringify({status:0,data:A}))}),F.onmessage=A=>{try{const Y=JSON.parse(A.data);Y.status===0&&typeof Y.data=="string"&&N.write(Y.data)}catch{N.write(typeof A.data=="string"?A.data:"")}},F.onopen=()=>{E(!0),xs(N,z,()=>u.current,F)},F.onclose=()=>{E(!1),N.write(`\r \x1B[31m[连接已关闭]\x1B[0m\r `)},F.onerror=()=>{N.write(`\r \x1B[31m[连接发生错误]\x1B[0m\r diff --git a/backend/static/assets/SystemManager-B9Kzdis0.js b/backend/static/assets/SystemManager-BVSipLbm.js similarity index 97% rename from backend/static/assets/SystemManager-B9Kzdis0.js rename to backend/static/assets/SystemManager-BVSipLbm.js index 9de09a5..1bfef02 100644 --- a/backend/static/assets/SystemManager-B9Kzdis0.js +++ b/backend/static/assets/SystemManager-BVSipLbm.js @@ -1,2 +1,2 @@ -import{r as o,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{u as q,D as Z,a as ss,b as es,c as ts,d as as,e as ls,B as x,at as ve,f as Ks,t as V,j as Bs,l as $,k as fe}from"./index-LZWfu62c.js";import{T as De,a as Le,b as Vs,c as Hs}from"./tabs-kmtfM2I-.js";import{B as cs}from"./badge-B0F5ZNtn.js";import{C as xs,a as hs,b as Ss,c as js,d as us}from"./card-B-RtdR4H.js";import{I as f}from"./input-BdDauX3U.js";import{T as As,a as Ps,b as J,c as M,d as Es,e as w}from"./table-BPFYQwjr.js";import{S as Us,a as ws,b as Cs,c as Ms,d as H}from"./select-4xU_9B3_.js";import{U as re,ag as Qs,aE as vs,ah as Gs,v as de,y as Ws,a as qs,N as Js,L as Ns,R as Xs,S as Te,P as Ys,al as Ue,ak as we,x as pe,T as Zs,j as se,aN as ee,as as Ce,Q as Me,V as ie,a3 as ke,aq as Ie,p as xe}from"./vendor-icons-Aso0-eeY.js";import{T as Re}from"./textarea-BdtIagjy.js";import{L as Ts}from"./label-u-lNUbKh.js";import{C as _e}from"./checkbox-DL3onEGv.js";import{S as bs}from"./switch-C4PJnJ9I.js";import"./index-CYARH0Cq.js";function Fe({open:e,onOpenChange:d,editingUser:t,form:a,setForm:m,saving:i,onSubmit:u}){const[T,N]=o.useState([]);return o.useEffect(()=>{if(!e)return;let n=!1;return(async()=>{try{const U=await q.getRoles();if(n)return;const h=U?.list??[];N(h.map(D=>({id:String(D.id??""),name:D.name??D.code??""})))}catch{n||N([])}})(),()=>{n=!0}},[e]),s.jsx(Z,{"code-path":"src/components/system/UserFormDialog.tsx:78:5",open:e,onOpenChange:d,children:s.jsxs(ss,{"code-path":"src/components/system/UserFormDialog.tsx:79:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/UserFormDialog.tsx:80:9",children:[s.jsxs(ts,{"code-path":"src/components/system/UserFormDialog.tsx:81:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(re,{"code-path":"src/components/system/UserFormDialog.tsx:82:13",className:"h-5 w-5 text-blue-400"}),t?"编辑用户":"新建用户"]}),s.jsx(as,{"code-path":"src/components/system/UserFormDialog.tsx:85:11",className:"text-slate-500",children:t?"修改用户信息":"创建新的系统用户"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:90:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:91:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:92:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:93:15",className:"text-xs text-slate-500",children:"用户名"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:94:15",value:a.username,onChange:n=>m({...a,username:n.target.value}),disabled:!!t,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"登录用户名"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:102:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:103:15",className:"text-xs text-slate-500",children:"昵称"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:104:15",value:a.nickname,onChange:n=>m({...a,nickname:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"显示昵称"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:111:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:112:15",className:"text-xs text-slate-500",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:113:15",value:a.email,onChange:n=>m({...a,email:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"user@example.com"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:120:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:121:15",className:"text-xs text-slate-500",children:"手机号"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:122:15",value:a.phone,onChange:n=>m({...a,phone:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"可选"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:129:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:130:15",className:"text-xs text-slate-500",children:"角色"}),s.jsxs(Us,{"code-path":"src/components/system/UserFormDialog.tsx:131:15",value:a.role,onValueChange:n=>m({...a,role:n}),children:[s.jsx(ws,{"code-path":"src/components/system/UserFormDialog.tsx:132:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/UserFormDialog.tsx:133:19",placeholder:"选择角色"})}),s.jsx(Ms,{"code-path":"src/components/system/UserFormDialog.tsx:135:17",className:"bg-slate-800 border-slate-700",children:T.map(n=>s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:137:21",value:n.name,children:n.name},n.id))})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:144:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:145:15",className:"text-xs text-slate-500",children:"状态"}),s.jsxs(Us,{"code-path":"src/components/system/UserFormDialog.tsx:146:15",value:String(a.status),onValueChange:n=>m({...a,status:Number(n)}),children:[s.jsx(ws,{"code-path":"src/components/system/UserFormDialog.tsx:150:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/UserFormDialog.tsx:151:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/UserFormDialog.tsx:153:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:154:19",value:"1",children:"正常"}),s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:155:19",value:"0",children:"禁用"})]})]})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:160:11",className:"space-y-2",children:[s.jsxs("label",{"code-path":"src/components/system/UserFormDialog.tsx:161:13",className:"text-xs text-slate-500",children:["密码",t?"(留空则不修改)":""]}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:164:13",type:"password",value:a.password,onChange:n=>m({...a,password:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:t?"留空则不修改":"设置初始密码"})]})]}),s.jsxs(ls,{"code-path":"src/components/system/UserFormDialog.tsx:174:9",children:[s.jsx(x,{"code-path":"src/components/system/UserFormDialog.tsx:175:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>d(!1),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/UserFormDialog.tsx:178:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:u,disabled:i,children:i?"保存中...":"保存"})]})]})})}function Oe({selectedUser:e,setSelectedUser:d,getUserStatusBadge:t,openEdit:a}){return s.jsx(Z,{"code-path":"src/components/system/UserDetailDialog.tsx:29:5",open:!!e,onOpenChange:()=>d(null),children:s.jsxs(ss,{"code-path":"src/components/system/UserDetailDialog.tsx:30:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/UserDetailDialog.tsx:31:9",children:[s.jsxs(ts,{"code-path":"src/components/system/UserDetailDialog.tsx:32:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(re,{"code-path":"src/components/system/UserDetailDialog.tsx:33:13",className:"h-5 w-5 text-blue-400"}),e?.nickname]}),s.jsxs(as,{"code-path":"src/components/system/UserDetailDialog.tsx:36:11",className:"text-slate-500",children:["@",e?.username," · ",e?.email]})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:41:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:42:11",className:"grid grid-cols-2 gap-4 p-4 rounded-lg bg-slate-800/50",children:[s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:43:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:44:15",className:"text-xs text-slate-500 mb-1",children:"用户名"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:45:15",className:"text-sm text-slate-200",children:e?.username})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:47:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:48:15",className:"text-xs text-slate-500 mb-1",children:"昵称"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:49:15",className:"text-sm text-slate-200",children:e?.nickname})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:51:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:52:15",className:"text-xs text-slate-500 mb-1",children:"邮箱"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:53:15",className:"text-sm text-slate-200",children:e?.email})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:55:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:56:15",className:"text-xs text-slate-500 mb-1",children:"手机号"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:57:15",className:"text-sm text-slate-200",children:e?.phone||"--"})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:59:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:60:15",className:"text-xs text-slate-500 mb-1",children:"状态"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:61:15",className:"text-sm text-slate-200",children:e&&t(e.status)})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:63:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:64:15",className:"text-xs text-slate-500 mb-1",children:"创建时间"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:65:15",className:"text-sm text-slate-200",children:e&&e.createdAt?new Date(e.createdAt).toLocaleDateString():"--"})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:71:11",children:[s.jsx("h4",{"code-path":"src/components/system/UserDetailDialog.tsx:72:13",className:"text-sm font-medium text-slate-300 mb-2",children:"角色"}),s.jsx("div",{"code-path":"src/components/system/UserDetailDialog.tsx:73:13",className:"flex flex-wrap gap-2",children:e?.roles.map(m=>s.jsx(cs,{"code-path":"src/components/system/UserDetailDialog.tsx:75:17",variant:"outline",className:"border-slate-700 text-slate-400",children:m},m))})]})]}),s.jsxs(ls,{"code-path":"src/components/system/UserDetailDialog.tsx:83:9",children:[s.jsxs(x,{"code-path":"src/components/system/UserDetailDialog.tsx:84:11",variant:"outline",className:"border-slate-700 text-slate-300",children:[s.jsx(Qs,{"code-path":"src/components/system/UserDetailDialog.tsx:85:13",className:"h-4 w-4 mr-2"}),"重置密码"]}),s.jsxs(x,{"code-path":"src/components/system/UserDetailDialog.tsx:88:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{e&&(d(null),a(e))},children:[s.jsx(vs,{"code-path":"src/components/system/UserDetailDialog.tsx:97:13",className:"h-4 w-4 mr-2"}),"编辑"]})]})]})})}function Ae({importDialogOpen:e,setImportDialogOpen:d,importPreview:t,setImportPreview:a,importing:m,importResult:i,setImportResult:u,handleCsvUpload:T,handleBatchImport:N}){return s.jsx(Z,{"code-path":"src/components/system/CsvImportDialog.tsx:47:5",open:e==="csv",onOpenChange:n=>!n&&d(null),children:s.jsxs(ss,{"code-path":"src/components/system/CsvImportDialog.tsx:48:7",className:"bg-slate-900 border-slate-800 max-w-2xl",children:[s.jsxs(es,{"code-path":"src/components/system/CsvImportDialog.tsx:49:9",children:[s.jsxs(ts,{"code-path":"src/components/system/CsvImportDialog.tsx:50:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Gs,{"code-path":"src/components/system/CsvImportDialog.tsx:51:13",className:"h-5 w-5 text-blue-400"}),"批量导入用户(CSV)"]}),s.jsx(as,{"code-path":"src/components/system/CsvImportDialog.tsx:54:11",className:"text-slate-500",children:"上传 CSV 文件批量创建用户。请先下载模板,按格式填写后上传。"})]}),i?s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:120:11",className:"space-y-4 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:121:13",className:`flex items-center gap-3 p-4 rounded-lg ${i.code===200?"bg-emerald-500/10":"bg-red-500/10"}`,children:[i.code===200?s.jsx(Ws,{"code-path":"src/components/system/CsvImportDialog.tsx:123:17",className:"h-6 w-6 text-emerald-400 shrink-0"}):s.jsx(qs,{"code-path":"src/components/system/CsvImportDialog.tsx:125:17",className:"h-6 w-6 text-red-400 shrink-0"}),s.jsx("span",{"code-path":"src/components/system/CsvImportDialog.tsx:127:15",className:"text-sm text-slate-200",children:i.message})]}),i.errors?.length>0&&s.jsx("div",{"code-path":"src/components/system/CsvImportDialog.tsx:130:15",className:"max-h-32 overflow-auto rounded-lg bg-slate-800/50 p-3 space-y-1",children:i.errors.map((n,U)=>s.jsx("div",{"code-path":"src/components/system/CsvImportDialog.tsx:132:19",className:"text-xs text-red-400",children:n},U))}),s.jsx(ls,{"code-path":"src/components/system/CsvImportDialog.tsx:136:13",children:s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:137:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{d(null),a([]),u(null)},children:"完成"})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:61:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:62:15",className:"flex items-center gap-2",children:[s.jsxs(x,{"code-path":"src/components/system/CsvImportDialog.tsx:63:17",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:()=>q.downloadTemplate(),children:[s.jsx(de,{"code-path":"src/components/system/CsvImportDialog.tsx:64:19",className:"h-4 w-4 mr-1.5"}),"下载模板"]}),s.jsxs("label",{"code-path":"src/components/system/CsvImportDialog.tsx:67:17",className:"inline-flex items-center px-3 py-1.5 rounded-md text-sm bg-slate-800 border border-slate-700 text-slate-200 cursor-pointer hover:bg-slate-700 transition-colors",children:[s.jsx(Gs,{"code-path":"src/components/system/CsvImportDialog.tsx:68:19",className:"h-4 w-4 mr-1.5"}),"选择 CSV 文件",s.jsx("input",{"code-path":"src/components/system/CsvImportDialog.tsx:70:19",type:"file",accept:".csv",className:"hidden",onChange:T})]})]}),t.length>0&&s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:75:17",className:"rounded-lg border border-slate-800 overflow-hidden",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:76:19",className:"px-3 py-2 bg-slate-800/50 text-xs text-slate-400",children:["预览:",t.length," 条数据"]}),s.jsxs(As,{"code-path":"src/components/system/CsvImportDialog.tsx:79:19",children:[s.jsx(Ps,{"code-path":"src/components/system/CsvImportDialog.tsx:80:21",children:s.jsxs(J,{"code-path":"src/components/system/CsvImportDialog.tsx:81:23",className:"border-slate-800",children:[s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:82:25",className:"text-slate-400 text-xs",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:83:25",className:"text-slate-400 text-xs",children:"昵称"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:84:25",className:"text-slate-400 text-xs",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:85:25",className:"text-slate-400 text-xs",children:"手机"})]})}),s.jsxs(Es,{"code-path":"src/components/system/CsvImportDialog.tsx:88:21",children:[t.slice(0,5).map((n,U)=>s.jsxs(J,{"code-path":"src/components/system/CsvImportDialog.tsx:90:25",className:"border-slate-800",children:[s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:91:27",className:"text-slate-200 text-xs",children:n.username}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:92:27",className:"text-slate-300 text-xs",children:n.nickname}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:93:27",className:"text-slate-400 text-xs",children:n.email}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:94:27",className:"text-slate-400 text-xs",children:n.phone})]},U)),t.length>5&&s.jsx(J,{"code-path":"src/components/system/CsvImportDialog.tsx:98:25",className:"border-slate-800",children:s.jsxs(w,{"code-path":"src/components/system/CsvImportDialog.tsx:99:27",colSpan:4,className:"text-slate-500 text-xs text-center",children:["还有 ",t.length-5," 条..."]})})]})]})]})]}),s.jsxs(ls,{"code-path":"src/components/system/CsvImportDialog.tsx:110:13",children:[s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:111:15",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>{d(null),a([])},children:"取消"}),s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:114:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:N,disabled:m||t.length===0,children:m?"导入中...":`确认导入 (${t.length})`})]})]})]})})}function Pe({importDialogOpen:e,setImportDialogOpen:d,ldapUsers:t,setLdapUsers:a,ldapSelected:m,setLdapSelected:i,ldapLoading:u,ldapImportOUs:T,ldapImportOUDN:N,setLdapImportOUDN:n,loadLdapUsers:U,handleLdapImport:h,importing:D,importResult:b,setImportResult:S}){return s.jsx(Z,{"code-path":"src/components/system/LdapImportDialog.tsx:58:5",open:e==="ldap",onOpenChange:y=>!y&&d(null),children:s.jsxs(ss,{"code-path":"src/components/system/LdapImportDialog.tsx:59:7",className:"bg-slate-900 border-slate-800 max-w-2xl",children:[s.jsxs(es,{"code-path":"src/components/system/LdapImportDialog.tsx:60:9",children:[s.jsxs(ts,{"code-path":"src/components/system/LdapImportDialog.tsx:61:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Js,{"code-path":"src/components/system/LdapImportDialog.tsx:62:13",className:"h-5 w-5 text-cyan-400"}),"从 LDAP 导入用户"]}),s.jsx(as,{"code-path":"src/components/system/LdapImportDialog.tsx:65:11",className:"text-slate-500",children:"从 LDAP 服务器检索用户列表,选择需要导入的用户"})]}),b?s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:163:11",className:"space-y-4 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:164:13",className:`flex items-center gap-3 p-4 rounded-lg ${b.code===200?"bg-emerald-500/10":"bg-red-500/10"}`,children:[b.code===200?s.jsx(Ws,{"code-path":"src/components/system/LdapImportDialog.tsx:166:17",className:"h-6 w-6 text-emerald-400 shrink-0"}):s.jsx(qs,{"code-path":"src/components/system/LdapImportDialog.tsx:168:17",className:"h-6 w-6 text-red-400 shrink-0"}),s.jsx("span",{"code-path":"src/components/system/LdapImportDialog.tsx:170:15",className:"text-sm text-slate-200",children:b.message})]}),s.jsx(ls,{"code-path":"src/components/system/LdapImportDialog.tsx:172:13",children:s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:173:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{d(null),a([]),S(null)},children:"完成"})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:72:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:73:15",className:"flex items-center gap-3",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:74:17",className:"flex items-center gap-2",children:[s.jsx("span",{"code-path":"src/components/system/LdapImportDialog.tsx:75:19",className:"text-xs text-slate-500 whitespace-nowrap",children:"选择 OU"}),s.jsxs("select",{"code-path":"src/components/system/LdapImportDialog.tsx:76:19",className:"bg-slate-800 border border-slate-700 text-slate-200 text-xs rounded-md px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-blue-500",value:N,onChange:y=>{n(y.target.value),U(y.target.value)},children:[s.jsx("option",{"code-path":"src/components/system/LdapImportDialog.tsx:84:21",value:"",children:"根 (全部)"}),T.map(y=>s.jsx("option",{"code-path":"src/components/system/LdapImportDialog.tsx:86:23",value:y.dn,children:y.name},y.dn))]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapImportDialog.tsx:90:17",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300 ml-auto",onClick:()=>U(N),disabled:u,children:[u?s.jsx(Ns,{"code-path":"src/components/system/LdapImportDialog.tsx:91:34",className:"h-4 w-4 mr-1.5 animate-spin"}):s.jsx(Xs,{"code-path":"src/components/system/LdapImportDialog.tsx:91:88",className:"h-4 w-4 mr-1.5"}),"刷新"]})]}),s.jsx("p",{"code-path":"src/components/system/LdapImportDialog.tsx:96:15",className:"text-xs text-slate-500",children:t.length>0?`找到 ${t.length} 个用户`:"选择 OU 或点击刷新获取用户列表"}),t.length>0&&s.jsx("div",{"code-path":"src/components/system/LdapImportDialog.tsx:101:17",className:"max-h-80 overflow-auto rounded-lg border border-slate-800",children:s.jsxs(As,{"code-path":"src/components/system/LdapImportDialog.tsx:102:19",children:[s.jsx(Ps,{"code-path":"src/components/system/LdapImportDialog.tsx:103:21",children:s.jsxs(J,{"code-path":"src/components/system/LdapImportDialog.tsx:104:23",className:"border-slate-800 sticky top-0 bg-slate-900",children:[s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:105:25",className:"w-10 text-slate-400 text-xs",children:s.jsx("input",{"code-path":"src/components/system/LdapImportDialog.tsx:106:27",type:"checkbox",className:"accent-blue-600",checked:m.size===t.length&&t.length>0,onChange:y=>{y.target.checked?i(new Set(t.map(R=>R.dn))):i(new Set)}})}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:119:25",className:"text-slate-400 text-xs",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:120:25",className:"text-slate-400 text-xs",children:"显示名"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:121:25",className:"text-slate-400 text-xs",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:122:25",className:"text-slate-400 text-xs",children:"DN"})]})}),s.jsx(Es,{"code-path":"src/components/system/LdapImportDialog.tsx:125:21",children:t.map(y=>s.jsxs(J,{"code-path":"src/components/system/LdapImportDialog.tsx:127:25",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:128:27",children:s.jsx("input",{"code-path":"src/components/system/LdapImportDialog.tsx:129:29",type:"checkbox",className:"accent-blue-600",checked:m.has(y.dn),onChange:R=>{const C=new Set(m);R.target.checked?C.add(y.dn):C.delete(y.dn),i(C)}})}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:141:27",className:"text-slate-200 text-xs",children:y.uid}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:142:27",className:"text-slate-300 text-xs",children:y.cn}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:143:27",className:"text-slate-400 text-xs",children:y.mail}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:144:27",className:"text-slate-500 text-xs font-mono truncate max-w-[200px]",children:y.dn})]},y.dn))})]})})]}),s.jsxs(ls,{"code-path":"src/components/system/LdapImportDialog.tsx:153:13",children:[s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:154:15",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>{d(null),a([])},children:"取消"}),s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:157:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:h,disabled:D||m.size===0,children:D?"导入中...":`导入选中 (${m.size})`})]})]})]})})}function Ee({searchQuery:e,setSearchQuery:d,filteredUsers:t,loading:a,selectedUser:m,setSelectedUser:i,getUserStatusBadge:u,dialogOpen:T,setDialogOpen:N,editingUser:n,form:U,setForm:h,saving:D,handleSubmit:b,openCreate:S,openEdit:y,handleDelete:R,importDialogOpen:C,setImportDialogOpen:P,importPreview:F,setImportPreview:B,importing:k,importResult:A,setImportResult:p,handleCsvUpload:O,handleBatchImport:j,ldapUsers:_,ldapSelected:G,setLdapSelected:E,ldapLoading:X,ldapImportOUs:L,ldapImportOUDN:rs,setLdapImportOUDN:ns,loadLdapUsers:ds,handleLdapImport:ps,setLdapUsers:K}){const{hasPermission:Q}=ve();return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:116:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:117:9",className:"relative w-64",children:[s.jsx(Te,{"code-path":"src/components/system/SystemUserTab.tsx:118:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),s.jsx(f,{"code-path":"src/components/system/SystemUserTab.tsx:119:11",placeholder:"搜索用户...",value:e,onChange:v=>d(v.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:126:9",className:"flex items-center gap-2",children:[Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:128:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>P("csv"),children:[s.jsx(Gs,{"code-path":"src/components/system/SystemUserTab.tsx:129:13",className:"h-4 w-4 mr-2"}),"批量导入"]}),Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:134:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>P("ldap"),children:[s.jsx(Js,{"code-path":"src/components/system/SystemUserTab.tsx:135:13",className:"h-4 w-4 mr-2"}),"LDAP 导入"]}),Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:140:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:S,children:[s.jsx(Ys,{"code-path":"src/components/system/SystemUserTab.tsx:141:13",className:"h-4 w-4 mr-2"}),"新建用户"]})]})]}),s.jsx(xs,{"code-path":"src/components/system/SystemUserTab.tsx:149:7",className:"bg-slate-900 border-slate-800",children:s.jsx(hs,{"code-path":"src/components/system/SystemUserTab.tsx:150:9",className:"p-0",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:151:11",className:"border-t border-slate-800",children:s.jsxs(As,{"code-path":"src/components/system/SystemUserTab.tsx:152:13",children:[s.jsx(Ps,{"code-path":"src/components/system/SystemUserTab.tsx:153:15",children:s.jsxs(J,{"code-path":"src/components/system/SystemUserTab.tsx:154:17",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:155:19",className:"text-slate-400",children:"用户信息"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:156:19",className:"text-slate-400",children:"联系方式"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:157:19",className:"text-slate-400",children:"角色"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:158:19",className:"text-slate-400",children:"来源"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:159:19",className:"text-slate-400",children:"状态"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:160:19",className:"text-slate-400",children:"最后登录"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:161:19",className:"text-slate-400 text-right",children:"操作"})]})}),s.jsx(Es,{"code-path":"src/components/system/SystemUserTab.tsx:164:15",children:a?s.jsx(J,{"code-path":"src/components/system/SystemUserTab.tsx:166:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:167:21",colSpan:7,className:"text-center py-12",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:168:23",className:"flex items-center justify-center",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:169:25",className:"h-6 w-6 border-2 border-slate-700 border-t-blue-500 rounded-full animate-spin"})})})}):t.length===0?s.jsx(J,{"code-path":"src/components/system/SystemUserTab.tsx:174:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:175:21",colSpan:7,className:"text-center py-12 text-sm text-slate-500",children:"暂无用户数据"})}):t.map(v=>s.jsxs(J,{"code-path":"src/components/system/SystemUserTab.tsx:181:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:182:23",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:183:25",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:184:27",className:"w-8 h-8 rounded-full bg-blue-600 flex items-center justify-center text-white text-sm font-medium",children:(v.nickname||v.username||"?").charAt(0)}),s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:187:27",children:[s.jsx("p",{"code-path":"src/components/system/SystemUserTab.tsx:188:29",className:"text-sm font-medium text-slate-200",children:v.nickname||v.username}),s.jsxs("p",{"code-path":"src/components/system/SystemUserTab.tsx:189:29",className:"text-xs text-slate-500",children:["@",v.username]})]})]})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:193:23",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:194:25",className:"space-y-1",children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:195:27",className:"flex items-center gap-1 text-sm text-slate-400",children:[s.jsx(Ue,{"code-path":"src/components/system/SystemUserTab.tsx:196:29",className:"h-3.5 w-3.5"}),v.email||"--"]}),v.phone&&s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:200:29",className:"flex items-center gap-1 text-sm text-slate-400",children:[s.jsx(we,{"code-path":"src/components/system/SystemUserTab.tsx:201:31",className:"h-3.5 w-3.5"}),v.phone]})]})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:207:23",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:208:25",className:"flex flex-wrap gap-1",children:(v.roles||[]).map(Y=>s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:210:29",variant:"outline",className:"border-slate-700 text-slate-400",children:Y},Y))})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:216:23",children:v.authSource==="ldap"?s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:218:27",variant:"outline",className:"border-cyan-500/30 text-cyan-400 bg-cyan-500/10",children:"LDAP"}):s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:222:27",variant:"outline",className:"border-slate-600/30 text-slate-400 bg-slate-600/10",children:"本地"})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:227:23",children:u(v.status)}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:228:23",children:s.jsx("span",{"code-path":"src/components/system/SystemUserTab.tsx:229:25",className:"text-sm text-slate-400",children:v.lastLoginAt?new Date(v.lastLoginAt).toLocaleString():"--"})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:233:23",className:"text-right",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:234:25",className:"flex items-center justify-end gap-1",children:[s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:235:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>i(v),children:s.jsx(pe,{"code-path":"src/components/system/SystemUserTab.tsx:241:29",className:"h-4 w-4"})}),Q("system:user")&&s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:244:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>y(v),children:s.jsx(vs,{"code-path":"src/components/system/SystemUserTab.tsx:250:29",className:"h-4 w-4"})}),Q("system:user")&&s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:254:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>R(v),children:s.jsx(Zs,{"code-path":"src/components/system/SystemUserTab.tsx:260:29",className:"h-4 w-4"})})]})})]},v.id))})]})})})}),s.jsx(Oe,{"code-path":"src/components/system/SystemUserTab.tsx:275:7",selectedUser:m,setSelectedUser:i,getUserStatusBadge:u,openEdit:y}),s.jsx(Fe,{"code-path":"src/components/system/SystemUserTab.tsx:282:7",open:T,onOpenChange:N,editingUser:n,form:U,setForm:h,saving:D,onSubmit:b}),s.jsx(Ae,{"code-path":"src/components/system/SystemUserTab.tsx:292:7",importDialogOpen:C,setImportDialogOpen:P,importPreview:F,setImportPreview:B,importing:k,importResult:A,setImportResult:p,handleCsvUpload:O,handleBatchImport:j}),s.jsx(Pe,{"code-path":"src/components/system/SystemUserTab.tsx:304:7",importDialogOpen:C,setImportDialogOpen:P,ldapUsers:_,setLdapUsers:K,ldapSelected:G,setLdapSelected:E,ldapLoading:X,ldapImportOUs:L,ldapImportOUDN:rs,setLdapImportOUDN:ns,loadLdapUsers:ds,handleLdapImport:ps,importing:k,importResult:A,setImportResult:p})]})}const ze=[{key:"dashboard",label:"📊 仪表盘",prefixes:["dashboard:"]},{key:"server",label:"🖥️ 资产管理",prefixes:["server:"]},{key:"cloud",label:"☁️ 云资源",prefixes:["cloud:"]},{key:"k8s",label:"☸️ Kubernetes",prefixes:["k8s:"]},{key:"deploy",label:"🚀 应用发布",prefixes:["deploy:"]},{key:"monitor",label:"📡 监控告警",prefixes:["monitor:","agent:"]},{key:"auto",label:"⚙️ 自动化运维",prefixes:["auto:"]},{key:"aiops",label:"🤖 AIOps智能",prefixes:["aiops:"]},{key:"approval",label:"✅ 资源申请",prefixes:["approval:"]},{key:"audit",label:"🔍 安全审计",prefixes:["audit:"]},{key:"system",label:"🔧 系统管理",prefixes:["system:"]}];function $e(e){const d=ze.map(m=>({key:m.key,label:m.label,items:e.filter(i=>m.prefixes.some(u=>i.code.startsWith(u)))})).filter(m=>m.items.length>0),t=new Set(d.flatMap(m=>m.items.map(i=>i.id))),a=e.filter(m=>!t.has(m.id));return a.length>0&&d.push({key:"other",label:"📌 其他",items:a}),d}function Be({open:e,onOpenChange:d,editingRole:t,form:a,setForm:m,saving:i,onSubmit:u,permissions:T}){const N=(h,D)=>{m(b=>{const S=new Set(b.permission_ids);return D?S.add(h):S.delete(h),{...b,permission_ids:Array.from(S)}})},n=(h,D)=>{m(b=>{const S=new Set(b.permission_ids);return h.forEach(y=>D?S.add(y.id):S.delete(y.id)),{...b,permission_ids:Array.from(S)}})},U=$e(T);return s.jsx(Z,{"code-path":"src/components/system/RoleFormDialog.tsx:91:5",open:e,onOpenChange:d,children:s.jsxs(ss,{"code-path":"src/components/system/RoleFormDialog.tsx:92:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(es,{"code-path":"src/components/system/RoleFormDialog.tsx:93:9",children:[s.jsxs(ts,{"code-path":"src/components/system/RoleFormDialog.tsx:94:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[s.jsx(se,{"code-path":"src/components/system/RoleFormDialog.tsx:95:13",className:"h-5 w-5 text-purple-400"}),t?"编辑角色":"新建角色"]}),s.jsx(as,{"code-path":"src/components/system/RoleFormDialog.tsx:98:11",className:"text-[var(--dg-text-secondary)]",children:t?"修改角色信息与权限":"创建新的系统角色并分配权限"})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:103:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:104:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:105:13",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:106:15",className:"text-xs text-[var(--dg-text-secondary)]",children:"角色名称"}),s.jsx(f,{"code-path":"src/components/system/RoleFormDialog.tsx:107:15",value:a.name,onChange:h=>m({...a,name:h.target.value}),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]",placeholder:"如:运维工程师"})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:114:13",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:115:15",className:"text-xs text-[var(--dg-text-secondary)]",children:"角色编码"}),s.jsx(f,{"code-path":"src/components/system/RoleFormDialog.tsx:116:15",value:a.code,onChange:h=>m({...a,code:h.target.value}),disabled:!!t,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] disabled:opacity-60",placeholder:"如:ops_engineer"})]})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:125:11",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:126:13",className:"text-xs text-[var(--dg-text-secondary)]",children:"描述"}),s.jsx(Re,{"code-path":"src/components/system/RoleFormDialog.tsx:127:13",value:a.description,onChange:h=>m({...a,description:h.target.value}),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] resize-none",placeholder:"角色职责描述(可选)",rows:2})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:137:11",className:"space-y-2",children:[s.jsxs(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:138:13",className:"text-xs text-[var(--dg-text-secondary)]",children:["权限分配",a.permission_ids.length>0&&s.jsxs("span",{"code-path":"src/components/system/RoleFormDialog.tsx:141:17",className:"ml-2 text-purple-400",children:["已选 ",a.permission_ids.length," 项"]})]}),s.jsx("div",{"code-path":"src/components/system/RoleFormDialog.tsx:144:13",className:"max-h-[40vh] overflow-y-auto rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-tertiary)] p-3 space-y-3",children:U.length===0?s.jsx("p",{"code-path":"src/components/system/RoleFormDialog.tsx:146:17",className:"text-xs text-[var(--dg-text-muted)] text-center py-4",children:"暂无可分配权限"}):U.map(h=>{const D=h.items.filter(S=>a.permission_ids.includes(S.id)).length,b=D===h.items.length&&h.items.length>0;return s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:152:21",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:153:23",className:"flex items-center justify-between mb-1.5",children:[s.jsxs("button",{"code-path":"src/components/system/RoleFormDialog.tsx:154:25",onClick:()=>n(h.items,!b),className:"text-xs font-medium text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] transition-colors flex items-center gap-1",children:[h.label,s.jsxs("span",{"code-path":"src/components/system/RoleFormDialog.tsx:159:27",className:"text-[var(--dg-text-muted)] text-[10px]",children:["(",D,"/",h.items.length,")"]})]}),s.jsx("button",{"code-path":"src/components/system/RoleFormDialog.tsx:163:25",onClick:()=>n(h.items,!b),className:"text-[10px] text-blue-400 hover:text-blue-300 transition-colors",children:b?"取消全选":"全选"})]}),s.jsx("div",{"code-path":"src/components/system/RoleFormDialog.tsx:170:23",className:"grid grid-cols-2 gap-x-3 gap-y-1 pl-1",children:h.items.map(S=>s.jsxs(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:172:27",className:"flex items-center gap-2 text-xs text-[var(--dg-text-secondary)] font-normal cursor-pointer hover:text-[var(--dg-text-primary)] py-0.5",children:[s.jsx(_e,{"code-path":"src/components/system/RoleFormDialog.tsx:176:29",checked:a.permission_ids.includes(S.id),onCheckedChange:y=>N(S.id,y===!0),className:"border-[var(--dg-border)] data-[state=checked]:bg-blue-600 data-[state=checked]:border-blue-600 h-3.5 w-3.5"}),s.jsx("span",{"code-path":"src/components/system/RoleFormDialog.tsx:181:29",className:"truncate",children:S.name})]},S.id))})]},h.key)})})]})]}),s.jsxs(ls,{"code-path":"src/components/system/RoleFormDialog.tsx:193:9",children:[s.jsx(x,{"code-path":"src/components/system/RoleFormDialog.tsx:194:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>d(!1),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/RoleFormDialog.tsx:197:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:u,disabled:i,children:i?"保存中...":"保存"})]})]})})}const Ve={super_admin:"👑",k8s_admin:"☸️",resource_admin:"🖥️",monitor_admin:"📡",security_auditor:"🔍",release_admin:"🚀",viewer:"👁️"},He=[{label:"仪表盘",prefixes:["dashboard:"]},{label:"资产管理",prefixes:["server:"]},{label:"云资源",prefixes:["cloud:"]},{label:"K8s",prefixes:["k8s:"]},{label:"发布",prefixes:["deploy:"]},{label:"监控",prefixes:["monitor:","agent:"]},{label:"自动化",prefixes:["auto:"]},{label:"AI",prefixes:["aiops:"]},{label:"审批",prefixes:["approval:"]},{label:"审计",prefixes:["audit:"]},{label:"系统",prefixes:["system:"]}];function Ge(e,d){return He.map(a=>{const m=e.filter((i,u)=>a.prefixes.some(T=>(d[u]||"").startsWith(T)));return{label:a.label,count:m.length}}).filter(a=>a.count>0)}function Ke(e){const d=Array.isArray(e.permissions)?e.permissions:[];return{id:String(e.id??""),name:e.name??"",code:e.code??"",description:e.description??"",permissions:d.map(t=>typeof t=="string"?t:t?.name??t?.code??"").filter(Boolean),permissionCodes:d.map(t=>typeof t=="string"?t:t?.code??"").filter(Boolean),createdAt:e.createdAt??e.created_at??"",isSystem:e.is_system??e.isSystem??!1,_permissionIds:d.map(t=>typeof t=="object"?Number(t.id):0).filter(Boolean),_raw:e}}const me={name:"",code:"",description:"",permission_ids:[]};function Qe({selectedRole:e,setSelectedRole:d}){const t=Ks(),[a,m]=o.useState([]),[i,u]=o.useState(!0),[T,N]=o.useState([]),[n,U]=o.useState(!1),[h,D]=o.useState(null),[b,S]=o.useState({...me}),[y,R]=o.useState(!1),C=o.useCallback(async()=>{u(!0);try{const O=(await q.getRoles())?.list??[];m(O.map(Ke))}catch{m([])}finally{u(!1)}},[]),P=o.useCallback(async()=>{try{const O=(await q.getPermissions())?.list??[];N(O.map(j=>({id:Number(j.id),name:j.name??j.code??"",code:j.code??"",type:j.type})))}catch{N([])}},[]);o.useEffect(()=>{C(),P()},[C,P]);const F=()=>{D(null),S({...me}),U(!0)},B=p=>{D(p._raw||p),S({name:p.name??"",code:p.code??"",description:p.description??"",permission_ids:Array.isArray(p._permissionIds)?[...p._permissionIds]:[]}),U(!0)},k=async()=>{if(!b.name.trim()){V.error("请输入角色名称");return}if(!b.code.trim()){V.error("请输入角色编码");return}R(!0);try{const p={name:b.name.trim(),code:b.code.trim(),description:b.description.trim(),permission_ids:b.permission_ids};h?(await q.updateRole(h.id,p),V.success("角色更新成功")):(await q.createRole(p),V.success("角色创建成功")),U(!1),await C()}catch(p){V.error(p?.message||"保存失败")}finally{R(!1)}},A=async p=>{if(p.isSystem){V.error("系统默认角色不可删除");return}if(await t({title:"删除角色",description:`确认删除角色「${p.name}」吗?该操作不可恢复。`,confirmText:"删除",variant:"destructive"}))try{await q.deleteRole(p.id),V.success("角色已删除"),await C()}catch(j){const _=j?.response?.data?.message||j?.message||"删除失败";V.error(_)}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:187:7",className:"flex items-center justify-end gap-2",children:[s.jsxs("span",{"code-path":"src/components/system/SystemRolesTab.tsx:188:9",className:"text-xs text-[var(--dg-text-muted)]",children:[a.length," 个角色"]}),s.jsxs(x,{"code-path":"src/components/system/SystemRolesTab.tsx:189:9",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:F,children:[s.jsx(Ys,{"code-path":"src/components/system/SystemRolesTab.tsx:190:11",className:"h-4 w-4 mr-2"}),"新建角色"]})]}),i?s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:195:9",className:"flex items-center justify-center py-16",children:s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:196:11",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):a.length===0?s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:199:9",className:"flex flex-col items-center justify-center py-16 text-[var(--dg-text-muted)]",children:[s.jsx(se,{"code-path":"src/components/system/SystemRolesTab.tsx:200:11",className:"h-10 w-10 mb-3 opacity-40"}),s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:201:11",className:"text-sm",children:"暂无角色数据"})]}):s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:204:9",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:a.map(p=>{const O=p.permissions,j=p.permissionCodes,_=Ge(O,j),G=Ve[p.code]||"🛡️";return s.jsxs(xs,{"code-path":"src/components/system/SystemRolesTab.tsx:211:15",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${p.isSystem?"border-purple-500/20":""}`,children:[s.jsx(Ss,{"code-path":"src/components/system/SystemRolesTab.tsx:212:17",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:213:19",className:"flex items-start justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:214:21",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:215:23",className:`w-10 h-10 rounded-lg flex items-center justify-center text-lg ${p.isSystem?"bg-purple-500/10":"bg-[var(--dg-bg-tertiary)]"}`,children:G}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:220:23",children:[s.jsxs(js,{"code-path":"src/components/system/SystemRolesTab.tsx:221:25",className:"text-base text-[var(--dg-text-primary)] flex items-center gap-1.5",children:[p.name,p.isSystem&&s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:224:29",className:"bg-purple-500/15 text-purple-400 border-purple-500/30 text-[10px] px-1 py-0",children:[s.jsx(ee,{"code-path":"src/components/system/SystemRolesTab.tsx:225:31",className:"h-2.5 w-2.5 mr-0.5"}),"系统"]})]}),s.jsx(us,{"code-path":"src/components/system/SystemRolesTab.tsx:229:25",className:"text-[var(--dg-text-muted)] text-xs",children:p.code})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:232:21",className:"flex items-center gap-1",children:[s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:233:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",onClick:()=>d(p),children:s.jsx(pe,{"code-path":"src/components/system/SystemRolesTab.tsx:238:25",className:"h-4 w-4"})}),s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:240:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-blue-400",onClick:()=>B(p),children:s.jsx(vs,{"code-path":"src/components/system/SystemRolesTab.tsx:245:25",className:"h-4 w-4"})}),s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:247:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-red-400",onClick:()=>A(p),disabled:p.isSystem,title:p.isSystem?"系统默认角色不可删除":"删除角色",children:s.jsx(Zs,{"code-path":"src/components/system/SystemRolesTab.tsx:254:25",className:`h-4 w-4 ${p.isSystem?"opacity-30":""}`})})]})]})}),s.jsxs(hs,{"code-path":"src/components/system/SystemRolesTab.tsx:259:17",children:[s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:260:19",className:"text-sm text-[var(--dg-text-secondary)] mb-3",children:p.description||"暂无描述"}),s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:262:19",className:"flex flex-wrap gap-1.5",children:_.map(E=>s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:264:23",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)] text-[10px]",children:[E.label,"·",E.count]},E.label))}),O.length===0&&s.jsx("span",{"code-path":"src/components/system/SystemRolesTab.tsx:270:21",className:"text-xs text-[var(--dg-text-muted)]",children:"未分配权限"})]})]},p.id)})}),s.jsx(We,{"code-path":"src/components/system/SystemRolesTab.tsx:280:7",role:e,onClose:()=>d(null),onEdit:p=>{d(null),B(p)}}),s.jsx(Be,{"code-path":"src/components/system/SystemRolesTab.tsx:283:7",open:n,onOpenChange:U,editingRole:h,form:b,setForm:S,saving:y,onSubmit:k,permissions:T})]})}function We({role:e,onClose:d,onEdit:t}){const m=e?.isSystem??!1;return s.jsx(Z,{"code-path":"src/components/system/SystemRolesTab.tsx:299:5",open:!!e,onOpenChange:i=>!i&&d(),children:s.jsxs(ss,{"code-path":"src/components/system/SystemRolesTab.tsx:300:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[s.jsxs(es,{"code-path":"src/components/system/SystemRolesTab.tsx:301:9",children:[s.jsxs(ts,{"code-path":"src/components/system/SystemRolesTab.tsx:302:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[s.jsx(Ce,{"code-path":"src/components/system/SystemRolesTab.tsx:303:13",className:"h-5 w-5 text-purple-400"}),e?.name,m&&s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:306:15",className:"bg-purple-500/15 text-purple-400 border-purple-500/30 text-[10px]",children:[s.jsx(ee,{"code-path":"src/components/system/SystemRolesTab.tsx:307:17",className:"h-2.5 w-2.5 mr-0.5"}),"系统"]})]}),s.jsxs(as,{"code-path":"src/components/system/SystemRolesTab.tsx:311:11",className:"text-[var(--dg-text-muted)]",children:["编码:",e?.code]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:313:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:314:11",className:"rounded-lg bg-[var(--dg-bg-tertiary)] p-4",children:[s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:315:13",className:"text-xs text-[var(--dg-text-muted)] mb-1",children:"描述"}),s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:316:13",className:"text-sm text-[var(--dg-text-primary)]",children:e?.description||"暂无描述"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:318:11",children:[s.jsxs("h4",{"code-path":"src/components/system/SystemRolesTab.tsx:319:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-2",children:["权限列表 (",e?.permissions?.length||0," 项)"]}),e&&e.permissions.length>0?s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:323:15",className:"flex flex-wrap gap-2 max-h-60 overflow-y-auto",children:e.permissions.map((i,u)=>s.jsx(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:325:19",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:i},u))}):s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:331:15",className:"text-xs text-[var(--dg-text-muted)]",children:"未分配权限"})]})]}),s.jsx(ls,{"code-path":"src/components/system/SystemRolesTab.tsx:335:9",children:s.jsxs(x,{"code-path":"src/components/system/SystemRolesTab.tsx:336:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>e&&t(e),children:[s.jsx(vs,{"code-path":"src/components/system/SystemRolesTab.tsx:337:13",className:"h-4 w-4 mr-2"}),"编辑"]})})]})})}function qe(e){const{ldapConfig:d,ldapMgmtOpen:t,setLdapMgmtOpen:a,ldapOUs:m,selectedOUDN:i,setSelectedOUDN:u,ldapUsers:T,selectedLDAPUsers:N,setSelectedLDAPUsers:n,loadLdapOUs:U,loadLdapOUUsers:h,handleLdapImport:D,importing:b,importFeedback:S,importResultOpen:y,setImportResultOpen:R,createOUOpen:C,setCreateOUOpen:P,ouForm:F,setOuForm:B,handleCreateOU:k,ldapSaving:A,createUserOpen:p,setCreateUserOpen:O,newUser:j,setNewUser:_,handleCreateLDAPUser:G,ldapUserTestOpen:E,setLdapUserTestOpen:X,ldapTestUser:L,setLdapTestUser:rs,ldapTestPass:ns,setLdapTestPass:ds,ldapUserTesting:ps,ldapUserTestResult:K,handleLdapUserTest:Q,editLdapUser:v,setEditLdapUser:Y,editLdapForm:r,setEditLdapForm:z,handleUpdateLdapUser:os,handleDeleteLDAPEntry:fs,openEditLdapUser:ks}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{"code-path":"src/components/system/LdapManagementSection.tsx:140:7",onClick:()=>{const c=!t;a(c),c&&m.length===0&&U()},className:"w-full flex items-center gap-2 px-4 py-2.5 bg-slate-900/50 hover:bg-slate-800/50 text-slate-400 text-sm transition-colors",children:[s.jsx(Me,{"code-path":"src/components/system/LdapManagementSection.tsx:148:9",className:`h-4 w-4 transition-transform ${t?"":"-rotate-90"}`}),s.jsx(ie,{"code-path":"src/components/system/LdapManagementSection.tsx:149:9",className:"h-4 w-4 text-amber-400"}),s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:150:9",className:"text-slate-300",children:"LDAP 账号管理"})]}),t&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:154:9",className:"bg-slate-900/30 border-t border-slate-800/50 px-4 py-4 space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:155:11",className:"flex items-center gap-3 flex-wrap",children:[s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:157:13",open:E,onOpenChange:X,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:158:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:159:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(Qs,{"code-path":"src/components/system/LdapManagementSection.tsx:160:19",className:"h-3.5 w-3.5 mr-1"}),"账号验证"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:164:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:165:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:166:19",className:"text-slate-100",children:"LDAP 账号验证测试"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:167:19",className:"text-slate-500",children:"输入 LDAP 用户凭据进行认证测试"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:169:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:170:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:171:21",className:"text-xs text-slate-500 mb-1 block",children:"用户名"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:172:21",value:L,onChange:c=>rs(c.target.value),placeholder:"zhangsan",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:179:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:180:21",className:"text-xs text-slate-500 mb-1 block",children:"密码"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:181:21",type:"password",value:ns,onChange:c=>ds(c.target.value),onKeyDown:c=>c.key==="Enter"&&Q(),placeholder:"••••••",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),K&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:191:21",className:`p-3 rounded-lg text-sm ${K.success?"bg-emerald-500/10 text-emerald-300":"bg-red-500/10 text-red-300"}`,children:[K.message,K.user_info&&s.jsx("pre",{"code-path":"src/components/system/LdapManagementSection.tsx:194:25",className:"mt-2 text-xs whitespace-pre-wrap",children:JSON.stringify(K.user_info,null,2)})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:198:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:Q,disabled:ps||!L,children:[ps?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:203:40",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"验证"]})]})]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:210:13",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",onClick:U,children:[s.jsx(Xs,{"code-path":"src/components/system/LdapManagementSection.tsx:211:15",className:"h-3.5 w-3.5 mr-1"}),"刷新"]}),s.jsxs(Us,{"code-path":"src/components/system/LdapManagementSection.tsx:216:13",value:i,onValueChange:c=>{u(c),h(c)},children:[s.jsx(ws,{"code-path":"src/components/system/LdapManagementSection.tsx:217:15",className:"w-60 h-7 bg-slate-800 border-slate-700 text-slate-200 text-xs",children:s.jsx(Cs,{"code-path":"src/components/system/LdapManagementSection.tsx:218:17",placeholder:"选择组织单元"})}),s.jsxs(Ms,{"code-path":"src/components/system/LdapManagementSection.tsx:220:15",className:"bg-slate-800 border-slate-700",children:[s.jsxs(H,{"code-path":"src/components/system/LdapManagementSection.tsx:221:17",value:d.base_dn,children:["根 (",d.base_dn,")"]}),m.map(c=>s.jsx(H,{"code-path":"src/components/system/LdapManagementSection.tsx:223:19",value:c.dn,children:c.description?`${c.name} (${c.description})`:c.name},c.dn))]})]}),s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:231:13",open:C,onOpenChange:P,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:232:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:233:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(Ys,{"code-path":"src/components/system/LdapManagementSection.tsx:234:19",className:"h-3.5 w-3.5 mr-1"}),"新建 OU"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:238:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:239:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:240:19",className:"text-slate-100",children:"新建组织单元"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:241:19",className:"text-slate-500",children:"在 LDAP 目录中创建新的组织单元 (OU)"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:243:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:244:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:245:21",className:"text-xs text-slate-500 mb-1 block",children:"OU 名称 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:246:21",value:F.ou_name,onChange:c=>B({...F,ou_name:c.target.value}),placeholder:"dev",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:248:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:249:21",className:"text-xs text-slate-500 mb-1 block",children:"父级 DN"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:250:21",value:F.parent_dn,onChange:c=>B({...F,parent_dn:c.target.value}),placeholder:d.base_dn,className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:252:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:253:21",className:"text-xs text-slate-500 mb-1 block",children:"描述"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:254:21",value:F.description,onChange:c=>B({...F,description:c.target.value}),placeholder:"开发团队",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:256:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:k,disabled:!F.ou_name||A,children:[A?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:257:35",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"创建"]})]})]})]}),s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:265:13",open:p,onOpenChange:O,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:266:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:267:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(ke,{"code-path":"src/components/system/LdapManagementSection.tsx:268:19",className:"h-3.5 w-3.5 mr-1"}),"添加用户"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:272:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:273:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:274:19",className:"text-slate-100",children:"添加 LDAP 用户"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:275:19",className:"text-slate-500",children:"在 LDAP 目录中创建新的用户账号"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:277:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:278:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:279:21",className:"text-xs text-slate-500 mb-1 block",children:"用户名 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:280:21",value:j.username,onChange:c=>_({...j,username:c.target.value}),placeholder:"zhangsan",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:282:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:283:21",className:"text-xs text-slate-500 mb-1 block",children:"密码 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:284:21",type:"password",value:j.password,onChange:c=>_({...j,password:c.target.value}),placeholder:"••••••",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:286:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:287:21",className:"text-xs text-slate-500 mb-1 block",children:"显示名称"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:288:21",value:j.display_name,onChange:c=>_({...j,display_name:c.target.value}),placeholder:"张三",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:290:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:291:21",className:"text-xs text-slate-500 mb-1 block",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:292:21",value:j.email,onChange:c=>_({...j,email:c.target.value}),placeholder:"zs@example.com",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:294:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:295:21",className:"text-xs text-slate-500 mb-1 block",children:"目标 OU"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:296:21",value:j.ou_dn||i||d.base_dn,onChange:c=>_({...j,ou_dn:c.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:298:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:G,disabled:!j.username||!j.password||A,children:[A?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:299:35",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"创建"]})]})]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:307:13",variant:"outline",size:"sm",className:"border-blue-600/50 text-blue-400 hover:bg-blue-600/10 ml-auto",onClick:D,disabled:T.length===0||b,children:[b?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:314:28",className:"h-3.5 w-3.5 mr-1 animate-spin"}):s.jsx(de,{"code-path":"src/components/system/LdapManagementSection.tsx:314:84",className:"h-3.5 w-3.5 mr-1"}),N.length>0?`导入 (${N.length})`:`导入全部 (${T.length})`]})]}),S&&s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:320:13",open:y,onOpenChange:R,children:s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:321:15",className:"max-w-sm bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:322:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:323:19",className:"text-slate-100",children:"导入结果"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:324:19",className:"text-slate-500",children:"LDAP 用户导入到本地用户库的执行结果"})]}),s.jsx("div",{"code-path":"src/components/system/LdapManagementSection.tsx:326:17",className:"py-3 text-sm text-slate-300",children:S}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:329:17",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>R(!1),children:"确定"})]})}),s.jsx("div",{"code-path":"src/components/system/LdapManagementSection.tsx:337:11",className:"border border-slate-800 rounded-lg overflow-hidden",children:s.jsxs(As,{"code-path":"src/components/system/LdapManagementSection.tsx:338:13",children:[s.jsx(Ps,{"code-path":"src/components/system/LdapManagementSection.tsx:339:15",children:s.jsxs(J,{"code-path":"src/components/system/LdapManagementSection.tsx:340:17",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:341:19",className:"text-slate-400 w-8",children:s.jsx("input",{"code-path":"src/components/system/LdapManagementSection.tsx:342:21",type:"checkbox",className:"rounded bg-slate-800 border-slate-600",checked:N.length>0&&N.length===T.length,onChange:c=>n(c.target.checked?T.map(W=>W.dn):[])})}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:349:19",className:"text-slate-400",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:350:19",className:"text-slate-400",children:"显示名称"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:351:19",className:"text-slate-400",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:352:19",className:"text-slate-400",children:"DN"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:353:19",className:"text-slate-400 w-12",children:"操作"})]})}),s.jsx(Es,{"code-path":"src/components/system/LdapManagementSection.tsx:356:15",children:T.length===0?s.jsx(J,{"code-path":"src/components/system/LdapManagementSection.tsx:358:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:359:21",colSpan:6,className:"text-center text-slate-500 py-8",children:"点击「刷新」加载 LDAP 用户"})}):T.map(c=>s.jsxs(J,{"code-path":"src/components/system/LdapManagementSection.tsx:365:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:366:23",children:s.jsx("input",{"code-path":"src/components/system/LdapManagementSection.tsx:367:25",type:"checkbox",className:"rounded bg-slate-800 border-slate-600",checked:N.includes(c.dn),onChange:W=>{W.target.checked?n([...N,c.dn]):n(N.filter(is=>is!==c.dn))}})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:377:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:378:25",className:"text-sm text-slate-200 font-medium",children:c.uid})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:380:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:381:25",className:"text-sm text-slate-300",children:c.cn})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:383:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:384:25",className:"text-sm text-slate-400",children:c.mail||"-"})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:386:23",children:s.jsx("code",{"code-path":"src/components/system/LdapManagementSection.tsx:387:25",className:"text-xs text-slate-500",children:c.dn})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:389:23",children:s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:390:25",className:"flex items-center gap-1",children:[s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:391:27",variant:"ghost",size:"icon",className:"h-6 w-6 text-slate-400 hover:text-blue-400 hover:bg-blue-500/10",onClick:()=>ks(c),children:s.jsx(vs,{"code-path":"src/components/system/LdapManagementSection.tsx:397:29",className:"h-3 w-3"})}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:399:27",variant:"ghost",size:"icon",className:"h-6 w-6 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>fs(c.dn),children:s.jsx(Zs,{"code-path":"src/components/system/LdapManagementSection.tsx:405:29",className:"h-3 w-3"})})]})})]},c.dn))})]})})]}),s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:419:7",open:!!v,onOpenChange:c=>!c&&Y(null),children:s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:420:9",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:421:11",children:[s.jsxs(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:422:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(vs,{"code-path":"src/components/system/LdapManagementSection.tsx:423:15",className:"h-5 w-5 text-blue-400"}),"编辑 LDAP 用户"]}),s.jsxs(as,{"code-path":"src/components/system/LdapManagementSection.tsx:426:13",className:"text-slate-500",children:["修改 ",v?.uid," 的属性"]})]}),v&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:431:13",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:432:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:433:17",className:"text-xs text-slate-500 mb-1 block",children:"用户名(只读)"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:434:17",value:v.uid||"",disabled:!0,className:"bg-slate-800/50 border-slate-700 text-slate-500"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:436:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:437:17",className:"text-xs text-slate-500 mb-1 block",children:"显示名称 (cn)"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:438:17",value:r.cn,onChange:c=>z({...r,cn:c.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:440:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:441:17",className:"text-xs text-slate-500 mb-1 block",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:442:17",value:r.mail,onChange:c=>z({...r,mail:c.target.value}),placeholder:"user@example.com",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:444:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:445:17",className:"text-xs text-slate-500 mb-1 block",children:"电话"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:446:17",value:r.phone,onChange:c=>z({...r,phone:c.target.value}),placeholder:"13800138000",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:448:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:449:17",className:"text-xs text-slate-500 mb-1 block",children:"职位/头衔"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:450:17",value:r.title,onChange:c=>z({...r,title:c.target.value}),placeholder:"运维工程师",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]})]}),s.jsxs(ls,{"code-path":"src/components/system/LdapManagementSection.tsx:454:11",children:[s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:455:13",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>Y(null),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:456:13",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:os,children:"保存"})]})]})})]})}function Je(e){const{ldapConfig:d,ldapForm:t,setLdapForm:a,ldapSaving:m,ldapTesting:i,ldapTestResult:u,handleLdapSave:T,handleLdapTest:N}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:93:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:94:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:95:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:96:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(ee,{"code-path":"src/components/system/SystemSettingsTab.tsx:97:15",className:"h-5 w-5 text-blue-400"}),"安全设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:100:13",className:"text-slate-500",children:"密码策略与登录安全"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:102:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:103:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:104:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:105:17",className:"text-sm font-medium text-slate-200",children:"强制密码复杂度"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:106:17",className:"text-xs text-slate-500",children:"要求密码包含大小写字母、数字和特殊字符"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:108:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:110:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:111:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:112:17",className:"text-sm font-medium text-slate-200",children:"登录失败锁定"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:113:17",className:"text-xs text-slate-500",children:"连续5次登录失败锁定账户30分钟"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:115:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:117:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:118:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:119:17",className:"text-sm font-medium text-slate-200",children:"双因素认证"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:120:17",className:"text-xs text-slate-500",children:"启用后需要手机验证码登录"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:122:15",className:"data-[state=checked]:bg-blue-600"})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:127:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:128:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:129:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Ie,{"code-path":"src/components/system/SystemSettingsTab.tsx:130:15",className:"h-5 w-5 text-emerald-400"}),"审计设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:133:13",className:"text-slate-500",children:"操作日志与审计策略"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:135:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:136:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:137:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:138:17",className:"text-sm font-medium text-slate-200",children:"记录所有操作"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:139:17",className:"text-xs text-slate-500",children:"记录用户的所有操作行为"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:141:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:143:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:144:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:145:17",className:"text-sm font-medium text-slate-200",children:"日志保留时间"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:146:17",className:"text-xs text-slate-500",children:"操作日志保留180天"})]}),s.jsxs(Us,{"code-path":"src/components/system/SystemSettingsTab.tsx:148:15",defaultValue:"180",children:[s.jsx(ws,{"code-path":"src/components/system/SystemSettingsTab.tsx:149:17",className:"w-32 h-8 bg-slate-800 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/SystemSettingsTab.tsx:150:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/SystemSettingsTab.tsx:152:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:153:19",value:"30",children:"30天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:154:19",value:"90",children:"90天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:155:19",value:"180",children:"180天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:156:19",value:"365",children:"1年"})]})]})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:163:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:164:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:165:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Qs,{"code-path":"src/components/system/SystemSettingsTab.tsx:166:15",className:"h-5 w-5 text-amber-400"}),"会话设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:169:13",className:"text-slate-500",children:"会话超时与Token配置"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:171:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:172:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:173:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:174:17",className:"text-sm font-medium text-slate-200",children:"会话超时时间"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:175:17",className:"text-xs text-slate-500",children:"用户无操作30分钟后自动登出"})]}),s.jsxs(Us,{"code-path":"src/components/system/SystemSettingsTab.tsx:177:15",defaultValue:"30",children:[s.jsx(ws,{"code-path":"src/components/system/SystemSettingsTab.tsx:178:17",className:"w-32 h-8 bg-slate-800 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/SystemSettingsTab.tsx:179:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/SystemSettingsTab.tsx:181:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:182:19",value:"15",children:"15分钟"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:183:19",value:"30",children:"30分钟"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:184:19",value:"60",children:"1小时"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:185:19",value:"120",children:"2小时"})]})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:189:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:190:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:191:17",className:"text-sm font-medium text-slate-200",children:"单点登录"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:192:17",className:"text-xs text-slate-500",children:"同一账号只能在一个设备登录"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:194:15",className:"data-[state=checked]:bg-blue-600"})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:199:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:200:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:201:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(xe,{"code-path":"src/components/system/SystemSettingsTab.tsx:202:15",className:"h-5 w-5 text-purple-400"}),"系统信息"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:205:13",className:"text-slate-500",children:"版本与系统状态"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:207:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:208:13",className:"flex items-center justify-between",children:[s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:209:15",className:"text-sm text-slate-400",children:"系统版本"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:210:15",className:"text-sm text-slate-200",children:"v2.5.1"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:212:13",className:"flex items-center justify-between",children:[s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:213:15",className:"text-sm text-slate-400",children:"运行时间"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:214:15",className:"text-sm text-slate-200",children:"30天 12小时"})]})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:221:7",className:"bg-slate-900 border-slate-800 mt-4",children:[s.jsx(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:222:9",children:s.jsx("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:223:11",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:224:13",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:225:15",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Js,{"code-path":"src/components/system/SystemSettingsTab.tsx:226:17",className:"h-5 w-5 text-cyan-400"}),"LDAP / Active Directory"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:229:15",className:"text-slate-500 mt-1",children:"配置 LDAP 服务器,实现统一身份认证"})]})})}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:233:9",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:234:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:235:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:236:15",className:"text-xs text-slate-500",children:"LDAP 服务器地址"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:237:15",value:t.ldap_host,onChange:n=>a({...t,ldap_host:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"ldap.example.com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:244:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:245:15",className:"text-xs text-slate-500",children:"端口"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:246:15",type:"number",value:t.ldap_port,onChange:n=>a({...t,ldap_port:Number(n.target.value)}),className:"bg-slate-800/50 border-slate-700 text-slate-200",placeholder:"389"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:254:13",className:"space-y-1.5 col-span-2",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:255:15",className:"text-xs text-slate-500",children:"Base DN(用户搜索基础)"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:256:15",value:t.base_dn,onChange:n=>a({...t,base_dn:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"ou=users,dc=example,dc=com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:263:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:264:15",className:"text-xs text-slate-500",children:"管理员 Bind DN"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:265:15",value:t.admin_dn,onChange:n=>a({...t,admin_dn:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"cn=admin,dc=example,dc=com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:272:13",className:"space-y-1.5",children:[s.jsxs("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:273:15",className:"text-xs text-slate-500",children:["管理员密码 ",d&&"(留空不修改)"]}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:274:15",type:"password",value:t.admin_password,onChange:n=>a({...t,admin_password:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"******"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:282:13",className:"space-y-1.5 col-span-2",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:283:15",className:"text-xs text-slate-500",children:"搜索过滤器(可选,用 %s 代表用户名)"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:284:15",value:t.search_filter,onChange:n=>a({...t,search_filter:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"(uid=%s)"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:291:13",className:"flex items-center gap-2 col-span-2",children:[s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:292:15",checked:t.use_ldaps,onCheckedChange:n=>a({...t,use_ldaps:n}),className:"data-[state=checked]:bg-blue-600"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:297:15",className:"text-sm text-slate-300",children:"启用 LDAPS(SSL 加密)"})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:302:11",className:"flex items-center gap-3 mt-4 pt-4 border-t border-slate-800",children:[u&&s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:304:15",className:`text-xs ${u.includes("成功")?"text-emerald-400":"text-red-400"}`,children:u}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:308:13",className:"flex items-center gap-2 ml-auto",children:[s.jsxs(x,{"code-path":"src/components/system/SystemSettingsTab.tsx:309:15",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:N,disabled:i,children:[i?s.jsx(Ns,{"code-path":"src/components/system/SystemSettingsTab.tsx:316:32",className:"h-3.5 w-3.5 mr-1 animate-spin"}):s.jsx(Xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:316:88",className:"h-3.5 w-3.5 mr-1"}),"测试连接"]}),s.jsx(x,{"code-path":"src/components/system/SystemSettingsTab.tsx:319:15",size:"sm",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:T,disabled:m,children:m?"保存中...":"保存配置"})]})]})]})]}),d&&s.jsx("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:334:9",className:"mt-4",children:s.jsx(qe,{"code-path":"src/components/system/SystemSettingsTab.tsx:335:11",...e})})]})}function Xe(e){const d=Ks(),[t,a]=o.useState([]),[m,i]=o.useState(new Set),[u,T]=o.useState(!1),[N,n]=o.useState([]),[U,h]=o.useState(""),[D,b]=o.useState(null),[S,y]=o.useState({ldap_host:"",ldap_port:389,use_ldaps:!1,admin_dn:"",admin_password:"",base_dn:"",search_filter:""}),[R,C]=o.useState(!1),[P,F]=o.useState(!1),[B,k]=o.useState(null),[A,p]=o.useState(!1),[O,j]=o.useState(null),[_,G]=o.useState(!1),[E,X]=o.useState([]),[L,rs]=o.useState(""),[ns,ds]=o.useState([]),[ps,K]=o.useState(!1),[Q,v]=o.useState(!1),[Y,r]=o.useState({ou_name:"",parent_dn:"",description:""}),[z,os]=o.useState({username:"",password:"",display_name:"",email:"",ou_dn:""}),[fs,ks]=o.useState(!1),[c,W]=o.useState(""),[is,Is]=o.useState(""),[Rs,Ds]=o.useState(!1),[_s,ys]=o.useState(null),[gs,g]=o.useState(null),[ms,Fs]=o.useState({cn:"",mail:"",phone:"",title:""}),[te,zs]=o.useState(!1),ae=async()=>{try{const l=await $.getConfig();l&&l.ldap_host&&(b(l),y({ldap_host:l.ldap_host||"",ldap_port:l.ldap_port||389,use_ldaps:l.use_ldaps||!1,admin_dn:l.admin_dn||"",admin_password:"",base_dn:l.base_dn||"",search_filter:l.search_filter||""}))}catch{}},he=async()=>{C(!0);try{await $.updateConfig(S),await ae()}catch(l){console.error("Failed to save LDAP config:",l)}finally{C(!1)}},ye=async()=>{F(!0),k(null);try{await $.updateConfig(S);const l=await $.testConnection();k(l?.message||(l?.success?"连接成功":"连接失败"))}catch(l){k(l?.message||"连接失败")}finally{F(!1)}},Ls=async l=>{try{const I=await $.listUsers(l);a(I||[])}catch(I){console.error("loadOUUsers",I)}},ce=async()=>{try{const l=await $.listOUs();X(l||[]),!L&&D?.base_dn&&(rs(D.base_dn),await Ls(D.base_dn))}catch(l){console.error("loadOUs",l)}},ge=async()=>{C(!0);try{await $.createOU(Y),K(!1),r({ou_name:"",parent_dn:"",description:""}),await ce()}catch(l){const I=l?.message||"";I.includes("Already Exists")||I.includes("68")?V.error(`OU "${Y.ou_name}" 已存在,请使用其他名称`):V.error("创建失败: "+I)}finally{C(!1)}},be=async()=>{C(!0);try{await $.createUser({...z,ou_dn:z.ou_dn||L||D?.base_dn}),v(!1),os({username:"",password:"",display_name:"",email:"",ou_dn:""}),await Ls(L)}catch(l){V.error(l?.message||"创建失败")}finally{C(!1)}},Se=async(l,I=!1)=>{if(!(!I&&!await d({title:"删除 LDAP 条目",description:`确定删除 ${l}?`,confirmText:"删除",variant:"destructive"})))try{await $.deleteUser(l),I||await Ls(L)}catch(Os){I||V.error(Os?.message||"删除失败")}},je=l=>{g(l),Fs({cn:l.cn||"",mail:l.mail||"",phone:l.phone||"",title:l.title||""})},ue=async()=>{if(gs)try{await $.updateUser({dn:gs.dn,...ms}),g(null),await Ls(L)}catch(l){V.error(l?.message||"修改失败")}},Ne=async()=>{Ds(!0),ys(null);try{const l=await $.testConnection({test_user:c,test_password:is});ys(l)}catch(l){ys({success:!1,message:l?.message||"验证失败"})}finally{Ds(!1)}},ne=async l=>{T(!0);try{const I=await $.listUsers(l);a(Array.isArray(I)?I:[]),i(new Set)}catch{a([])}finally{T(!1)}},oe=async()=>{let l=[];if(ns.length>0?l=t.filter(I=>ns.includes(I.dn)):l=t,l.length!==0){zs(!0);try{const I=l.map($s=>({username:$s.uid||"",nickname:$s.cn||"",email:$s.mail||""})),Os=await $.batchImport(I);j(Os?.message||`成功导入 ${l.length} 个用户`),G(!0),ds([]),await e()}catch(I){j("导入失败: "+(I?.message||"未知错误")),G(!0)}finally{zs(!1)}}};return{ldapUsers:t,setLdapUsers:a,ldapSelected:m,setLdapSelected:i,ldapLoading:u,ldapImportOUs:N,ldapImportOUDN:U,setLdapImportOUDN:h,loadLdapUsers:ne,handleLdapImport:oe,loadImportDialogData:()=>{$.listOUs().then(l=>n(Array.isArray(l)?l:[])).catch(()=>{}),ne("")},importing:te,setImporting:zs,importFeedback:O,importResultOpen:_,setImportResultOpen:G,loadLdapConfig:ae,settingsTabProps:{ldapConfig:D,ldapForm:S,setLdapForm:y,ldapSaving:R,ldapTesting:P,ldapTestResult:B,handleLdapSave:he,handleLdapTest:ye,ldapMgmtOpen:A,setLdapMgmtOpen:p,ldapOUs:E,selectedOUDN:L,setSelectedOUDN:rs,ldapUsers:t,selectedLDAPUsers:ns,setSelectedLDAPUsers:ds,loadLdapOUs:ce,loadLdapOUUsers:Ls,handleLdapImport:oe,importing:te,importFeedback:O,importResultOpen:_,setImportResultOpen:G,createOUOpen:ps,setCreateOUOpen:K,ouForm:Y,setOuForm:r,handleCreateOU:ge,createUserOpen:Q,setCreateUserOpen:v,newUser:z,setNewUser:os,handleCreateLDAPUser:be,ldapUserTestOpen:fs,setLdapUserTestOpen:ks,ldapTestUser:c,setLdapTestUser:W,ldapTestPass:is,setLdapTestPass:Is,ldapUserTesting:Rs,ldapUserTestResult:_s,handleLdapUserTest:Ne,editLdapUser:gs,setEditLdapUser:g,editLdapForm:ms,setEditLdapForm:Fs,handleUpdateLdapUser:ue,handleDeleteLDAPEntry:Se,openEditLdapUser:je}}}function Ye(e){return{...e,status:e.status===1||e.status==="active"?"active":"inactive",roles:Array.isArray(e.roles)?e.roles:e.role?[e.role]:[],lastLoginAt:e.last_login??e.lastLoginAt,createdAt:e.created_at??e.createdAt,authSource:e.auth_source??e.authSource??"local"}}const le={username:"",nickname:"",email:"",phone:"",role:"",password:"",status:1};function yt(){const e=Ks(),d=fe(),t={"/users":"users","/roles":"roles","/settings":"settings"},[a,m]=o.useState(t[d.pathname]||"users");o.useEffect(()=>{const r=t[d.pathname];r&&r!==a&&m(r)},[d.pathname]);const[i,u]=o.useState(""),[T,N]=o.useState([]),[n,U]=o.useState(!0),[h,D]=o.useState(null),[b,S]=o.useState(null),[y,R]=o.useState(!1),[C,P]=o.useState(null),[F,B]=o.useState(!1),[k,A]=o.useState({...le}),[p,O]=o.useState(null),[j,_]=o.useState([]),[G,E]=o.useState(null),X=async()=>{U(!0);try{const z=(await q.getUsers({page:1,page_size:100}))?.list??[];N(z.map(Ye))}catch(r){console.error("Failed to fetch users:",r),N([])}finally{U(!1)}},L=Xe(X);o.useEffect(()=>{X(),L.loadLdapConfig()},[]),o.useEffect(()=>{p==="ldap"&&L.loadImportDialogData()},[p]);const rs=T.filter(r=>(r.username||"").toLowerCase().includes(i.toLowerCase())||(r.nickname||"").toLowerCase().includes(i.toLowerCase())||(r.email||"").toLowerCase().includes(i.toLowerCase())),ns=r=>r==="active"?s.jsxs(cs,{"code-path":"src/components/system/SystemManager.tsx:110:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(Ws,{"code-path":"src/components/system/SystemManager.tsx:111:9",className:"h-3 w-3 mr-1"}),"正常"]}):s.jsxs(cs,{"code-path":"src/components/system/SystemManager.tsx:115:7",variant:"outline",className:"border-slate-500/30 text-slate-400 bg-slate-500/10",children:[s.jsx(qs,{"code-path":"src/components/system/SystemManager.tsx:116:9",className:"h-3 w-3 mr-1"}),"禁用"]}),ds=()=>{P(null),A({...le}),R(!0)},ps=r=>{P(r),A({username:r.username||"",nickname:r.nickname||"",email:r.email||"",phone:r.phone||"",role:Array.isArray(r.roles)?r.roles[0]||"":r.role||"",password:"",status:r.status==="active"?1:0}),R(!0)},K=async()=>{B(!0);try{const r={username:k.username,nickname:k.nickname,email:k.email,phone:k.phone,role:k.role,status:k.status};k.password&&(r.password=k.password),C?await q.updateUser(C.id,r):await q.createUser(r),R(!1),await X()}catch(r){console.error("Failed to save user:",r)}finally{B(!1)}},Q=async r=>{if(await e({title:"删除用户",description:`确认删除用户「${r.nickname||r.username}」吗?`,confirmText:"删除",variant:"destructive"}))try{await q.deleteUser(r.id),await X()}catch(os){console.error("Failed to delete user:",os)}},v=r=>{const z=r.target.files?.[0];if(!z)return;const os=new FileReader;os.onload=fs=>{const c=(fs.target?.result).split(` -`).filter(g=>g.trim()&&!g.startsWith(""));if(c.length<2)return;const W=c[0].split(",").map(g=>g.trim().toLowerCase()),is=W.findIndex(g=>g.includes("用户名")||g.includes("username")),Is=W.findIndex(g=>g.includes("昵称")||g.includes("name")||g.includes("显示名")),Rs=W.findIndex(g=>g.includes("邮箱")||g.includes("email")||g.includes("mail")),Ds=W.findIndex(g=>g.includes("手机")||g.includes("phone")),_s=W.findIndex(g=>g.includes("角色")||g.includes("role")),ys=W.findIndex(g=>g.includes("密码")||g.includes("password")),gs=[];for(let g=1;gFs.trim());gs.push({username:is>=0?ms[is]:"",nickname:Is>=0?ms[Is]:"",email:Rs>=0?ms[Rs]:"",phone:Ds>=0?ms[Ds]:"",role:_s>=0?ms[_s]:"",password:ys>=0?ms[ys]:""})}_(gs),E(null)},os.readAsText(z,"UTF-8")},Y=async()=>{L.setImporting(!0);try{const r=await q.batchImport({users:j,skip_existing:!0});E(r),await X()}catch(r){E({code:500,message:r?.message||"导入失败"})}finally{L.setImporting(!1)}};return s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:232:5",className:"space-y-6",children:[s.jsx("div",{"code-path":"src/components/system/SystemManager.tsx:234:7",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:235:9",children:[s.jsx("h1",{"code-path":"src/components/system/SystemManager.tsx:236:11",className:"text-2xl font-bold text-slate-100",children:"系统管理"}),s.jsx("p",{"code-path":"src/components/system/SystemManager.tsx:237:11",className:"text-sm text-slate-500 mt-1",children:"用户、权限与系统配置"})]})}),s.jsxs(De,{"code-path":"src/components/system/SystemManager.tsx:242:7",value:a,onValueChange:m,className:"w-full",children:[s.jsxs(Le,{"code-path":"src/components/system/SystemManager.tsx:243:9",className:"bg-slate-800 border border-slate-700",children:[s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:244:11",value:"users",className:"data-[state=active]:bg-slate-700",children:[s.jsx(ie,{"code-path":"src/components/system/SystemManager.tsx:245:13",className:"h-4 w-4 mr-2"}),"用户管理"]}),s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:248:11",value:"roles",className:"data-[state=active]:bg-slate-700",children:[s.jsx(se,{"code-path":"src/components/system/SystemManager.tsx:249:13",className:"h-4 w-4 mr-2"}),"角色权限"]}),s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:252:11",value:"settings",className:"data-[state=active]:bg-slate-700",children:[s.jsx(xe,{"code-path":"src/components/system/SystemManager.tsx:253:13",className:"h-4 w-4 mr-2"}),"系统设置"]})]}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:258:9",value:"users",className:"mt-4 space-y-4",children:s.jsx(Ee,{"code-path":"src/components/system/SystemManager.tsx:259:11",searchQuery:i,setSearchQuery:u,filteredUsers:rs,loading:n,selectedUser:h,setSelectedUser:D,getUserStatusBadge:ns,dialogOpen:y,setDialogOpen:R,editingUser:C,form:k,setForm:A,saving:F,handleSubmit:K,openCreate:ds,openEdit:ps,handleDelete:Q,importDialogOpen:p,setImportDialogOpen:O,importPreview:j,setImportPreview:_,importing:L.importing,importResult:G,setImportResult:E,handleCsvUpload:v,handleBatchImport:Y,ldapUsers:L.ldapUsers,ldapSelected:L.ldapSelected,setLdapSelected:L.setLdapSelected,ldapLoading:L.ldapLoading,ldapImportOUs:L.ldapImportOUs,ldapImportOUDN:L.ldapImportOUDN,setLdapImportOUDN:L.setLdapImportOUDN,loadLdapUsers:L.loadLdapUsers,handleLdapImport:L.handleLdapImport,setLdapUsers:L.setLdapUsers})}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:299:9",value:"roles",className:"mt-4 space-y-4",children:s.jsx(Qe,{"code-path":"src/components/system/SystemManager.tsx:300:11",selectedRole:b,setSelectedRole:S})}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:306:9",value:"settings",className:"mt-4",children:s.jsx(Je,{"code-path":"src/components/system/SystemManager.tsx:307:11",...L.settingsTabProps})})]})]})}export{yt as SystemManager}; +import{r as o,j as s}from"./vendor-codemirror-B1SGo4xl.js";import{u as q,D as Z,a as ss,b as es,c as ts,d as as,e as ls,B as x,at as ve,f as Gs,t as V,j as Bs,l as $,k as fe}from"./index-Bp-M7P_8.js";import{T as De,a as Le,b as Vs,c as Hs}from"./tabs-DbNlmoQJ.js";import{B as cs}from"./badge-B00SZHvE.js";import{C as xs,a as hs,b as Ss,c as js,d as us}from"./card-BHSBTtub.js";import{I as f}from"./input-Bnlm--la.js";import{T as As,a as Ps,b as J,c as M,d as Es,e as w}from"./table-u8V9iTZf.js";import{S as Us,a as ws,b as Cs,c as Ms,d as H}from"./select-DbhcBWnH.js";import{U as re,ag as Qs,aE as vs,ah as Ks,v as de,y as Ws,a as qs,N as Js,L as Ns,R as Xs,S as Te,P as Ys,al as Ue,ak as we,x as pe,T as Zs,j as se,aK as ee,as as Ce,Q as Me,V as ie,a3 as ke,aq as Ie,p as xe}from"./vendor-icons-BWk-DH7F.js";import{T as Re}from"./textarea-BvOVhaCD.js";import{L as Ts}from"./label-NkONM5Mp.js";import{C as _e}from"./checkbox-Bsb-ZRm9.js";import{S as bs}from"./switch-CEwFnSNV.js";import"./index-5FEebgvX.js";function Fe({open:e,onOpenChange:d,editingUser:t,form:a,setForm:m,saving:i,onSubmit:u}){const[T,N]=o.useState([]);return o.useEffect(()=>{if(!e)return;let n=!1;return(async()=>{try{const U=await q.getRoles();if(n)return;const h=U?.list??[];N(h.map(D=>({id:String(D.id??""),name:D.name??D.code??""})))}catch{n||N([])}})(),()=>{n=!0}},[e]),s.jsx(Z,{"code-path":"src/components/system/UserFormDialog.tsx:78:5",open:e,onOpenChange:d,children:s.jsxs(ss,{"code-path":"src/components/system/UserFormDialog.tsx:79:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/UserFormDialog.tsx:80:9",children:[s.jsxs(ts,{"code-path":"src/components/system/UserFormDialog.tsx:81:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(re,{"code-path":"src/components/system/UserFormDialog.tsx:82:13",className:"h-5 w-5 text-blue-400"}),t?"编辑用户":"新建用户"]}),s.jsx(as,{"code-path":"src/components/system/UserFormDialog.tsx:85:11",className:"text-slate-500",children:t?"修改用户信息":"创建新的系统用户"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:90:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:91:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:92:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:93:15",className:"text-xs text-slate-500",children:"用户名"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:94:15",value:a.username,onChange:n=>m({...a,username:n.target.value}),disabled:!!t,className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"登录用户名"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:102:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:103:15",className:"text-xs text-slate-500",children:"昵称"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:104:15",value:a.nickname,onChange:n=>m({...a,nickname:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"显示昵称"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:111:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:112:15",className:"text-xs text-slate-500",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:113:15",value:a.email,onChange:n=>m({...a,email:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"user@example.com"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:120:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:121:15",className:"text-xs text-slate-500",children:"手机号"}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:122:15",value:a.phone,onChange:n=>m({...a,phone:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:"可选"})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:129:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:130:15",className:"text-xs text-slate-500",children:"角色"}),s.jsxs(Us,{"code-path":"src/components/system/UserFormDialog.tsx:131:15",value:a.role,onValueChange:n=>m({...a,role:n}),children:[s.jsx(ws,{"code-path":"src/components/system/UserFormDialog.tsx:132:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/UserFormDialog.tsx:133:19",placeholder:"选择角色"})}),s.jsx(Ms,{"code-path":"src/components/system/UserFormDialog.tsx:135:17",className:"bg-slate-800 border-slate-700",children:T.map(n=>s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:137:21",value:n.name,children:n.name},n.id))})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:144:13",className:"space-y-2",children:[s.jsx("label",{"code-path":"src/components/system/UserFormDialog.tsx:145:15",className:"text-xs text-slate-500",children:"状态"}),s.jsxs(Us,{"code-path":"src/components/system/UserFormDialog.tsx:146:15",value:String(a.status),onValueChange:n=>m({...a,status:Number(n)}),children:[s.jsx(ws,{"code-path":"src/components/system/UserFormDialog.tsx:150:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/UserFormDialog.tsx:151:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/UserFormDialog.tsx:153:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:154:19",value:"1",children:"正常"}),s.jsx(H,{"code-path":"src/components/system/UserFormDialog.tsx:155:19",value:"0",children:"禁用"})]})]})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserFormDialog.tsx:160:11",className:"space-y-2",children:[s.jsxs("label",{"code-path":"src/components/system/UserFormDialog.tsx:161:13",className:"text-xs text-slate-500",children:["密码",t?"(留空则不修改)":""]}),s.jsx(f,{"code-path":"src/components/system/UserFormDialog.tsx:164:13",type:"password",value:a.password,onChange:n=>m({...a,password:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500",placeholder:t?"留空则不修改":"设置初始密码"})]})]}),s.jsxs(ls,{"code-path":"src/components/system/UserFormDialog.tsx:174:9",children:[s.jsx(x,{"code-path":"src/components/system/UserFormDialog.tsx:175:11",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>d(!1),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/UserFormDialog.tsx:178:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:u,disabled:i,children:i?"保存中...":"保存"})]})]})})}function Oe({selectedUser:e,setSelectedUser:d,getUserStatusBadge:t,openEdit:a}){return s.jsx(Z,{"code-path":"src/components/system/UserDetailDialog.tsx:29:5",open:!!e,onOpenChange:()=>d(null),children:s.jsxs(ss,{"code-path":"src/components/system/UserDetailDialog.tsx:30:7",className:"bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/UserDetailDialog.tsx:31:9",children:[s.jsxs(ts,{"code-path":"src/components/system/UserDetailDialog.tsx:32:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(re,{"code-path":"src/components/system/UserDetailDialog.tsx:33:13",className:"h-5 w-5 text-blue-400"}),e?.nickname]}),s.jsxs(as,{"code-path":"src/components/system/UserDetailDialog.tsx:36:11",className:"text-slate-500",children:["@",e?.username," · ",e?.email]})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:41:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:42:11",className:"grid grid-cols-2 gap-4 p-4 rounded-lg bg-slate-800/50",children:[s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:43:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:44:15",className:"text-xs text-slate-500 mb-1",children:"用户名"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:45:15",className:"text-sm text-slate-200",children:e?.username})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:47:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:48:15",className:"text-xs text-slate-500 mb-1",children:"昵称"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:49:15",className:"text-sm text-slate-200",children:e?.nickname})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:51:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:52:15",className:"text-xs text-slate-500 mb-1",children:"邮箱"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:53:15",className:"text-sm text-slate-200",children:e?.email})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:55:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:56:15",className:"text-xs text-slate-500 mb-1",children:"手机号"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:57:15",className:"text-sm text-slate-200",children:e?.phone||"--"})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:59:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:60:15",className:"text-xs text-slate-500 mb-1",children:"状态"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:61:15",className:"text-sm text-slate-200",children:e&&t(e.status)})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:63:13",children:[s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:64:15",className:"text-xs text-slate-500 mb-1",children:"创建时间"}),s.jsx("p",{"code-path":"src/components/system/UserDetailDialog.tsx:65:15",className:"text-sm text-slate-200",children:e&&e.createdAt?new Date(e.createdAt).toLocaleDateString():"--"})]})]}),s.jsxs("div",{"code-path":"src/components/system/UserDetailDialog.tsx:71:11",children:[s.jsx("h4",{"code-path":"src/components/system/UserDetailDialog.tsx:72:13",className:"text-sm font-medium text-slate-300 mb-2",children:"角色"}),s.jsx("div",{"code-path":"src/components/system/UserDetailDialog.tsx:73:13",className:"flex flex-wrap gap-2",children:e?.roles.map(m=>s.jsx(cs,{"code-path":"src/components/system/UserDetailDialog.tsx:75:17",variant:"outline",className:"border-slate-700 text-slate-400",children:m},m))})]})]}),s.jsxs(ls,{"code-path":"src/components/system/UserDetailDialog.tsx:83:9",children:[s.jsxs(x,{"code-path":"src/components/system/UserDetailDialog.tsx:84:11",variant:"outline",className:"border-slate-700 text-slate-300",children:[s.jsx(Qs,{"code-path":"src/components/system/UserDetailDialog.tsx:85:13",className:"h-4 w-4 mr-2"}),"重置密码"]}),s.jsxs(x,{"code-path":"src/components/system/UserDetailDialog.tsx:88:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{e&&(d(null),a(e))},children:[s.jsx(vs,{"code-path":"src/components/system/UserDetailDialog.tsx:97:13",className:"h-4 w-4 mr-2"}),"编辑"]})]})]})})}function Ae({importDialogOpen:e,setImportDialogOpen:d,importPreview:t,setImportPreview:a,importing:m,importResult:i,setImportResult:u,handleCsvUpload:T,handleBatchImport:N}){return s.jsx(Z,{"code-path":"src/components/system/CsvImportDialog.tsx:47:5",open:e==="csv",onOpenChange:n=>!n&&d(null),children:s.jsxs(ss,{"code-path":"src/components/system/CsvImportDialog.tsx:48:7",className:"bg-slate-900 border-slate-800 max-w-2xl",children:[s.jsxs(es,{"code-path":"src/components/system/CsvImportDialog.tsx:49:9",children:[s.jsxs(ts,{"code-path":"src/components/system/CsvImportDialog.tsx:50:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Ks,{"code-path":"src/components/system/CsvImportDialog.tsx:51:13",className:"h-5 w-5 text-blue-400"}),"批量导入用户(CSV)"]}),s.jsx(as,{"code-path":"src/components/system/CsvImportDialog.tsx:54:11",className:"text-slate-500",children:"上传 CSV 文件批量创建用户。请先下载模板,按格式填写后上传。"})]}),i?s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:120:11",className:"space-y-4 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:121:13",className:`flex items-center gap-3 p-4 rounded-lg ${i.code===200?"bg-emerald-500/10":"bg-red-500/10"}`,children:[i.code===200?s.jsx(Ws,{"code-path":"src/components/system/CsvImportDialog.tsx:123:17",className:"h-6 w-6 text-emerald-400 shrink-0"}):s.jsx(qs,{"code-path":"src/components/system/CsvImportDialog.tsx:125:17",className:"h-6 w-6 text-red-400 shrink-0"}),s.jsx("span",{"code-path":"src/components/system/CsvImportDialog.tsx:127:15",className:"text-sm text-slate-200",children:i.message})]}),i.errors?.length>0&&s.jsx("div",{"code-path":"src/components/system/CsvImportDialog.tsx:130:15",className:"max-h-32 overflow-auto rounded-lg bg-slate-800/50 p-3 space-y-1",children:i.errors.map((n,U)=>s.jsx("div",{"code-path":"src/components/system/CsvImportDialog.tsx:132:19",className:"text-xs text-red-400",children:n},U))}),s.jsx(ls,{"code-path":"src/components/system/CsvImportDialog.tsx:136:13",children:s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:137:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{d(null),a([]),u(null)},children:"完成"})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:61:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:62:15",className:"flex items-center gap-2",children:[s.jsxs(x,{"code-path":"src/components/system/CsvImportDialog.tsx:63:17",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:()=>q.downloadTemplate(),children:[s.jsx(de,{"code-path":"src/components/system/CsvImportDialog.tsx:64:19",className:"h-4 w-4 mr-1.5"}),"下载模板"]}),s.jsxs("label",{"code-path":"src/components/system/CsvImportDialog.tsx:67:17",className:"inline-flex items-center px-3 py-1.5 rounded-md text-sm bg-slate-800 border border-slate-700 text-slate-200 cursor-pointer hover:bg-slate-700 transition-colors",children:[s.jsx(Ks,{"code-path":"src/components/system/CsvImportDialog.tsx:68:19",className:"h-4 w-4 mr-1.5"}),"选择 CSV 文件",s.jsx("input",{"code-path":"src/components/system/CsvImportDialog.tsx:70:19",type:"file",accept:".csv",className:"hidden",onChange:T})]})]}),t.length>0&&s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:75:17",className:"rounded-lg border border-slate-800 overflow-hidden",children:[s.jsxs("div",{"code-path":"src/components/system/CsvImportDialog.tsx:76:19",className:"px-3 py-2 bg-slate-800/50 text-xs text-slate-400",children:["预览:",t.length," 条数据"]}),s.jsxs(As,{"code-path":"src/components/system/CsvImportDialog.tsx:79:19",children:[s.jsx(Ps,{"code-path":"src/components/system/CsvImportDialog.tsx:80:21",children:s.jsxs(J,{"code-path":"src/components/system/CsvImportDialog.tsx:81:23",className:"border-slate-800",children:[s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:82:25",className:"text-slate-400 text-xs",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:83:25",className:"text-slate-400 text-xs",children:"昵称"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:84:25",className:"text-slate-400 text-xs",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/CsvImportDialog.tsx:85:25",className:"text-slate-400 text-xs",children:"手机"})]})}),s.jsxs(Es,{"code-path":"src/components/system/CsvImportDialog.tsx:88:21",children:[t.slice(0,5).map((n,U)=>s.jsxs(J,{"code-path":"src/components/system/CsvImportDialog.tsx:90:25",className:"border-slate-800",children:[s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:91:27",className:"text-slate-200 text-xs",children:n.username}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:92:27",className:"text-slate-300 text-xs",children:n.nickname}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:93:27",className:"text-slate-400 text-xs",children:n.email}),s.jsx(w,{"code-path":"src/components/system/CsvImportDialog.tsx:94:27",className:"text-slate-400 text-xs",children:n.phone})]},U)),t.length>5&&s.jsx(J,{"code-path":"src/components/system/CsvImportDialog.tsx:98:25",className:"border-slate-800",children:s.jsxs(w,{"code-path":"src/components/system/CsvImportDialog.tsx:99:27",colSpan:4,className:"text-slate-500 text-xs text-center",children:["还有 ",t.length-5," 条..."]})})]})]})]})]}),s.jsxs(ls,{"code-path":"src/components/system/CsvImportDialog.tsx:110:13",children:[s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:111:15",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>{d(null),a([])},children:"取消"}),s.jsx(x,{"code-path":"src/components/system/CsvImportDialog.tsx:114:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:N,disabled:m||t.length===0,children:m?"导入中...":`确认导入 (${t.length})`})]})]})]})})}function Pe({importDialogOpen:e,setImportDialogOpen:d,ldapUsers:t,setLdapUsers:a,ldapSelected:m,setLdapSelected:i,ldapLoading:u,ldapImportOUs:T,ldapImportOUDN:N,setLdapImportOUDN:n,loadLdapUsers:U,handleLdapImport:h,importing:D,importResult:b,setImportResult:S}){return s.jsx(Z,{"code-path":"src/components/system/LdapImportDialog.tsx:58:5",open:e==="ldap",onOpenChange:y=>!y&&d(null),children:s.jsxs(ss,{"code-path":"src/components/system/LdapImportDialog.tsx:59:7",className:"bg-slate-900 border-slate-800 max-w-2xl",children:[s.jsxs(es,{"code-path":"src/components/system/LdapImportDialog.tsx:60:9",children:[s.jsxs(ts,{"code-path":"src/components/system/LdapImportDialog.tsx:61:11",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Js,{"code-path":"src/components/system/LdapImportDialog.tsx:62:13",className:"h-5 w-5 text-cyan-400"}),"从 LDAP 导入用户"]}),s.jsx(as,{"code-path":"src/components/system/LdapImportDialog.tsx:65:11",className:"text-slate-500",children:"从 LDAP 服务器检索用户列表,选择需要导入的用户"})]}),b?s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:163:11",className:"space-y-4 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:164:13",className:`flex items-center gap-3 p-4 rounded-lg ${b.code===200?"bg-emerald-500/10":"bg-red-500/10"}`,children:[b.code===200?s.jsx(Ws,{"code-path":"src/components/system/LdapImportDialog.tsx:166:17",className:"h-6 w-6 text-emerald-400 shrink-0"}):s.jsx(qs,{"code-path":"src/components/system/LdapImportDialog.tsx:168:17",className:"h-6 w-6 text-red-400 shrink-0"}),s.jsx("span",{"code-path":"src/components/system/LdapImportDialog.tsx:170:15",className:"text-sm text-slate-200",children:b.message})]}),s.jsx(ls,{"code-path":"src/components/system/LdapImportDialog.tsx:172:13",children:s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:173:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>{d(null),a([]),S(null)},children:"完成"})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:72:13",className:"space-y-3",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:73:15",className:"flex items-center gap-3",children:[s.jsxs("div",{"code-path":"src/components/system/LdapImportDialog.tsx:74:17",className:"flex items-center gap-2",children:[s.jsx("span",{"code-path":"src/components/system/LdapImportDialog.tsx:75:19",className:"text-xs text-slate-500 whitespace-nowrap",children:"选择 OU"}),s.jsxs("select",{"code-path":"src/components/system/LdapImportDialog.tsx:76:19",className:"bg-slate-800 border border-slate-700 text-slate-200 text-xs rounded-md px-2 py-1.5 focus:outline-none focus:ring-1 focus:ring-blue-500",value:N,onChange:y=>{n(y.target.value),U(y.target.value)},children:[s.jsx("option",{"code-path":"src/components/system/LdapImportDialog.tsx:84:21",value:"",children:"根 (全部)"}),T.map(y=>s.jsx("option",{"code-path":"src/components/system/LdapImportDialog.tsx:86:23",value:y.dn,children:y.name},y.dn))]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapImportDialog.tsx:90:17",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300 ml-auto",onClick:()=>U(N),disabled:u,children:[u?s.jsx(Ns,{"code-path":"src/components/system/LdapImportDialog.tsx:91:34",className:"h-4 w-4 mr-1.5 animate-spin"}):s.jsx(Xs,{"code-path":"src/components/system/LdapImportDialog.tsx:91:88",className:"h-4 w-4 mr-1.5"}),"刷新"]})]}),s.jsx("p",{"code-path":"src/components/system/LdapImportDialog.tsx:96:15",className:"text-xs text-slate-500",children:t.length>0?`找到 ${t.length} 个用户`:"选择 OU 或点击刷新获取用户列表"}),t.length>0&&s.jsx("div",{"code-path":"src/components/system/LdapImportDialog.tsx:101:17",className:"max-h-80 overflow-auto rounded-lg border border-slate-800",children:s.jsxs(As,{"code-path":"src/components/system/LdapImportDialog.tsx:102:19",children:[s.jsx(Ps,{"code-path":"src/components/system/LdapImportDialog.tsx:103:21",children:s.jsxs(J,{"code-path":"src/components/system/LdapImportDialog.tsx:104:23",className:"border-slate-800 sticky top-0 bg-slate-900",children:[s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:105:25",className:"w-10 text-slate-400 text-xs",children:s.jsx("input",{"code-path":"src/components/system/LdapImportDialog.tsx:106:27",type:"checkbox",className:"accent-blue-600",checked:m.size===t.length&&t.length>0,onChange:y=>{y.target.checked?i(new Set(t.map(R=>R.dn))):i(new Set)}})}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:119:25",className:"text-slate-400 text-xs",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:120:25",className:"text-slate-400 text-xs",children:"显示名"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:121:25",className:"text-slate-400 text-xs",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/LdapImportDialog.tsx:122:25",className:"text-slate-400 text-xs",children:"DN"})]})}),s.jsx(Es,{"code-path":"src/components/system/LdapImportDialog.tsx:125:21",children:t.map(y=>s.jsxs(J,{"code-path":"src/components/system/LdapImportDialog.tsx:127:25",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:128:27",children:s.jsx("input",{"code-path":"src/components/system/LdapImportDialog.tsx:129:29",type:"checkbox",className:"accent-blue-600",checked:m.has(y.dn),onChange:R=>{const C=new Set(m);R.target.checked?C.add(y.dn):C.delete(y.dn),i(C)}})}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:141:27",className:"text-slate-200 text-xs",children:y.uid}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:142:27",className:"text-slate-300 text-xs",children:y.cn}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:143:27",className:"text-slate-400 text-xs",children:y.mail}),s.jsx(w,{"code-path":"src/components/system/LdapImportDialog.tsx:144:27",className:"text-slate-500 text-xs font-mono truncate max-w-[200px]",children:y.dn})]},y.dn))})]})})]}),s.jsxs(ls,{"code-path":"src/components/system/LdapImportDialog.tsx:153:13",children:[s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:154:15",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>{d(null),a([])},children:"取消"}),s.jsx(x,{"code-path":"src/components/system/LdapImportDialog.tsx:157:15",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:h,disabled:D||m.size===0,children:D?"导入中...":`导入选中 (${m.size})`})]})]})]})})}function Ee({searchQuery:e,setSearchQuery:d,filteredUsers:t,loading:a,selectedUser:m,setSelectedUser:i,getUserStatusBadge:u,dialogOpen:T,setDialogOpen:N,editingUser:n,form:U,setForm:h,saving:D,handleSubmit:b,openCreate:S,openEdit:y,handleDelete:R,importDialogOpen:C,setImportDialogOpen:P,importPreview:F,setImportPreview:B,importing:k,importResult:A,setImportResult:p,handleCsvUpload:O,handleBatchImport:j,ldapUsers:_,ldapSelected:K,setLdapSelected:E,ldapLoading:X,ldapImportOUs:L,ldapImportOUDN:rs,setLdapImportOUDN:ns,loadLdapUsers:ds,handleLdapImport:ps,setLdapUsers:G}){const{hasPermission:Q}=ve();return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:116:7",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:117:9",className:"relative w-64",children:[s.jsx(Te,{"code-path":"src/components/system/SystemUserTab.tsx:118:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),s.jsx(f,{"code-path":"src/components/system/SystemUserTab.tsx:119:11",placeholder:"搜索用户...",value:e,onChange:v=>d(v.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:126:9",className:"flex items-center gap-2",children:[Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:128:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>P("csv"),children:[s.jsx(Ks,{"code-path":"src/components/system/SystemUserTab.tsx:129:13",className:"h-4 w-4 mr-2"}),"批量导入"]}),Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:134:11",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>P("ldap"),children:[s.jsx(Js,{"code-path":"src/components/system/SystemUserTab.tsx:135:13",className:"h-4 w-4 mr-2"}),"LDAP 导入"]}),Q("system:user")&&s.jsxs(x,{"code-path":"src/components/system/SystemUserTab.tsx:140:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:S,children:[s.jsx(Ys,{"code-path":"src/components/system/SystemUserTab.tsx:141:13",className:"h-4 w-4 mr-2"}),"新建用户"]})]})]}),s.jsx(xs,{"code-path":"src/components/system/SystemUserTab.tsx:149:7",className:"bg-slate-900 border-slate-800",children:s.jsx(hs,{"code-path":"src/components/system/SystemUserTab.tsx:150:9",className:"p-0",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:151:11",className:"border-t border-slate-800",children:s.jsxs(As,{"code-path":"src/components/system/SystemUserTab.tsx:152:13",children:[s.jsx(Ps,{"code-path":"src/components/system/SystemUserTab.tsx:153:15",children:s.jsxs(J,{"code-path":"src/components/system/SystemUserTab.tsx:154:17",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:155:19",className:"text-slate-400",children:"用户信息"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:156:19",className:"text-slate-400",children:"联系方式"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:157:19",className:"text-slate-400",children:"角色"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:158:19",className:"text-slate-400",children:"来源"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:159:19",className:"text-slate-400",children:"状态"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:160:19",className:"text-slate-400",children:"最后登录"}),s.jsx(M,{"code-path":"src/components/system/SystemUserTab.tsx:161:19",className:"text-slate-400 text-right",children:"操作"})]})}),s.jsx(Es,{"code-path":"src/components/system/SystemUserTab.tsx:164:15",children:a?s.jsx(J,{"code-path":"src/components/system/SystemUserTab.tsx:166:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:167:21",colSpan:7,className:"text-center py-12",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:168:23",className:"flex items-center justify-center",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:169:25",className:"h-6 w-6 border-2 border-slate-700 border-t-blue-500 rounded-full animate-spin"})})})}):t.length===0?s.jsx(J,{"code-path":"src/components/system/SystemUserTab.tsx:174:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:175:21",colSpan:7,className:"text-center py-12 text-sm text-slate-500",children:"暂无用户数据"})}):t.map(v=>s.jsxs(J,{"code-path":"src/components/system/SystemUserTab.tsx:181:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:182:23",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:183:25",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:184:27",className:"w-8 h-8 rounded-full bg-blue-600 flex items-center justify-center text-white text-sm font-medium",children:(v.nickname||v.username||"?").charAt(0)}),s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:187:27",children:[s.jsx("p",{"code-path":"src/components/system/SystemUserTab.tsx:188:29",className:"text-sm font-medium text-slate-200",children:v.nickname||v.username}),s.jsxs("p",{"code-path":"src/components/system/SystemUserTab.tsx:189:29",className:"text-xs text-slate-500",children:["@",v.username]})]})]})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:193:23",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:194:25",className:"space-y-1",children:[s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:195:27",className:"flex items-center gap-1 text-sm text-slate-400",children:[s.jsx(Ue,{"code-path":"src/components/system/SystemUserTab.tsx:196:29",className:"h-3.5 w-3.5"}),v.email||"--"]}),v.phone&&s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:200:29",className:"flex items-center gap-1 text-sm text-slate-400",children:[s.jsx(we,{"code-path":"src/components/system/SystemUserTab.tsx:201:31",className:"h-3.5 w-3.5"}),v.phone]})]})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:207:23",children:s.jsx("div",{"code-path":"src/components/system/SystemUserTab.tsx:208:25",className:"flex flex-wrap gap-1",children:(v.roles||[]).map(Y=>s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:210:29",variant:"outline",className:"border-slate-700 text-slate-400",children:Y},Y))})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:216:23",children:v.authSource==="ldap"?s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:218:27",variant:"outline",className:"border-cyan-500/30 text-cyan-400 bg-cyan-500/10",children:"LDAP"}):s.jsx(cs,{"code-path":"src/components/system/SystemUserTab.tsx:222:27",variant:"outline",className:"border-slate-600/30 text-slate-400 bg-slate-600/10",children:"本地"})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:227:23",children:u(v.status)}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:228:23",children:s.jsx("span",{"code-path":"src/components/system/SystemUserTab.tsx:229:25",className:"text-sm text-slate-400",children:v.lastLoginAt?new Date(v.lastLoginAt).toLocaleString():"--"})}),s.jsx(w,{"code-path":"src/components/system/SystemUserTab.tsx:233:23",className:"text-right",children:s.jsxs("div",{"code-path":"src/components/system/SystemUserTab.tsx:234:25",className:"flex items-center justify-end gap-1",children:[s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:235:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>i(v),children:s.jsx(pe,{"code-path":"src/components/system/SystemUserTab.tsx:241:29",className:"h-4 w-4"})}),Q("system:user")&&s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:244:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-100",onClick:()=>y(v),children:s.jsx(vs,{"code-path":"src/components/system/SystemUserTab.tsx:250:29",className:"h-4 w-4"})}),Q("system:user")&&s.jsx(x,{"code-path":"src/components/system/SystemUserTab.tsx:254:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400",onClick:()=>R(v),children:s.jsx(Zs,{"code-path":"src/components/system/SystemUserTab.tsx:260:29",className:"h-4 w-4"})})]})})]},v.id))})]})})})}),s.jsx(Oe,{"code-path":"src/components/system/SystemUserTab.tsx:275:7",selectedUser:m,setSelectedUser:i,getUserStatusBadge:u,openEdit:y}),s.jsx(Fe,{"code-path":"src/components/system/SystemUserTab.tsx:282:7",open:T,onOpenChange:N,editingUser:n,form:U,setForm:h,saving:D,onSubmit:b}),s.jsx(Ae,{"code-path":"src/components/system/SystemUserTab.tsx:292:7",importDialogOpen:C,setImportDialogOpen:P,importPreview:F,setImportPreview:B,importing:k,importResult:A,setImportResult:p,handleCsvUpload:O,handleBatchImport:j}),s.jsx(Pe,{"code-path":"src/components/system/SystemUserTab.tsx:304:7",importDialogOpen:C,setImportDialogOpen:P,ldapUsers:_,setLdapUsers:G,ldapSelected:K,setLdapSelected:E,ldapLoading:X,ldapImportOUs:L,ldapImportOUDN:rs,setLdapImportOUDN:ns,loadLdapUsers:ds,handleLdapImport:ps,importing:k,importResult:A,setImportResult:p})]})}const ze=[{key:"dashboard",label:"📊 仪表盘",prefixes:["dashboard:"]},{key:"server",label:"🖥️ 资产管理",prefixes:["server:"]},{key:"cloud",label:"☁️ 云资源",prefixes:["cloud:"]},{key:"k8s",label:"☸️ Kubernetes",prefixes:["k8s:"]},{key:"deploy",label:"🚀 应用发布",prefixes:["deploy:"]},{key:"monitor",label:"📡 监控告警",prefixes:["monitor:","agent:"]},{key:"auto",label:"⚙️ 自动化运维",prefixes:["auto:"]},{key:"aiops",label:"🤖 AIOps智能",prefixes:["aiops:"]},{key:"approval",label:"✅ 资源申请",prefixes:["approval:"]},{key:"audit",label:"🔍 安全审计",prefixes:["audit:"]},{key:"system",label:"🔧 系统管理",prefixes:["system:"]}];function $e(e){const d=ze.map(m=>({key:m.key,label:m.label,items:e.filter(i=>m.prefixes.some(u=>i.code.startsWith(u)))})).filter(m=>m.items.length>0),t=new Set(d.flatMap(m=>m.items.map(i=>i.id))),a=e.filter(m=>!t.has(m.id));return a.length>0&&d.push({key:"other",label:"📌 其他",items:a}),d}function Be({open:e,onOpenChange:d,editingRole:t,form:a,setForm:m,saving:i,onSubmit:u,permissions:T}){const N=(h,D)=>{m(b=>{const S=new Set(b.permission_ids);return D?S.add(h):S.delete(h),{...b,permission_ids:Array.from(S)}})},n=(h,D)=>{m(b=>{const S=new Set(b.permission_ids);return h.forEach(y=>D?S.add(y.id):S.delete(y.id)),{...b,permission_ids:Array.from(S)}})},U=$e(T);return s.jsx(Z,{"code-path":"src/components/system/RoleFormDialog.tsx:91:5",open:e,onOpenChange:d,children:s.jsxs(ss,{"code-path":"src/components/system/RoleFormDialog.tsx:92:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-2xl max-h-[90vh] overflow-y-auto",children:[s.jsxs(es,{"code-path":"src/components/system/RoleFormDialog.tsx:93:9",children:[s.jsxs(ts,{"code-path":"src/components/system/RoleFormDialog.tsx:94:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[s.jsx(se,{"code-path":"src/components/system/RoleFormDialog.tsx:95:13",className:"h-5 w-5 text-purple-400"}),t?"编辑角色":"新建角色"]}),s.jsx(as,{"code-path":"src/components/system/RoleFormDialog.tsx:98:11",className:"text-[var(--dg-text-secondary)]",children:t?"修改角色信息与权限":"创建新的系统角色并分配权限"})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:103:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:104:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:105:13",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:106:15",className:"text-xs text-[var(--dg-text-secondary)]",children:"角色名称"}),s.jsx(f,{"code-path":"src/components/system/RoleFormDialog.tsx:107:15",value:a.name,onChange:h=>m({...a,name:h.target.value}),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)]",placeholder:"如:运维工程师"})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:114:13",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:115:15",className:"text-xs text-[var(--dg-text-secondary)]",children:"角色编码"}),s.jsx(f,{"code-path":"src/components/system/RoleFormDialog.tsx:116:15",value:a.code,onChange:h=>m({...a,code:h.target.value}),disabled:!!t,className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] disabled:opacity-60",placeholder:"如:ops_engineer"})]})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:125:11",className:"space-y-2",children:[s.jsx(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:126:13",className:"text-xs text-[var(--dg-text-secondary)]",children:"描述"}),s.jsx(Re,{"code-path":"src/components/system/RoleFormDialog.tsx:127:13",value:a.description,onChange:h=>m({...a,description:h.target.value}),className:"bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)] text-[var(--dg-text-primary)] placeholder:text-[var(--dg-text-muted)] resize-none",placeholder:"角色职责描述(可选)",rows:2})]}),s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:137:11",className:"space-y-2",children:[s.jsxs(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:138:13",className:"text-xs text-[var(--dg-text-secondary)]",children:["权限分配",a.permission_ids.length>0&&s.jsxs("span",{"code-path":"src/components/system/RoleFormDialog.tsx:141:17",className:"ml-2 text-purple-400",children:["已选 ",a.permission_ids.length," 项"]})]}),s.jsx("div",{"code-path":"src/components/system/RoleFormDialog.tsx:144:13",className:"max-h-[40vh] overflow-y-auto rounded-lg border border-[var(--dg-border)] bg-[var(--dg-bg-tertiary)] p-3 space-y-3",children:U.length===0?s.jsx("p",{"code-path":"src/components/system/RoleFormDialog.tsx:146:17",className:"text-xs text-[var(--dg-text-muted)] text-center py-4",children:"暂无可分配权限"}):U.map(h=>{const D=h.items.filter(S=>a.permission_ids.includes(S.id)).length,b=D===h.items.length&&h.items.length>0;return s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:152:21",children:[s.jsxs("div",{"code-path":"src/components/system/RoleFormDialog.tsx:153:23",className:"flex items-center justify-between mb-1.5",children:[s.jsxs("button",{"code-path":"src/components/system/RoleFormDialog.tsx:154:25",onClick:()=>n(h.items,!b),className:"text-xs font-medium text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] transition-colors flex items-center gap-1",children:[h.label,s.jsxs("span",{"code-path":"src/components/system/RoleFormDialog.tsx:159:27",className:"text-[var(--dg-text-muted)] text-[10px]",children:["(",D,"/",h.items.length,")"]})]}),s.jsx("button",{"code-path":"src/components/system/RoleFormDialog.tsx:163:25",onClick:()=>n(h.items,!b),className:"text-[10px] text-blue-400 hover:text-blue-300 transition-colors",children:b?"取消全选":"全选"})]}),s.jsx("div",{"code-path":"src/components/system/RoleFormDialog.tsx:170:23",className:"grid grid-cols-2 gap-x-3 gap-y-1 pl-1",children:h.items.map(S=>s.jsxs(Ts,{"code-path":"src/components/system/RoleFormDialog.tsx:172:27",className:"flex items-center gap-2 text-xs text-[var(--dg-text-secondary)] font-normal cursor-pointer hover:text-[var(--dg-text-primary)] py-0.5",children:[s.jsx(_e,{"code-path":"src/components/system/RoleFormDialog.tsx:176:29",checked:a.permission_ids.includes(S.id),onCheckedChange:y=>N(S.id,y===!0),className:"border-[var(--dg-border)] data-[state=checked]:bg-blue-600 data-[state=checked]:border-blue-600 h-3.5 w-3.5"}),s.jsx("span",{"code-path":"src/components/system/RoleFormDialog.tsx:181:29",className:"truncate",children:S.name})]},S.id))})]},h.key)})})]})]}),s.jsxs(ls,{"code-path":"src/components/system/RoleFormDialog.tsx:193:9",children:[s.jsx(x,{"code-path":"src/components/system/RoleFormDialog.tsx:194:11",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",onClick:()=>d(!1),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/RoleFormDialog.tsx:197:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:u,disabled:i,children:i?"保存中...":"保存"})]})]})})}const Ve={super_admin:"👑",k8s_admin:"☸️",resource_admin:"🖥️",monitor_admin:"📡",security_auditor:"🔍",release_admin:"🚀",viewer:"👁️"},He=[{label:"仪表盘",prefixes:["dashboard:"]},{label:"资产管理",prefixes:["server:"]},{label:"云资源",prefixes:["cloud:"]},{label:"K8s",prefixes:["k8s:"]},{label:"发布",prefixes:["deploy:"]},{label:"监控",prefixes:["monitor:","agent:"]},{label:"自动化",prefixes:["auto:"]},{label:"AI",prefixes:["aiops:"]},{label:"审批",prefixes:["approval:"]},{label:"审计",prefixes:["audit:"]},{label:"系统",prefixes:["system:"]}];function Ke(e,d){return He.map(a=>{const m=e.filter((i,u)=>a.prefixes.some(T=>(d[u]||"").startsWith(T)));return{label:a.label,count:m.length}}).filter(a=>a.count>0)}function Ge(e){const d=Array.isArray(e.permissions)?e.permissions:[];return{id:String(e.id??""),name:e.name??"",code:e.code??"",description:e.description??"",permissions:d.map(t=>typeof t=="string"?t:t?.name??t?.code??"").filter(Boolean),permissionCodes:d.map(t=>typeof t=="string"?t:t?.code??"").filter(Boolean),createdAt:e.createdAt??e.created_at??"",isSystem:e.is_system??e.isSystem??!1,_permissionIds:d.map(t=>typeof t=="object"?Number(t.id):0).filter(Boolean),_raw:e}}const me={name:"",code:"",description:"",permission_ids:[]};function Qe({selectedRole:e,setSelectedRole:d}){const t=Gs(),[a,m]=o.useState([]),[i,u]=o.useState(!0),[T,N]=o.useState([]),[n,U]=o.useState(!1),[h,D]=o.useState(null),[b,S]=o.useState({...me}),[y,R]=o.useState(!1),C=o.useCallback(async()=>{u(!0);try{const O=(await q.getRoles())?.list??[];m(O.map(Ge))}catch{m([])}finally{u(!1)}},[]),P=o.useCallback(async()=>{try{const O=(await q.getPermissions())?.list??[];N(O.map(j=>({id:Number(j.id),name:j.name??j.code??"",code:j.code??"",type:j.type})))}catch{N([])}},[]);o.useEffect(()=>{C(),P()},[C,P]);const F=()=>{D(null),S({...me}),U(!0)},B=p=>{D(p._raw||p),S({name:p.name??"",code:p.code??"",description:p.description??"",permission_ids:Array.isArray(p._permissionIds)?[...p._permissionIds]:[]}),U(!0)},k=async()=>{if(!b.name.trim()){V.error("请输入角色名称");return}if(!b.code.trim()){V.error("请输入角色编码");return}R(!0);try{const p={name:b.name.trim(),code:b.code.trim(),description:b.description.trim(),permission_ids:b.permission_ids};h?(await q.updateRole(h.id,p),V.success("角色更新成功")):(await q.createRole(p),V.success("角色创建成功")),U(!1),await C()}catch(p){V.error(p?.message||"保存失败")}finally{R(!1)}},A=async p=>{if(p.isSystem){V.error("系统默认角色不可删除");return}if(await t({title:"删除角色",description:`确认删除角色「${p.name}」吗?该操作不可恢复。`,confirmText:"删除",variant:"destructive"}))try{await q.deleteRole(p.id),V.success("角色已删除"),await C()}catch(j){const _=j?.response?.data?.message||j?.message||"删除失败";V.error(_)}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:187:7",className:"flex items-center justify-end gap-2",children:[s.jsxs("span",{"code-path":"src/components/system/SystemRolesTab.tsx:188:9",className:"text-xs text-[var(--dg-text-muted)]",children:[a.length," 个角色"]}),s.jsxs(x,{"code-path":"src/components/system/SystemRolesTab.tsx:189:9",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:F,children:[s.jsx(Ys,{"code-path":"src/components/system/SystemRolesTab.tsx:190:11",className:"h-4 w-4 mr-2"}),"新建角色"]})]}),i?s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:195:9",className:"flex items-center justify-center py-16",children:s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:196:11",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):a.length===0?s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:199:9",className:"flex flex-col items-center justify-center py-16 text-[var(--dg-text-muted)]",children:[s.jsx(se,{"code-path":"src/components/system/SystemRolesTab.tsx:200:11",className:"h-10 w-10 mb-3 opacity-40"}),s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:201:11",className:"text-sm",children:"暂无角色数据"})]}):s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:204:9",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:a.map(p=>{const O=p.permissions,j=p.permissionCodes,_=Ke(O,j),K=Ve[p.code]||"🛡️";return s.jsxs(xs,{"code-path":"src/components/system/SystemRolesTab.tsx:211:15",className:`bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] ${p.isSystem?"border-purple-500/20":""}`,children:[s.jsx(Ss,{"code-path":"src/components/system/SystemRolesTab.tsx:212:17",className:"pb-2",children:s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:213:19",className:"flex items-start justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:214:21",className:"flex items-center gap-3",children:[s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:215:23",className:`w-10 h-10 rounded-lg flex items-center justify-center text-lg ${p.isSystem?"bg-purple-500/10":"bg-[var(--dg-bg-tertiary)]"}`,children:K}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:220:23",children:[s.jsxs(js,{"code-path":"src/components/system/SystemRolesTab.tsx:221:25",className:"text-base text-[var(--dg-text-primary)] flex items-center gap-1.5",children:[p.name,p.isSystem&&s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:224:29",className:"bg-purple-500/15 text-purple-400 border-purple-500/30 text-[10px] px-1 py-0",children:[s.jsx(ee,{"code-path":"src/components/system/SystemRolesTab.tsx:225:31",className:"h-2.5 w-2.5 mr-0.5"}),"系统"]})]}),s.jsx(us,{"code-path":"src/components/system/SystemRolesTab.tsx:229:25",className:"text-[var(--dg-text-muted)] text-xs",children:p.code})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:232:21",className:"flex items-center gap-1",children:[s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:233:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-[var(--dg-text-primary)]",onClick:()=>d(p),children:s.jsx(pe,{"code-path":"src/components/system/SystemRolesTab.tsx:238:25",className:"h-4 w-4"})}),s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:240:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-blue-400",onClick:()=>B(p),children:s.jsx(vs,{"code-path":"src/components/system/SystemRolesTab.tsx:245:25",className:"h-4 w-4"})}),s.jsx(x,{"code-path":"src/components/system/SystemRolesTab.tsx:247:23",variant:"ghost",size:"icon",className:"h-8 w-8 text-[var(--dg-text-muted)] hover:text-red-400",onClick:()=>A(p),disabled:p.isSystem,title:p.isSystem?"系统默认角色不可删除":"删除角色",children:s.jsx(Zs,{"code-path":"src/components/system/SystemRolesTab.tsx:254:25",className:`h-4 w-4 ${p.isSystem?"opacity-30":""}`})})]})]})}),s.jsxs(hs,{"code-path":"src/components/system/SystemRolesTab.tsx:259:17",children:[s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:260:19",className:"text-sm text-[var(--dg-text-secondary)] mb-3",children:p.description||"暂无描述"}),s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:262:19",className:"flex flex-wrap gap-1.5",children:_.map(E=>s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:264:23",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-muted)] text-[10px]",children:[E.label,"·",E.count]},E.label))}),O.length===0&&s.jsx("span",{"code-path":"src/components/system/SystemRolesTab.tsx:270:21",className:"text-xs text-[var(--dg-text-muted)]",children:"未分配权限"})]})]},p.id)})}),s.jsx(We,{"code-path":"src/components/system/SystemRolesTab.tsx:280:7",role:e,onClose:()=>d(null),onEdit:p=>{d(null),B(p)}}),s.jsx(Be,{"code-path":"src/components/system/SystemRolesTab.tsx:283:7",open:n,onOpenChange:U,editingRole:h,form:b,setForm:S,saving:y,onSubmit:k,permissions:T})]})}function We({role:e,onClose:d,onEdit:t}){const m=e?.isSystem??!1;return s.jsx(Z,{"code-path":"src/components/system/SystemRolesTab.tsx:299:5",open:!!e,onOpenChange:i=>!i&&d(),children:s.jsxs(ss,{"code-path":"src/components/system/SystemRolesTab.tsx:300:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)]",children:[s.jsxs(es,{"code-path":"src/components/system/SystemRolesTab.tsx:301:9",children:[s.jsxs(ts,{"code-path":"src/components/system/SystemRolesTab.tsx:302:11",className:"text-[var(--dg-text-primary)] flex items-center gap-2",children:[s.jsx(Ce,{"code-path":"src/components/system/SystemRolesTab.tsx:303:13",className:"h-5 w-5 text-purple-400"}),e?.name,m&&s.jsxs(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:306:15",className:"bg-purple-500/15 text-purple-400 border-purple-500/30 text-[10px]",children:[s.jsx(ee,{"code-path":"src/components/system/SystemRolesTab.tsx:307:17",className:"h-2.5 w-2.5 mr-0.5"}),"系统"]})]}),s.jsxs(as,{"code-path":"src/components/system/SystemRolesTab.tsx:311:11",className:"text-[var(--dg-text-muted)]",children:["编码:",e?.code]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:313:9",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:314:11",className:"rounded-lg bg-[var(--dg-bg-tertiary)] p-4",children:[s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:315:13",className:"text-xs text-[var(--dg-text-muted)] mb-1",children:"描述"}),s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:316:13",className:"text-sm text-[var(--dg-text-primary)]",children:e?.description||"暂无描述"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemRolesTab.tsx:318:11",children:[s.jsxs("h4",{"code-path":"src/components/system/SystemRolesTab.tsx:319:13",className:"text-sm font-medium text-[var(--dg-text-primary)] mb-2",children:["权限列表 (",e?.permissions?.length||0," 项)"]}),e&&e.permissions.length>0?s.jsx("div",{"code-path":"src/components/system/SystemRolesTab.tsx:323:15",className:"flex flex-wrap gap-2 max-h-60 overflow-y-auto",children:e.permissions.map((i,u)=>s.jsx(cs,{"code-path":"src/components/system/SystemRolesTab.tsx:325:19",variant:"outline",className:"border-[var(--dg-border)] text-[var(--dg-text-secondary)]",children:i},u))}):s.jsx("p",{"code-path":"src/components/system/SystemRolesTab.tsx:331:15",className:"text-xs text-[var(--dg-text-muted)]",children:"未分配权限"})]})]}),s.jsx(ls,{"code-path":"src/components/system/SystemRolesTab.tsx:335:9",children:s.jsxs(x,{"code-path":"src/components/system/SystemRolesTab.tsx:336:11",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>e&&t(e),children:[s.jsx(vs,{"code-path":"src/components/system/SystemRolesTab.tsx:337:13",className:"h-4 w-4 mr-2"}),"编辑"]})})]})})}function qe(e){const{ldapConfig:d,ldapMgmtOpen:t,setLdapMgmtOpen:a,ldapOUs:m,selectedOUDN:i,setSelectedOUDN:u,ldapUsers:T,selectedLDAPUsers:N,setSelectedLDAPUsers:n,loadLdapOUs:U,loadLdapOUUsers:h,handleLdapImport:D,importing:b,importFeedback:S,importResultOpen:y,setImportResultOpen:R,createOUOpen:C,setCreateOUOpen:P,ouForm:F,setOuForm:B,handleCreateOU:k,ldapSaving:A,createUserOpen:p,setCreateUserOpen:O,newUser:j,setNewUser:_,handleCreateLDAPUser:K,ldapUserTestOpen:E,setLdapUserTestOpen:X,ldapTestUser:L,setLdapTestUser:rs,ldapTestPass:ns,setLdapTestPass:ds,ldapUserTesting:ps,ldapUserTestResult:G,handleLdapUserTest:Q,editLdapUser:v,setEditLdapUser:Y,editLdapForm:r,setEditLdapForm:z,handleUpdateLdapUser:os,handleDeleteLDAPEntry:fs,openEditLdapUser:ks}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("button",{"code-path":"src/components/system/LdapManagementSection.tsx:140:7",onClick:()=>{const c=!t;a(c),c&&m.length===0&&U()},className:"w-full flex items-center gap-2 px-4 py-2.5 bg-slate-900/50 hover:bg-slate-800/50 text-slate-400 text-sm transition-colors",children:[s.jsx(Me,{"code-path":"src/components/system/LdapManagementSection.tsx:148:9",className:`h-4 w-4 transition-transform ${t?"":"-rotate-90"}`}),s.jsx(ie,{"code-path":"src/components/system/LdapManagementSection.tsx:149:9",className:"h-4 w-4 text-amber-400"}),s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:150:9",className:"text-slate-300",children:"LDAP 账号管理"})]}),t&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:154:9",className:"bg-slate-900/30 border-t border-slate-800/50 px-4 py-4 space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:155:11",className:"flex items-center gap-3 flex-wrap",children:[s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:157:13",open:E,onOpenChange:X,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:158:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:159:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(Qs,{"code-path":"src/components/system/LdapManagementSection.tsx:160:19",className:"h-3.5 w-3.5 mr-1"}),"账号验证"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:164:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:165:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:166:19",className:"text-slate-100",children:"LDAP 账号验证测试"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:167:19",className:"text-slate-500",children:"输入 LDAP 用户凭据进行认证测试"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:169:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:170:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:171:21",className:"text-xs text-slate-500 mb-1 block",children:"用户名"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:172:21",value:L,onChange:c=>rs(c.target.value),placeholder:"zhangsan",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:179:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:180:21",className:"text-xs text-slate-500 mb-1 block",children:"密码"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:181:21",type:"password",value:ns,onChange:c=>ds(c.target.value),onKeyDown:c=>c.key==="Enter"&&Q(),placeholder:"••••••",className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600"})]}),G&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:191:21",className:`p-3 rounded-lg text-sm ${G.success?"bg-emerald-500/10 text-emerald-300":"bg-red-500/10 text-red-300"}`,children:[G.message,G.user_info&&s.jsx("pre",{"code-path":"src/components/system/LdapManagementSection.tsx:194:25",className:"mt-2 text-xs whitespace-pre-wrap",children:JSON.stringify(G.user_info,null,2)})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:198:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:Q,disabled:ps||!L,children:[ps?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:203:40",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"验证"]})]})]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:210:13",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",onClick:U,children:[s.jsx(Xs,{"code-path":"src/components/system/LdapManagementSection.tsx:211:15",className:"h-3.5 w-3.5 mr-1"}),"刷新"]}),s.jsxs(Us,{"code-path":"src/components/system/LdapManagementSection.tsx:216:13",value:i,onValueChange:c=>{u(c),h(c)},children:[s.jsx(ws,{"code-path":"src/components/system/LdapManagementSection.tsx:217:15",className:"w-60 h-7 bg-slate-800 border-slate-700 text-slate-200 text-xs",children:s.jsx(Cs,{"code-path":"src/components/system/LdapManagementSection.tsx:218:17",placeholder:"选择组织单元"})}),s.jsxs(Ms,{"code-path":"src/components/system/LdapManagementSection.tsx:220:15",className:"bg-slate-800 border-slate-700",children:[s.jsxs(H,{"code-path":"src/components/system/LdapManagementSection.tsx:221:17",value:d.base_dn,children:["根 (",d.base_dn,")"]}),m.map(c=>s.jsx(H,{"code-path":"src/components/system/LdapManagementSection.tsx:223:19",value:c.dn,children:c.description?`${c.name} (${c.description})`:c.name},c.dn))]})]}),s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:231:13",open:C,onOpenChange:P,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:232:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:233:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(Ys,{"code-path":"src/components/system/LdapManagementSection.tsx:234:19",className:"h-3.5 w-3.5 mr-1"}),"新建 OU"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:238:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:239:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:240:19",className:"text-slate-100",children:"新建组织单元"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:241:19",className:"text-slate-500",children:"在 LDAP 目录中创建新的组织单元 (OU)"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:243:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:244:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:245:21",className:"text-xs text-slate-500 mb-1 block",children:"OU 名称 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:246:21",value:F.ou_name,onChange:c=>B({...F,ou_name:c.target.value}),placeholder:"dev",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:248:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:249:21",className:"text-xs text-slate-500 mb-1 block",children:"父级 DN"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:250:21",value:F.parent_dn,onChange:c=>B({...F,parent_dn:c.target.value}),placeholder:d.base_dn,className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:252:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:253:21",className:"text-xs text-slate-500 mb-1 block",children:"描述"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:254:21",value:F.description,onChange:c=>B({...F,description:c.target.value}),placeholder:"开发团队",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:256:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:k,disabled:!F.ou_name||A,children:[A?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:257:35",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"创建"]})]})]})]}),s.jsxs(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:265:13",open:p,onOpenChange:O,children:[s.jsx(Bs,{"code-path":"src/components/system/LdapManagementSection.tsx:266:15",asChild:!0,children:s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:267:17",variant:"ghost",size:"sm",className:"text-slate-400 hover:text-slate-200",children:[s.jsx(ke,{"code-path":"src/components/system/LdapManagementSection.tsx:268:19",className:"h-3.5 w-3.5 mr-1"}),"添加用户"]})}),s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:272:15",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:273:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:274:19",className:"text-slate-100",children:"添加 LDAP 用户"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:275:19",className:"text-slate-500",children:"在 LDAP 目录中创建新的用户账号"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:277:17",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:278:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:279:21",className:"text-xs text-slate-500 mb-1 block",children:"用户名 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:280:21",value:j.username,onChange:c=>_({...j,username:c.target.value}),placeholder:"zhangsan",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:282:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:283:21",className:"text-xs text-slate-500 mb-1 block",children:"密码 *"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:284:21",type:"password",value:j.password,onChange:c=>_({...j,password:c.target.value}),placeholder:"••••••",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:286:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:287:21",className:"text-xs text-slate-500 mb-1 block",children:"显示名称"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:288:21",value:j.display_name,onChange:c=>_({...j,display_name:c.target.value}),placeholder:"张三",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:290:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:291:21",className:"text-xs text-slate-500 mb-1 block",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:292:21",value:j.email,onChange:c=>_({...j,email:c.target.value}),placeholder:"zs@example.com",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:294:19",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:295:21",className:"text-xs text-slate-500 mb-1 block",children:"目标 OU"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:296:21",value:j.ou_dn||i||d.base_dn,onChange:c=>_({...j,ou_dn:c.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:298:19",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:K,disabled:!j.username||!j.password||A,children:[A?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:299:35",className:"h-4 w-4 mr-1.5 animate-spin"}):null,"创建"]})]})]})]}),s.jsxs(x,{"code-path":"src/components/system/LdapManagementSection.tsx:307:13",variant:"outline",size:"sm",className:"border-blue-600/50 text-blue-400 hover:bg-blue-600/10 ml-auto",onClick:D,disabled:T.length===0||b,children:[b?s.jsx(Ns,{"code-path":"src/components/system/LdapManagementSection.tsx:314:28",className:"h-3.5 w-3.5 mr-1 animate-spin"}):s.jsx(de,{"code-path":"src/components/system/LdapManagementSection.tsx:314:84",className:"h-3.5 w-3.5 mr-1"}),N.length>0?`导入 (${N.length})`:`导入全部 (${T.length})`]})]}),S&&s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:320:13",open:y,onOpenChange:R,children:s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:321:15",className:"max-w-sm bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:322:17",children:[s.jsx(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:323:19",className:"text-slate-100",children:"导入结果"}),s.jsx(as,{"code-path":"src/components/system/LdapManagementSection.tsx:324:19",className:"text-slate-500",children:"LDAP 用户导入到本地用户库的执行结果"})]}),s.jsx("div",{"code-path":"src/components/system/LdapManagementSection.tsx:326:17",className:"py-3 text-sm text-slate-300",children:S}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:329:17",className:"w-full bg-blue-600 hover:bg-blue-700 text-white",onClick:()=>R(!1),children:"确定"})]})}),s.jsx("div",{"code-path":"src/components/system/LdapManagementSection.tsx:337:11",className:"border border-slate-800 rounded-lg overflow-hidden",children:s.jsxs(As,{"code-path":"src/components/system/LdapManagementSection.tsx:338:13",children:[s.jsx(Ps,{"code-path":"src/components/system/LdapManagementSection.tsx:339:15",children:s.jsxs(J,{"code-path":"src/components/system/LdapManagementSection.tsx:340:17",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:341:19",className:"text-slate-400 w-8",children:s.jsx("input",{"code-path":"src/components/system/LdapManagementSection.tsx:342:21",type:"checkbox",className:"rounded bg-slate-800 border-slate-600",checked:N.length>0&&N.length===T.length,onChange:c=>n(c.target.checked?T.map(W=>W.dn):[])})}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:349:19",className:"text-slate-400",children:"用户名"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:350:19",className:"text-slate-400",children:"显示名称"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:351:19",className:"text-slate-400",children:"邮箱"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:352:19",className:"text-slate-400",children:"DN"}),s.jsx(M,{"code-path":"src/components/system/LdapManagementSection.tsx:353:19",className:"text-slate-400 w-12",children:"操作"})]})}),s.jsx(Es,{"code-path":"src/components/system/LdapManagementSection.tsx:356:15",children:T.length===0?s.jsx(J,{"code-path":"src/components/system/LdapManagementSection.tsx:358:19",className:"border-slate-800",children:s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:359:21",colSpan:6,className:"text-center text-slate-500 py-8",children:"点击「刷新」加载 LDAP 用户"})}):T.map(c=>s.jsxs(J,{"code-path":"src/components/system/LdapManagementSection.tsx:365:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:366:23",children:s.jsx("input",{"code-path":"src/components/system/LdapManagementSection.tsx:367:25",type:"checkbox",className:"rounded bg-slate-800 border-slate-600",checked:N.includes(c.dn),onChange:W=>{W.target.checked?n([...N,c.dn]):n(N.filter(is=>is!==c.dn))}})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:377:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:378:25",className:"text-sm text-slate-200 font-medium",children:c.uid})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:380:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:381:25",className:"text-sm text-slate-300",children:c.cn})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:383:23",children:s.jsx("span",{"code-path":"src/components/system/LdapManagementSection.tsx:384:25",className:"text-sm text-slate-400",children:c.mail||"-"})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:386:23",children:s.jsx("code",{"code-path":"src/components/system/LdapManagementSection.tsx:387:25",className:"text-xs text-slate-500",children:c.dn})}),s.jsx(w,{"code-path":"src/components/system/LdapManagementSection.tsx:389:23",children:s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:390:25",className:"flex items-center gap-1",children:[s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:391:27",variant:"ghost",size:"icon",className:"h-6 w-6 text-slate-400 hover:text-blue-400 hover:bg-blue-500/10",onClick:()=>ks(c),children:s.jsx(vs,{"code-path":"src/components/system/LdapManagementSection.tsx:397:29",className:"h-3 w-3"})}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:399:27",variant:"ghost",size:"icon",className:"h-6 w-6 text-red-400 hover:text-red-300 hover:bg-red-500/10",onClick:()=>fs(c.dn),children:s.jsx(Zs,{"code-path":"src/components/system/LdapManagementSection.tsx:405:29",className:"h-3 w-3"})})]})})]},c.dn))})]})})]}),s.jsx(Z,{"code-path":"src/components/system/LdapManagementSection.tsx:419:7",open:!!v,onOpenChange:c=>!c&&Y(null),children:s.jsxs(ss,{"code-path":"src/components/system/LdapManagementSection.tsx:420:9",className:"max-w-md bg-slate-900 border-slate-800",children:[s.jsxs(es,{"code-path":"src/components/system/LdapManagementSection.tsx:421:11",children:[s.jsxs(ts,{"code-path":"src/components/system/LdapManagementSection.tsx:422:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(vs,{"code-path":"src/components/system/LdapManagementSection.tsx:423:15",className:"h-5 w-5 text-blue-400"}),"编辑 LDAP 用户"]}),s.jsxs(as,{"code-path":"src/components/system/LdapManagementSection.tsx:426:13",className:"text-slate-500",children:["修改 ",v?.uid," 的属性"]})]}),v&&s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:431:13",className:"space-y-3 py-2",children:[s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:432:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:433:17",className:"text-xs text-slate-500 mb-1 block",children:"用户名(只读)"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:434:17",value:v.uid||"",disabled:!0,className:"bg-slate-800/50 border-slate-700 text-slate-500"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:436:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:437:17",className:"text-xs text-slate-500 mb-1 block",children:"显示名称 (cn)"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:438:17",value:r.cn,onChange:c=>z({...r,cn:c.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:440:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:441:17",className:"text-xs text-slate-500 mb-1 block",children:"邮箱"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:442:17",value:r.mail,onChange:c=>z({...r,mail:c.target.value}),placeholder:"user@example.com",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:444:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:445:17",className:"text-xs text-slate-500 mb-1 block",children:"电话"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:446:17",value:r.phone,onChange:c=>z({...r,phone:c.target.value}),placeholder:"13800138000",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),s.jsxs("div",{"code-path":"src/components/system/LdapManagementSection.tsx:448:15",children:[s.jsx("label",{"code-path":"src/components/system/LdapManagementSection.tsx:449:17",className:"text-xs text-slate-500 mb-1 block",children:"职位/头衔"}),s.jsx(f,{"code-path":"src/components/system/LdapManagementSection.tsx:450:17",value:r.title,onChange:c=>z({...r,title:c.target.value}),placeholder:"运维工程师",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]})]}),s.jsxs(ls,{"code-path":"src/components/system/LdapManagementSection.tsx:454:11",children:[s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:455:13",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>Y(null),children:"取消"}),s.jsx(x,{"code-path":"src/components/system/LdapManagementSection.tsx:456:13",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:os,children:"保存"})]})]})})]})}function Je(e){const{ldapConfig:d,ldapForm:t,setLdapForm:a,ldapSaving:m,ldapTesting:i,ldapTestResult:u,handleLdapSave:T,handleLdapTest:N}=e;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:93:7",className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:94:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:95:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:96:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(ee,{"code-path":"src/components/system/SystemSettingsTab.tsx:97:15",className:"h-5 w-5 text-blue-400"}),"安全设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:100:13",className:"text-slate-500",children:"密码策略与登录安全"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:102:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:103:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:104:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:105:17",className:"text-sm font-medium text-slate-200",children:"强制密码复杂度"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:106:17",className:"text-xs text-slate-500",children:"要求密码包含大小写字母、数字和特殊字符"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:108:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:110:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:111:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:112:17",className:"text-sm font-medium text-slate-200",children:"登录失败锁定"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:113:17",className:"text-xs text-slate-500",children:"连续5次登录失败锁定账户30分钟"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:115:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:117:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:118:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:119:17",className:"text-sm font-medium text-slate-200",children:"双因素认证"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:120:17",className:"text-xs text-slate-500",children:"启用后需要手机验证码登录"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:122:15",className:"data-[state=checked]:bg-blue-600"})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:127:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:128:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:129:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Ie,{"code-path":"src/components/system/SystemSettingsTab.tsx:130:15",className:"h-5 w-5 text-emerald-400"}),"审计设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:133:13",className:"text-slate-500",children:"操作日志与审计策略"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:135:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:136:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:137:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:138:17",className:"text-sm font-medium text-slate-200",children:"记录所有操作"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:139:17",className:"text-xs text-slate-500",children:"记录用户的所有操作行为"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:141:15",defaultChecked:!0,className:"data-[state=checked]:bg-blue-600"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:143:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:144:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:145:17",className:"text-sm font-medium text-slate-200",children:"日志保留时间"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:146:17",className:"text-xs text-slate-500",children:"操作日志保留180天"})]}),s.jsxs(Us,{"code-path":"src/components/system/SystemSettingsTab.tsx:148:15",defaultValue:"180",children:[s.jsx(ws,{"code-path":"src/components/system/SystemSettingsTab.tsx:149:17",className:"w-32 h-8 bg-slate-800 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/SystemSettingsTab.tsx:150:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/SystemSettingsTab.tsx:152:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:153:19",value:"30",children:"30天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:154:19",value:"90",children:"90天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:155:19",value:"180",children:"180天"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:156:19",value:"365",children:"1年"})]})]})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:163:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:164:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:165:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Qs,{"code-path":"src/components/system/SystemSettingsTab.tsx:166:15",className:"h-5 w-5 text-amber-400"}),"会话设置"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:169:13",className:"text-slate-500",children:"会话超时与Token配置"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:171:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:172:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:173:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:174:17",className:"text-sm font-medium text-slate-200",children:"会话超时时间"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:175:17",className:"text-xs text-slate-500",children:"用户无操作30分钟后自动登出"})]}),s.jsxs(Us,{"code-path":"src/components/system/SystemSettingsTab.tsx:177:15",defaultValue:"30",children:[s.jsx(ws,{"code-path":"src/components/system/SystemSettingsTab.tsx:178:17",className:"w-32 h-8 bg-slate-800 border-slate-700 text-slate-200",children:s.jsx(Cs,{"code-path":"src/components/system/SystemSettingsTab.tsx:179:19"})}),s.jsxs(Ms,{"code-path":"src/components/system/SystemSettingsTab.tsx:181:17",className:"bg-slate-800 border-slate-700",children:[s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:182:19",value:"15",children:"15分钟"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:183:19",value:"30",children:"30分钟"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:184:19",value:"60",children:"1小时"}),s.jsx(H,{"code-path":"src/components/system/SystemSettingsTab.tsx:185:19",value:"120",children:"2小时"})]})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:189:13",className:"flex items-center justify-between",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:190:15",children:[s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:191:17",className:"text-sm font-medium text-slate-200",children:"单点登录"}),s.jsx("p",{"code-path":"src/components/system/SystemSettingsTab.tsx:192:17",className:"text-xs text-slate-500",children:"同一账号只能在一个设备登录"})]}),s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:194:15",className:"data-[state=checked]:bg-blue-600"})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:199:9",className:"bg-slate-900 border-slate-800",children:[s.jsxs(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:200:11",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:201:13",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(xe,{"code-path":"src/components/system/SystemSettingsTab.tsx:202:15",className:"h-5 w-5 text-purple-400"}),"系统信息"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:205:13",className:"text-slate-500",children:"版本与系统状态"})]}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:207:11",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:208:13",className:"flex items-center justify-between",children:[s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:209:15",className:"text-sm text-slate-400",children:"系统版本"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:210:15",className:"text-sm text-slate-200",children:"v2.5.1"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:212:13",className:"flex items-center justify-between",children:[s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:213:15",className:"text-sm text-slate-400",children:"运行时间"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:214:15",className:"text-sm text-slate-200",children:"30天 12小时"})]})]})]})]}),s.jsxs(xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:221:7",className:"bg-slate-900 border-slate-800 mt-4",children:[s.jsx(Ss,{"code-path":"src/components/system/SystemSettingsTab.tsx:222:9",children:s.jsx("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:223:11",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:224:13",children:[s.jsxs(js,{"code-path":"src/components/system/SystemSettingsTab.tsx:225:15",className:"text-slate-100 flex items-center gap-2",children:[s.jsx(Js,{"code-path":"src/components/system/SystemSettingsTab.tsx:226:17",className:"h-5 w-5 text-cyan-400"}),"LDAP / Active Directory"]}),s.jsx(us,{"code-path":"src/components/system/SystemSettingsTab.tsx:229:15",className:"text-slate-500 mt-1",children:"配置 LDAP 服务器,实现统一身份认证"})]})})}),s.jsxs(hs,{"code-path":"src/components/system/SystemSettingsTab.tsx:233:9",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:234:11",className:"grid grid-cols-2 gap-4",children:[s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:235:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:236:15",className:"text-xs text-slate-500",children:"LDAP 服务器地址"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:237:15",value:t.ldap_host,onChange:n=>a({...t,ldap_host:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"ldap.example.com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:244:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:245:15",className:"text-xs text-slate-500",children:"端口"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:246:15",type:"number",value:t.ldap_port,onChange:n=>a({...t,ldap_port:Number(n.target.value)}),className:"bg-slate-800/50 border-slate-700 text-slate-200",placeholder:"389"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:254:13",className:"space-y-1.5 col-span-2",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:255:15",className:"text-xs text-slate-500",children:"Base DN(用户搜索基础)"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:256:15",value:t.base_dn,onChange:n=>a({...t,base_dn:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"ou=users,dc=example,dc=com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:263:13",className:"space-y-1.5",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:264:15",className:"text-xs text-slate-500",children:"管理员 Bind DN"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:265:15",value:t.admin_dn,onChange:n=>a({...t,admin_dn:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"cn=admin,dc=example,dc=com"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:272:13",className:"space-y-1.5",children:[s.jsxs("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:273:15",className:"text-xs text-slate-500",children:["管理员密码 ",d&&"(留空不修改)"]}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:274:15",type:"password",value:t.admin_password,onChange:n=>a({...t,admin_password:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"******"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:282:13",className:"space-y-1.5 col-span-2",children:[s.jsx("label",{"code-path":"src/components/system/SystemSettingsTab.tsx:283:15",className:"text-xs text-slate-500",children:"搜索过滤器(可选,用 %s 代表用户名)"}),s.jsx(f,{"code-path":"src/components/system/SystemSettingsTab.tsx:284:15",value:t.search_filter,onChange:n=>a({...t,search_filter:n.target.value}),className:"bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-600",placeholder:"(uid=%s)"})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:291:13",className:"flex items-center gap-2 col-span-2",children:[s.jsx(bs,{"code-path":"src/components/system/SystemSettingsTab.tsx:292:15",checked:t.use_ldaps,onCheckedChange:n=>a({...t,use_ldaps:n}),className:"data-[state=checked]:bg-blue-600"}),s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:297:15",className:"text-sm text-slate-300",children:"启用 LDAPS(SSL 加密)"})]})]}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:302:11",className:"flex items-center gap-3 mt-4 pt-4 border-t border-slate-800",children:[u&&s.jsx("span",{"code-path":"src/components/system/SystemSettingsTab.tsx:304:15",className:`text-xs ${u.includes("成功")?"text-emerald-400":"text-red-400"}`,children:u}),s.jsxs("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:308:13",className:"flex items-center gap-2 ml-auto",children:[s.jsxs(x,{"code-path":"src/components/system/SystemSettingsTab.tsx:309:15",variant:"outline",size:"sm",className:"border-slate-700 text-slate-300",onClick:N,disabled:i,children:[i?s.jsx(Ns,{"code-path":"src/components/system/SystemSettingsTab.tsx:316:32",className:"h-3.5 w-3.5 mr-1 animate-spin"}):s.jsx(Xs,{"code-path":"src/components/system/SystemSettingsTab.tsx:316:88",className:"h-3.5 w-3.5 mr-1"}),"测试连接"]}),s.jsx(x,{"code-path":"src/components/system/SystemSettingsTab.tsx:319:15",size:"sm",className:"bg-blue-600 hover:bg-blue-700 text-white",onClick:T,disabled:m,children:m?"保存中...":"保存配置"})]})]})]})]}),d&&s.jsx("div",{"code-path":"src/components/system/SystemSettingsTab.tsx:334:9",className:"mt-4",children:s.jsx(qe,{"code-path":"src/components/system/SystemSettingsTab.tsx:335:11",...e})})]})}function Xe(e){const d=Gs(),[t,a]=o.useState([]),[m,i]=o.useState(new Set),[u,T]=o.useState(!1),[N,n]=o.useState([]),[U,h]=o.useState(""),[D,b]=o.useState(null),[S,y]=o.useState({ldap_host:"",ldap_port:389,use_ldaps:!1,admin_dn:"",admin_password:"",base_dn:"",search_filter:""}),[R,C]=o.useState(!1),[P,F]=o.useState(!1),[B,k]=o.useState(null),[A,p]=o.useState(!1),[O,j]=o.useState(null),[_,K]=o.useState(!1),[E,X]=o.useState([]),[L,rs]=o.useState(""),[ns,ds]=o.useState([]),[ps,G]=o.useState(!1),[Q,v]=o.useState(!1),[Y,r]=o.useState({ou_name:"",parent_dn:"",description:""}),[z,os]=o.useState({username:"",password:"",display_name:"",email:"",ou_dn:""}),[fs,ks]=o.useState(!1),[c,W]=o.useState(""),[is,Is]=o.useState(""),[Rs,Ds]=o.useState(!1),[_s,ys]=o.useState(null),[gs,g]=o.useState(null),[ms,Fs]=o.useState({cn:"",mail:"",phone:"",title:""}),[te,zs]=o.useState(!1),ae=async()=>{try{const l=await $.getConfig();l&&l.ldap_host&&(b(l),y({ldap_host:l.ldap_host||"",ldap_port:l.ldap_port||389,use_ldaps:l.use_ldaps||!1,admin_dn:l.admin_dn||"",admin_password:"",base_dn:l.base_dn||"",search_filter:l.search_filter||""}))}catch{}},he=async()=>{C(!0);try{await $.updateConfig(S),await ae()}catch(l){console.error("Failed to save LDAP config:",l)}finally{C(!1)}},ye=async()=>{F(!0),k(null);try{await $.updateConfig(S);const l=await $.testConnection();k(l?.message||(l?.success?"连接成功":"连接失败"))}catch(l){k(l?.message||"连接失败")}finally{F(!1)}},Ls=async l=>{try{const I=await $.listUsers(l);a(I||[])}catch(I){console.error("loadOUUsers",I)}},ce=async()=>{try{const l=await $.listOUs();X(l||[]),!L&&D?.base_dn&&(rs(D.base_dn),await Ls(D.base_dn))}catch(l){console.error("loadOUs",l)}},ge=async()=>{C(!0);try{await $.createOU(Y),G(!1),r({ou_name:"",parent_dn:"",description:""}),await ce()}catch(l){const I=l?.message||"";I.includes("Already Exists")||I.includes("68")?V.error(`OU "${Y.ou_name}" 已存在,请使用其他名称`):V.error("创建失败: "+I)}finally{C(!1)}},be=async()=>{C(!0);try{await $.createUser({...z,ou_dn:z.ou_dn||L||D?.base_dn}),v(!1),os({username:"",password:"",display_name:"",email:"",ou_dn:""}),await Ls(L)}catch(l){V.error(l?.message||"创建失败")}finally{C(!1)}},Se=async(l,I=!1)=>{if(!(!I&&!await d({title:"删除 LDAP 条目",description:`确定删除 ${l}?`,confirmText:"删除",variant:"destructive"})))try{await $.deleteUser(l),I||await Ls(L)}catch(Os){I||V.error(Os?.message||"删除失败")}},je=l=>{g(l),Fs({cn:l.cn||"",mail:l.mail||"",phone:l.phone||"",title:l.title||""})},ue=async()=>{if(gs)try{await $.updateUser({dn:gs.dn,...ms}),g(null),await Ls(L)}catch(l){V.error(l?.message||"修改失败")}},Ne=async()=>{Ds(!0),ys(null);try{const l=await $.testConnection({test_user:c,test_password:is});ys(l)}catch(l){ys({success:!1,message:l?.message||"验证失败"})}finally{Ds(!1)}},ne=async l=>{T(!0);try{const I=await $.listUsers(l);a(Array.isArray(I)?I:[]),i(new Set)}catch{a([])}finally{T(!1)}},oe=async()=>{let l=[];if(ns.length>0?l=t.filter(I=>ns.includes(I.dn)):l=t,l.length!==0){zs(!0);try{const I=l.map($s=>({username:$s.uid||"",nickname:$s.cn||"",email:$s.mail||""})),Os=await $.batchImport(I);j(Os?.message||`成功导入 ${l.length} 个用户`),K(!0),ds([]),await e()}catch(I){j("导入失败: "+(I?.message||"未知错误")),K(!0)}finally{zs(!1)}}};return{ldapUsers:t,setLdapUsers:a,ldapSelected:m,setLdapSelected:i,ldapLoading:u,ldapImportOUs:N,ldapImportOUDN:U,setLdapImportOUDN:h,loadLdapUsers:ne,handleLdapImport:oe,loadImportDialogData:()=>{$.listOUs().then(l=>n(Array.isArray(l)?l:[])).catch(()=>{}),ne("")},importing:te,setImporting:zs,importFeedback:O,importResultOpen:_,setImportResultOpen:K,loadLdapConfig:ae,settingsTabProps:{ldapConfig:D,ldapForm:S,setLdapForm:y,ldapSaving:R,ldapTesting:P,ldapTestResult:B,handleLdapSave:he,handleLdapTest:ye,ldapMgmtOpen:A,setLdapMgmtOpen:p,ldapOUs:E,selectedOUDN:L,setSelectedOUDN:rs,ldapUsers:t,selectedLDAPUsers:ns,setSelectedLDAPUsers:ds,loadLdapOUs:ce,loadLdapOUUsers:Ls,handleLdapImport:oe,importing:te,importFeedback:O,importResultOpen:_,setImportResultOpen:K,createOUOpen:ps,setCreateOUOpen:G,ouForm:Y,setOuForm:r,handleCreateOU:ge,createUserOpen:Q,setCreateUserOpen:v,newUser:z,setNewUser:os,handleCreateLDAPUser:be,ldapUserTestOpen:fs,setLdapUserTestOpen:ks,ldapTestUser:c,setLdapTestUser:W,ldapTestPass:is,setLdapTestPass:Is,ldapUserTesting:Rs,ldapUserTestResult:_s,handleLdapUserTest:Ne,editLdapUser:gs,setEditLdapUser:g,editLdapForm:ms,setEditLdapForm:Fs,handleUpdateLdapUser:ue,handleDeleteLDAPEntry:Se,openEditLdapUser:je}}}function Ye(e){return{...e,status:e.status===1||e.status==="active"?"active":"inactive",roles:Array.isArray(e.roles)?e.roles:e.role?[e.role]:[],lastLoginAt:e.last_login??e.lastLoginAt,createdAt:e.created_at??e.createdAt,authSource:e.auth_source??e.authSource??"local"}}const le={username:"",nickname:"",email:"",phone:"",role:"",password:"",status:1};function yt(){const e=Gs(),d=fe(),t={"/users":"users","/roles":"roles","/settings":"settings"},[a,m]=o.useState(t[d.pathname]||"users");o.useEffect(()=>{const r=t[d.pathname];r&&r!==a&&m(r)},[d.pathname]);const[i,u]=o.useState(""),[T,N]=o.useState([]),[n,U]=o.useState(!0),[h,D]=o.useState(null),[b,S]=o.useState(null),[y,R]=o.useState(!1),[C,P]=o.useState(null),[F,B]=o.useState(!1),[k,A]=o.useState({...le}),[p,O]=o.useState(null),[j,_]=o.useState([]),[K,E]=o.useState(null),X=async()=>{U(!0);try{const z=(await q.getUsers({page:1,page_size:100}))?.list??[];N(z.map(Ye))}catch(r){console.error("Failed to fetch users:",r),N([])}finally{U(!1)}},L=Xe(X);o.useEffect(()=>{X(),L.loadLdapConfig()},[]),o.useEffect(()=>{p==="ldap"&&L.loadImportDialogData()},[p]);const rs=T.filter(r=>(r.username||"").toLowerCase().includes(i.toLowerCase())||(r.nickname||"").toLowerCase().includes(i.toLowerCase())||(r.email||"").toLowerCase().includes(i.toLowerCase())),ns=r=>r==="active"?s.jsxs(cs,{"code-path":"src/components/system/SystemManager.tsx:110:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[s.jsx(Ws,{"code-path":"src/components/system/SystemManager.tsx:111:9",className:"h-3 w-3 mr-1"}),"正常"]}):s.jsxs(cs,{"code-path":"src/components/system/SystemManager.tsx:115:7",variant:"outline",className:"border-slate-500/30 text-slate-400 bg-slate-500/10",children:[s.jsx(qs,{"code-path":"src/components/system/SystemManager.tsx:116:9",className:"h-3 w-3 mr-1"}),"禁用"]}),ds=()=>{P(null),A({...le}),R(!0)},ps=r=>{P(r),A({username:r.username||"",nickname:r.nickname||"",email:r.email||"",phone:r.phone||"",role:Array.isArray(r.roles)?r.roles[0]||"":r.role||"",password:"",status:r.status==="active"?1:0}),R(!0)},G=async()=>{B(!0);try{const r={username:k.username,nickname:k.nickname,email:k.email,phone:k.phone,role:k.role,status:k.status};k.password&&(r.password=k.password),C?await q.updateUser(C.id,r):await q.createUser(r),R(!1),await X()}catch(r){console.error("Failed to save user:",r)}finally{B(!1)}},Q=async r=>{if(await e({title:"删除用户",description:`确认删除用户「${r.nickname||r.username}」吗?`,confirmText:"删除",variant:"destructive"}))try{await q.deleteUser(r.id),await X()}catch(os){console.error("Failed to delete user:",os)}},v=r=>{const z=r.target.files?.[0];if(!z)return;const os=new FileReader;os.onload=fs=>{const c=(fs.target?.result).split(` +`).filter(g=>g.trim()&&!g.startsWith(""));if(c.length<2)return;const W=c[0].split(",").map(g=>g.trim().toLowerCase()),is=W.findIndex(g=>g.includes("用户名")||g.includes("username")),Is=W.findIndex(g=>g.includes("昵称")||g.includes("name")||g.includes("显示名")),Rs=W.findIndex(g=>g.includes("邮箱")||g.includes("email")||g.includes("mail")),Ds=W.findIndex(g=>g.includes("手机")||g.includes("phone")),_s=W.findIndex(g=>g.includes("角色")||g.includes("role")),ys=W.findIndex(g=>g.includes("密码")||g.includes("password")),gs=[];for(let g=1;gFs.trim());gs.push({username:is>=0?ms[is]:"",nickname:Is>=0?ms[Is]:"",email:Rs>=0?ms[Rs]:"",phone:Ds>=0?ms[Ds]:"",role:_s>=0?ms[_s]:"",password:ys>=0?ms[ys]:""})}_(gs),E(null)},os.readAsText(z,"UTF-8")},Y=async()=>{L.setImporting(!0);try{const r=await q.batchImport({users:j,skip_existing:!0});E(r),await X()}catch(r){E({code:500,message:r?.message||"导入失败"})}finally{L.setImporting(!1)}};return s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:232:5",className:"space-y-6",children:[s.jsx("div",{"code-path":"src/components/system/SystemManager.tsx:234:7",className:"flex items-center justify-between",children:s.jsxs("div",{"code-path":"src/components/system/SystemManager.tsx:235:9",children:[s.jsx("h1",{"code-path":"src/components/system/SystemManager.tsx:236:11",className:"text-2xl font-bold text-slate-100",children:"系统管理"}),s.jsx("p",{"code-path":"src/components/system/SystemManager.tsx:237:11",className:"text-sm text-slate-500 mt-1",children:"用户、权限与系统配置"})]})}),s.jsxs(De,{"code-path":"src/components/system/SystemManager.tsx:242:7",value:a,onValueChange:m,className:"w-full",children:[s.jsxs(Le,{"code-path":"src/components/system/SystemManager.tsx:243:9",className:"bg-slate-800 border border-slate-700",children:[s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:244:11",value:"users",className:"data-[state=active]:bg-slate-700",children:[s.jsx(ie,{"code-path":"src/components/system/SystemManager.tsx:245:13",className:"h-4 w-4 mr-2"}),"用户管理"]}),s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:248:11",value:"roles",className:"data-[state=active]:bg-slate-700",children:[s.jsx(se,{"code-path":"src/components/system/SystemManager.tsx:249:13",className:"h-4 w-4 mr-2"}),"角色权限"]}),s.jsxs(Vs,{"code-path":"src/components/system/SystemManager.tsx:252:11",value:"settings",className:"data-[state=active]:bg-slate-700",children:[s.jsx(xe,{"code-path":"src/components/system/SystemManager.tsx:253:13",className:"h-4 w-4 mr-2"}),"系统设置"]})]}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:258:9",value:"users",className:"mt-4 space-y-4",children:s.jsx(Ee,{"code-path":"src/components/system/SystemManager.tsx:259:11",searchQuery:i,setSearchQuery:u,filteredUsers:rs,loading:n,selectedUser:h,setSelectedUser:D,getUserStatusBadge:ns,dialogOpen:y,setDialogOpen:R,editingUser:C,form:k,setForm:A,saving:F,handleSubmit:G,openCreate:ds,openEdit:ps,handleDelete:Q,importDialogOpen:p,setImportDialogOpen:O,importPreview:j,setImportPreview:_,importing:L.importing,importResult:K,setImportResult:E,handleCsvUpload:v,handleBatchImport:Y,ldapUsers:L.ldapUsers,ldapSelected:L.ldapSelected,setLdapSelected:L.setLdapSelected,ldapLoading:L.ldapLoading,ldapImportOUs:L.ldapImportOUs,ldapImportOUDN:L.ldapImportOUDN,setLdapImportOUDN:L.setLdapImportOUDN,loadLdapUsers:L.loadLdapUsers,handleLdapImport:L.handleLdapImport,setLdapUsers:L.setLdapUsers})}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:299:9",value:"roles",className:"mt-4 space-y-4",children:s.jsx(Qe,{"code-path":"src/components/system/SystemManager.tsx:300:11",selectedRole:b,setSelectedRole:S})}),s.jsx(Hs,{"code-path":"src/components/system/SystemManager.tsx:306:9",value:"settings",className:"mt-4",children:s.jsx(Je,{"code-path":"src/components/system/SystemManager.tsx:307:11",...L.settingsTabProps})})]})]})}export{yt as SystemManager}; diff --git a/backend/static/assets/TerminalAuditTab-D4-qFyPi.js b/backend/static/assets/TerminalAuditTab-DLfjD3Vi.js similarity index 98% rename from backend/static/assets/TerminalAuditTab-D4-qFyPi.js rename to backend/static/assets/TerminalAuditTab-DLfjD3Vi.js index 240c31a..4eac569 100644 --- a/backend/static/assets/TerminalAuditTab-D4-qFyPi.js +++ b/backend/static/assets/TerminalAuditTab-DLfjD3Vi.js @@ -1,3 +1,3 @@ -import{r as n,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{G as oe,o as le,D as U,a as J,m as Q,c as X,d as G,f as ce,B as H,b as de}from"./index-LZWfu62c.js";import{C as z,a as E}from"./card-B-RtdR4H.js";import{I as $}from"./input-BdDauX3U.js";import{T as I,a as O,b as T,c as d,d as q,e as m}from"./table-BPFYQwjr.js";import{x as Z,a as V}from"./vendor-xterm-20M9KZE1.js";import{B as k}from"./badge-B0F5ZNtn.js";import{m as me,a as pe}from"./xterm-utils-slbfdUHf.js";import{_ as K,L as Y,an as xe,ao as he,X as ue,S as _,R as W,aZ as ge,a_ as ve,A as ee,a$ as fe,x as ye,z as je,v as Se}from"./vendor-icons-Aso0-eeY.js";import{u as se,q as te,b as ae}from"./unwrap-BmWy-KM2.js";import{u as B}from"./useMutation-Bp3lz5hm.js";import{t as L,s as be}from"./terminal-BchqP-zB.js";function ne(s={page:1,page_size:100}){return se({queryKey:te.terminalSessions(s),queryFn:async()=>{const r=await L.list(s);return ae(r)}})}function Ne(){const s=oe(),r=()=>s.invalidateQueries({queryKey:["terminal-sessions"]}),i=B({mutationFn:p=>L.kill(p),onSuccess:r}),c=B({mutationFn:p=>L.delete(p),onSuccess:r}),l=B({mutationFn:p=>L.batchDelete(p),onSuccess:r});return{killMutation:i,deleteMutation:c,batchDeleteMutation:l,invalidate:r}}function Pe(s={page:1,page_size:200}){return se({queryKey:te.sessionCommands(s),queryFn:async()=>{const r=await be.list(s);return ae(r)}})}function we({open:s,onOpenChange:r,sessionId:i,sessionInfo:c}){const l=n.useRef(null),p=n.useRef(null),f=n.useRef(null),u=n.useRef(null),[y,a]=n.useState(!1),[x,g]=n.useState(""),[t,P]=n.useState(c||null),[v,b]=n.useState(!1);n.useEffect(()=>{s||(a(!1),g(""),b(!1))},[s]),n.useEffect(()=>{if(!s||!i)return;a(!1),g("");const h=new Z.Terminal({cursorBlink:!1,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',disableStdin:!0,allowProposedApi:!0,scrollback:5e3,theme:{background:"#0a0e14",foreground:"#d6d6d6",cursor:"#d6d6d6",selectionBackground:"rgba(255,255,255,0.2)"}}),o=new V.FitAddon;h.loadAddon(o),p.current=h,f.current=o;const j=le.getState().token||localStorage.getItem("token")||(()=>{try{return JSON.parse(localStorage.getItem("user-storage")||"{}")?.state?.token||""}catch{return""}})(),M=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/audit/${i}?token=${encodeURIComponent(j)}`,S=new WebSocket(M);u.current=S;let N=!1;S.onopen=()=>{N=!0,a(!0),g(""),me(h,o,()=>l.current),h.writeln("\x1B[36m[审计监控] 已连接到会话...\x1B[0m")},S.onmessage=R=>{try{const C=JSON.parse(R.data);switch(C.type){case"session_info":P(C.payload),h.writeln(`\x1B[36m用户: ${C.payload.username} 服务器: ${C.payload.server_name} (${C.payload.server_ip})\x1B[0m`);break;case"history":C.data&&h.write(C.data);break;case"output":C.data&&h.write(C.data);break}}catch{}},S.onerror=()=>g("WebSocket 连接失败"),S.onclose=R=>{N||g(`连接失败 (code=${R.code}): ${R.reason||"认证失败或网络问题"}`),a(!1),h.writeln(`\r +import{r as n,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{G as oe,o as le,D as U,a as J,m as Q,c as X,d as G,f as ce,B as H,b as de}from"./index-Bp-M7P_8.js";import{C as z,a as E}from"./card-BHSBTtub.js";import{I as $}from"./input-Bnlm--la.js";import{T as I,a as O,b as T,c as d,d as q,e as m}from"./table-u8V9iTZf.js";import{x as Z,a as V}from"./vendor-xterm-20M9KZE1.js";import{B as k}from"./badge-B00SZHvE.js";import{m as me,a as pe}from"./xterm-utils-slbfdUHf.js";import{_ as K,L as Y,an as xe,ao as he,X as ue,S as _,R as W,aZ as ge,a_ as ve,A as ee,a$ as fe,x as ye,z as je,v as Se}from"./vendor-icons-BWk-DH7F.js";import{u as se,q as te,b as ae}from"./unwrap-D6sbt6TG.js";import{u as B}from"./useMutation-DTWI9Q1n.js";import{t as L,s as be}from"./terminal-DMFQ_5h4.js";function ne(s={page:1,page_size:100}){return se({queryKey:te.terminalSessions(s),queryFn:async()=>{const r=await L.list(s);return ae(r)}})}function Ne(){const s=oe(),r=()=>s.invalidateQueries({queryKey:["terminal-sessions"]}),i=B({mutationFn:p=>L.kill(p),onSuccess:r}),c=B({mutationFn:p=>L.delete(p),onSuccess:r}),l=B({mutationFn:p=>L.batchDelete(p),onSuccess:r});return{killMutation:i,deleteMutation:c,batchDeleteMutation:l,invalidate:r}}function Pe(s={page:1,page_size:200}){return se({queryKey:te.sessionCommands(s),queryFn:async()=>{const r=await be.list(s);return ae(r)}})}function we({open:s,onOpenChange:r,sessionId:i,sessionInfo:c}){const l=n.useRef(null),p=n.useRef(null),f=n.useRef(null),u=n.useRef(null),[y,a]=n.useState(!1),[x,g]=n.useState(""),[t,P]=n.useState(c||null),[v,b]=n.useState(!1);n.useEffect(()=>{s||(a(!1),g(""),b(!1))},[s]),n.useEffect(()=>{if(!s||!i)return;a(!1),g("");const h=new Z.Terminal({cursorBlink:!1,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',disableStdin:!0,allowProposedApi:!0,scrollback:5e3,theme:{background:"#0a0e14",foreground:"#d6d6d6",cursor:"#d6d6d6",selectionBackground:"rgba(255,255,255,0.2)"}}),o=new V.FitAddon;h.loadAddon(o),p.current=h,f.current=o;const j=le.getState().token||localStorage.getItem("token")||(()=>{try{return JSON.parse(localStorage.getItem("user-storage")||"{}")?.state?.token||""}catch{return""}})(),M=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/audit/${i}?token=${encodeURIComponent(j)}`,S=new WebSocket(M);u.current=S;let N=!1;S.onopen=()=>{N=!0,a(!0),g(""),me(h,o,()=>l.current),h.writeln("\x1B[36m[审计监控] 已连接到会话...\x1B[0m")},S.onmessage=R=>{try{const C=JSON.parse(R.data);switch(C.type){case"session_info":P(C.payload),h.writeln(`\x1B[36m用户: ${C.payload.username} 服务器: ${C.payload.server_name} (${C.payload.server_ip})\x1B[0m`);break;case"history":C.data&&h.write(C.data);break;case"output":C.data&&h.write(C.data);break}}catch{}},S.onerror=()=>g("WebSocket 连接失败"),S.onclose=R=>{N||g(`连接失败 (code=${R.code}): ${R.reason||"认证失败或网络问题"}`),a(!1),h.writeln(`\r \x1B[33m[审计监控] 连接已断开\x1B[0m`)};const w=setTimeout(()=>{N||(g("连接超时 — 请确认已登录且有活跃会话"),S.close())},5e3);return()=>{clearTimeout(w),S.close(),h.dispose(),p.current=null,f.current=null,u.current=null,a(!1)}},[s,i]),n.useEffect(()=>{if(!s)return;let h,o=0;const j=()=>{const D=l.current,M=f.current,S=p.current;if(!D||!M||!S){o++<30&&requestAnimationFrame(j);return}h=pe(D,M,S)};return j(),()=>h?.()},[s,i,v]);const A=h=>h?new Date(h).toLocaleString():"--";return e.jsx(U,{"code-path":"src/components/system/LiveMonitorDialog.tsx:180:5",open:s,onOpenChange:r,children:e.jsxs(J,{"code-path":"src/components/system/LiveMonitorDialog.tsx:181:7",showCloseButton:!1,showOverlay:!1,className:Q("bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] p-0 gap-0","!duration-0 !transition-none",v?"!max-w-none !w-screen !h-screen !rounded-none !translate-x-0 !translate-y-0 !left-0 !top-0":""),style:v?{maxWidth:"100vw",width:"100vw",height:"100vh"}:{maxWidth:"960px",width:"92vw"},children:[e.jsx(X,{"code-path":"src/components/system/LiveMonitorDialog.tsx:197:9",className:"sr-only",children:"终端实时监控"}),e.jsx(G,{"code-path":"src/components/system/LiveMonitorDialog.tsx:198:9",className:"sr-only",children:"审计在线 WebSSH 会话"}),e.jsxs("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:201:9",className:"flex items-center justify-between px-4 py-2 border-b border-[var(--dg-border)]",children:[e.jsxs("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:202:11",className:"flex items-center gap-2 text-sm min-w-0 flex-wrap",children:[e.jsx(K,{"code-path":"src/components/system/LiveMonitorDialog.tsx:203:13",className:"h-4 w-4 text-emerald-400 shrink-0"}),e.jsx("span",{"code-path":"src/components/system/LiveMonitorDialog.tsx:204:13",className:"text-[var(--dg-text-primary)] font-medium",children:"终端实时监控"}),t&&e.jsxs("span",{"code-path":"src/components/system/LiveMonitorDialog.tsx:206:15",className:"text-[var(--dg-text-muted)] truncate",children:[t.username," · ",t.server_name," (",t.server_ip,") · ",A(t.start_time)]}),y&&e.jsx(k,{"code-path":"src/components/system/LiveMonitorDialog.tsx:211:15",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10 text-xs",children:"● 在线"}),!y&&!x&&e.jsxs(k,{"code-path":"src/components/system/LiveMonitorDialog.tsx:216:15",variant:"outline",className:"border-yellow-500/30 text-yellow-400 bg-yellow-500/10 text-xs",children:[e.jsx(Y,{"code-path":"src/components/system/LiveMonitorDialog.tsx:217:17",className:"h-3 w-3 animate-spin mr-1"}),"连接中"]}),x&&e.jsx(k,{"code-path":"src/components/system/LiveMonitorDialog.tsx:222:15",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10 text-xs",children:"连接失败"})]}),e.jsxs("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:227:11",className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{"code-path":"src/components/system/LiveMonitorDialog.tsx:228:13",type:"button",onClick:()=>b(!v),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",title:v?"退出全屏":"全屏",children:v?e.jsx(xe,{"code-path":"src/components/system/LiveMonitorDialog.tsx:234:29",className:"h-4 w-4"}):e.jsx(he,{"code-path":"src/components/system/LiveMonitorDialog.tsx:234:65",className:"h-4 w-4"})}),e.jsx("button",{"code-path":"src/components/system/LiveMonitorDialog.tsx:236:13",type:"button",onClick:()=>r(!1),className:"p-1.5 rounded hover:bg-[var(--dg-bg-hover)] text-[var(--dg-text-secondary)]",children:e.jsx(ue,{"code-path":"src/components/system/LiveMonitorDialog.tsx:241:15",className:"h-4 w-4"})})]})]}),x&&e.jsx("p",{"code-path":"src/components/system/LiveMonitorDialog.tsx:247:11",className:"text-sm text-red-400 px-4 py-2 border-b border-[var(--dg-border)]",children:x}),e.jsx("div",{"code-path":"src/components/system/LiveMonitorDialog.tsx:250:9",ref:l,className:"xterm-terminal-host",style:{height:v?"calc(100vh - 49px)":"520px"}})]})})}function re(s){if(!s||s<0)return"--";if(s<60)return`${s}秒`;const r=Math.floor(s/60),i=s%60;if(r<60)return`${r}分${i>0?`${i}秒`:""}`;const c=Math.floor(r/60),l=r%60;return`${c}时${l>0?`${l}分`:""}`}function Ce(s){return s?s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(2)} MB`:"0 B"}function ie(s){return s==="active"?e.jsxs(k,{"code-path":"src/pages/terminal-audit/helpers.tsx:26:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:[e.jsx("span",{"code-path":"src/pages/terminal-audit/helpers.tsx:27:9",className:"w-1.5 h-1.5 rounded-full bg-emerald-400 mr-1.5 inline-block animate-pulse"}),"活动中"]}):s==="failed"?e.jsx(k,{"code-path":"src/pages/terminal-audit/helpers.tsx:34:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",children:"失败"}):e.jsx(k,{"code-path":"src/pages/terminal-audit/helpers.tsx:40:5",variant:"outline",className:"border-slate-500/30 text-slate-400 bg-slate-500/10",children:"已关闭"})}const F=10;function Ae(s){const[r,i]=n.useState(0);return n.useEffect(()=>{if(!s)return;const c=new Date(s).getTime(),l=()=>i(Math.floor((Date.now()-c)/1e3));l();const p=setInterval(l,1e3);return()=>clearInterval(p)},[s]),r}function De({session:s,onKill:r,onMonitor:i}){const c=Ae(s.start_time);return e.jsxs(T,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:54:5",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:55:7",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:56:9",className:"text-sm text-slate-400",children:s.id})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:58:7",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:59:9",className:"text-sm text-slate-200",children:s.username||"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:61:7",children:e.jsxs("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:62:9",className:"flex flex-col",children:[e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:63:11",className:"text-sm text-slate-200",children:s.server_name||"--"}),e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:64:11",className:"text-xs text-slate-500",children:s.server_ip})]})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:67:7",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:68:9",className:"text-sm text-slate-400",children:s.server_port})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:70:7",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:71:9",className:"text-sm text-slate-400",children:s.start_time?new Date(s.start_time).toLocaleString():"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:75:7",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:76:9",className:"text-sm text-emerald-400 font-mono",children:re(c)})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:78:7",children:ie(s.status)}),e.jsx(m,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:79:7",children:e.jsxs("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:80:9",className:"flex items-center justify-end gap-1",children:[e.jsx(H,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:81:11",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-red-400 hover:bg-slate-800",onClick:()=>r(s.id,s.username),title:"阻断会话",children:e.jsx(fe,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:88:13",className:"h-4 w-4"})}),e.jsx(H,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:90:11",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400 hover:bg-slate-800",onClick:()=>i(s.id),title:"实时查看",children:e.jsx(ye,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:97:13",className:"h-4 w-4"})})]})})]})}function He({userToggledOff:s,onUserToggledOff:r}){const i=ce(),{killMutation:c}=Ne(),{data:l=[],isLoading:p,refetch:f}=ne({page:1,page_size:100,status:"active"}),[u,y]=n.useState(""),[a,x]=n.useState(()=>!s),[g,t]=n.useState(!1),[P,v]=n.useState(null);n.useEffect(()=>{s||x(!0)},[s]),n.useEffect(()=>{if(!a)return;const o=setInterval(()=>f(),F*1e3);return()=>clearInterval(o)},[a,f]);const b=l.filter(o=>{const j=u.toLowerCase();return!j||(o.username||"").toLowerCase().includes(j)||(o.server_name||"").toLowerCase().includes(j)||(o.server_ip||"").toLowerCase().includes(j)}),A=async(o,j)=>{if(await i({title:"阻断会话",description:`确认强制断开用户「${j}」的当前会话吗?`,confirmText:"阻断",variant:"destructive"}))try{await c.mutateAsync(o)}catch{}},h=o=>{v(o),t(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:162:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:163:9",className:"relative w-64",children:[e.jsx(_,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:164:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx($,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:165:11",placeholder:"搜索用户/服务器...",value:u,onChange:o=>y(o.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs(H,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:172:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>f(),children:[e.jsx(W,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:177:11",className:"h-4 w-4 mr-2"}),"刷新"]}),e.jsx(H,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:180:9",variant:a?"default":"outline",className:a?"bg-emerald-600 hover:bg-emerald-700 text-white":"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>{a&&r(),x(!a)},title:a?`每 ${F}s 自动刷新 · 点击关闭`:"点击开启自动刷新",children:a?e.jsxs(e.Fragment,{children:[e.jsx(ge,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:195:15",className:"h-4 w-4 mr-1.5 animate-pulse"}),F,"s"]}):e.jsxs(e.Fragment,{children:[e.jsx(ve,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:200:15",className:"h-4 w-4 mr-2"}),"自动刷新"]})})]}),e.jsx(z,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:207:7",className:"bg-slate-900 border-slate-800",children:e.jsx(E,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:208:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:209:11",className:"border-t border-slate-800",children:p?e.jsx("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:211:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:212:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):b.length===0?e.jsxs("div",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:215:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[e.jsx(ee,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:216:17",className:"h-8 w-8 mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:217:17",className:"text-sm",children:"暂无在线会话"})]}):e.jsxs(I,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:220:15",children:[e.jsx(O,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:221:17",children:e.jsxs(T,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:222:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:223:21",className:"text-slate-400",children:"ID"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:224:21",className:"text-slate-400",children:"用户"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:225:21",className:"text-slate-400",children:"目标服务器"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:226:21",className:"text-slate-400",children:"端口"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:227:21",className:"text-slate-400",children:"开始时间"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:228:21",className:"text-slate-400",children:"时长"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:229:21",className:"text-slate-400",children:"状态"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:230:21",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(q,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:233:17",children:b.map(o=>e.jsx(De,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:235:21",session:o,onKill:A,onMonitor:h},o.id))})]})})})}),e.jsx(we,{"code-path":"src/pages/terminal-audit/ActiveSessionsPanel.tsx:244:7",open:g,onOpenChange:t,sessionId:P})]})}function Me({open:s,onOpenChange:r,sessionId:i}){const c=n.useRef(null),l=n.useRef(null),p=n.useRef(null),[f,u]=n.useState(!1),[y,a]=n.useState(""),[x,g]=n.useState(0);return n.useEffect(()=>{if(!s||!i)return;const t=new Z.Terminal({cursorBlink:!1,fontSize:13,fontFamily:'Menlo, Monaco, "Courier New", monospace',disableStdin:!0,cols:80,rows:24,theme:{background:"#0a0e14",foreground:"#d6d6d6",cursor:"#0a0e14",selectionBackground:"rgba(255,255,255,0.2)"}}),P=new V.FitAddon;t.loadAddon(P),l.current=t;let v=!1;return u(!0),a(""),g(0),L.getRecord(i).then(b=>{if(v)return;const A=typeof b=="string"?b:b?.data||b?.record_data||"";if(!A||A.trim()===""){a("No recording data available for this session"),u(!1);return}if(c.current){t.open(c.current);try{P.fit()}catch{}}const h=A.split(` `).filter(N=>N.trim()),o=[];for(const N of h)try{const w=JSON.parse(N);Array.isArray(w)&&w.length>=3&&o.push({time:w[0],eventType:w[1],data:w[2]})}catch{}if(o.length===0){t.write(A),g(100),u(!1);return}u(!1);const j=o[o.length-1].time;let D=0,M=0;const S=()=>{if(v||D>=o.length){g(100);return}const N=o[D],w=(N.time-M)*1e3;M=N.time,D++;const R=Math.min(w,2e3);p.current=setTimeout(()=>{v||(t.write(N.data),g(Math.round(N.time/j*100)),S())},R)};S()}).catch(b=>{v||(console.error("[Replay] Load failed:",b),a("Failed to load recording data"),u(!1))}),()=>{v=!0,p.current&&clearTimeout(p.current);try{t.dispose()}catch{}l.current=null}},[s,i]),e.jsx(U,{"code-path":"src/components/system/ReplayDialog.tsx:153:5",open:s,onOpenChange:r,children:e.jsxs(J,{"code-path":"src/components/system/ReplayDialog.tsx:154:7",showOverlay:!1,className:"bg-slate-900 border-slate-800 p-0 gap-0",style:{maxWidth:"900px",width:"90vw"},children:[e.jsxs(de,{"code-path":"src/components/system/ReplayDialog.tsx:155:9",className:"px-4 py-3 border-b border-slate-800",children:[e.jsxs(X,{"code-path":"src/components/system/ReplayDialog.tsx:156:11",className:"text-slate-100 text-base flex items-center gap-2",children:["Terminal Replay #",i??"",x>0&&x<100&&e.jsxs("span",{"code-path":"src/components/system/ReplayDialog.tsx:159:15",className:"text-xs text-slate-500 font-normal ml-2",children:[x,"%"]})]}),e.jsx(G,{"code-path":"src/components/system/ReplayDialog.tsx:162:11",className:"text-slate-500 sr-only",children:"Replay recorded terminal output"})]}),e.jsxs("div",{"code-path":"src/components/system/ReplayDialog.tsx:164:9",className:"relative bg-[#0a0e14]",style:{height:"460px"},children:[f&&e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:166:13",className:"absolute inset-0 z-10 flex items-center justify-center bg-black/40",children:e.jsx(Y,{"code-path":"src/components/system/ReplayDialog.tsx:167:15",className:"h-6 w-6 animate-spin text-blue-400"})}),y&&e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:171:13",className:"absolute inset-0 z-10 flex items-center justify-center bg-black/40",children:e.jsx("p",{"code-path":"src/components/system/ReplayDialog.tsx:172:15",className:"text-red-400 text-sm",children:y})}),x>0&&x<100&&e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:176:13",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-slate-800 z-10",children:e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:177:15",className:"h-full bg-blue-500 transition-all duration-300",style:{width:`${x}%`}})}),e.jsx("div",{"code-path":"src/components/system/ReplayDialog.tsx:183:11",ref:c,className:"absolute inset-0 p-1"})]})]})})}function Re(){const{data:s=[],isLoading:r,refetch:i}=ne({page:1,page_size:100,status:"closed"}),[c,l]=n.useState(""),[p,f]=n.useState(null),[u,y]=n.useState(!1),a=s.filter(t=>{const P=c.toLowerCase();return!P||(t.username||"").toLowerCase().includes(P)||(t.server_name||"").toLowerCase().includes(P)||(t.server_ip||"").toLowerCase().includes(P)}),x=t=>{f(t),y(!0)},g=async t=>{try{await L.download(t)}catch{}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:57:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:58:9",className:"relative w-64",children:[e.jsx(_,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:59:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx($,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:60:11",placeholder:"搜索用户/服务器/IP...",value:c,onChange:t=>l(t.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsxs(H,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:67:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>i(),children:[e.jsx(W,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:72:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),e.jsx(z,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:77:7",className:"bg-slate-900 border-slate-800",children:e.jsx(E,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:78:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:79:11",className:"border-t border-slate-800",children:r?e.jsx("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:81:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:82:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):a.length===0?e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:85:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[e.jsx(K,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:86:17",className:"h-8 w-8 mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:87:17",className:"text-sm",children:"暂无历史会话"})]}):e.jsxs(I,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:90:15",children:[e.jsx(O,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:91:17",children:e.jsxs(T,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:92:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:93:21",className:"text-slate-400",children:"ID"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:94:21",className:"text-slate-400",children:"用户"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:95:21",className:"text-slate-400",children:"目标服务器"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:96:21",className:"text-slate-400",children:"端口"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:97:21",className:"text-slate-400",children:"开始时间"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:98:21",className:"text-slate-400",children:"结束时间"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:99:21",className:"text-slate-400",children:"时长"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:100:21",className:"text-slate-400",children:"状态"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:101:21",className:"text-slate-400 text-right",children:"操作"})]})}),e.jsx(q,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:104:17",children:a.map(t=>e.jsxs(T,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:106:21",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:107:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:108:25",className:"text-sm text-slate-400",children:t.id})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:110:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:111:25",className:"text-sm text-slate-200",children:t.username||"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:113:23",children:e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:114:25",className:"flex flex-col",children:[e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:115:27",className:"text-sm text-slate-200",children:t.server_name||"--"}),e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:116:27",className:"text-xs text-slate-500",children:t.server_ip})]})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:119:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:120:25",className:"text-sm text-slate-400",children:t.server_port})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:122:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:123:25",className:"text-sm text-slate-400",children:t.start_time?new Date(t.start_time).toLocaleString():"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:127:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:128:25",className:"text-sm text-slate-400",children:t.end_time?new Date(t.end_time).toLocaleString():"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:132:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:133:25",className:"text-sm text-slate-300",children:re(t.duration)})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:135:23",children:ie(t.status)}),e.jsx(m,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:136:23",children:e.jsxs("div",{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:137:25",className:"flex items-center justify-end gap-1",children:[e.jsx(H,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:138:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-blue-400 hover:bg-slate-800",onClick:()=>x(t.id),title:"回放",children:e.jsx(je,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:145:29",className:"h-4 w-4"})}),e.jsx(H,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:147:27",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-green-400 hover:bg-slate-800",onClick:()=>g(t.id),title:"下载录制",children:e.jsx(Se,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:154:29",className:"h-4 w-4"})})]})})]},t.id))})]})})})}),e.jsx(Me,{"code-path":"src/pages/terminal-audit/HistorySessionsPanel.tsx:167:7",open:u,onOpenChange:y,sessionId:p})]})}function ke(){const[s,r]=n.useState(""),[i,c]=n.useState(""),l=n.useMemo(()=>({page:1,page_size:200,...i?{session_id:Number(i)}:{}}),[i]),{data:p=[],isLoading:f,refetch:u}=Pe(l),y=p.filter(a=>{const x=s.toLowerCase();return!x||(a.username||"").toLowerCase().includes(x)||(a.command||"").toLowerCase().includes(x)});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:45:7",className:"flex items-center gap-3 flex-wrap",children:[e.jsxs("div",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:46:9",className:"relative w-64",children:[e.jsx(_,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:47:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx($,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:48:11",placeholder:"搜索用户/命令...",value:s,onChange:a=>r(a.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),e.jsx($,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:55:9",placeholder:"会话 ID(可选)",value:i,onChange:a=>c(a.target.value),className:"w-32 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"}),e.jsxs(H,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:61:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:()=>u(),children:[e.jsx(W,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:66:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),e.jsx(z,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:71:7",className:"bg-slate-900 border-slate-800",children:e.jsx(E,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:72:9",className:"p-0",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:73:11",className:"border-t border-slate-800",children:f?e.jsx("div",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:75:15",className:"flex items-center justify-center py-16",children:e.jsx("div",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:76:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):y.length===0?e.jsxs("div",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:79:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[e.jsx(_,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:80:17",className:"h-8 w-8 mb-3 opacity-40"}),e.jsx("p",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:81:17",className:"text-sm",children:"暂无会话命令记录"})]}):e.jsxs(I,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:84:15",children:[e.jsx(O,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:85:17",children:e.jsxs(T,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:86:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(d,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:87:21",className:"text-slate-400",children:"时间"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:88:21",className:"text-slate-400",children:"用户"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:89:21",className:"text-slate-400",children:"命令"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:90:21",className:"text-slate-400",children:"输出大小"}),e.jsx(d,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:91:21",className:"text-slate-400",children:"关联会话"})]})}),e.jsx(q,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:94:17",children:y.map(a=>e.jsxs(T,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:96:21",className:"border-slate-800 hover:bg-slate-800/50",children:[e.jsx(m,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:97:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:98:25",className:"text-sm text-slate-400",children:a.created_at?new Date(a.created_at).toLocaleString():"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:102:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:103:25",className:"text-sm text-slate-200",children:a.username||"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:105:23",children:e.jsx("code",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:106:25",className:"text-xs text-slate-300 bg-slate-800 px-2 py-0.5 rounded max-w-[400px] truncate block",children:a.command||"--"})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:110:23",children:e.jsx("span",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:111:25",className:"text-sm text-slate-400",children:Ce(a.output_size)})}),e.jsx(m,{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:113:23",children:e.jsxs("span",{"code-path":"src/pages/terminal-audit/SessionCommandsPanel.tsx:114:25",className:"text-xs text-slate-500",children:["#",a.session_id]})})]},a.id))})]})})})})]})}const Le=[{id:"active",name:"在线会话",icon:ee},{id:"history",name:"历史会话",icon:K},{id:"commands",name:"会话命令",icon:_}];function Ue(){const[s,r]=n.useState("active"),[i,c]=n.useState(!1);return e.jsxs("div",{"code-path":"src/pages/TerminalAuditTab.tsx:22:5",className:"space-y-4",children:[e.jsx("div",{"code-path":"src/pages/TerminalAuditTab.tsx:23:7",className:"flex gap-1 bg-[var(--dg-bg-secondary)] p-1 rounded-lg border border-[var(--dg-border)] w-fit",children:Le.map(l=>e.jsxs("button",{"code-path":"src/pages/TerminalAuditTab.tsx:25:11",onClick:()=>r(l.id),className:Q("flex items-center gap-2 px-4 py-2 rounded-md text-sm font-medium transition-all",s===l.id?"bg-[var(--dg-bg-tertiary)] text-[var(--dg-text-primary)] shadow-sm":"text-[var(--dg-text-muted)] hover:text-[var(--dg-text-secondary)]"),children:[e.jsx(l.icon,{"code-path":"src/pages/TerminalAuditTab.tsx:35:13",className:"h-4 w-4"}),l.name]},l.id))}),s==="active"&&e.jsx(He,{"code-path":"src/pages/TerminalAuditTab.tsx:42:9",userToggledOff:i,onUserToggledOff:()=>c(!0)}),s==="history"&&e.jsx(Re,{"code-path":"src/pages/TerminalAuditTab.tsx:47:32"}),s==="commands"&&e.jsx(ke,{"code-path":"src/pages/TerminalAuditTab.tsx:48:33"})]})}export{Ue as TerminalAuditTab}; diff --git a/backend/static/assets/TopologyView-DdP6o9Mj.js b/backend/static/assets/TopologyView-Bs02-3Xu.js similarity index 97% rename from backend/static/assets/TopologyView-DdP6o9Mj.js rename to backend/static/assets/TopologyView-Bs02-3Xu.js index 3d909be..3f7f2f5 100644 --- a/backend/static/assets/TopologyView-DdP6o9Mj.js +++ b/backend/static/assets/TopologyView-Bs02-3Xu.js @@ -1 +1 @@ -import{j as e,r as d}from"./vendor-codemirror-C7mXSpXt.js";import{C as oe,a as ne,b as Fe,c as He,d as Je}from"./card-B-RtdR4H.js";import{g as Ge,f as Ke,B as v,D as Te,a as je,b as Ve,c as Ne,d as ve,e as Ze,t as j}from"./index-LZWfu62c.js";import{I as Se}from"./input-BdDauX3U.js";import{L as ae}from"./label-u-lNUbKh.js";import{B as Ce}from"./badge-B0F5ZNtn.js";import{S as ce,a as re,b as le,c as ie,d as q}from"./select-4xU_9B3_.js";import{T as qe}from"./textarea-BdtIagjy.js";import{k as _}from"./index-Z0O8nAcG.js";import{h as Ee,ad as es,a4 as ss,D as ts,N as os,B as ns,i as pe,G as as,d as _e,L as $e,R as cs,P as rs,ai as Me,$ as ls,n as is,S as ds,T as ps}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const de={cluster:"集群",loadbalancer:"Ingress",service:"Service",app:"Deployment",server:"Node",database:"数据库",external:"外部服务",custom:"自定义"},ms=[{value:"database",label:"数据库",desc:"MySQL / Redis / PostgreSQL 等"},{value:"external",label:"外部服务",desc:"外部 API / CDN / DNS 等"},{value:"custom",label:"自定义",desc:"其他自定义节点"}],X=u=>u.startsWith("custom-");function M(u,h="h-5 w-5"){switch(u){case"server":return e.jsx(Ee,{"code-path":"src/components/kubernetes/topology-helpers.tsx:31:27",className:h});case"loadbalancer":return e.jsx(as,{"code-path":"src/components/kubernetes/topology-helpers.tsx:32:33",className:h});case"cluster":return e.jsx(pe,{"code-path":"src/components/kubernetes/topology-helpers.tsx:33:28",className:h});case"app":return e.jsx(ns,{"code-path":"src/components/kubernetes/topology-helpers.tsx:34:24",className:h});case"service":return e.jsx(os,{"code-path":"src/components/kubernetes/topology-helpers.tsx:35:28",className:h});case"database":return e.jsx(ts,{"code-path":"src/components/kubernetes/topology-helpers.tsx:36:29",className:h});case"external":return e.jsx(ss,{"code-path":"src/components/kubernetes/topology-helpers.tsx:37:29",className:h});case"custom":return e.jsx(es,{"code-path":"src/components/kubernetes/topology-helpers.tsx:38:27",className:h});default:return e.jsx(Ee,{"code-path":"src/components/kubernetes/topology-helpers.tsx:39:21",className:h})}}function ee(u){switch(u){case"server":return"bg-blue-500/20 text-blue-400 border-blue-500/30";case"loadbalancer":return"bg-purple-500/20 text-purple-400 border-purple-500/30";case"cluster":return"bg-cyan-500/20 text-cyan-400 border-cyan-500/30";case"app":return"bg-rose-500/20 text-rose-400 border-rose-500/30";case"service":return"bg-emerald-500/20 text-emerald-400 border-emerald-500/30";case"database":return"bg-amber-500/20 text-amber-400 border-amber-500/30";case"external":return"bg-orange-500/20 text-orange-400 border-orange-500/30";case"custom":return"bg-slate-500/20 text-slate-400 border-slate-500/30";default:return"bg-slate-500/20 text-slate-400 border-slate-500/30"}}function us(u,h,D,Y,x){const V=[],l=[],z=Math.max(1,h.length,D.length,Y.length,x.length),L=Math.max(900,Math.min(z*130,2400)),r=[60,180,320,480,640],N=o=>{const i=Math.min(o,12);if(i===0)return[];if(i===1)return[L/2];const c=L/(i+1);return Array.from({length:i},(p,g)=>c*(g+1))},E=`cluster-${u.id}`;V.push({id:E,name:u.name||"集群",type:"cluster",x:L/2,y:r[0],data:{kind:"cluster",version:u.version,status:u.status,api_server:u.api_server,node_count:u.node_count,pod_count:u.pod_count}});const R=h.slice(0,12),B=N(R.length);R.forEach((o,i)=>{const c=`ingress-${o.id}`;V.push({id:c,name:o.name,type:"loadbalancer",x:B[i],y:r[1],data:{kind:"ingress",namespace:o.namespace,backend:o.backend,tls:o.tls,hosts:o.hosts}}),l.push({id:`e-${E}-${c}`,source:E,target:c,label:"route"})});const f=D.slice(0,12),A=N(f.length);f.forEach((o,i)=>{const c=`service-${o.id}`;V.push({id:c,name:o.name,type:"service",x:A[i],y:r[2],data:{kind:"service",namespace:o.namespace,type:o.type,cluster_ip:o.cluster_ip,external_ip:o.external_ip,selector:o.selector}})}),R.length>0&&f.length>0?R.forEach(o=>{const i=`ingress-${o.id}`,c=(o.backend||"").split(":")[0].trim();let p=f.filter(g=>g.name===c);p.length===0&&(p=f.filter(g=>g.namespace===o.namespace)),p.length===0&&(p=[f[0]]),p.forEach(g=>l.push({id:`e-${i}-service-${g.id}`,source:i,target:`service-${g.id}`,label:"→"}))}):f.length>0&&f.forEach(o=>l.push({id:`e-${E}-service-${o.id}`,source:E,target:`service-${o.id}`,label:"expose"}));const T=Y.slice(0,12),H=N(T.length);T.forEach((o,i)=>{const c=`deploy-${o.id}`;V.push({id:c,name:o.name,type:"app",x:H[i],y:r[3],data:{kind:"deployment",namespace:o.namespace,replicas:o.replicas,ready_replicas:o.ready_replicas,available_replicas:o.available_replicas,image:o.image}})}),f.length>0&&T.length>0&&f.forEach(o=>{const i=`service-${o.id}`;let c=[];try{const p=typeof o.selector=="string"?JSON.parse(o.selector||"{}"):o.selector||{},g=Object.entries(p);g.length>0&&(c=T.filter(P=>{let W={};try{W=typeof P.labels=="string"?JSON.parse(P.labels||"{}"):P.labels||{}}catch{}return g.every(([se,G])=>W[se]===G)}))}catch{}c.length===0&&(c=T.filter(p=>p.name===o.name)),c.length===0&&(c=T.filter(p=>p.namespace===o.namespace)),c.length===0&&(c=[T[0]]),c.slice(0,4).forEach(p=>l.push({id:`e-${i}-deploy-${p.id}`,source:i,target:`deploy-${p.id}`,label:"select"}))});const I=x.slice(0,12),J=N(I.length);I.forEach((o,i)=>{const c=`k8snode-${o.id}`;V.push({id:c,name:o.name,type:"server",x:J[i],y:r[4],data:{kind:"node",ip:o.ip,role:o.role,status:o.status,os:o.os,cpu:o.cpu,memory:o.memory,cpu_usage:o.cpu_usage,memory_usage:o.memory_usage,pod_count:o.pod_count}})});const y=I.filter(o=>(o.role||"").toLowerCase()==="worker"),O=y.length>0?y:I;return T.length>0&&O.length>0&&T.forEach(o=>{const i=`deploy-${o.id}`;O.slice(0,3).forEach(c=>l.push({id:`e-${i}-k8snode-${c.id}`,source:i,target:`k8snode-${c.id}`,label:"schedule"}))}),{nodes:V,edges:l}}function Ns(){const{clusterCode:u}=Ge(),h=Ke(),[D,Y]=d.useState([]),[x,V]=d.useState(""),[l,S]=d.useState({nodes:[],edges:[]}),[z,L]=d.useState(!1),[r,N]=d.useState(null),[E,R]=d.useState(""),[B,f]=d.useState("all"),[A,T]=d.useState(null),[H,I]=d.useState({x:0,y:0}),J=d.useRef(null),[y,O]=d.useState(!1),[o,i]=d.useState(!1),[c,p]=d.useState(null),[,g]=d.useState(null),[P,W]=d.useState(!1),[se,G]=d.useState(1),[De,Q]=d.useState(!1),[U,me]=d.useState(null),[w,F]=d.useState({name:"",type:"database",note:""}),ue=d.useCallback(async()=>{try{const n=(await _.getClusters())?.list||[];if(Y(n),!x)if(u){const t=n.find(a=>(a.code||String(a.id))===u);t&&V(String(t.id))}else n.length>0&&V(String(n[0].id))}catch{Y([])}},[u]);d.useEffect(()=>{ue()},[ue]);const xe=d.useCallback(async s=>{try{const t=await _.getTopology(s);if(t?.layout_data){const a=JSON.parse(t.layout_data);if(g(a),a.customNodes?.length>0){const m=Math.max(...a.customNodes.map(k=>{const b=k.id.match(/custom-(\d+)/);return b?parseInt(b[1]):0}));G(m+1)}return a}}catch{}return g(null),null},[]),K=d.useCallback(async()=>{if(x){L(!0);try{const s=C=>Array.isArray(C)?C:C?.list||[],[n,t,a,m]=await Promise.all([_.getNodes(x).catch(()=>[]),_.getServices(x).catch(()=>[]),_.getDeployments(x).catch(()=>[]),_.getIngresses(x).catch(()=>[])]),k=D.find(C=>String(C.id)===x)||{},b=us(k,s(m),s(t),s(a),s(n)),$=await xe(x);$&&($.positions&&(b.nodes=b.nodes.map(C=>{const te=$.positions[C.id];return te?{...C,x:te.x,y:te.y}:C})),$.customNodes&&(b.nodes=[...b.nodes,...$.customNodes]),$.customEdges&&(b.edges=[...b.edges,...$.customEdges])),S(b)}catch{S({nodes:[],edges:[]})}finally{L(!1)}}},[x,D,xe]);d.useEffect(()=>{K()},[K]);const Z=l.nodes.filter(s=>s.name.toLowerCase().includes(E.toLowerCase())&&(B==="all"||s.type===B)),he=new Set(Z.map(s=>s.id)),ge=s=>{const n=J.current;if(!n)return{x:0,y:0};const t=n.createSVGPoint();t.x=s.clientX,t.y=s.clientY;const a=n.getScreenCTM();return a?{x:t.matrixTransform(a.inverse()).x,y:t.matrixTransform(a.inverse()).y}:{x:0,y:0}},Le=(s,n)=>{if(o)return;s.stopPropagation();const t=ge(s);I({x:t.x-n.x,y:t.y-n.y}),T(n.id)},Re=s=>{if(!A)return;const n=ge(s);S(t=>({...t,nodes:t.nodes.map(a=>a.id===A?{...a,x:n.x-H.x,y:n.y-H.y}:a)}))},be=()=>T(null),Ae=s=>{if(!A){if(o){if(!c)p(s.id),j.info(`已选择源节点: ${s.name},请点击目标节点`);else if(c===s.id)j.info("不能连接自身");else{const n={id:`custom-edge-${Date.now()}`,source:c,target:s.id,label:"connect"};S(t=>({...t,edges:[...t.edges,n]})),j.success("连线已添加"),p(null),i(!1)}return}N(s)}},Ie=()=>{me(null),F({name:"",type:"database",note:""}),Q(!0)},ye=s=>{me(s),F({name:s.name,type:s.type,note:s.data?.note||""}),Q(!0)},Oe=()=>{if(!w.name.trim()){j.error("请输入节点名称");return}if(U)S(s=>({...s,nodes:s.nodes.map(n=>n.id===U.id?{...n,name:w.name,type:w.type,data:{...n.data,note:w.note}}:n)})),j.success("节点已更新");else{const n={id:`custom-${se}`,name:w.name,type:w.type,x:we/2+(Math.random()-.5)*100,y:ke/2+(Math.random()-.5)*100,data:{kind:"custom",note:w.note}};S(t=>({...t,nodes:[...t.nodes,n]})),G(t=>t+1),j.success("节点已添加")}Q(!1)},Pe=async s=>{await h({title:"删除节点",description:`确定删除「${s.name}」?相关连线也会一并删除`,variant:"destructive"})&&(S(t=>({nodes:t.nodes.filter(a=>a.id!==s.id),edges:t.edges.filter(a=>a.source!==s.id&&a.target!==s.id)})),N(null),j.success("节点已删除"))},Xe=async s=>{if(!s.id.startsWith("custom-edge")){j.info("Kubernetes 原生关系不可删除");return}await h({title:"删除连线",description:"确定删除此自定义连线?",variant:"destructive"})&&(S(t=>({...t,edges:t.edges.filter(a=>a.id!==s.id)})),j.success("连线已删除"))},Ye=async()=>{if(x){W(!0);try{const s={positions:Object.fromEntries(l.nodes.map(n=>[n.id,{x:n.x,y:n.y}])),customNodes:l.nodes.filter(n=>X(n.id)),customEdges:l.edges.filter(n=>n.id.startsWith("custom-edge"))};await _.saveTopology(x,JSON.stringify(s)),j.success("布局已保存")}catch{j.error("保存失败")}finally{W(!1)}}},ze=async()=>{if(await h({title:"重置布局",description:"将清除已保存的布局并重新自动排列",variant:"destructive"})){try{await _.saveTopology(x,"")}catch{}g(null),O(!1),i(!1),p(null),await K(),j.success("布局已重置")}},Be=l.nodes.length>0?Math.max(...l.nodes.map(s=>s.x))+80:900,We=l.nodes.length>0?Math.max(...l.nodes.map(s=>s.y))+80:700,we=Math.max(Be,900),ke=Math.max(We,700),fe=s=>l.nodes.filter(n=>n.type===s).length,Qe=()=>{if(l.nodes.length===0)return null;const s=[60,180,320,480,640],n=["集群","Ingress","Service","Deployment","Node"];return e.jsxs("svg",{"code-path":"src/components/kubernetes/TopologyView.tsx:291:7",ref:J,width:"100%",height:"100%",viewBox:`0 0 ${we} ${ke}`,className:"bg-slate-950 rounded-lg",preserveAspectRatio:"xMidYMin meet",onMouseMove:Re,onMouseUp:be,onMouseLeave:be,children:[e.jsxs("defs",{"code-path":"src/components/kubernetes/TopologyView.tsx:293:9",children:[e.jsx("pattern",{"code-path":"src/components/kubernetes/TopologyView.tsx:294:11",id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:e.jsx("path",{"code-path":"src/components/kubernetes/TopologyView.tsx:295:13",d:"M 20 0 L 0 0 0 20",fill:"none",stroke:"#1e293b",strokeWidth:"0.5"})}),e.jsx("marker",{"code-path":"src/components/kubernetes/TopologyView.tsx:297:11",id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:"28",refY:"3.5",orient:"auto",children:e.jsx("polygon",{"code-path":"src/components/kubernetes/TopologyView.tsx:298:13",points:"0 0, 10 3.5, 0 7",fill:o?"#f59e0b":"#475569"})})]}),e.jsx("rect",{"code-path":"src/components/kubernetes/TopologyView.tsx:301:9",width:"100%",height:"100%",fill:"url(#grid)"}),n.map((t,a)=>e.jsx("text",{"code-path":"src/components/kubernetes/TopologyView.tsx:303:11",x:14,y:s[a]+4,fill:"#475569",fontSize:"11",className:"font-medium select-none",children:t},t)),l.edges.map(t=>{const a=l.nodes.find(b=>b.id===t.source),m=l.nodes.find(b=>b.id===t.target);if(!a||!m||!he.has(a.id)||!he.has(m.id))return null;const k=t.id.startsWith("custom-edge");return e.jsxs("g",{"code-path":"src/components/kubernetes/TopologyView.tsx:311:13",className:y&&k?"cursor-pointer":"",onClick:()=>{y&&k&&Xe(t)},children:[e.jsx("line",{"code-path":"src/components/kubernetes/TopologyView.tsx:312:15",x1:a.x,y1:a.y,x2:m.x,y2:m.y,stroke:k?"#f59e0b":"#475569",strokeWidth:k?2:1.5,strokeDasharray:k?"6 3":void 0,markerEnd:"url(#arrowhead)",opacity:k?.8:.6}),y&&k&&e.jsx("text",{"code-path":"src/components/kubernetes/TopologyView.tsx:317:17",x:(a.x+m.x)/2,y:(a.y+m.y)/2,fill:"#f59e0b",fontSize:"10",textAnchor:"middle",className:"select-none pointer-events-none",children:"✕ 删除"})]},t.id)}),Z.map(t=>{const a=X(t.id),m=c===t.id;return e.jsxs("g",{"code-path":"src/components/kubernetes/TopologyView.tsx:327:13",transform:`translate(${t.x}, ${t.y})`,className:o?"cursor-crosshair":A===t.id?"cursor-grabbing":"cursor-grab",onMouseDown:k=>Le(k,t),onClick:()=>Ae(t),onDoubleClick:()=>{y&&ye(t)},children:[e.jsx("circle",{"code-path":"src/components/kubernetes/TopologyView.tsx:332:15",r:"28",fill:"#0f172a",stroke:m?"#f59e0b":r?.id===t.id?"#3b82f6":a?"#f59e0b":"#334155",strokeWidth:m||r?.id===t.id?3:2,strokeDasharray:a?"4 2":void 0,className:"transition-all hover:stroke-blue-500"}),e.jsx("foreignObject",{"code-path":"src/components/kubernetes/TopologyView.tsx:337:15",x:"-12",y:"-12",width:"24",height:"24",children:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:338:17",className:`flex items-center justify-center w-full h-full ${ee(t.type).split(" ")[1]}`,children:M(t.type)})}),e.jsx("text",{"code-path":"src/components/kubernetes/TopologyView.tsx:340:15",y:"45",fill:a?"#f59e0b":"#94a3b8",fontSize:"12",textAnchor:"middle",className:"font-medium select-none",children:t.name.length>20?t.name.slice(0,18)+"…":t.name})]},t.id)})]})},Ue=s=>{const n=s.data||{},t=Object.entries(n).filter(([a])=>a!=="kind");return t.length===0?null:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:355:7",className:"grid grid-cols-2 gap-3",children:t.map(([a,m])=>e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:357:11",className:"p-2 rounded-lg bg-slate-800/50",children:[e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:358:13",className:"text-xs text-slate-500 mb-0.5",children:a}),e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:359:13",className:"text-sm text-slate-200 truncate",title:String(m),children:m==null?"—":String(m)})]},a))})};return e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:367:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:369:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:370:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/TopologyView.tsx:371:11",className:"text-2xl font-bold text-slate-100",children:"架构拓扑"}),e.jsxs("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:372:11",className:"text-sm text-slate-500 mt-1",children:["Kubernetes 集群资源拓扑可视化 · 拖拽节点调整布局",y&&e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:374:26",className:"text-amber-400 ml-2",children:"· 编辑模式"}),o&&e.jsxs("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:375:29",className:"text-amber-400 ml-1",children:["· 连线中",c?"(选择目标节点)":"(选择源节点)"]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:378:9",className:"flex items-center gap-2",children:[e.jsxs(ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:379:11",value:x,onValueChange:s=>{V(s),N(null),O(!1)},children:[e.jsx(re,{"code-path":"src/components/kubernetes/TopologyView.tsx:380:13",className:"w-44 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(le,{"code-path":"src/components/kubernetes/TopologyView.tsx:380:97",placeholder:"选择集群"})}),e.jsx(ie,{"code-path":"src/components/kubernetes/TopologyView.tsx:381:13",className:"bg-slate-800 border-slate-700",children:D.map(s=>e.jsx(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:382:36",value:String(s.id),children:s.name},s.id))})]}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:385:11",variant:y?"default":"outline",size:"sm",className:"h-9",onClick:()=>{O(!y),i(!1),p(null)},children:[e.jsx(_e,{"code-path":"src/components/kubernetes/TopologyView.tsx:387:13",className:"h-4 w-4 mr-1"}),y?"退出编辑":"编辑"]}),e.jsx(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:389:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:K,disabled:z,children:z?e.jsx($e,{"code-path":"src/components/kubernetes/TopologyView.tsx:390:24",className:"h-4 w-4 animate-spin"}):e.jsx(cs,{"code-path":"src/components/kubernetes/TopologyView.tsx:390:71",className:"h-4 w-4"})})]})]}),y&&e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:397:9",className:"flex items-center gap-2 p-3 rounded-lg bg-slate-800/50 border border-slate-700",children:[e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:398:11",size:"sm",variant:"outline",className:"border-slate-600 text-slate-200",onClick:Ie,children:[e.jsx(rs,{"code-path":"src/components/kubernetes/TopologyView.tsx:399:13",className:"h-4 w-4 mr-1"}),"添加节点"]}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:401:11",size:"sm",variant:o?"default":"outline",className:o?"bg-amber-600 hover:bg-amber-700":"border-slate-600 text-slate-200",onClick:()=>{i(!o),p(null)},children:[e.jsx(Me,{"code-path":"src/components/kubernetes/TopologyView.tsx:403:13",className:"h-4 w-4 mr-1"}),o?"取消连线":"添加连线"]}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:405:11",className:"h-5 w-px bg-slate-600"}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:406:11",size:"sm",variant:"outline",className:"border-emerald-600/30 text-emerald-400 hover:bg-emerald-600/10",onClick:Ye,disabled:P,children:[e.jsx(ls,{"code-path":"src/components/kubernetes/TopologyView.tsx:407:13",className:"h-4 w-4 mr-1"}),P?"保存中...":"保存布局"]}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:409:11",size:"sm",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:ze,children:[e.jsx(is,{"code-path":"src/components/kubernetes/TopologyView.tsx:410:13",className:"h-4 w-4 mr-1"}),"重置布局"]}),e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:412:11",className:"text-xs text-slate-500 ml-auto",children:"双击节点编辑 · 点击虚线删除 · 拖拽调整位置"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:417:7",className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[{label:"总节点数",value:l.nodes.length,icon:e.jsx(pe,{"code-path":"src/components/kubernetes/TopologyView.tsx:419:64",className:"h-5 w-5"}),color:"text-blue-400",bg:"bg-blue-500/10"},{label:"连接数",value:l.edges.length,icon:e.jsx(Me,{"code-path":"src/components/kubernetes/TopologyView.tsx:420:63",className:"h-5 w-5"}),color:"text-purple-400",bg:"bg-purple-500/10"},{label:"Service",value:fe("service"),icon:M("service"),color:"text-emerald-400",bg:"bg-emerald-500/10"},{label:"Deployment",value:fe("app"),icon:M("app"),color:"text-rose-400",bg:"bg-rose-500/10"},{label:"自定义",value:l.nodes.filter(s=>X(s.id)).length,icon:M("custom"),color:"text-amber-400",bg:"bg-amber-500/10"}].map(s=>e.jsx(oe,{"code-path":"src/components/kubernetes/TopologyView.tsx:425:11",className:"bg-slate-900 border-slate-800",children:e.jsx(ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:426:13",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:427:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:428:17",children:[e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:429:19",className:"text-sm text-slate-500",children:s.label}),e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:430:19",className:`text-2xl font-bold ${s.color}`,children:s.value})]}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:432:17",className:`p-3 rounded-lg ${s.bg} ${s.color}`,children:s.icon})]})})},s.label))}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:440:7",className:"flex items-center gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:441:9",className:"relative w-48",children:[e.jsx(ds,{"code-path":"src/components/kubernetes/TopologyView.tsx:442:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(Se,{"code-path":"src/components/kubernetes/TopologyView.tsx:443:11",placeholder:"搜索节点...",value:E,onChange:s=>R(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs(ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:445:9",value:B,onValueChange:f,children:[e.jsx(re,{"code-path":"src/components/kubernetes/TopologyView.tsx:446:11",className:"w-36 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(le,{"code-path":"src/components/kubernetes/TopologyView.tsx:446:95",placeholder:"节点类型"})}),e.jsxs(ie,{"code-path":"src/components/kubernetes/TopologyView.tsx:447:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:448:13",value:"all",children:"全部类型"}),Object.entries(de).map(([s,n])=>e.jsx(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:449:63",value:s,children:n},s))]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:455:7",className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:456:9",className:"lg:col-span-3",children:e.jsx(oe,{"code-path":"src/components/kubernetes/TopologyView.tsx:457:11",className:"bg-slate-900 border-slate-800",children:e.jsx(ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:458:13",className:"p-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:459:15",className:`h-[600px] overflow-auto ${o?"ring-2 ring-amber-500/30 rounded-lg":""}`,children:z?e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:461:19",className:"flex items-center justify-center h-full",children:e.jsx($e,{"code-path":"src/components/kubernetes/TopologyView.tsx:461:76",className:"h-8 w-8 animate-spin text-slate-600"})}):l.nodes.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:463:19",className:"flex flex-col items-center justify-center h-full text-slate-600",children:[e.jsx(pe,{"code-path":"src/components/kubernetes/TopologyView.tsx:464:21",className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:465:21",className:"text-sm",children:x?"该集群暂无拓扑数据":"请选择集群查看拓扑"})]}):Qe()})})})}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:472:9",children:e.jsxs(oe,{"code-path":"src/components/kubernetes/TopologyView.tsx:473:11",className:"bg-slate-900 border-slate-800",children:[e.jsxs(Fe,{"code-path":"src/components/kubernetes/TopologyView.tsx:474:13",className:"pb-2",children:[e.jsx(He,{"code-path":"src/components/kubernetes/TopologyView.tsx:475:15",className:"text-base text-slate-100",children:"节点列表"}),e.jsx(Je,{"code-path":"src/components/kubernetes/TopologyView.tsx:476:15",className:"text-slate-500",children:"点击节点查看详情"})]}),e.jsx(ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:478:13",children:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:479:15",className:"space-y-2 max-h-[520px] overflow-auto",children:Z.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:481:19",className:"text-sm text-slate-600 text-center py-8",children:"暂无节点"}):Z.map(s=>e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:484:21",className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-colors ${r?.id===s.id?"bg-blue-500/10 border border-blue-500/30":"hover:bg-slate-800/50"}`,onClick:()=>N(s),children:[e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:485:23",className:`p-2 rounded-lg ${ee(s.type)}`,children:M(s.type)}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:486:23",className:"flex-1 min-w-0",children:[e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:487:25",className:"text-sm font-medium text-slate-200 truncate",children:s.name}),e.jsxs("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:488:25",className:"text-xs text-slate-500",children:[de[s.type]||s.type,X(s.id)?" · 自定义":""]})]})]},s.id))})})]})})]}),e.jsx(Te,{"code-path":"src/components/kubernetes/TopologyView.tsx:500:7",open:!!r,onOpenChange:()=>N(null),children:e.jsxs(je,{"code-path":"src/components/kubernetes/TopologyView.tsx:501:9",className:"bg-slate-900 border-slate-800 max-w-lg",children:[e.jsxs(Ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:502:11",children:[e.jsxs(Ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:503:13",className:"text-slate-100 flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:504:15",className:`p-2 rounded-lg ${ee(r?.type||"server")}`,children:r&&M(r.type)}),r?.name,r&&X(r.id)&&e.jsx(Ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:506:65",variant:"outline",className:"border-amber-500/30 text-amber-400 text-xs",children:"自定义"})]}),e.jsxs(ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:508:13",className:"text-slate-500",children:["类型: ",de[r?.type||""]||r?.type]})]}),r&&e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:511:13",className:"space-y-4",children:[Ue(r),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:513:15",children:[e.jsx("h4",{"code-path":"src/components/kubernetes/TopologyView.tsx:514:17",className:"text-sm font-medium text-slate-300 mb-2",children:"关联连接"}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:515:17",className:"space-y-2",children:[l.edges.filter(s=>s.source===r.id||s.target===r.id).map(s=>{const n=s.source===r.id,t=l.nodes.find(a=>a.id===(n?s.target:s.source));return t?e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:521:23",className:"flex items-center gap-2 p-2 rounded-lg bg-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:522:25",className:"text-sm text-slate-400",children:n?"→":"←"}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:523:25",className:`p-1 rounded ${ee(t.type)}`,children:M(t.type,"h-4 w-4")}),e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:524:25",className:"text-sm text-slate-300",children:t.name}),e.jsx(Ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:525:25",variant:"outline",className:"ml-auto border-slate-700 text-slate-400 text-xs",children:s.label})]},s.id):null}),l.edges.filter(s=>s.source===r.id||s.target===r.id).length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:529:127",className:"text-xs text-slate-600",children:"无关联连接"})]})]}),y&&r&&e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:534:17",className:"flex gap-2 pt-2 border-t border-slate-700",children:[e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:535:19",size:"sm",variant:"outline",className:"border-slate-600 text-slate-200",onClick:()=>ye(r),children:[e.jsx(_e,{"code-path":"src/components/kubernetes/TopologyView.tsx:536:21",className:"h-3.5 w-3.5 mr-1"}),"编辑"]}),X(r.id)&&e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:539:21",size:"sm",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>Pe(r),children:[e.jsx(ps,{"code-path":"src/components/kubernetes/TopologyView.tsx:540:23",className:"h-3.5 w-3.5 mr-1"}),"删除"]})]})]})]})}),e.jsx(Te,{"code-path":"src/components/kubernetes/TopologyView.tsx:551:7",open:De,onOpenChange:Q,children:e.jsxs(je,{"code-path":"src/components/kubernetes/TopologyView.tsx:552:9",className:"bg-slate-900 border-slate-800 max-w-md",children:[e.jsxs(Ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:553:11",children:[e.jsx(Ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:554:13",className:"text-slate-100",children:U?"编辑节点":"添加自定义节点"}),e.jsx(ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:555:13",className:"text-slate-500",children:U?"修改节点属性":"添加数据库、外部服务等非 Kubernetes 资源节点"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:557:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:558:13",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/TopologyView.tsx:559:15",className:"text-slate-300",children:"名称"}),e.jsx(Se,{"code-path":"src/components/kubernetes/TopologyView.tsx:560:15",value:w.name,onChange:s=>F({...w,name:s.target.value}),placeholder:"如 MySQL 主库、Redis 集群",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:563:13",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/TopologyView.tsx:564:15",className:"text-slate-300",children:"类型"}),e.jsxs(ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:565:15",value:w.type,onValueChange:s=>F({...w,type:s}),children:[e.jsx(re,{"code-path":"src/components/kubernetes/TopologyView.tsx:566:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(le,{"code-path":"src/components/kubernetes/TopologyView.tsx:566:92"})}),e.jsx(ie,{"code-path":"src/components/kubernetes/TopologyView.tsx:567:17",className:"bg-slate-800 border-slate-700",children:ms.map(s=>e.jsxs(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:568:49",value:s.value,children:[s.label," — ",s.desc]},s.value))})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:572:13",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/TopologyView.tsx:573:15",className:"text-slate-300",children:"备注"}),e.jsx(qe,{"code-path":"src/components/kubernetes/TopologyView.tsx:574:15",value:w.note,onChange:s=>F({...w,note:s.target.value}),placeholder:"连接信息、用途说明等",rows:2,className:"bg-slate-800/50 border-slate-700 text-slate-200 resize-none"})]})]}),e.jsxs(Ze,{"code-path":"src/components/kubernetes/TopologyView.tsx:578:11",children:[e.jsx(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:579:13",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>Q(!1),children:"取消"}),e.jsx(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:580:13",onClick:Oe,children:U?"保存":"添加"})]})]})})]})}export{Ns as TopologyView}; +import{j as e,r as d}from"./vendor-codemirror-B1SGo4xl.js";import{C as oe,a as ne,b as Fe,c as He,d as Je}from"./card-BHSBTtub.js";import{g as Ge,f as Ke,B as v,D as Te,a as je,b as Ve,c as Ne,d as ve,e as Ze,t as j}from"./index-Bp-M7P_8.js";import{I as Se}from"./input-Bnlm--la.js";import{L as ae}from"./label-NkONM5Mp.js";import{B as Ce}from"./badge-B00SZHvE.js";import{S as ce,a as re,b as le,c as ie,d as q}from"./select-DbhcBWnH.js";import{T as qe}from"./textarea-BvOVhaCD.js";import{k as _}from"./index-BkulU9RM.js";import{h as Ee,ad as es,a4 as ss,D as ts,N as os,B as ns,i as pe,G as as,d as _e,L as $e,R as cs,P as rs,ai as Me,$ as ls,n as is,S as ds,T as ps}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";const de={cluster:"集群",loadbalancer:"Ingress",service:"Service",app:"Deployment",server:"Node",database:"数据库",external:"外部服务",custom:"自定义"},ms=[{value:"database",label:"数据库",desc:"MySQL / Redis / PostgreSQL 等"},{value:"external",label:"外部服务",desc:"外部 API / CDN / DNS 等"},{value:"custom",label:"自定义",desc:"其他自定义节点"}],X=u=>u.startsWith("custom-");function M(u,h="h-5 w-5"){switch(u){case"server":return e.jsx(Ee,{"code-path":"src/components/kubernetes/topology-helpers.tsx:31:27",className:h});case"loadbalancer":return e.jsx(as,{"code-path":"src/components/kubernetes/topology-helpers.tsx:32:33",className:h});case"cluster":return e.jsx(pe,{"code-path":"src/components/kubernetes/topology-helpers.tsx:33:28",className:h});case"app":return e.jsx(ns,{"code-path":"src/components/kubernetes/topology-helpers.tsx:34:24",className:h});case"service":return e.jsx(os,{"code-path":"src/components/kubernetes/topology-helpers.tsx:35:28",className:h});case"database":return e.jsx(ts,{"code-path":"src/components/kubernetes/topology-helpers.tsx:36:29",className:h});case"external":return e.jsx(ss,{"code-path":"src/components/kubernetes/topology-helpers.tsx:37:29",className:h});case"custom":return e.jsx(es,{"code-path":"src/components/kubernetes/topology-helpers.tsx:38:27",className:h});default:return e.jsx(Ee,{"code-path":"src/components/kubernetes/topology-helpers.tsx:39:21",className:h})}}function ee(u){switch(u){case"server":return"bg-blue-500/20 text-blue-400 border-blue-500/30";case"loadbalancer":return"bg-purple-500/20 text-purple-400 border-purple-500/30";case"cluster":return"bg-cyan-500/20 text-cyan-400 border-cyan-500/30";case"app":return"bg-rose-500/20 text-rose-400 border-rose-500/30";case"service":return"bg-emerald-500/20 text-emerald-400 border-emerald-500/30";case"database":return"bg-amber-500/20 text-amber-400 border-amber-500/30";case"external":return"bg-orange-500/20 text-orange-400 border-orange-500/30";case"custom":return"bg-slate-500/20 text-slate-400 border-slate-500/30";default:return"bg-slate-500/20 text-slate-400 border-slate-500/30"}}function us(u,h,D,Y,x){const V=[],l=[],z=Math.max(1,h.length,D.length,Y.length,x.length),L=Math.max(900,Math.min(z*130,2400)),r=[60,180,320,480,640],N=o=>{const i=Math.min(o,12);if(i===0)return[];if(i===1)return[L/2];const c=L/(i+1);return Array.from({length:i},(p,g)=>c*(g+1))},E=`cluster-${u.id}`;V.push({id:E,name:u.name||"集群",type:"cluster",x:L/2,y:r[0],data:{kind:"cluster",version:u.version,status:u.status,api_server:u.api_server,node_count:u.node_count,pod_count:u.pod_count}});const R=h.slice(0,12),B=N(R.length);R.forEach((o,i)=>{const c=`ingress-${o.id}`;V.push({id:c,name:o.name,type:"loadbalancer",x:B[i],y:r[1],data:{kind:"ingress",namespace:o.namespace,backend:o.backend,tls:o.tls,hosts:o.hosts}}),l.push({id:`e-${E}-${c}`,source:E,target:c,label:"route"})});const f=D.slice(0,12),A=N(f.length);f.forEach((o,i)=>{const c=`service-${o.id}`;V.push({id:c,name:o.name,type:"service",x:A[i],y:r[2],data:{kind:"service",namespace:o.namespace,type:o.type,cluster_ip:o.cluster_ip,external_ip:o.external_ip,selector:o.selector}})}),R.length>0&&f.length>0?R.forEach(o=>{const i=`ingress-${o.id}`,c=(o.backend||"").split(":")[0].trim();let p=f.filter(g=>g.name===c);p.length===0&&(p=f.filter(g=>g.namespace===o.namespace)),p.length===0&&(p=[f[0]]),p.forEach(g=>l.push({id:`e-${i}-service-${g.id}`,source:i,target:`service-${g.id}`,label:"→"}))}):f.length>0&&f.forEach(o=>l.push({id:`e-${E}-service-${o.id}`,source:E,target:`service-${o.id}`,label:"expose"}));const T=Y.slice(0,12),H=N(T.length);T.forEach((o,i)=>{const c=`deploy-${o.id}`;V.push({id:c,name:o.name,type:"app",x:H[i],y:r[3],data:{kind:"deployment",namespace:o.namespace,replicas:o.replicas,ready_replicas:o.ready_replicas,available_replicas:o.available_replicas,image:o.image}})}),f.length>0&&T.length>0&&f.forEach(o=>{const i=`service-${o.id}`;let c=[];try{const p=typeof o.selector=="string"?JSON.parse(o.selector||"{}"):o.selector||{},g=Object.entries(p);g.length>0&&(c=T.filter(P=>{let W={};try{W=typeof P.labels=="string"?JSON.parse(P.labels||"{}"):P.labels||{}}catch{}return g.every(([se,G])=>W[se]===G)}))}catch{}c.length===0&&(c=T.filter(p=>p.name===o.name)),c.length===0&&(c=T.filter(p=>p.namespace===o.namespace)),c.length===0&&(c=[T[0]]),c.slice(0,4).forEach(p=>l.push({id:`e-${i}-deploy-${p.id}`,source:i,target:`deploy-${p.id}`,label:"select"}))});const I=x.slice(0,12),J=N(I.length);I.forEach((o,i)=>{const c=`k8snode-${o.id}`;V.push({id:c,name:o.name,type:"server",x:J[i],y:r[4],data:{kind:"node",ip:o.ip,role:o.role,status:o.status,os:o.os,cpu:o.cpu,memory:o.memory,cpu_usage:o.cpu_usage,memory_usage:o.memory_usage,pod_count:o.pod_count}})});const y=I.filter(o=>(o.role||"").toLowerCase()==="worker"),O=y.length>0?y:I;return T.length>0&&O.length>0&&T.forEach(o=>{const i=`deploy-${o.id}`;O.slice(0,3).forEach(c=>l.push({id:`e-${i}-k8snode-${c.id}`,source:i,target:`k8snode-${c.id}`,label:"schedule"}))}),{nodes:V,edges:l}}function Ns(){const{clusterCode:u}=Ge(),h=Ke(),[D,Y]=d.useState([]),[x,V]=d.useState(""),[l,S]=d.useState({nodes:[],edges:[]}),[z,L]=d.useState(!1),[r,N]=d.useState(null),[E,R]=d.useState(""),[B,f]=d.useState("all"),[A,T]=d.useState(null),[H,I]=d.useState({x:0,y:0}),J=d.useRef(null),[y,O]=d.useState(!1),[o,i]=d.useState(!1),[c,p]=d.useState(null),[,g]=d.useState(null),[P,W]=d.useState(!1),[se,G]=d.useState(1),[De,Q]=d.useState(!1),[U,me]=d.useState(null),[w,F]=d.useState({name:"",type:"database",note:""}),ue=d.useCallback(async()=>{try{const n=(await _.getClusters())?.list||[];if(Y(n),!x)if(u){const t=n.find(a=>(a.code||String(a.id))===u);t&&V(String(t.id))}else n.length>0&&V(String(n[0].id))}catch{Y([])}},[u]);d.useEffect(()=>{ue()},[ue]);const xe=d.useCallback(async s=>{try{const t=await _.getTopology(s);if(t?.layout_data){const a=JSON.parse(t.layout_data);if(g(a),a.customNodes?.length>0){const m=Math.max(...a.customNodes.map(k=>{const b=k.id.match(/custom-(\d+)/);return b?parseInt(b[1]):0}));G(m+1)}return a}}catch{}return g(null),null},[]),K=d.useCallback(async()=>{if(x){L(!0);try{const s=C=>Array.isArray(C)?C:C?.list||[],[n,t,a,m]=await Promise.all([_.getNodes(x).catch(()=>[]),_.getServices(x).catch(()=>[]),_.getDeployments(x).catch(()=>[]),_.getIngresses(x).catch(()=>[])]),k=D.find(C=>String(C.id)===x)||{},b=us(k,s(m),s(t),s(a),s(n)),$=await xe(x);$&&($.positions&&(b.nodes=b.nodes.map(C=>{const te=$.positions[C.id];return te?{...C,x:te.x,y:te.y}:C})),$.customNodes&&(b.nodes=[...b.nodes,...$.customNodes]),$.customEdges&&(b.edges=[...b.edges,...$.customEdges])),S(b)}catch{S({nodes:[],edges:[]})}finally{L(!1)}}},[x,D,xe]);d.useEffect(()=>{K()},[K]);const Z=l.nodes.filter(s=>s.name.toLowerCase().includes(E.toLowerCase())&&(B==="all"||s.type===B)),he=new Set(Z.map(s=>s.id)),ge=s=>{const n=J.current;if(!n)return{x:0,y:0};const t=n.createSVGPoint();t.x=s.clientX,t.y=s.clientY;const a=n.getScreenCTM();return a?{x:t.matrixTransform(a.inverse()).x,y:t.matrixTransform(a.inverse()).y}:{x:0,y:0}},Le=(s,n)=>{if(o)return;s.stopPropagation();const t=ge(s);I({x:t.x-n.x,y:t.y-n.y}),T(n.id)},Re=s=>{if(!A)return;const n=ge(s);S(t=>({...t,nodes:t.nodes.map(a=>a.id===A?{...a,x:n.x-H.x,y:n.y-H.y}:a)}))},be=()=>T(null),Ae=s=>{if(!A){if(o){if(!c)p(s.id),j.info(`已选择源节点: ${s.name},请点击目标节点`);else if(c===s.id)j.info("不能连接自身");else{const n={id:`custom-edge-${Date.now()}`,source:c,target:s.id,label:"connect"};S(t=>({...t,edges:[...t.edges,n]})),j.success("连线已添加"),p(null),i(!1)}return}N(s)}},Ie=()=>{me(null),F({name:"",type:"database",note:""}),Q(!0)},ye=s=>{me(s),F({name:s.name,type:s.type,note:s.data?.note||""}),Q(!0)},Oe=()=>{if(!w.name.trim()){j.error("请输入节点名称");return}if(U)S(s=>({...s,nodes:s.nodes.map(n=>n.id===U.id?{...n,name:w.name,type:w.type,data:{...n.data,note:w.note}}:n)})),j.success("节点已更新");else{const n={id:`custom-${se}`,name:w.name,type:w.type,x:we/2+(Math.random()-.5)*100,y:ke/2+(Math.random()-.5)*100,data:{kind:"custom",note:w.note}};S(t=>({...t,nodes:[...t.nodes,n]})),G(t=>t+1),j.success("节点已添加")}Q(!1)},Pe=async s=>{await h({title:"删除节点",description:`确定删除「${s.name}」?相关连线也会一并删除`,variant:"destructive"})&&(S(t=>({nodes:t.nodes.filter(a=>a.id!==s.id),edges:t.edges.filter(a=>a.source!==s.id&&a.target!==s.id)})),N(null),j.success("节点已删除"))},Xe=async s=>{if(!s.id.startsWith("custom-edge")){j.info("Kubernetes 原生关系不可删除");return}await h({title:"删除连线",description:"确定删除此自定义连线?",variant:"destructive"})&&(S(t=>({...t,edges:t.edges.filter(a=>a.id!==s.id)})),j.success("连线已删除"))},Ye=async()=>{if(x){W(!0);try{const s={positions:Object.fromEntries(l.nodes.map(n=>[n.id,{x:n.x,y:n.y}])),customNodes:l.nodes.filter(n=>X(n.id)),customEdges:l.edges.filter(n=>n.id.startsWith("custom-edge"))};await _.saveTopology(x,JSON.stringify(s)),j.success("布局已保存")}catch{j.error("保存失败")}finally{W(!1)}}},ze=async()=>{if(await h({title:"重置布局",description:"将清除已保存的布局并重新自动排列",variant:"destructive"})){try{await _.saveTopology(x,"")}catch{}g(null),O(!1),i(!1),p(null),await K(),j.success("布局已重置")}},Be=l.nodes.length>0?Math.max(...l.nodes.map(s=>s.x))+80:900,We=l.nodes.length>0?Math.max(...l.nodes.map(s=>s.y))+80:700,we=Math.max(Be,900),ke=Math.max(We,700),fe=s=>l.nodes.filter(n=>n.type===s).length,Qe=()=>{if(l.nodes.length===0)return null;const s=[60,180,320,480,640],n=["集群","Ingress","Service","Deployment","Node"];return e.jsxs("svg",{"code-path":"src/components/kubernetes/TopologyView.tsx:291:7",ref:J,width:"100%",height:"100%",viewBox:`0 0 ${we} ${ke}`,className:"bg-slate-950 rounded-lg",preserveAspectRatio:"xMidYMin meet",onMouseMove:Re,onMouseUp:be,onMouseLeave:be,children:[e.jsxs("defs",{"code-path":"src/components/kubernetes/TopologyView.tsx:293:9",children:[e.jsx("pattern",{"code-path":"src/components/kubernetes/TopologyView.tsx:294:11",id:"grid",width:"20",height:"20",patternUnits:"userSpaceOnUse",children:e.jsx("path",{"code-path":"src/components/kubernetes/TopologyView.tsx:295:13",d:"M 20 0 L 0 0 0 20",fill:"none",stroke:"#1e293b",strokeWidth:"0.5"})}),e.jsx("marker",{"code-path":"src/components/kubernetes/TopologyView.tsx:297:11",id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:"28",refY:"3.5",orient:"auto",children:e.jsx("polygon",{"code-path":"src/components/kubernetes/TopologyView.tsx:298:13",points:"0 0, 10 3.5, 0 7",fill:o?"#f59e0b":"#475569"})})]}),e.jsx("rect",{"code-path":"src/components/kubernetes/TopologyView.tsx:301:9",width:"100%",height:"100%",fill:"url(#grid)"}),n.map((t,a)=>e.jsx("text",{"code-path":"src/components/kubernetes/TopologyView.tsx:303:11",x:14,y:s[a]+4,fill:"#475569",fontSize:"11",className:"font-medium select-none",children:t},t)),l.edges.map(t=>{const a=l.nodes.find(b=>b.id===t.source),m=l.nodes.find(b=>b.id===t.target);if(!a||!m||!he.has(a.id)||!he.has(m.id))return null;const k=t.id.startsWith("custom-edge");return e.jsxs("g",{"code-path":"src/components/kubernetes/TopologyView.tsx:311:13",className:y&&k?"cursor-pointer":"",onClick:()=>{y&&k&&Xe(t)},children:[e.jsx("line",{"code-path":"src/components/kubernetes/TopologyView.tsx:312:15",x1:a.x,y1:a.y,x2:m.x,y2:m.y,stroke:k?"#f59e0b":"#475569",strokeWidth:k?2:1.5,strokeDasharray:k?"6 3":void 0,markerEnd:"url(#arrowhead)",opacity:k?.8:.6}),y&&k&&e.jsx("text",{"code-path":"src/components/kubernetes/TopologyView.tsx:317:17",x:(a.x+m.x)/2,y:(a.y+m.y)/2,fill:"#f59e0b",fontSize:"10",textAnchor:"middle",className:"select-none pointer-events-none",children:"✕ 删除"})]},t.id)}),Z.map(t=>{const a=X(t.id),m=c===t.id;return e.jsxs("g",{"code-path":"src/components/kubernetes/TopologyView.tsx:327:13",transform:`translate(${t.x}, ${t.y})`,className:o?"cursor-crosshair":A===t.id?"cursor-grabbing":"cursor-grab",onMouseDown:k=>Le(k,t),onClick:()=>Ae(t),onDoubleClick:()=>{y&&ye(t)},children:[e.jsx("circle",{"code-path":"src/components/kubernetes/TopologyView.tsx:332:15",r:"28",fill:"#0f172a",stroke:m?"#f59e0b":r?.id===t.id?"#3b82f6":a?"#f59e0b":"#334155",strokeWidth:m||r?.id===t.id?3:2,strokeDasharray:a?"4 2":void 0,className:"transition-all hover:stroke-blue-500"}),e.jsx("foreignObject",{"code-path":"src/components/kubernetes/TopologyView.tsx:337:15",x:"-12",y:"-12",width:"24",height:"24",children:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:338:17",className:`flex items-center justify-center w-full h-full ${ee(t.type).split(" ")[1]}`,children:M(t.type)})}),e.jsx("text",{"code-path":"src/components/kubernetes/TopologyView.tsx:340:15",y:"45",fill:a?"#f59e0b":"#94a3b8",fontSize:"12",textAnchor:"middle",className:"font-medium select-none",children:t.name.length>20?t.name.slice(0,18)+"…":t.name})]},t.id)})]})},Ue=s=>{const n=s.data||{},t=Object.entries(n).filter(([a])=>a!=="kind");return t.length===0?null:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:355:7",className:"grid grid-cols-2 gap-3",children:t.map(([a,m])=>e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:357:11",className:"p-2 rounded-lg bg-slate-800/50",children:[e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:358:13",className:"text-xs text-slate-500 mb-0.5",children:a}),e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:359:13",className:"text-sm text-slate-200 truncate",title:String(m),children:m==null?"—":String(m)})]},a))})};return e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:367:5",className:"space-y-6",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:369:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:370:9",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/TopologyView.tsx:371:11",className:"text-2xl font-bold text-slate-100",children:"架构拓扑"}),e.jsxs("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:372:11",className:"text-sm text-slate-500 mt-1",children:["Kubernetes 集群资源拓扑可视化 · 拖拽节点调整布局",y&&e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:374:26",className:"text-amber-400 ml-2",children:"· 编辑模式"}),o&&e.jsxs("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:375:29",className:"text-amber-400 ml-1",children:["· 连线中",c?"(选择目标节点)":"(选择源节点)"]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:378:9",className:"flex items-center gap-2",children:[e.jsxs(ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:379:11",value:x,onValueChange:s=>{V(s),N(null),O(!1)},children:[e.jsx(re,{"code-path":"src/components/kubernetes/TopologyView.tsx:380:13",className:"w-44 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(le,{"code-path":"src/components/kubernetes/TopologyView.tsx:380:97",placeholder:"选择集群"})}),e.jsx(ie,{"code-path":"src/components/kubernetes/TopologyView.tsx:381:13",className:"bg-slate-800 border-slate-700",children:D.map(s=>e.jsx(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:382:36",value:String(s.id),children:s.name},s.id))})]}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:385:11",variant:y?"default":"outline",size:"sm",className:"h-9",onClick:()=>{O(!y),i(!1),p(null)},children:[e.jsx(_e,{"code-path":"src/components/kubernetes/TopologyView.tsx:387:13",className:"h-4 w-4 mr-1"}),y?"退出编辑":"编辑"]}),e.jsx(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:389:11",variant:"outline",size:"icon",className:"h-9 w-9 border-slate-700 text-slate-400",onClick:K,disabled:z,children:z?e.jsx($e,{"code-path":"src/components/kubernetes/TopologyView.tsx:390:24",className:"h-4 w-4 animate-spin"}):e.jsx(cs,{"code-path":"src/components/kubernetes/TopologyView.tsx:390:71",className:"h-4 w-4"})})]})]}),y&&e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:397:9",className:"flex items-center gap-2 p-3 rounded-lg bg-slate-800/50 border border-slate-700",children:[e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:398:11",size:"sm",variant:"outline",className:"border-slate-600 text-slate-200",onClick:Ie,children:[e.jsx(rs,{"code-path":"src/components/kubernetes/TopologyView.tsx:399:13",className:"h-4 w-4 mr-1"}),"添加节点"]}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:401:11",size:"sm",variant:o?"default":"outline",className:o?"bg-amber-600 hover:bg-amber-700":"border-slate-600 text-slate-200",onClick:()=>{i(!o),p(null)},children:[e.jsx(Me,{"code-path":"src/components/kubernetes/TopologyView.tsx:403:13",className:"h-4 w-4 mr-1"}),o?"取消连线":"添加连线"]}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:405:11",className:"h-5 w-px bg-slate-600"}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:406:11",size:"sm",variant:"outline",className:"border-emerald-600/30 text-emerald-400 hover:bg-emerald-600/10",onClick:Ye,disabled:P,children:[e.jsx(ls,{"code-path":"src/components/kubernetes/TopologyView.tsx:407:13",className:"h-4 w-4 mr-1"}),P?"保存中...":"保存布局"]}),e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:409:11",size:"sm",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:ze,children:[e.jsx(is,{"code-path":"src/components/kubernetes/TopologyView.tsx:410:13",className:"h-4 w-4 mr-1"}),"重置布局"]}),e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:412:11",className:"text-xs text-slate-500 ml-auto",children:"双击节点编辑 · 点击虚线删除 · 拖拽调整位置"})]}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:417:7",className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[{label:"总节点数",value:l.nodes.length,icon:e.jsx(pe,{"code-path":"src/components/kubernetes/TopologyView.tsx:419:64",className:"h-5 w-5"}),color:"text-blue-400",bg:"bg-blue-500/10"},{label:"连接数",value:l.edges.length,icon:e.jsx(Me,{"code-path":"src/components/kubernetes/TopologyView.tsx:420:63",className:"h-5 w-5"}),color:"text-purple-400",bg:"bg-purple-500/10"},{label:"Service",value:fe("service"),icon:M("service"),color:"text-emerald-400",bg:"bg-emerald-500/10"},{label:"Deployment",value:fe("app"),icon:M("app"),color:"text-rose-400",bg:"bg-rose-500/10"},{label:"自定义",value:l.nodes.filter(s=>X(s.id)).length,icon:M("custom"),color:"text-amber-400",bg:"bg-amber-500/10"}].map(s=>e.jsx(oe,{"code-path":"src/components/kubernetes/TopologyView.tsx:425:11",className:"bg-slate-900 border-slate-800",children:e.jsx(ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:426:13",className:"p-4",children:e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:427:15",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:428:17",children:[e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:429:19",className:"text-sm text-slate-500",children:s.label}),e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:430:19",className:`text-2xl font-bold ${s.color}`,children:s.value})]}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:432:17",className:`p-3 rounded-lg ${s.bg} ${s.color}`,children:s.icon})]})})},s.label))}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:440:7",className:"flex items-center gap-3",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:441:9",className:"relative w-48",children:[e.jsx(ds,{"code-path":"src/components/kubernetes/TopologyView.tsx:442:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(Se,{"code-path":"src/components/kubernetes/TopologyView.tsx:443:11",placeholder:"搜索节点...",value:E,onChange:s=>R(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs(ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:445:9",value:B,onValueChange:f,children:[e.jsx(re,{"code-path":"src/components/kubernetes/TopologyView.tsx:446:11",className:"w-36 h-9 bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(le,{"code-path":"src/components/kubernetes/TopologyView.tsx:446:95",placeholder:"节点类型"})}),e.jsxs(ie,{"code-path":"src/components/kubernetes/TopologyView.tsx:447:11",className:"bg-slate-800 border-slate-700",children:[e.jsx(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:448:13",value:"all",children:"全部类型"}),Object.entries(de).map(([s,n])=>e.jsx(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:449:63",value:s,children:n},s))]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:455:7",className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:456:9",className:"lg:col-span-3",children:e.jsx(oe,{"code-path":"src/components/kubernetes/TopologyView.tsx:457:11",className:"bg-slate-900 border-slate-800",children:e.jsx(ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:458:13",className:"p-4",children:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:459:15",className:`h-[600px] overflow-auto ${o?"ring-2 ring-amber-500/30 rounded-lg":""}`,children:z?e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:461:19",className:"flex items-center justify-center h-full",children:e.jsx($e,{"code-path":"src/components/kubernetes/TopologyView.tsx:461:76",className:"h-8 w-8 animate-spin text-slate-600"})}):l.nodes.length===0?e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:463:19",className:"flex flex-col items-center justify-center h-full text-slate-600",children:[e.jsx(pe,{"code-path":"src/components/kubernetes/TopologyView.tsx:464:21",className:"h-12 w-12 mb-3 opacity-50"}),e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:465:21",className:"text-sm",children:x?"该集群暂无拓扑数据":"请选择集群查看拓扑"})]}):Qe()})})})}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:472:9",children:e.jsxs(oe,{"code-path":"src/components/kubernetes/TopologyView.tsx:473:11",className:"bg-slate-900 border-slate-800",children:[e.jsxs(Fe,{"code-path":"src/components/kubernetes/TopologyView.tsx:474:13",className:"pb-2",children:[e.jsx(He,{"code-path":"src/components/kubernetes/TopologyView.tsx:475:15",className:"text-base text-slate-100",children:"节点列表"}),e.jsx(Je,{"code-path":"src/components/kubernetes/TopologyView.tsx:476:15",className:"text-slate-500",children:"点击节点查看详情"})]}),e.jsx(ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:478:13",children:e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:479:15",className:"space-y-2 max-h-[520px] overflow-auto",children:Z.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:481:19",className:"text-sm text-slate-600 text-center py-8",children:"暂无节点"}):Z.map(s=>e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:484:21",className:`flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-colors ${r?.id===s.id?"bg-blue-500/10 border border-blue-500/30":"hover:bg-slate-800/50"}`,onClick:()=>N(s),children:[e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:485:23",className:`p-2 rounded-lg ${ee(s.type)}`,children:M(s.type)}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:486:23",className:"flex-1 min-w-0",children:[e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:487:25",className:"text-sm font-medium text-slate-200 truncate",children:s.name}),e.jsxs("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:488:25",className:"text-xs text-slate-500",children:[de[s.type]||s.type,X(s.id)?" · 自定义":""]})]})]},s.id))})})]})})]}),e.jsx(Te,{"code-path":"src/components/kubernetes/TopologyView.tsx:500:7",open:!!r,onOpenChange:()=>N(null),children:e.jsxs(je,{"code-path":"src/components/kubernetes/TopologyView.tsx:501:9",className:"bg-slate-900 border-slate-800 max-w-lg",children:[e.jsxs(Ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:502:11",children:[e.jsxs(Ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:503:13",className:"text-slate-100 flex items-center gap-2",children:[e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:504:15",className:`p-2 rounded-lg ${ee(r?.type||"server")}`,children:r&&M(r.type)}),r?.name,r&&X(r.id)&&e.jsx(Ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:506:65",variant:"outline",className:"border-amber-500/30 text-amber-400 text-xs",children:"自定义"})]}),e.jsxs(ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:508:13",className:"text-slate-500",children:["类型: ",de[r?.type||""]||r?.type]})]}),r&&e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:511:13",className:"space-y-4",children:[Ue(r),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:513:15",children:[e.jsx("h4",{"code-path":"src/components/kubernetes/TopologyView.tsx:514:17",className:"text-sm font-medium text-slate-300 mb-2",children:"关联连接"}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:515:17",className:"space-y-2",children:[l.edges.filter(s=>s.source===r.id||s.target===r.id).map(s=>{const n=s.source===r.id,t=l.nodes.find(a=>a.id===(n?s.target:s.source));return t?e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:521:23",className:"flex items-center gap-2 p-2 rounded-lg bg-slate-800/50",children:[e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:522:25",className:"text-sm text-slate-400",children:n?"→":"←"}),e.jsx("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:523:25",className:`p-1 rounded ${ee(t.type)}`,children:M(t.type,"h-4 w-4")}),e.jsx("span",{"code-path":"src/components/kubernetes/TopologyView.tsx:524:25",className:"text-sm text-slate-300",children:t.name}),e.jsx(Ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:525:25",variant:"outline",className:"ml-auto border-slate-700 text-slate-400 text-xs",children:s.label})]},s.id):null}),l.edges.filter(s=>s.source===r.id||s.target===r.id).length===0&&e.jsx("p",{"code-path":"src/components/kubernetes/TopologyView.tsx:529:127",className:"text-xs text-slate-600",children:"无关联连接"})]})]}),y&&r&&e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:534:17",className:"flex gap-2 pt-2 border-t border-slate-700",children:[e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:535:19",size:"sm",variant:"outline",className:"border-slate-600 text-slate-200",onClick:()=>ye(r),children:[e.jsx(_e,{"code-path":"src/components/kubernetes/TopologyView.tsx:536:21",className:"h-3.5 w-3.5 mr-1"}),"编辑"]}),X(r.id)&&e.jsxs(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:539:21",size:"sm",variant:"outline",className:"border-red-500/30 text-red-400 hover:bg-red-500/10",onClick:()=>Pe(r),children:[e.jsx(ps,{"code-path":"src/components/kubernetes/TopologyView.tsx:540:23",className:"h-3.5 w-3.5 mr-1"}),"删除"]})]})]})]})}),e.jsx(Te,{"code-path":"src/components/kubernetes/TopologyView.tsx:551:7",open:De,onOpenChange:Q,children:e.jsxs(je,{"code-path":"src/components/kubernetes/TopologyView.tsx:552:9",className:"bg-slate-900 border-slate-800 max-w-md",children:[e.jsxs(Ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:553:11",children:[e.jsx(Ne,{"code-path":"src/components/kubernetes/TopologyView.tsx:554:13",className:"text-slate-100",children:U?"编辑节点":"添加自定义节点"}),e.jsx(ve,{"code-path":"src/components/kubernetes/TopologyView.tsx:555:13",className:"text-slate-500",children:U?"修改节点属性":"添加数据库、外部服务等非 Kubernetes 资源节点"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:557:11",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:558:13",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/TopologyView.tsx:559:15",className:"text-slate-300",children:"名称"}),e.jsx(Se,{"code-path":"src/components/kubernetes/TopologyView.tsx:560:15",value:w.name,onChange:s=>F({...w,name:s.target.value}),placeholder:"如 MySQL 主库、Redis 集群",className:"bg-slate-800/50 border-slate-700 text-slate-200"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:563:13",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/TopologyView.tsx:564:15",className:"text-slate-300",children:"类型"}),e.jsxs(ce,{"code-path":"src/components/kubernetes/TopologyView.tsx:565:15",value:w.type,onValueChange:s=>F({...w,type:s}),children:[e.jsx(re,{"code-path":"src/components/kubernetes/TopologyView.tsx:566:17",className:"bg-slate-800/50 border-slate-700 text-slate-200",children:e.jsx(le,{"code-path":"src/components/kubernetes/TopologyView.tsx:566:92"})}),e.jsx(ie,{"code-path":"src/components/kubernetes/TopologyView.tsx:567:17",className:"bg-slate-800 border-slate-700",children:ms.map(s=>e.jsxs(q,{"code-path":"src/components/kubernetes/TopologyView.tsx:568:49",value:s.value,children:[s.label," — ",s.desc]},s.value))})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/TopologyView.tsx:572:13",className:"space-y-2",children:[e.jsx(ae,{"code-path":"src/components/kubernetes/TopologyView.tsx:573:15",className:"text-slate-300",children:"备注"}),e.jsx(qe,{"code-path":"src/components/kubernetes/TopologyView.tsx:574:15",value:w.note,onChange:s=>F({...w,note:s.target.value}),placeholder:"连接信息、用途说明等",rows:2,className:"bg-slate-800/50 border-slate-700 text-slate-200 resize-none"})]})]}),e.jsxs(Ze,{"code-path":"src/components/kubernetes/TopologyView.tsx:578:11",children:[e.jsx(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:579:13",variant:"outline",className:"border-slate-700 text-slate-300",onClick:()=>Q(!1),children:"取消"}),e.jsx(v,{"code-path":"src/components/kubernetes/TopologyView.tsx:580:13",onClick:Oe,children:U?"保存":"添加"})]})]})})]})}export{Ns as TopologyView}; diff --git a/backend/static/assets/TraceManager-JbMTFm_u.js b/backend/static/assets/TraceManager-D3OFjsrO.js similarity index 98% rename from backend/static/assets/TraceManager-JbMTFm_u.js rename to backend/static/assets/TraceManager-D3OFjsrO.js index eba0ae8..27e671f 100644 --- a/backend/static/assets/TraceManager-JbMTFm_u.js +++ b/backend/static/assets/TraceManager-D3OFjsrO.js @@ -1 +1 @@ -import{r,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{t as y,B as w,D as z,a as Q,b as H,c as J,d as G,p as S,q as le}from"./index-LZWfu62c.js";import{I as he}from"./input-BdDauX3U.js";import{B as j}from"./badge-B0F5ZNtn.js";import{C as M,a as N,b,c as C}from"./card-B-RtdR4H.js";import{S as ge}from"./stat-strip-BPzU38xY.js";import{S as D,a as I,b as L,c as R,d as n}from"./select-4xU_9B3_.js";import{T as ue,a as Te,b as F,c as O}from"./tabs-kmtfM2I-.js";import{L as s}from"./label-u-lNUbKh.js";import{t as k}from"./trace-L8uY5gM3.js";import{S as je,R as Me,x as Ne,u as fe,aa as ve,J as ye,b as we,a as Se,y as be,Q as Ce,f as De,ab as Ie,ac as Le,ad as Re,a4 as Fe,h as Oe,ae as ke}from"./vendor-icons-Aso0-eeY.js";import"./index-CYARH0Cq.js";const Ke=()=>{const[B,K]=r.useState([]),[p,U]=r.useState([]),[X,E]=r.useState(!1),[f,Z]=r.useState(""),[l,W]=r.useState("all"),[h,Y]=r.useState("all"),[g,_]=r.useState("1h"),[ee,ae]=r.useState("traces"),[m,te]=r.useState(null),[o,re]=r.useState(null),[ce,$]=r.useState(!1),[se,A]=r.useState(!1);r.useEffect(()=>{oe()},[g]);const oe=async()=>{await Promise.all([P(),ne()])},P=async()=>{E(!0);try{const a=await k.getTraces({timeRange:g,service:l,status:h});K(a.data||[])}catch{y.error("获取链路数据失败")}finally{E(!1)}},ne=async()=>{try{const a=await k.getServices(g);U(a.data||[])}catch{y.error("获取服务数据失败")}},me=async a=>{try{return(await k.getTraceDetail(a)).data}catch{return y.error("获取链路详情失败"),null}},v=a=>{switch(a){case"success":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:139:16",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx(be,{"code-path":"src/components/monitor/trace/TraceManager.tsx:139:72",className:"w-3 h-3"}),"成功"]});case"error":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:141:16",variant:"destructive",className:"gap-1",children:[e.jsx(Se,{"code-path":"src/components/monitor/trace/TraceManager.tsx:141:63",className:"w-3 h-3"}),"错误"]});case"pending":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:143:16",variant:"outline",className:"gap-1",children:[e.jsx(we,{"code-path":"src/components/monitor/trace/TraceManager.tsx:143:59",className:"w-3 h-3"}),"进行中"]});default:return e.jsx(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:145:16",variant:"secondary",children:"未知"})}},de=a=>{switch(a){case"client":return e.jsx(ke,{"code-path":"src/components/monitor/trace/TraceManager.tsx:151:29",className:"w-4 h-4"});case"server":return e.jsx(Oe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:152:29",className:"w-4 h-4"});case"producer":return e.jsx(Fe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:153:31",className:"w-4 h-4"});case"consumer":return e.jsx(Re,{"code-path":"src/components/monitor/trace/TraceManager.tsx:154:31",className:"w-4 h-4"});default:return e.jsx(Le,{"code-path":"src/components/monitor/trace/TraceManager.tsx:155:23",className:"w-4 h-4"})}},ie=a=>{switch(a){case"success":return"bg-green-500";case"error":return"bg-red-500";case"pending":return"bg-yellow-500";default:return"bg-gray-500"}},d=a=>a<1?`${(a*1e3).toFixed(2)}μs`:a<1e3?`${a.toFixed(2)}ms`:`${(a/1e3).toFixed(2)}s`,V=B.filter(a=>{const t=a.traceId.toLowerCase().includes(f.toLowerCase())||a.operationName.toLowerCase().includes(f.toLowerCase()),i=l==="all"||a.serviceName===l,c=h==="all"||a.status===h;return t&&i&&c}),pe=Array.from(new Set(B.map(a=>a.serviceName))),xe=a=>{const t=new Map,i=[];return a.forEach(c=>{t.set(c.spanId,{...c,children:[]})}),a.forEach(c=>{const u=t.get(c.spanId);if(c.parentSpanId&&t.has(c.parentSpanId)){const x=t.get(c.parentSpanId);x.children=x.children||[],x.children.push(u)}else i.push(u)}),i},q=({span:a,level:t,totalDuration:i})=>{const[c,u]=r.useState(!0),x=i>0?a.duration/i*100:0;return e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:214:7",className:"select-none",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:215:9",className:"flex items-center py-2 hover:bg-muted/50 cursor-pointer border-l-2 border-transparent hover:border-blue-500",style:{paddingLeft:`${t*24+12}px`},onClick:()=>{re(a),A(!0)},children:[a.children?.length>0&&e.jsx(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:221:13",variant:"ghost",size:"sm",className:"h-4 w-4 p-0 mr-1",onClick:T=>{T.stopPropagation(),u(!c)},children:c?e.jsx(Ce,{"code-path":"src/components/monitor/trace/TraceManager.tsx:227:27",className:"w-3 h-3"}):e.jsx(De,{"code-path":"src/components/monitor/trace/TraceManager.tsx:227:65",className:"w-3 h-3"})}),!a.children?.length&&e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:230:38",className:"w-5"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:232:11",className:"flex items-center gap-2 flex-1 min-w-0",children:[de(a.kind),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:234:13",className:"font-medium truncate",children:a.operationName}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:235:13",className:"text-xs text-muted-foreground",children:a.serviceName})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:238:11",className:"flex items-center gap-4",children:[e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:239:13",className:"w-32 h-4 bg-muted rounded overflow-hidden",children:e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:240:15",className:`h-full ${ie(a.status)}`,style:{width:`${Math.max(x,1)}%`}})}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:245:13",className:"text-sm text-muted-foreground w-20 text-right",children:d(a.duration)}),a.status==="error"&&e.jsx(Ie,{"code-path":"src/components/monitor/trace/TraceManager.tsx:248:41",className:"w-4 h-4 text-red-500"})]})]}),c&&a.children?.map(T=>e.jsx(q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:253:11",span:T,level:t+1,totalDuration:i},T.spanId))]})};return e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:260:5",className:"space-y-6",children:[e.jsx(ge,{"code-path":"src/components/monitor/trace/TraceManager.tsx:262:7",items:[{label:"总请求",value:p.reduce((a,t)=>a+t.requestCount,0).toLocaleString(),color:"blue"},{label:"错误率",value:`${(p.reduce((a,t)=>a+t.errorRate,0)/(p.length||1)).toFixed(2)}%`,color:"red"},{label:"平均延迟",value:d(p.reduce((a,t)=>a+t.avgDuration,0)/(p.length||1)),color:"amber"},{label:"服务数",value:p.length,color:"purple"}]}),e.jsxs(ue,{"code-path":"src/components/monitor/trace/TraceManager.tsx:271:7",value:ee,onValueChange:ae,children:[e.jsxs(Te,{"code-path":"src/components/monitor/trace/TraceManager.tsx:272:9",className:"grid w-full grid-cols-3 lg:w-[400px]",children:[e.jsx(F,{"code-path":"src/components/monitor/trace/TraceManager.tsx:273:11",value:"traces",children:"链路追踪"}),e.jsx(F,{"code-path":"src/components/monitor/trace/TraceManager.tsx:274:11",value:"services",children:"服务拓扑"}),e.jsx(F,{"code-path":"src/components/monitor/trace/TraceManager.tsx:275:11",value:"metrics",children:"性能指标"})]}),e.jsxs(O,{"code-path":"src/components/monitor/trace/TraceManager.tsx:278:9",value:"traces",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:280:11",className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:281:13",className:"flex items-center gap-2 flex-1 min-w-[400px]",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:282:15",className:"relative flex-1",children:[e.jsx(je,{"code-path":"src/components/monitor/trace/TraceManager.tsx:283:17",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(he,{"code-path":"src/components/monitor/trace/TraceManager.tsx:284:17",placeholder:"搜索Trace ID、操作名...",value:f,onChange:a=>Z(a.target.value),className:"pl-10"})]}),e.jsxs(D,{"code-path":"src/components/monitor/trace/TraceManager.tsx:291:15",value:l,onValueChange:W,children:[e.jsx(I,{"code-path":"src/components/monitor/trace/TraceManager.tsx:292:17",className:"w-[150px]",children:e.jsx(L,{"code-path":"src/components/monitor/trace/TraceManager.tsx:293:19",placeholder:"服务"})}),e.jsxs(R,{"code-path":"src/components/monitor/trace/TraceManager.tsx:295:17",children:[e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:296:19",value:"all",children:"全部服务"}),pe.map(a=>e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:298:21",value:a,children:a},a))]})]}),e.jsxs(D,{"code-path":"src/components/monitor/trace/TraceManager.tsx:302:15",value:h,onValueChange:Y,children:[e.jsx(I,{"code-path":"src/components/monitor/trace/TraceManager.tsx:303:17",className:"w-[120px]",children:e.jsx(L,{"code-path":"src/components/monitor/trace/TraceManager.tsx:304:19",placeholder:"状态"})}),e.jsxs(R,{"code-path":"src/components/monitor/trace/TraceManager.tsx:306:17",children:[e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:307:19",value:"all",children:"全部状态"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:308:19",value:"success",children:"成功"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:309:19",value:"error",children:"错误"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:310:19",value:"pending",children:"进行中"})]})]}),e.jsxs(D,{"code-path":"src/components/monitor/trace/TraceManager.tsx:313:15",value:g,onValueChange:_,children:[e.jsx(I,{"code-path":"src/components/monitor/trace/TraceManager.tsx:314:17",className:"w-[120px]",children:e.jsx(L,{"code-path":"src/components/monitor/trace/TraceManager.tsx:315:19"})}),e.jsxs(R,{"code-path":"src/components/monitor/trace/TraceManager.tsx:317:17",children:[e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:318:19",value:"15m",children:"15分钟"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:319:19",value:"1h",children:"1小时"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:320:19",value:"6h",children:"6小时"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:321:19",value:"24h",children:"24小时"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:322:19",value:"7d",children:"7天"})]})]})]}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:326:13",className:"flex items-center gap-2",children:e.jsxs(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:327:15",variant:"outline",onClick:P,children:[e.jsx(Me,{"code-path":"src/components/monitor/trace/TraceManager.tsx:328:17",className:"w-4 h-4 mr-2"}),"刷新"]})})]}),e.jsx(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:335:11",children:e.jsx(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:336:13",className:"p-0",children:e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:337:15",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/trace/TraceManager.tsx:338:17",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/monitor/trace/TraceManager.tsx:339:19",className:"bg-muted/50",children:e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:340:21",children:[e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:341:23",className:"px-4 py-3 text-left text-sm font-medium",children:"Trace ID"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:342:23",className:"px-4 py-3 text-left text-sm font-medium",children:"服务 / 操作"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:343:23",className:"px-4 py-3 text-left text-sm font-medium",children:"状态"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:344:23",className:"px-4 py-3 text-left text-sm font-medium",children:"耗时"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:345:23",className:"px-4 py-3 text-left text-sm font-medium",children:"Span数"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:346:23",className:"px-4 py-3 text-left text-sm font-medium",children:"时间"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:347:23",className:"px-4 py-3 text-left text-sm font-medium",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/trace/TraceManager.tsx:350:19",className:"divide-y",children:X?e.jsx("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:352:23",children:e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:353:25",colSpan:7,className:"px-4 py-8 text-center text-muted-foreground",children:"加载中..."})}):V.length===0?e.jsx("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:356:23",children:e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:357:25",colSpan:7,className:"px-4 py-8 text-center text-muted-foreground",children:"暂无链路数据"})}):V.map(a=>e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:361:25",className:"hover:bg-muted/50",children:[e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:362:27",className:"px-4 py-3",children:e.jsxs("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:363:29",className:"font-mono text-sm text-blue-500",children:[a.traceId.slice(0,16),"..."]})}),e.jsxs("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:365:27",className:"px-4 py-3",children:[e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:366:29",className:"font-medium",children:a.operationName}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:367:29",className:"text-sm text-muted-foreground",children:a.serviceName})]}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:369:27",className:"px-4 py-3",children:v(a.status)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:370:27",className:"px-4 py-3 text-sm",children:d(a.duration)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:371:27",className:"px-4 py-3 text-sm",children:a.spanCount}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:372:27",className:"px-4 py-3 text-sm text-muted-foreground",children:a.startTime}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:373:27",className:"px-4 py-3",children:e.jsx(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:374:29",variant:"ghost",size:"sm",onClick:async()=>{const t=await me(a.traceId);t&&(te({...a,spans:t.spans}),$(!0))},children:e.jsx(Ne,{"code-path":"src/components/monitor/trace/TraceManager.tsx:385:31",className:"w-4 h-4"})})})]},a.id))})]})})})})]}),e.jsx(O,{"code-path":"src/components/monitor/trace/TraceManager.tsx:398:9",value:"services",className:"space-y-4",children:e.jsxs(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:399:11",children:[e.jsx(b,{"code-path":"src/components/monitor/trace/TraceManager.tsx:400:13",children:e.jsx(C,{"code-path":"src/components/monitor/trace/TraceManager.tsx:401:15",children:"服务性能概览"})}),e.jsx(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:403:13",children:e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:404:15",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/trace/TraceManager.tsx:405:17",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/monitor/trace/TraceManager.tsx:406:19",className:"bg-muted/50",children:e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:407:21",children:[e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:408:23",className:"px-4 py-3 text-left text-sm font-medium",children:"服务名称"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:409:23",className:"px-4 py-3 text-left text-sm font-medium",children:"请求数"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:410:23",className:"px-4 py-3 text-left text-sm font-medium",children:"错误率"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:411:23",className:"px-4 py-3 text-left text-sm font-medium",children:"平均延迟"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:412:23",className:"px-4 py-3 text-left text-sm font-medium",children:"P95延迟"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:413:23",className:"px-4 py-3 text-left text-sm font-medium",children:"P99延迟"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/trace/TraceManager.tsx:416:19",className:"divide-y",children:p.map(a=>e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:418:23",className:"hover:bg-muted/50",children:[e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:419:25",className:"px-4 py-3 font-medium",children:a.serviceName}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:420:25",className:"px-4 py-3",children:a.requestCount.toLocaleString()}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:421:25",className:"px-4 py-3",children:e.jsxs("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:422:27",className:a.errorRate>1?"text-red-500":"text-green-500",children:[a.errorRate.toFixed(2),"%"]})}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:426:25",className:"px-4 py-3",children:d(a.avgDuration)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:427:25",className:"px-4 py-3",children:d(a.p95Duration)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:428:25",className:"px-4 py-3",children:d(a.p99Duration)})]},a.serviceName))})]})})})]})}),e.jsx(O,{"code-path":"src/components/monitor/trace/TraceManager.tsx:438:9",value:"metrics",className:"space-y-4",children:e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:439:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:440:13",children:[e.jsx(b,{"code-path":"src/components/monitor/trace/TraceManager.tsx:441:15",children:e.jsx(C,{"code-path":"src/components/monitor/trace/TraceManager.tsx:442:17",children:"延迟分布"})}),e.jsxs(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:444:15",className:"h-[300px] flex items-center justify-center text-muted-foreground",children:[e.jsx(fe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:445:17",className:"w-16 h-16 mr-4"}),"延迟分布图表(集成图表库后显示)"]})]}),e.jsxs(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:449:13",children:[e.jsx(b,{"code-path":"src/components/monitor/trace/TraceManager.tsx:450:15",children:e.jsx(C,{"code-path":"src/components/monitor/trace/TraceManager.tsx:451:17",children:"错误率趋势"})}),e.jsxs(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:453:15",className:"h-[300px] flex items-center justify-center text-muted-foreground",children:[e.jsx(ve,{"code-path":"src/components/monitor/trace/TraceManager.tsx:454:17",className:"w-16 h-16 mr-4"}),"错误率趋势图表(集成图表库后显示)"]})]})]})})]}),e.jsx(z,{"code-path":"src/components/monitor/trace/TraceManager.tsx:463:7",open:ce,onOpenChange:$,children:e.jsxs(Q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:464:9",className:"max-w-6xl max-h-[90vh]",children:[e.jsxs(H,{"code-path":"src/components/monitor/trace/TraceManager.tsx:465:11",children:[e.jsxs(J,{"code-path":"src/components/monitor/trace/TraceManager.tsx:466:13",className:"flex items-center gap-2",children:[e.jsx(ye,{"code-path":"src/components/monitor/trace/TraceManager.tsx:467:15",className:"w-5 h-5"}),"Trace详情",e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:469:15",className:"font-mono text-sm text-muted-foreground",children:m?.traceId})]}),e.jsx(G,{"code-path":"src/components/monitor/trace/TraceManager.tsx:471:13",className:"sr-only",children:"描述"})]}),m&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:474:13",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:475:15",className:"flex items-center gap-4 p-3 bg-muted rounded-lg",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:476:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:477:19",className:"text-xs text-muted-foreground",children:"服务"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:478:19",className:"font-medium",children:m.serviceName})]}),e.jsx(S,{"code-path":"src/components/monitor/trace/TraceManager.tsx:480:17",orientation:"vertical",className:"h-8"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:481:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:482:19",className:"text-xs text-muted-foreground",children:"操作"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:483:19",className:"font-medium",children:m.operationName})]}),e.jsx(S,{"code-path":"src/components/monitor/trace/TraceManager.tsx:485:17",orientation:"vertical",className:"h-8"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:486:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:487:19",className:"text-xs text-muted-foreground",children:"总耗时"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:488:19",className:"font-medium",children:d(m.duration)})]}),e.jsx(S,{"code-path":"src/components/monitor/trace/TraceManager.tsx:490:17",orientation:"vertical",className:"h-8"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:491:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:492:19",className:"text-xs text-muted-foreground",children:"状态"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:493:19",children:v(m.status)})]})]}),e.jsx(le,{"code-path":"src/components/monitor/trace/TraceManager.tsx:497:15",className:"h-[500px]",children:e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:498:17",className:"border rounded-lg",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:499:19",className:"flex items-center px-4 py-2 bg-muted/50 border-b text-sm font-medium",children:[e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:500:21",className:"flex-1",children:"Span名称"}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:501:21",className:"w-32",children:"时间线"}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:502:21",className:"w-20 text-right",children:"耗时"})]}),m.spans&&xe(m.spans).map(a=>e.jsx(q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:506:21",span:a,level:0,totalDuration:m.duration},a.spanId))]})})]})]})}),e.jsx(z,{"code-path":"src/components/monitor/trace/TraceManager.tsx:516:7",open:se,onOpenChange:A,children:e.jsxs(Q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:517:9",className:"max-w-2xl",children:[e.jsxs(H,{"code-path":"src/components/monitor/trace/TraceManager.tsx:518:11",children:[e.jsx(J,{"code-path":"src/components/monitor/trace/TraceManager.tsx:519:13",children:"Span详情"}),e.jsx(G,{"code-path":"src/components/monitor/trace/TraceManager.tsx:520:13",className:"sr-only",children:"描述"})]}),o&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:523:13",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:524:15",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:525:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:526:19",className:"text-muted-foreground",children:"Span ID"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:527:19",className:"font-mono text-sm",children:o.spanId})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:529:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:530:19",className:"text-muted-foreground",children:"类型"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:531:19",className:"capitalize",children:o.kind})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:533:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:534:19",className:"text-muted-foreground",children:"服务"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:535:19",className:"font-medium",children:o.serviceName})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:537:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:538:19",className:"text-muted-foreground",children:"操作"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:539:19",className:"font-medium",children:o.operationName})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:541:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:542:19",className:"text-muted-foreground",children:"状态"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:543:19",children:v(o.status)})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:545:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:546:19",className:"text-muted-foreground",children:"耗时"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:547:19",className:"font-medium",children:d(o.duration)})]})]}),Object.keys(o.tags).length>0&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:552:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:553:19",className:"text-muted-foreground",children:"标签"}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:554:19",className:"mt-1 p-3 bg-muted rounded-lg",children:Object.entries(o.tags).map(([a,t])=>e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:556:23",className:"flex justify-between text-sm py-1",children:[e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:557:25",className:"text-muted-foreground",children:a}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:558:25",className:"font-mono",children:t})]},a))})]}),o.logs?.length>0&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:566:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:567:19",className:"text-muted-foreground",children:"日志"}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:568:19",className:"mt-1 space-y-2",children:o.logs.map((a,t)=>e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:570:23",className:"p-2 bg-muted rounded text-sm",children:[e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:571:25",className:"text-muted-foreground",children:a.timestamp}),e.jsx("pre",{"code-path":"src/components/monitor/trace/TraceManager.tsx:572:25",className:"mt-1 text-xs",children:JSON.stringify(a.fields,null,2)})]},t))})]})]})]})})]})};export{Ke as default}; +import{r,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{t as y,B as w,D as z,a as Q,b as H,c as J,d as G,p as S,q as le}from"./index-Bp-M7P_8.js";import{I as he}from"./input-Bnlm--la.js";import{B as j}from"./badge-B00SZHvE.js";import{C as M,a as N,b,c as C}from"./card-BHSBTtub.js";import{S as ge}from"./stat-strip-CSMyyoYr.js";import{S as D,a as I,b as L,c as R,d as n}from"./select-DbhcBWnH.js";import{T as ue,a as Te,b as F,c as O}from"./tabs-DbNlmoQJ.js";import{L as s}from"./label-NkONM5Mp.js";import{t as k}from"./trace-L8uY5gM3.js";import{S as je,R as Me,x as Ne,u as fe,aa as ve,J as ye,b as we,a as Se,y as be,Q as Ce,f as De,ab as Ie,ac as Le,ad as Re,a4 as Fe,h as Oe,ae as ke}from"./vendor-icons-BWk-DH7F.js";import"./index-5FEebgvX.js";const Ke=()=>{const[B,K]=r.useState([]),[p,U]=r.useState([]),[X,E]=r.useState(!1),[f,Z]=r.useState(""),[l,W]=r.useState("all"),[h,Y]=r.useState("all"),[g,_]=r.useState("1h"),[ee,ae]=r.useState("traces"),[m,te]=r.useState(null),[o,re]=r.useState(null),[ce,$]=r.useState(!1),[se,A]=r.useState(!1);r.useEffect(()=>{oe()},[g]);const oe=async()=>{await Promise.all([P(),ne()])},P=async()=>{E(!0);try{const a=await k.getTraces({timeRange:g,service:l,status:h});K(a.data||[])}catch{y.error("获取链路数据失败")}finally{E(!1)}},ne=async()=>{try{const a=await k.getServices(g);U(a.data||[])}catch{y.error("获取服务数据失败")}},me=async a=>{try{return(await k.getTraceDetail(a)).data}catch{return y.error("获取链路详情失败"),null}},v=a=>{switch(a){case"success":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:139:16",variant:"default",className:"bg-green-500 gap-1",children:[e.jsx(be,{"code-path":"src/components/monitor/trace/TraceManager.tsx:139:72",className:"w-3 h-3"}),"成功"]});case"error":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:141:16",variant:"destructive",className:"gap-1",children:[e.jsx(Se,{"code-path":"src/components/monitor/trace/TraceManager.tsx:141:63",className:"w-3 h-3"}),"错误"]});case"pending":return e.jsxs(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:143:16",variant:"outline",className:"gap-1",children:[e.jsx(we,{"code-path":"src/components/monitor/trace/TraceManager.tsx:143:59",className:"w-3 h-3"}),"进行中"]});default:return e.jsx(j,{"code-path":"src/components/monitor/trace/TraceManager.tsx:145:16",variant:"secondary",children:"未知"})}},de=a=>{switch(a){case"client":return e.jsx(ke,{"code-path":"src/components/monitor/trace/TraceManager.tsx:151:29",className:"w-4 h-4"});case"server":return e.jsx(Oe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:152:29",className:"w-4 h-4"});case"producer":return e.jsx(Fe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:153:31",className:"w-4 h-4"});case"consumer":return e.jsx(Re,{"code-path":"src/components/monitor/trace/TraceManager.tsx:154:31",className:"w-4 h-4"});default:return e.jsx(Le,{"code-path":"src/components/monitor/trace/TraceManager.tsx:155:23",className:"w-4 h-4"})}},ie=a=>{switch(a){case"success":return"bg-green-500";case"error":return"bg-red-500";case"pending":return"bg-yellow-500";default:return"bg-gray-500"}},d=a=>a<1?`${(a*1e3).toFixed(2)}μs`:a<1e3?`${a.toFixed(2)}ms`:`${(a/1e3).toFixed(2)}s`,V=B.filter(a=>{const t=a.traceId.toLowerCase().includes(f.toLowerCase())||a.operationName.toLowerCase().includes(f.toLowerCase()),i=l==="all"||a.serviceName===l,c=h==="all"||a.status===h;return t&&i&&c}),pe=Array.from(new Set(B.map(a=>a.serviceName))),xe=a=>{const t=new Map,i=[];return a.forEach(c=>{t.set(c.spanId,{...c,children:[]})}),a.forEach(c=>{const u=t.get(c.spanId);if(c.parentSpanId&&t.has(c.parentSpanId)){const x=t.get(c.parentSpanId);x.children=x.children||[],x.children.push(u)}else i.push(u)}),i},q=({span:a,level:t,totalDuration:i})=>{const[c,u]=r.useState(!0),x=i>0?a.duration/i*100:0;return e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:214:7",className:"select-none",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:215:9",className:"flex items-center py-2 hover:bg-muted/50 cursor-pointer border-l-2 border-transparent hover:border-blue-500",style:{paddingLeft:`${t*24+12}px`},onClick:()=>{re(a),A(!0)},children:[a.children?.length>0&&e.jsx(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:221:13",variant:"ghost",size:"sm",className:"h-4 w-4 p-0 mr-1",onClick:T=>{T.stopPropagation(),u(!c)},children:c?e.jsx(Ce,{"code-path":"src/components/monitor/trace/TraceManager.tsx:227:27",className:"w-3 h-3"}):e.jsx(De,{"code-path":"src/components/monitor/trace/TraceManager.tsx:227:65",className:"w-3 h-3"})}),!a.children?.length&&e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:230:38",className:"w-5"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:232:11",className:"flex items-center gap-2 flex-1 min-w-0",children:[de(a.kind),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:234:13",className:"font-medium truncate",children:a.operationName}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:235:13",className:"text-xs text-muted-foreground",children:a.serviceName})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:238:11",className:"flex items-center gap-4",children:[e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:239:13",className:"w-32 h-4 bg-muted rounded overflow-hidden",children:e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:240:15",className:`h-full ${ie(a.status)}`,style:{width:`${Math.max(x,1)}%`}})}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:245:13",className:"text-sm text-muted-foreground w-20 text-right",children:d(a.duration)}),a.status==="error"&&e.jsx(Ie,{"code-path":"src/components/monitor/trace/TraceManager.tsx:248:41",className:"w-4 h-4 text-red-500"})]})]}),c&&a.children?.map(T=>e.jsx(q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:253:11",span:T,level:t+1,totalDuration:i},T.spanId))]})};return e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:260:5",className:"space-y-6",children:[e.jsx(ge,{"code-path":"src/components/monitor/trace/TraceManager.tsx:262:7",items:[{label:"总请求",value:p.reduce((a,t)=>a+t.requestCount,0).toLocaleString(),color:"blue"},{label:"错误率",value:`${(p.reduce((a,t)=>a+t.errorRate,0)/(p.length||1)).toFixed(2)}%`,color:"red"},{label:"平均延迟",value:d(p.reduce((a,t)=>a+t.avgDuration,0)/(p.length||1)),color:"amber"},{label:"服务数",value:p.length,color:"purple"}]}),e.jsxs(ue,{"code-path":"src/components/monitor/trace/TraceManager.tsx:271:7",value:ee,onValueChange:ae,children:[e.jsxs(Te,{"code-path":"src/components/monitor/trace/TraceManager.tsx:272:9",className:"grid w-full grid-cols-3 lg:w-[400px]",children:[e.jsx(F,{"code-path":"src/components/monitor/trace/TraceManager.tsx:273:11",value:"traces",children:"链路追踪"}),e.jsx(F,{"code-path":"src/components/monitor/trace/TraceManager.tsx:274:11",value:"services",children:"服务拓扑"}),e.jsx(F,{"code-path":"src/components/monitor/trace/TraceManager.tsx:275:11",value:"metrics",children:"性能指标"})]}),e.jsxs(O,{"code-path":"src/components/monitor/trace/TraceManager.tsx:278:9",value:"traces",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:280:11",className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:281:13",className:"flex items-center gap-2 flex-1 min-w-[400px]",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:282:15",className:"relative flex-1",children:[e.jsx(je,{"code-path":"src/components/monitor/trace/TraceManager.tsx:283:17",className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(he,{"code-path":"src/components/monitor/trace/TraceManager.tsx:284:17",placeholder:"搜索Trace ID、操作名...",value:f,onChange:a=>Z(a.target.value),className:"pl-10"})]}),e.jsxs(D,{"code-path":"src/components/monitor/trace/TraceManager.tsx:291:15",value:l,onValueChange:W,children:[e.jsx(I,{"code-path":"src/components/monitor/trace/TraceManager.tsx:292:17",className:"w-[150px]",children:e.jsx(L,{"code-path":"src/components/monitor/trace/TraceManager.tsx:293:19",placeholder:"服务"})}),e.jsxs(R,{"code-path":"src/components/monitor/trace/TraceManager.tsx:295:17",children:[e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:296:19",value:"all",children:"全部服务"}),pe.map(a=>e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:298:21",value:a,children:a},a))]})]}),e.jsxs(D,{"code-path":"src/components/monitor/trace/TraceManager.tsx:302:15",value:h,onValueChange:Y,children:[e.jsx(I,{"code-path":"src/components/monitor/trace/TraceManager.tsx:303:17",className:"w-[120px]",children:e.jsx(L,{"code-path":"src/components/monitor/trace/TraceManager.tsx:304:19",placeholder:"状态"})}),e.jsxs(R,{"code-path":"src/components/monitor/trace/TraceManager.tsx:306:17",children:[e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:307:19",value:"all",children:"全部状态"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:308:19",value:"success",children:"成功"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:309:19",value:"error",children:"错误"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:310:19",value:"pending",children:"进行中"})]})]}),e.jsxs(D,{"code-path":"src/components/monitor/trace/TraceManager.tsx:313:15",value:g,onValueChange:_,children:[e.jsx(I,{"code-path":"src/components/monitor/trace/TraceManager.tsx:314:17",className:"w-[120px]",children:e.jsx(L,{"code-path":"src/components/monitor/trace/TraceManager.tsx:315:19"})}),e.jsxs(R,{"code-path":"src/components/monitor/trace/TraceManager.tsx:317:17",children:[e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:318:19",value:"15m",children:"15分钟"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:319:19",value:"1h",children:"1小时"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:320:19",value:"6h",children:"6小时"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:321:19",value:"24h",children:"24小时"}),e.jsx(n,{"code-path":"src/components/monitor/trace/TraceManager.tsx:322:19",value:"7d",children:"7天"})]})]})]}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:326:13",className:"flex items-center gap-2",children:e.jsxs(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:327:15",variant:"outline",onClick:P,children:[e.jsx(Me,{"code-path":"src/components/monitor/trace/TraceManager.tsx:328:17",className:"w-4 h-4 mr-2"}),"刷新"]})})]}),e.jsx(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:335:11",children:e.jsx(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:336:13",className:"p-0",children:e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:337:15",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/trace/TraceManager.tsx:338:17",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/monitor/trace/TraceManager.tsx:339:19",className:"bg-muted/50",children:e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:340:21",children:[e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:341:23",className:"px-4 py-3 text-left text-sm font-medium",children:"Trace ID"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:342:23",className:"px-4 py-3 text-left text-sm font-medium",children:"服务 / 操作"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:343:23",className:"px-4 py-3 text-left text-sm font-medium",children:"状态"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:344:23",className:"px-4 py-3 text-left text-sm font-medium",children:"耗时"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:345:23",className:"px-4 py-3 text-left text-sm font-medium",children:"Span数"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:346:23",className:"px-4 py-3 text-left text-sm font-medium",children:"时间"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:347:23",className:"px-4 py-3 text-left text-sm font-medium",children:"操作"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/trace/TraceManager.tsx:350:19",className:"divide-y",children:X?e.jsx("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:352:23",children:e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:353:25",colSpan:7,className:"px-4 py-8 text-center text-muted-foreground",children:"加载中..."})}):V.length===0?e.jsx("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:356:23",children:e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:357:25",colSpan:7,className:"px-4 py-8 text-center text-muted-foreground",children:"暂无链路数据"})}):V.map(a=>e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:361:25",className:"hover:bg-muted/50",children:[e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:362:27",className:"px-4 py-3",children:e.jsxs("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:363:29",className:"font-mono text-sm text-blue-500",children:[a.traceId.slice(0,16),"..."]})}),e.jsxs("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:365:27",className:"px-4 py-3",children:[e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:366:29",className:"font-medium",children:a.operationName}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:367:29",className:"text-sm text-muted-foreground",children:a.serviceName})]}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:369:27",className:"px-4 py-3",children:v(a.status)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:370:27",className:"px-4 py-3 text-sm",children:d(a.duration)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:371:27",className:"px-4 py-3 text-sm",children:a.spanCount}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:372:27",className:"px-4 py-3 text-sm text-muted-foreground",children:a.startTime}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:373:27",className:"px-4 py-3",children:e.jsx(w,{"code-path":"src/components/monitor/trace/TraceManager.tsx:374:29",variant:"ghost",size:"sm",onClick:async()=>{const t=await me(a.traceId);t&&(te({...a,spans:t.spans}),$(!0))},children:e.jsx(Ne,{"code-path":"src/components/monitor/trace/TraceManager.tsx:385:31",className:"w-4 h-4"})})})]},a.id))})]})})})})]}),e.jsx(O,{"code-path":"src/components/monitor/trace/TraceManager.tsx:398:9",value:"services",className:"space-y-4",children:e.jsxs(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:399:11",children:[e.jsx(b,{"code-path":"src/components/monitor/trace/TraceManager.tsx:400:13",children:e.jsx(C,{"code-path":"src/components/monitor/trace/TraceManager.tsx:401:15",children:"服务性能概览"})}),e.jsx(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:403:13",children:e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:404:15",className:"overflow-x-auto",children:e.jsxs("table",{"code-path":"src/components/monitor/trace/TraceManager.tsx:405:17",className:"w-full",children:[e.jsx("thead",{"code-path":"src/components/monitor/trace/TraceManager.tsx:406:19",className:"bg-muted/50",children:e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:407:21",children:[e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:408:23",className:"px-4 py-3 text-left text-sm font-medium",children:"服务名称"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:409:23",className:"px-4 py-3 text-left text-sm font-medium",children:"请求数"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:410:23",className:"px-4 py-3 text-left text-sm font-medium",children:"错误率"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:411:23",className:"px-4 py-3 text-left text-sm font-medium",children:"平均延迟"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:412:23",className:"px-4 py-3 text-left text-sm font-medium",children:"P95延迟"}),e.jsx("th",{"code-path":"src/components/monitor/trace/TraceManager.tsx:413:23",className:"px-4 py-3 text-left text-sm font-medium",children:"P99延迟"})]})}),e.jsx("tbody",{"code-path":"src/components/monitor/trace/TraceManager.tsx:416:19",className:"divide-y",children:p.map(a=>e.jsxs("tr",{"code-path":"src/components/monitor/trace/TraceManager.tsx:418:23",className:"hover:bg-muted/50",children:[e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:419:25",className:"px-4 py-3 font-medium",children:a.serviceName}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:420:25",className:"px-4 py-3",children:a.requestCount.toLocaleString()}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:421:25",className:"px-4 py-3",children:e.jsxs("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:422:27",className:a.errorRate>1?"text-red-500":"text-green-500",children:[a.errorRate.toFixed(2),"%"]})}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:426:25",className:"px-4 py-3",children:d(a.avgDuration)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:427:25",className:"px-4 py-3",children:d(a.p95Duration)}),e.jsx("td",{"code-path":"src/components/monitor/trace/TraceManager.tsx:428:25",className:"px-4 py-3",children:d(a.p99Duration)})]},a.serviceName))})]})})})]})}),e.jsx(O,{"code-path":"src/components/monitor/trace/TraceManager.tsx:438:9",value:"metrics",className:"space-y-4",children:e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:439:11",className:"grid grid-cols-2 gap-4",children:[e.jsxs(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:440:13",children:[e.jsx(b,{"code-path":"src/components/monitor/trace/TraceManager.tsx:441:15",children:e.jsx(C,{"code-path":"src/components/monitor/trace/TraceManager.tsx:442:17",children:"延迟分布"})}),e.jsxs(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:444:15",className:"h-[300px] flex items-center justify-center text-muted-foreground",children:[e.jsx(fe,{"code-path":"src/components/monitor/trace/TraceManager.tsx:445:17",className:"w-16 h-16 mr-4"}),"延迟分布图表(集成图表库后显示)"]})]}),e.jsxs(M,{"code-path":"src/components/monitor/trace/TraceManager.tsx:449:13",children:[e.jsx(b,{"code-path":"src/components/monitor/trace/TraceManager.tsx:450:15",children:e.jsx(C,{"code-path":"src/components/monitor/trace/TraceManager.tsx:451:17",children:"错误率趋势"})}),e.jsxs(N,{"code-path":"src/components/monitor/trace/TraceManager.tsx:453:15",className:"h-[300px] flex items-center justify-center text-muted-foreground",children:[e.jsx(ve,{"code-path":"src/components/monitor/trace/TraceManager.tsx:454:17",className:"w-16 h-16 mr-4"}),"错误率趋势图表(集成图表库后显示)"]})]})]})})]}),e.jsx(z,{"code-path":"src/components/monitor/trace/TraceManager.tsx:463:7",open:ce,onOpenChange:$,children:e.jsxs(Q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:464:9",className:"max-w-6xl max-h-[90vh]",children:[e.jsxs(H,{"code-path":"src/components/monitor/trace/TraceManager.tsx:465:11",children:[e.jsxs(J,{"code-path":"src/components/monitor/trace/TraceManager.tsx:466:13",className:"flex items-center gap-2",children:[e.jsx(ye,{"code-path":"src/components/monitor/trace/TraceManager.tsx:467:15",className:"w-5 h-5"}),"Trace详情",e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:469:15",className:"font-mono text-sm text-muted-foreground",children:m?.traceId})]}),e.jsx(G,{"code-path":"src/components/monitor/trace/TraceManager.tsx:471:13",className:"sr-only",children:"描述"})]}),m&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:474:13",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:475:15",className:"flex items-center gap-4 p-3 bg-muted rounded-lg",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:476:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:477:19",className:"text-xs text-muted-foreground",children:"服务"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:478:19",className:"font-medium",children:m.serviceName})]}),e.jsx(S,{"code-path":"src/components/monitor/trace/TraceManager.tsx:480:17",orientation:"vertical",className:"h-8"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:481:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:482:19",className:"text-xs text-muted-foreground",children:"操作"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:483:19",className:"font-medium",children:m.operationName})]}),e.jsx(S,{"code-path":"src/components/monitor/trace/TraceManager.tsx:485:17",orientation:"vertical",className:"h-8"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:486:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:487:19",className:"text-xs text-muted-foreground",children:"总耗时"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:488:19",className:"font-medium",children:d(m.duration)})]}),e.jsx(S,{"code-path":"src/components/monitor/trace/TraceManager.tsx:490:17",orientation:"vertical",className:"h-8"}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:491:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:492:19",className:"text-xs text-muted-foreground",children:"状态"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:493:19",children:v(m.status)})]})]}),e.jsx(le,{"code-path":"src/components/monitor/trace/TraceManager.tsx:497:15",className:"h-[500px]",children:e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:498:17",className:"border rounded-lg",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:499:19",className:"flex items-center px-4 py-2 bg-muted/50 border-b text-sm font-medium",children:[e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:500:21",className:"flex-1",children:"Span名称"}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:501:21",className:"w-32",children:"时间线"}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:502:21",className:"w-20 text-right",children:"耗时"})]}),m.spans&&xe(m.spans).map(a=>e.jsx(q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:506:21",span:a,level:0,totalDuration:m.duration},a.spanId))]})})]})]})}),e.jsx(z,{"code-path":"src/components/monitor/trace/TraceManager.tsx:516:7",open:se,onOpenChange:A,children:e.jsxs(Q,{"code-path":"src/components/monitor/trace/TraceManager.tsx:517:9",className:"max-w-2xl",children:[e.jsxs(H,{"code-path":"src/components/monitor/trace/TraceManager.tsx:518:11",children:[e.jsx(J,{"code-path":"src/components/monitor/trace/TraceManager.tsx:519:13",children:"Span详情"}),e.jsx(G,{"code-path":"src/components/monitor/trace/TraceManager.tsx:520:13",className:"sr-only",children:"描述"})]}),o&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:523:13",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:524:15",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:525:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:526:19",className:"text-muted-foreground",children:"Span ID"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:527:19",className:"font-mono text-sm",children:o.spanId})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:529:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:530:19",className:"text-muted-foreground",children:"类型"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:531:19",className:"capitalize",children:o.kind})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:533:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:534:19",className:"text-muted-foreground",children:"服务"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:535:19",className:"font-medium",children:o.serviceName})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:537:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:538:19",className:"text-muted-foreground",children:"操作"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:539:19",className:"font-medium",children:o.operationName})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:541:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:542:19",className:"text-muted-foreground",children:"状态"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:543:19",children:v(o.status)})]}),e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:545:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:546:19",className:"text-muted-foreground",children:"耗时"}),e.jsx("p",{"code-path":"src/components/monitor/trace/TraceManager.tsx:547:19",className:"font-medium",children:d(o.duration)})]})]}),Object.keys(o.tags).length>0&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:552:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:553:19",className:"text-muted-foreground",children:"标签"}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:554:19",className:"mt-1 p-3 bg-muted rounded-lg",children:Object.entries(o.tags).map(([a,t])=>e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:556:23",className:"flex justify-between text-sm py-1",children:[e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:557:25",className:"text-muted-foreground",children:a}),e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:558:25",className:"font-mono",children:t})]},a))})]}),o.logs?.length>0&&e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:566:17",children:[e.jsx(s,{"code-path":"src/components/monitor/trace/TraceManager.tsx:567:19",className:"text-muted-foreground",children:"日志"}),e.jsx("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:568:19",className:"mt-1 space-y-2",children:o.logs.map((a,t)=>e.jsxs("div",{"code-path":"src/components/monitor/trace/TraceManager.tsx:570:23",className:"p-2 bg-muted rounded text-sm",children:[e.jsx("span",{"code-path":"src/components/monitor/trace/TraceManager.tsx:571:25",className:"text-muted-foreground",children:a.timestamp}),e.jsx("pre",{"code-path":"src/components/monitor/trace/TraceManager.tsx:572:25",className:"mt-1 text-xs",children:JSON.stringify(a.fields,null,2)})]},t))})]})]})]})})]})};export{Ke as default}; diff --git a/backend/static/assets/UserGroupsManager-CjYJT4qh.js b/backend/static/assets/UserGroupsManager-BbYcJ9kF.js similarity index 96% rename from backend/static/assets/UserGroupsManager-CjYJT4qh.js rename to backend/static/assets/UserGroupsManager-BbYcJ9kF.js index 8b3fb30..54f0ced 100644 --- a/backend/static/assets/UserGroupsManager-CjYJT4qh.js +++ b/backend/static/assets/UserGroupsManager-BbYcJ9kF.js @@ -1 +1 @@ -import{r as o,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{f as R,B as t,D as F,a as O,b as T,c as A,t as a}from"./index-LZWfu62c.js";import{I as u}from"./input-BdDauX3U.js";import{B as I}from"./badge-B0F5ZNtn.js";import{L as y}from"./label-u-lNUbKh.js";import{d as n}from"./config-DAXaHuse.js";import{R as $,P as H,L as K,V as w,j as V,d as X,T as _,a3 as q,a9 as J}from"./vendor-icons-Aso0-eeY.js";function oe(){const g=R(),[G,C]=o.useState([]),[k,j]=o.useState(!0),[S,D]=o.useState({}),[E,p]=o.useState(!1),[l,M]=o.useState(null),[i,m]=o.useState(""),[x,h]=o.useState(""),[U,v]=o.useState(!1),[f,N]=o.useState({}),c=async()=>{j(!0);try{const s=await n.getGroups();C(s?.list||[])}catch{a.error("加载失败")}finally{j(!1)}};o.useEffect(()=>{c()},[]);const z=async()=>{if(!i.trim()){a.error("请输入组名");return}v(!0);try{l?await n.updateGroup(l,{name:i,description:x}):await n.createGroup({name:i,description:x}),a.success(l?"已更新":"已创建"),p(!1),c()}catch{a.error("操作失败")}finally{v(!1)}},L=async s=>{if(await g({title:"删除用户组",description:`确定删除「${s.name}」?所有成员和流水线授权将同时移除。`,variant:"destructive"}))try{await n.deleteGroup(s.id),a.success("已删除"),c()}catch{a.error("删除失败")}},b=async s=>{const r=(f[s]||"").trim();if(!r){a.error("输入用户名");return}try{await n.addGroupMember(s,{username:r}),a.success("已添加"),c(),N(d=>({...d,[s]:""}))}catch{a.error("添加失败")}},B=async(s,r,d)=>{if(await g({title:"移除成员",description:`确定从组中移除「${d}」?`}))try{await n.removeGroupMember(s,r),a.success("已移除"),c()}catch{a.error("移除失败")}},P=s=>D(r=>({...r,[s]:!r[s]}));return e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:82:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:83:9",children:[e.jsx("h2",{"code-path":"src/components/deploy/UserGroupsManager.tsx:84:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:"用户组管理"}),e.jsx("p",{"code-path":"src/components/deploy/UserGroupsManager.tsx:85:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"创建用户组,将组授权给流水线,组内成员自动获得流水线权限"})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:87:9",className:"flex items-center gap-2",children:[e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:88:11",variant:"outline",size:"sm",onClick:c,children:[e.jsx($,{"code-path":"src/components/deploy/UserGroupsManager.tsx:88:68",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:89:11",size:"sm",onClick:()=>{M(null),m(""),h(""),p(!0)},children:[e.jsx(H,{"code-path":"src/components/deploy/UserGroupsManager.tsx:90:13",className:"w-4 h-4 mr-1"}),"新建用户组"]})]})]}),k?e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:96:9",className:"flex justify-center py-12",children:e.jsx(K,{"code-path":"src/components/deploy/UserGroupsManager.tsx:96:52",className:"w-6 h-6 animate-spin text-[var(--dg-text-secondary)]"})}):G.length===0?e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:98:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:[e.jsx(w,{"code-path":"src/components/deploy/UserGroupsManager.tsx:99:11",className:"w-10 h-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/deploy/UserGroupsManager.tsx:100:11",children:"暂无用户组,点击「新建用户组」创建"})]}):e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:103:9",className:"space-y-3",children:G.map(s=>e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:105:13",className:"border border-[var(--dg-border)] rounded-lg bg-[var(--dg-bg-secondary)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:106:15",className:"flex items-center justify-between p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:107:17",className:"flex items-center gap-3",style:{cursor:"pointer"},onClick:()=>P(s.id),children:[e.jsx(V,{"code-path":"src/components/deploy/UserGroupsManager.tsx:108:19",className:"w-5 h-5 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:109:19",children:[e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:110:21",className:"font-medium text-[var(--dg-text-primary)]",children:s.name}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:111:21",className:"text-xs text-[var(--dg-text-secondary)]",children:[s.description||"暂无描述"," · ",(s.members||[]).length," 位成员"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:114:17",className:"flex items-center gap-2",children:[e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:115:19",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{M(s.id),m(s.name),h(s.description||""),p(!0)},children:e.jsx(X,{"code-path":"src/components/deploy/UserGroupsManager.tsx:116:21",className:"w-4 h-4"})}),e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:118:19",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-500",onClick:()=>L(s),children:e.jsx(_,{"code-path":"src/components/deploy/UserGroupsManager.tsx:119:21",className:"w-4 h-4"})})]})]}),S[s.id]&&e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:125:17",className:"border-t border-[var(--dg-border)] px-4 py-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:127:19",className:"flex items-end gap-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:128:21",className:"flex-1 space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/UserGroupsManager.tsx:128:55",className:"text-xs",children:"添加用户"}),e.jsx(u,{"code-path":"src/components/deploy/UserGroupsManager.tsx:129:23",value:f[s.id]||"",onChange:r=>N(d=>({...d,[s.id]:r.target.value})),placeholder:"输入用户名",className:"h-8 text-sm",onKeyDown:r=>r.key==="Enter"&&b(s.id)})]}),e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:131:21",size:"sm",className:"h-8",onClick:()=>b(s.id),children:[e.jsx(q,{"code-path":"src/components/deploy/UserGroupsManager.tsx:131:93",className:"w-3.5 h-3.5 mr-1"}),"添加"]})]}),(s.members||[]).length===0?e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:135:21",className:"text-xs text-[var(--dg-text-secondary)] py-2",children:"暂无成员"}):e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:137:21",className:"flex flex-wrap gap-2",children:(s.members||[]).map(r=>e.jsxs(I,{"code-path":"src/components/deploy/UserGroupsManager.tsx:139:25",variant:"secondary",className:"flex items-center gap-1 pl-2 pr-1 py-1.5",children:[e.jsx(w,{"code-path":"src/components/deploy/UserGroupsManager.tsx:140:27",className:"w-3 h-3"}),r.username,e.jsx("button",{"code-path":"src/components/deploy/UserGroupsManager.tsx:141:27",className:"ml-1 hover:text-red-400",onClick:()=>B(s.id,r.id,r.username),children:e.jsx(J,{"code-path":"src/components/deploy/UserGroupsManager.tsx:142:29",className:"w-3 h-3"})})]},r.id))})]})]},s.id))}),e.jsx(F,{"code-path":"src/components/deploy/UserGroupsManager.tsx:156:7",open:E,onOpenChange:p,children:e.jsxs(O,{"code-path":"src/components/deploy/UserGroupsManager.tsx:157:9",children:[e.jsx(T,{"code-path":"src/components/deploy/UserGroupsManager.tsx:158:11",children:e.jsx(A,{"code-path":"src/components/deploy/UserGroupsManager.tsx:158:25",children:l?"编辑用户组":"新建用户组"})}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:159:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:160:13",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/UserGroupsManager.tsx:160:40",children:"组名"}),e.jsx(u,{"code-path":"src/components/deploy/UserGroupsManager.tsx:160:57",value:i,onChange:s=>m(s.target.value),placeholder:"例如: 后端开发组"})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:161:13",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/UserGroupsManager.tsx:161:40",children:"描述"}),e.jsx(u,{"code-path":"src/components/deploy/UserGroupsManager.tsx:161:57",value:x,onChange:s=>h(s.target.value),placeholder:"可选"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:163:11",className:"flex justify-end gap-2 mt-4 pt-4 border-t",children:[e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:164:13",variant:"outline",onClick:()=>p(!1),children:"取消"}),e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:165:13",onClick:z,disabled:U,children:U?"...":"保存"})]})]})})]})}export{oe as default}; +import{r as o,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{f as R,B as t,D as F,a as O,b as T,c as A,t as a}from"./index-Bp-M7P_8.js";import{I as u}from"./input-Bnlm--la.js";import{B as I}from"./badge-B00SZHvE.js";import{L as y}from"./label-NkONM5Mp.js";import{d as n}from"./config-CBy2SxR-.js";import{R as $,P as H,L as K,V as w,j as V,d as X,T as _,a3 as q,a9 as J}from"./vendor-icons-BWk-DH7F.js";function oe(){const g=R(),[G,C]=o.useState([]),[k,j]=o.useState(!0),[S,D]=o.useState({}),[E,p]=o.useState(!1),[l,M]=o.useState(null),[i,m]=o.useState(""),[x,h]=o.useState(""),[U,v]=o.useState(!1),[f,N]=o.useState({}),c=async()=>{j(!0);try{const s=await n.getGroups();C(s?.list||[])}catch{a.error("加载失败")}finally{j(!1)}};o.useEffect(()=>{c()},[]);const z=async()=>{if(!i.trim()){a.error("请输入组名");return}v(!0);try{l?await n.updateGroup(l,{name:i,description:x}):await n.createGroup({name:i,description:x}),a.success(l?"已更新":"已创建"),p(!1),c()}catch{a.error("操作失败")}finally{v(!1)}},L=async s=>{if(await g({title:"删除用户组",description:`确定删除「${s.name}」?所有成员和流水线授权将同时移除。`,variant:"destructive"}))try{await n.deleteGroup(s.id),a.success("已删除"),c()}catch{a.error("删除失败")}},b=async s=>{const r=(f[s]||"").trim();if(!r){a.error("输入用户名");return}try{await n.addGroupMember(s,{username:r}),a.success("已添加"),c(),N(d=>({...d,[s]:""}))}catch{a.error("添加失败")}},B=async(s,r,d)=>{if(await g({title:"移除成员",description:`确定从组中移除「${d}」?`}))try{await n.removeGroupMember(s,r),a.success("已移除"),c()}catch{a.error("移除失败")}},P=s=>D(r=>({...r,[s]:!r[s]}));return e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:81:5",className:"space-y-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:82:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:83:9",children:[e.jsx("h2",{"code-path":"src/components/deploy/UserGroupsManager.tsx:84:11",className:"text-lg font-semibold text-[var(--dg-text-primary)]",children:"用户组管理"}),e.jsx("p",{"code-path":"src/components/deploy/UserGroupsManager.tsx:85:11",className:"text-sm text-[var(--dg-text-secondary)] mt-1",children:"创建用户组,将组授权给流水线,组内成员自动获得流水线权限"})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:87:9",className:"flex items-center gap-2",children:[e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:88:11",variant:"outline",size:"sm",onClick:c,children:[e.jsx($,{"code-path":"src/components/deploy/UserGroupsManager.tsx:88:68",className:"w-4 h-4 mr-1"}),"刷新"]}),e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:89:11",size:"sm",onClick:()=>{M(null),m(""),h(""),p(!0)},children:[e.jsx(H,{"code-path":"src/components/deploy/UserGroupsManager.tsx:90:13",className:"w-4 h-4 mr-1"}),"新建用户组"]})]})]}),k?e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:96:9",className:"flex justify-center py-12",children:e.jsx(K,{"code-path":"src/components/deploy/UserGroupsManager.tsx:96:52",className:"w-6 h-6 animate-spin text-[var(--dg-text-secondary)]"})}):G.length===0?e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:98:9",className:"text-center py-12 text-[var(--dg-text-secondary)]",children:[e.jsx(w,{"code-path":"src/components/deploy/UserGroupsManager.tsx:99:11",className:"w-10 h-10 mx-auto mb-3 opacity-30"}),e.jsx("p",{"code-path":"src/components/deploy/UserGroupsManager.tsx:100:11",children:"暂无用户组,点击「新建用户组」创建"})]}):e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:103:9",className:"space-y-3",children:G.map(s=>e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:105:13",className:"border border-[var(--dg-border)] rounded-lg bg-[var(--dg-bg-secondary)]",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:106:15",className:"flex items-center justify-between p-4",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:107:17",className:"flex items-center gap-3",style:{cursor:"pointer"},onClick:()=>P(s.id),children:[e.jsx(V,{"code-path":"src/components/deploy/UserGroupsManager.tsx:108:19",className:"w-5 h-5 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:109:19",children:[e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:110:21",className:"font-medium text-[var(--dg-text-primary)]",children:s.name}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:111:21",className:"text-xs text-[var(--dg-text-secondary)]",children:[s.description||"暂无描述"," · ",(s.members||[]).length," 位成员"]})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:114:17",className:"flex items-center gap-2",children:[e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:115:19",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{M(s.id),m(s.name),h(s.description||""),p(!0)},children:e.jsx(X,{"code-path":"src/components/deploy/UserGroupsManager.tsx:116:21",className:"w-4 h-4"})}),e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:118:19",variant:"ghost",size:"icon",className:"h-8 w-8 text-red-500",onClick:()=>L(s),children:e.jsx(_,{"code-path":"src/components/deploy/UserGroupsManager.tsx:119:21",className:"w-4 h-4"})})]})]}),S[s.id]&&e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:125:17",className:"border-t border-[var(--dg-border)] px-4 py-3 space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:127:19",className:"flex items-end gap-2",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:128:21",className:"flex-1 space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/UserGroupsManager.tsx:128:55",className:"text-xs",children:"添加用户"}),e.jsx(u,{"code-path":"src/components/deploy/UserGroupsManager.tsx:129:23",value:f[s.id]||"",onChange:r=>N(d=>({...d,[s.id]:r.target.value})),placeholder:"输入用户名",className:"h-8 text-sm",onKeyDown:r=>r.key==="Enter"&&b(s.id)})]}),e.jsxs(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:131:21",size:"sm",className:"h-8",onClick:()=>b(s.id),children:[e.jsx(q,{"code-path":"src/components/deploy/UserGroupsManager.tsx:131:93",className:"w-3.5 h-3.5 mr-1"}),"添加"]})]}),(s.members||[]).length===0?e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:135:21",className:"text-xs text-[var(--dg-text-secondary)] py-2",children:"暂无成员"}):e.jsx("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:137:21",className:"flex flex-wrap gap-2",children:(s.members||[]).map(r=>e.jsxs(I,{"code-path":"src/components/deploy/UserGroupsManager.tsx:139:25",variant:"secondary",className:"flex items-center gap-1 pl-2 pr-1 py-1.5",children:[e.jsx(w,{"code-path":"src/components/deploy/UserGroupsManager.tsx:140:27",className:"w-3 h-3"}),r.username,e.jsx("button",{"code-path":"src/components/deploy/UserGroupsManager.tsx:141:27",className:"ml-1 hover:text-red-400",onClick:()=>B(s.id,r.id,r.username),children:e.jsx(J,{"code-path":"src/components/deploy/UserGroupsManager.tsx:142:29",className:"w-3 h-3"})})]},r.id))})]})]},s.id))}),e.jsx(F,{"code-path":"src/components/deploy/UserGroupsManager.tsx:156:7",open:E,onOpenChange:p,children:e.jsxs(O,{"code-path":"src/components/deploy/UserGroupsManager.tsx:157:9",children:[e.jsx(T,{"code-path":"src/components/deploy/UserGroupsManager.tsx:158:11",children:e.jsx(A,{"code-path":"src/components/deploy/UserGroupsManager.tsx:158:25",children:l?"编辑用户组":"新建用户组"})}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:159:11",className:"space-y-3",children:[e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:160:13",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/UserGroupsManager.tsx:160:40",children:"组名"}),e.jsx(u,{"code-path":"src/components/deploy/UserGroupsManager.tsx:160:57",value:i,onChange:s=>m(s.target.value),placeholder:"例如: 后端开发组"})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:161:13",className:"space-y-1",children:[e.jsx(y,{"code-path":"src/components/deploy/UserGroupsManager.tsx:161:40",children:"描述"}),e.jsx(u,{"code-path":"src/components/deploy/UserGroupsManager.tsx:161:57",value:x,onChange:s=>h(s.target.value),placeholder:"可选"})]})]}),e.jsxs("div",{"code-path":"src/components/deploy/UserGroupsManager.tsx:163:11",className:"flex justify-end gap-2 mt-4 pt-4 border-t",children:[e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:164:13",variant:"outline",onClick:()=>p(!1),children:"取消"}),e.jsx(t,{"code-path":"src/components/deploy/UserGroupsManager.tsx:165:13",onClick:z,disabled:U,children:U?"...":"保存"})]})]})})]})}export{oe as default}; diff --git a/backend/static/assets/WorkloadViewPage-C6aQleIG.js b/backend/static/assets/WorkloadViewPage-C6aQleIG.js new file mode 100644 index 0000000..38c753f --- /dev/null +++ b/backend/static/assets/WorkloadViewPage-C6aQleIG.js @@ -0,0 +1 @@ +import{r as d,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{C as V,a as W,b as y,c as S}from"./card-BHSBTtub.js";import{g as Te,i as Re,k as Le,f as $e,B as p}from"./index-Bp-M7P_8.js";import{B as j}from"./badge-B00SZHvE.js";import{T as re,a as ce,b as C,c as h,d as le,e as i}from"./table-u8V9iTZf.js";import{k as U}from"./index-BkulU9RM.js";import{u as Ae}from"./use-toast-DNZLibQY.js";import{Y as de,P as Me,a as Be}from"./PodFileBrowser-CVjj8HxI.js";import{S as w,f as ie,s as q}from"./k8s-yaml-utils-4KZB_Bq_.js";import{m as ze,B as xe,n as Oe,o as Fe,p as _e,q as De,D as He,k as he,A as Ye,r as Ee,H as qe,s as Ie,P as Je}from"./vendor-icons-BWk-DH7F.js";import"./select-DbhcBWnH.js";import"./index-5FEebgvX.js";import"./vendor-xterm-20M9KZE1.js";function c({label:t,value:x,sub:P,color:u}){return e.jsx(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:29:5",className:"bg-slate-900 border-slate-800",children:e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:30:7",className:"p-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:31:9",className:"text-xs text-slate-500",children:t}),e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:32:9",className:"text-base font-bold mt-0.5",style:{color:u||"#e2e8f0"},children:x}),P&&e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:33:17",className:"text-[10px] text-slate-600 mt-0.5",children:P})]})})}function me({labels:t}){const x=Object.entries(t||{});return x.length===0?e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:42:36",className:"text-xs text-slate-600",children:"无"}):e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:44:5",className:"flex flex-wrap gap-1.5",children:x.map(([P,u])=>e.jsxs(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:46:9",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px] font-mono",children:[P,"=",u]},P))})}function ls(){const t=Te(),x=Re(),P=Le(),{toast:u}=Ae(),ke=$e(),n=t.clusterCode||"",r=t.namespace||"",l=t.name||"",m=P.pathname.includes("/DaemonSet/")?"DaemonSet":"StatefulSet",T=t.mode==="yaml"?"yaml":"view",[N,ue]=d.useState(null),[R,be]=d.useState([]),[ge,I]=d.useState(!0),[we,L]=d.useState(!1),[v,F]=d.useState(1),[$,A]=d.useState(!1),[_,J]=d.useState(null),[D,K]=d.useState(null),[je,G]=d.useState(!1),M=d.useCallback(async()=>{I(!0);try{const[s,o]=await Promise.all([U.getResourceYaml(n,r,m.toLowerCase()+"s",l).catch(()=>""),U.getPods(n).catch(()=>[])]);let f=null;if(s&&typeof s=="string")try{f=JSON.parse(s)}catch{f={_raw:s}}else s&&typeof s=="object"&&(f=s);ue(f);const E=(Array.isArray(o)?o:o?.list||o?.data||[]).filter(O=>{const Ue=O.name||O.metadata?.name||"",ne=O.namespace||O.namespace_name||"";return Ue.startsWith(l)&&(!ne||ne===r)});be(E)}catch(s){console.error("load error",s)}finally{I(!1)}},[n,r,l,m]);d.useEffect(()=>{M()},[M]);const Q=s=>{s!==T&&x(`/kubernetes/${n}/namespace/${r}/workload/${s}/${m}/${l}`,{replace:!0})},Pe=async()=>{if(await ke({title:"滚动重启",description:`确认重启 ${m} ${l}?将触发滚动重启。`,confirmText:"重启"})){A(!0);try{m==="StatefulSet"?await U.restartStatefulSet(n,r,l):await U.restartDaemonSet(n,r,l),u({title:"重启指令已下发",description:`${m} 滚动重启已触发`}),setTimeout(M,1e3)}catch(o){u({title:"重启失败",description:o?.message||String(o),variant:"destructive"})}finally{A(!1)}}},Ve=async()=>{A(!0);try{await U.scaleStatefulSet(n,r,l,v),u({title:"扩缩容成功",description:`StatefulSet 副本数已更新为 ${v}`}),L(!1),setTimeout(M,1e3)}catch(s){u({title:"扩缩容失败",description:s?.message||String(s),variant:"destructive"})}finally{A(!1)}},k=N?.spec||{},b=N?.status||{},X=k?.template?.spec?.containers||[],Z=k?.template?.spec?.initContainers||[],B=k.replicas??1,ee=b.readyReplicas??0,We=b.currentReplicas??0,Ne=b.updatedReplicas??0,H=b.desiredNumberScheduled??0,fe=b.currentNumberScheduled??0,se=b.numberReady??0,ve=b.numberAvailable??0,ye=b.updatedNumberScheduled??0,g=m==="StatefulSet",z=g?ee===B&&B>0:se===H&&H>0,a=k.updateStrategy||{},Y=a.type||"RollingUpdate",te=k.volumeClaimTemplates||[],Se=k.selector?.matchLabels||{},Ce=N?.metadata?.labels||{},ae=N?.metadata?.annotations||{};return e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:190:5",className:"p-4 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:192:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:193:9",className:"flex items-center gap-3",children:[e.jsx(p,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:194:11",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-200",onClick:()=>x(-1),children:e.jsx(ze,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:195:13",className:"h-4 w-4"})}),e.jsx(xe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:197:11",className:"h-5 w-5 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:198:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:199:13",className:"flex items-center gap-2",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:200:15",className:"text-lg font-bold text-slate-100",children:l}),e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:201:15",variant:"outline",className:"border-slate-700 text-slate-400",children:m}),e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:202:15",variant:"outline",className:"border-slate-700 text-slate-400",children:r}),z?e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:204:19",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"健康"}):e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:205:19",className:"bg-amber-500/20 text-amber-400 border-amber-500/30",children:"更新中"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:207:13",className:"text-xs text-slate-500 mt-0.5",children:["集群: ",n]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:210:9",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:212:11",className:"flex items-center gap-1 bg-slate-900 border border-slate-800 rounded-lg p-0.5",children:[e.jsx("button",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:213:13",className:`px-3 py-1 text-xs rounded transition-colors ${T==="view"?"bg-blue-500/20 text-blue-400":"text-slate-400 hover:text-slate-200"}`,onClick:()=>Q("view"),children:"查看"}),e.jsx("button",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:217:13",className:`px-3 py-1 text-xs rounded transition-colors ${T==="yaml"?"bg-blue-500/20 text-blue-400":"text-slate-400 hover:text-slate-200"}`,onClick:()=>Q("yaml"),children:"YAML"})]}),g&&e.jsxs(p,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:224:13",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 hover:text-slate-100",onClick:()=>{F(B),L(!0)},children:[e.jsx(xe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:226:15",className:"h-3.5 w-3.5 mr-1"}),"伸缩"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:229:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 hover:text-slate-100",disabled:$,onClick:Pe,children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:231:13",className:"h-3.5 w-3.5 mr-1"}),$?"重启中...":"重启"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:233:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 hover:text-slate-100",onClick:()=>G(!0),children:[e.jsx(Fe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:235:13",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]})]}),ge?e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:241:9",className:"text-center text-slate-500 py-20",children:"加载中..."}):T==="yaml"?e.jsx(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:243:9",className:"bg-slate-900 border-slate-800",children:e.jsx(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:244:11",className:"p-4",children:e.jsx(de,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:245:13",clusterCode:n,namespace:r,resource:m.toLowerCase()+"s",name:l,onClose:()=>{},inline:!0,autoEdit:!0})})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:259:11",className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:g?e.jsxs(e.Fragment,{children:[e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:262:17",label:"副本就绪",value:`${ee}/${B}`,color:z?w.green:w.orange,sub:z?"全部就绪":"部分未就绪"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:263:17",label:"当前副本",value:We,color:w.blue}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:264:17",label:"已更新副本",value:Ne,color:w.green}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:265:17",label:"服务名",value:k.serviceName||"-",color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:266:17",label:"Pod 数量",value:R.length,color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:267:17",label:"创建时间",value:e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:267:47",className:"text-xs",children:ie(N?.metadata?.creationTimestamp)}),color:"#94a3b8"})]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:271:17",label:"期望调度",value:H,color:w.blue}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:272:17",label:"当前调度",value:fe,color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:273:17",label:"就绪数量",value:se,color:z?w.green:w.orange}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:274:17",label:"可用数量",value:ve,color:w.green}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:275:17",label:"已更新",value:ye,color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:276:17",label:"创建时间",value:e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:276:47",className:"text-xs",children:ie(N?.metadata?.creationTimestamp)}),color:"#94a3b8"})]})}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:282:11",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:283:13",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:284:15",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:285:17",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(_e,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:286:19",className:"h-4 w-4 text-amber-400"}),"更新策略"]})}),e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:289:15",className:"pt-0 space-y-2 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:290:17",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:291:19",className:"text-slate-500",children:"策略类型"}),e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:292:19",variant:"outline",className:"border-slate-700 text-slate-300",children:Y})]}),Y==="RollingUpdate"&&g&&a.rollingUpdate&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:296:21",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:297:23",className:"text-slate-500",children:"分区 (partition)"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:298:23",className:"text-slate-300 font-mono",children:a.rollingUpdate.partition??0})]}),a.rollingUpdate.maxUnavailable&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:301:23",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:302:25",className:"text-slate-500",children:"最大不可用"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:303:25",className:"text-slate-300 font-mono",children:typeof a.rollingUpdate.maxUnavailable=="object"?JSON.stringify(a.rollingUpdate.maxUnavailable):a.rollingUpdate.maxUnavailable})]})]}),Y==="RollingUpdate"&&!g&&a.rollingUpdate&&e.jsxs(e.Fragment,{children:[a.rollingUpdate.maxUnavailable&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:311:23",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:312:25",className:"text-slate-500",children:"最大不可用"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:313:25",className:"text-slate-300 font-mono",children:typeof a.rollingUpdate.maxUnavailable=="object"?JSON.stringify(a.rollingUpdate.maxUnavailable):a.rollingUpdate.maxUnavailable})]}),a.rollingUpdate.maxSurge&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:317:23",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:318:25",className:"text-slate-500",children:"最大 surge"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:319:25",className:"text-slate-300 font-mono",children:typeof a.rollingUpdate.maxSurge=="object"?JSON.stringify(a.rollingUpdate.maxSurge):a.rollingUpdate.maxSurge})]})]}),g&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:325:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:326:21",className:"text-slate-500",children:"Pod 管理策略"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:327:21",className:"text-slate-300 font-mono",children:k.podManagementPolicy||"OrderedReady"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:330:17",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:331:19",className:"text-slate-500",children:"修订历史限制"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:332:19",className:"text-slate-300 font-mono",children:k.revisionHistoryLimit??10})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:337:13",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:338:15",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:339:17",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(De,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:340:19",className:"h-4 w-4 text-purple-400"}),"选择器与标签"]})}),e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:343:15",className:"pt-0 space-y-3 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:344:17",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:345:19",className:"text-slate-500 mb-1.5",children:"Selector (matchLabels)"}),e.jsx(me,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:346:19",labels:Se})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:348:17",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:349:19",className:"text-slate-500 mb-1.5",children:"Labels"}),e.jsx(me,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:350:19",labels:Ce})]}),Object.keys(ae).length>0&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:353:19",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:354:21",className:"text-slate-500 mb-1.5",children:"Annotations"}),e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:355:21",className:"flex flex-wrap gap-1.5",children:Object.entries(ae).slice(0,8).map(([s,o])=>e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:357:25",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px] font-mono max-w-[300px] truncate",children:s},s))})]})]})]})]}),g&&te.length>0&&e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:370:13",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:371:15",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:372:17",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(He,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:373:19",className:"h-4 w-4 text-cyan-400"}),"存储卷声明模板 (VolumeClaimTemplates)"]})}),e.jsx(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:376:15",className:"pt-0",children:e.jsxs(re,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:377:17",children:[e.jsx(ce,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:378:19",children:e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:379:21",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:380:23",className:"text-slate-400",children:"名称"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:381:23",className:"text-slate-400",children:"访问模式"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:382:23",className:"text-slate-400",children:"存储类"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:383:23",className:"text-slate-400",children:"大小"})]})}),e.jsx(le,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:386:19",children:te.map((s,o)=>{const f=(s.spec?.accessModes||[]).join(", "),oe=s.spec?.storageClassName||s.spec?.storageClassName||"-",E=s.spec?.resources?.requests?.storage||"-";return e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:392:25",className:"border-slate-800",children:[e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:393:27",className:"font-medium text-slate-200",children:s.metadata?.name||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:394:27",className:"text-sm text-slate-400",children:f||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:395:27",className:"text-sm text-slate-400",children:oe}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:396:27",className:"text-sm text-slate-300 font-mono",children:E})]},o)})})]})})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:407:11",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:408:13",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:409:15",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(he,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:410:17",className:"h-4 w-4 text-blue-400"}),"容器模板(Pod Template)"]})}),e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:413:13",className:"pt-0",children:[Z.length>0&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:415:17",className:"mb-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:416:19",className:"text-[11px] text-slate-500 mb-2 uppercase tracking-wide",children:"Init Containers"}),e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:417:19",className:"space-y-2",children:Z.map((s,o)=>e.jsx(pe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:419:23",c:s},`init-${o}`))})]}),X.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:425:17",className:"text-xs text-slate-500 py-3",children:"暂无容器数据,请查看 YAML"}):e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:427:17",className:"space-y-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:428:19",className:"text-[11px] text-slate-500 mb-1 uppercase tracking-wide",children:"Containers"}),X.map((s,o)=>e.jsx(pe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:430:21",c:s},o))]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:438:11",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:439:13",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:440:15",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ye,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:441:17",className:"h-4 w-4 text-emerald-400"}),"Pod 实例 (",R.length,")"]})}),e.jsx(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:444:13",className:"p-0",children:e.jsxs(re,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:445:15",children:[e.jsx(ce,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:446:17",children:e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:447:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:448:21",className:"text-slate-400",children:"Pod 名称"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:449:21",className:"text-slate-400",children:"状态"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:450:21",className:"text-slate-400",children:"所在节点"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:451:21",className:"text-slate-400",children:"Pod IP"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:452:21",className:"text-slate-400",children:"重启"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:453:21",className:"text-slate-400",children:"操作"})]})}),e.jsx(le,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:456:17",children:R.length===0?e.jsx(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:458:21",children:e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:458:31",colSpan:6,className:"text-center text-slate-500 py-8",children:"暂无 Pod"})}):R.map(s=>e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:460:21",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:461:23",className:"font-medium text-slate-200",children:s.name}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:462:23",children:e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:463:25",style:{background:`${q(s.status)}22`,color:q(s.status),border:`1px solid ${q(s.status)}44`},children:s.status||"Unknown"})}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:467:23",className:"text-sm text-slate-400",children:s.node_name||s.node||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:468:23",className:"text-sm text-slate-400 font-mono",children:s.ip||s.pod_ip||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:469:23",className:(s.restart_count||0)>0?"text-yellow-400":"text-slate-500",children:s.restart_count||0}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:470:23",children:e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:471:25",className:"flex items-center gap-1",children:[e.jsxs(p,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:472:27",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300 hover:bg-emerald-500/10",onClick:()=>J(s),children:[e.jsx(Ee,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:474:29",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(p,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:476:27",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-amber-400 hover:text-amber-300 hover:bg-amber-500/10",onClick:()=>K(s),children:[e.jsx(qe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:478:29",className:"h-3.5 w-3.5 mr-1"}),"文件浏览器"]})]})})]},s.name))})]})})]})]}),we&&e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:493:9",className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center",onClick:()=>L(!1),children:e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:494:11",className:"bg-slate-900 border border-slate-800 rounded-lg p-6 w-80",onClick:s=>s.stopPropagation(),children:[e.jsx("h3",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:495:13",className:"text-sm font-semibold text-slate-200 mb-4",children:"伸缩 StatefulSet"}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:496:13",className:"flex items-center justify-center gap-4 mb-4",children:[e.jsx(p,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:497:15",variant:"outline",size:"icon",className:"h-9 w-9",onClick:()=>F(Math.max(0,v-1)),children:e.jsx(Ie,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:498:17",className:"h-4 w-4"})}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:500:15",className:"text-2xl font-bold text-slate-100 w-12 text-center",children:v}),e.jsx(p,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:501:15",variant:"outline",size:"icon",className:"h-9 w-9",onClick:()=>F(v+1),children:e.jsx(Je,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:502:17",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:505:13",className:"flex gap-2",children:[e.jsx(p,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:506:15",variant:"outline",size:"sm",className:"flex-1 border-slate-700 text-slate-400",onClick:()=>L(!1),children:"取消"}),e.jsx(p,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:507:15",size:"sm",className:"flex-1 bg-blue-600 hover:bg-blue-500",disabled:$,onClick:Ve,children:$?"执行中...":"确认"})]})]})}),je&&e.jsx(de,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:517:9",clusterCode:n,namespace:r,resource:m.toLowerCase()+"s",name:l,onClose:()=>G(!1)}),_&&e.jsx(Me,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:528:9",open:!0,onOpenChange:s=>{s||J(null)},clusterId:n,namespace:r,podName:_.name,containers:_.containers?.map(s=>s.name).filter(Boolean)||[]}),D&&e.jsx(Be,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:540:9",open:!0,onOpenChange:s=>{s||K(null)},clusterCode:n,namespace:r,podName:D.name,containers:D.containers?.map(s=>s.name).filter(Boolean)||[]})]})}function pe({c:t}){return e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:556:5",className:"border border-slate-800 rounded-lg p-3 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:557:7",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:558:9",className:"flex items-center gap-2",children:[e.jsx(he,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:559:11",className:"h-4 w-4 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:560:11",className:"text-sm font-semibold text-slate-200",children:t.name})]}),e.jsx("code",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:562:9",className:"text-[11px] text-slate-400 font-mono truncate max-w-[400px]",children:t.image})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:564:7",className:"grid grid-cols-2 md:grid-cols-3 gap-2 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:565:9",className:"text-slate-400",children:["CPU: ",e.jsxs("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:566:16",className:"text-slate-200 font-mono",children:[t.resources?.requests?.cpu||"-","/",t.resources?.limits?.cpu||"-"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:568:9",className:"text-slate-400",children:["内存: ",e.jsxs("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:569:15",className:"text-slate-200 font-mono",children:[t.resources?.requests?.memory||"-","/",t.resources?.limits?.memory||"-"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:571:9",className:"text-slate-400",children:["端口: ",e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:572:15",className:"text-slate-200 font-mono",children:(t.ports||[]).map(x=>x.containerPort||x.port).join(", ")||"-"})]})]})]})}export{ls as default}; diff --git a/backend/static/assets/WorkloadViewPage-DSiv67B6.js b/backend/static/assets/WorkloadViewPage-DSiv67B6.js deleted file mode 100644 index 54048bb..0000000 --- a/backend/static/assets/WorkloadViewPage-DSiv67B6.js +++ /dev/null @@ -1 +0,0 @@ -import{r as d,j as e}from"./vendor-codemirror-C7mXSpXt.js";import{C as V,a as W,b as y,c as S}from"./card-B-RtdR4H.js";import{g as Te,i as Re,k as Le,f as $e,B as m}from"./index-LZWfu62c.js";import{B as j}from"./badge-B0F5ZNtn.js";import{T as re,a as ce,b as C,c as h,d as le,e as i}from"./table-BPFYQwjr.js";import{k as U}from"./index-Z0O8nAcG.js";import{u as Ae}from"./use-toast-CkA38LVP.js";import{Y as de,S as w,f as ie,s as q,P as Me,a as Be}from"./PodFileBrowser-Bs6KRfHw.js";import{m as ze,B as xe,n as Oe,o as Fe,p as _e,q as De,D as He,k as he,A as Ye,r as Ee,H as qe,s as Ie,P as Je}from"./vendor-icons-Aso0-eeY.js";import"./select-4xU_9B3_.js";import"./index-CYARH0Cq.js";import"./vendor-xterm-20M9KZE1.js";function c({label:t,value:x,sub:P,color:u}){return e.jsx(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:29:5",className:"bg-slate-900 border-slate-800",children:e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:30:7",className:"p-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:31:9",className:"text-xs text-slate-500",children:t}),e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:32:9",className:"text-base font-bold mt-0.5",style:{color:u||"#e2e8f0"},children:x}),P&&e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:33:17",className:"text-[10px] text-slate-600 mt-0.5",children:P})]})})}function pe({labels:t}){const x=Object.entries(t||{});return x.length===0?e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:42:36",className:"text-xs text-slate-600",children:"无"}):e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:44:5",className:"flex flex-wrap gap-1.5",children:x.map(([P,u])=>e.jsxs(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:46:9",variant:"outline",className:"border-slate-700 text-slate-400 text-[10px] font-mono",children:[P,"=",u]},P))})}function cs(){const t=Te(),x=Re(),P=Le(),{toast:u}=Ae(),ke=$e(),n=t.clusterCode||"",r=t.namespace||"",l=t.name||"",p=P.pathname.includes("/DaemonSet/")?"DaemonSet":"StatefulSet",T=t.mode==="yaml"?"yaml":"view",[N,ue]=d.useState(null),[R,be]=d.useState([]),[ge,I]=d.useState(!0),[we,L]=d.useState(!1),[v,F]=d.useState(1),[$,A]=d.useState(!1),[_,J]=d.useState(null),[D,K]=d.useState(null),[je,G]=d.useState(!1),M=d.useCallback(async()=>{I(!0);try{const[s,o]=await Promise.all([U.getResourceYaml(n,r,p.toLowerCase()+"s",l).catch(()=>""),U.getPods(n).catch(()=>[])]);let f=null;if(s&&typeof s=="string")try{f=JSON.parse(s)}catch{f={_raw:s}}else s&&typeof s=="object"&&(f=s);ue(f);const E=(Array.isArray(o)?o:o?.list||o?.data||[]).filter(O=>{const Ue=O.name||O.metadata?.name||"",ne=O.namespace||O.namespace_name||"";return Ue.startsWith(l)&&(!ne||ne===r)});be(E)}catch(s){console.error("load error",s)}finally{I(!1)}},[n,r,l,p]);d.useEffect(()=>{M()},[M]);const Q=s=>{s!==T&&x(`/kubernetes/${n}/namespace/${r}/workload/${s}/${p}/${l}`,{replace:!0})},Pe=async()=>{if(await ke({title:"滚动重启",description:`确认重启 ${p} ${l}?将触发滚动重启。`,confirmText:"重启"})){A(!0);try{p==="StatefulSet"?await U.restartStatefulSet(n,r,l):await U.restartDaemonSet(n,r,l),u({title:"重启指令已下发",description:`${p} 滚动重启已触发`}),setTimeout(M,1e3)}catch(o){u({title:"重启失败",description:o?.message||String(o),variant:"destructive"})}finally{A(!1)}}},Ve=async()=>{A(!0);try{await U.scaleStatefulSet(n,r,l,v),u({title:"扩缩容成功",description:`StatefulSet 副本数已更新为 ${v}`}),L(!1),setTimeout(M,1e3)}catch(s){u({title:"扩缩容失败",description:s?.message||String(s),variant:"destructive"})}finally{A(!1)}},k=N?.spec||{},b=N?.status||{},X=k?.template?.spec?.containers||[],Z=k?.template?.spec?.initContainers||[],B=k.replicas??1,ee=b.readyReplicas??0,We=b.currentReplicas??0,Ne=b.updatedReplicas??0,H=b.desiredNumberScheduled??0,fe=b.currentNumberScheduled??0,se=b.numberReady??0,ve=b.numberAvailable??0,ye=b.updatedNumberScheduled??0,g=p==="StatefulSet",z=g?ee===B&&B>0:se===H&&H>0,a=k.updateStrategy||{},Y=a.type||"RollingUpdate",te=k.volumeClaimTemplates||[],Se=k.selector?.matchLabels||{},Ce=N?.metadata?.labels||{},ae=N?.metadata?.annotations||{};return e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:190:5",className:"p-4 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:192:7",className:"flex items-center justify-between",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:193:9",className:"flex items-center gap-3",children:[e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:194:11",variant:"ghost",size:"icon",className:"h-8 w-8 text-slate-400 hover:text-slate-200",onClick:()=>x(-1),children:e.jsx(ze,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:195:13",className:"h-4 w-4"})}),e.jsx(xe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:197:11",className:"h-5 w-5 text-blue-400"}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:198:11",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:199:13",className:"flex items-center gap-2",children:[e.jsx("h1",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:200:15",className:"text-lg font-bold text-slate-100",children:l}),e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:201:15",variant:"outline",className:"border-slate-700 text-slate-400",children:p}),e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:202:15",variant:"outline",className:"border-slate-700 text-slate-400",children:r}),z?e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:204:19",className:"bg-emerald-500/20 text-emerald-400 border-emerald-500/30",children:"健康"}):e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:205:19",className:"bg-amber-500/20 text-amber-400 border-amber-500/30",children:"更新中"})]}),e.jsxs("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:207:13",className:"text-xs text-slate-500 mt-0.5",children:["集群: ",n]})]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:210:9",className:"flex items-center gap-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:212:11",className:"flex items-center gap-1 bg-slate-900 border border-slate-800 rounded-lg p-0.5",children:[e.jsx("button",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:213:13",className:`px-3 py-1 text-xs rounded transition-colors ${T==="view"?"bg-blue-500/20 text-blue-400":"text-slate-400 hover:text-slate-200"}`,onClick:()=>Q("view"),children:"查看"}),e.jsx("button",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:217:13",className:`px-3 py-1 text-xs rounded transition-colors ${T==="yaml"?"bg-blue-500/20 text-blue-400":"text-slate-400 hover:text-slate-200"}`,onClick:()=>Q("yaml"),children:"YAML"})]}),g&&e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:224:13",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 hover:text-slate-100",onClick:()=>{F(B),L(!0)},children:[e.jsx(xe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:226:15",className:"h-3.5 w-3.5 mr-1"}),"伸缩"]}),e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:229:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 hover:text-slate-100",disabled:$,onClick:Pe,children:[e.jsx(Oe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:231:13",className:"h-3.5 w-3.5 mr-1"}),$?"重启中...":"重启"]}),e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:233:11",variant:"outline",size:"sm",className:"h-8 border-slate-700 text-slate-300 hover:text-slate-100",onClick:()=>G(!0),children:[e.jsx(Fe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:235:13",className:"h-3.5 w-3.5 mr-1"}),"YAML"]})]})]}),ge?e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:241:9",className:"text-center text-slate-500 py-20",children:"加载中..."}):T==="yaml"?e.jsx(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:243:9",className:"bg-slate-900 border-slate-800",children:e.jsx(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:244:11",className:"p-4",children:e.jsx(de,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:245:13",clusterCode:n,namespace:r,resource:p.toLowerCase()+"s",name:l,onClose:()=>{},inline:!0,autoEdit:!0})})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:259:11",className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-3",children:g?e.jsxs(e.Fragment,{children:[e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:262:17",label:"副本就绪",value:`${ee}/${B}`,color:z?w.green:w.orange,sub:z?"全部就绪":"部分未就绪"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:263:17",label:"当前副本",value:We,color:w.blue}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:264:17",label:"已更新副本",value:Ne,color:w.green}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:265:17",label:"服务名",value:k.serviceName||"-",color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:266:17",label:"Pod 数量",value:R.length,color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:267:17",label:"创建时间",value:e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:267:47",className:"text-xs",children:ie(N?.metadata?.creationTimestamp)}),color:"#94a3b8"})]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:271:17",label:"期望调度",value:H,color:w.blue}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:272:17",label:"当前调度",value:fe,color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:273:17",label:"就绪数量",value:se,color:z?w.green:w.orange}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:274:17",label:"可用数量",value:ve,color:w.green}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:275:17",label:"已更新",value:ye,color:"#94a3b8"}),e.jsx(c,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:276:17",label:"创建时间",value:e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:276:47",className:"text-xs",children:ie(N?.metadata?.creationTimestamp)}),color:"#94a3b8"})]})}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:282:11",className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:283:13",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:284:15",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:285:17",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(_e,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:286:19",className:"h-4 w-4 text-amber-400"}),"更新策略"]})}),e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:289:15",className:"pt-0 space-y-2 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:290:17",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:291:19",className:"text-slate-500",children:"策略类型"}),e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:292:19",variant:"outline",className:"border-slate-700 text-slate-300",children:Y})]}),Y==="RollingUpdate"&&g&&a.rollingUpdate&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:296:21",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:297:23",className:"text-slate-500",children:"分区 (partition)"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:298:23",className:"text-slate-300 font-mono",children:a.rollingUpdate.partition??0})]}),a.rollingUpdate.maxUnavailable&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:301:23",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:302:25",className:"text-slate-500",children:"最大不可用"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:303:25",className:"text-slate-300 font-mono",children:typeof a.rollingUpdate.maxUnavailable=="object"?JSON.stringify(a.rollingUpdate.maxUnavailable):a.rollingUpdate.maxUnavailable})]})]}),Y==="RollingUpdate"&&!g&&a.rollingUpdate&&e.jsxs(e.Fragment,{children:[a.rollingUpdate.maxUnavailable&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:311:23",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:312:25",className:"text-slate-500",children:"最大不可用"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:313:25",className:"text-slate-300 font-mono",children:typeof a.rollingUpdate.maxUnavailable=="object"?JSON.stringify(a.rollingUpdate.maxUnavailable):a.rollingUpdate.maxUnavailable})]}),a.rollingUpdate.maxSurge&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:317:23",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:318:25",className:"text-slate-500",children:"最大 surge"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:319:25",className:"text-slate-300 font-mono",children:typeof a.rollingUpdate.maxSurge=="object"?JSON.stringify(a.rollingUpdate.maxSurge):a.rollingUpdate.maxSurge})]})]}),g&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:325:19",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:326:21",className:"text-slate-500",children:"Pod 管理策略"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:327:21",className:"text-slate-300 font-mono",children:k.podManagementPolicy||"OrderedReady"})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:330:17",className:"flex justify-between",children:[e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:331:19",className:"text-slate-500",children:"修订历史限制"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:332:19",className:"text-slate-300 font-mono",children:k.revisionHistoryLimit??10})]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:337:13",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:338:15",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:339:17",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(De,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:340:19",className:"h-4 w-4 text-purple-400"}),"选择器与标签"]})}),e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:343:15",className:"pt-0 space-y-3 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:344:17",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:345:19",className:"text-slate-500 mb-1.5",children:"Selector (matchLabels)"}),e.jsx(pe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:346:19",labels:Se})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:348:17",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:349:19",className:"text-slate-500 mb-1.5",children:"Labels"}),e.jsx(pe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:350:19",labels:Ce})]}),Object.keys(ae).length>0&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:353:19",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:354:21",className:"text-slate-500 mb-1.5",children:"Annotations"}),e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:355:21",className:"flex flex-wrap gap-1.5",children:Object.entries(ae).slice(0,8).map(([s,o])=>e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:357:25",variant:"outline",className:"border-slate-700 text-slate-500 text-[10px] font-mono max-w-[300px] truncate",children:s},s))})]})]})]})]}),g&&te.length>0&&e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:370:13",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:371:15",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:372:17",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(He,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:373:19",className:"h-4 w-4 text-cyan-400"}),"存储卷声明模板 (VolumeClaimTemplates)"]})}),e.jsx(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:376:15",className:"pt-0",children:e.jsxs(re,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:377:17",children:[e.jsx(ce,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:378:19",children:e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:379:21",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:380:23",className:"text-slate-400",children:"名称"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:381:23",className:"text-slate-400",children:"访问模式"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:382:23",className:"text-slate-400",children:"存储类"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:383:23",className:"text-slate-400",children:"大小"})]})}),e.jsx(le,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:386:19",children:te.map((s,o)=>{const f=(s.spec?.accessModes||[]).join(", "),oe=s.spec?.storageClassName||s.spec?.storageClassName||"-",E=s.spec?.resources?.requests?.storage||"-";return e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:392:25",className:"border-slate-800",children:[e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:393:27",className:"font-medium text-slate-200",children:s.metadata?.name||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:394:27",className:"text-sm text-slate-400",children:f||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:395:27",className:"text-sm text-slate-400",children:oe}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:396:27",className:"text-sm text-slate-300 font-mono",children:E})]},o)})})]})})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:407:11",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:408:13",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:409:15",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(he,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:410:17",className:"h-4 w-4 text-blue-400"}),"容器模板(Pod Template)"]})}),e.jsxs(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:413:13",className:"pt-0",children:[Z.length>0&&e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:415:17",className:"mb-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:416:19",className:"text-[11px] text-slate-500 mb-2 uppercase tracking-wide",children:"Init Containers"}),e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:417:19",className:"space-y-2",children:Z.map((s,o)=>e.jsx(me,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:419:23",c:s},`init-${o}`))})]}),X.length===0?e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:425:17",className:"text-xs text-slate-500 py-3",children:"暂无容器数据,请查看 YAML"}):e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:427:17",className:"space-y-3",children:[e.jsx("p",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:428:19",className:"text-[11px] text-slate-500 mb-1 uppercase tracking-wide",children:"Containers"}),X.map((s,o)=>e.jsx(me,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:430:21",c:s},o))]})]})]}),e.jsxs(V,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:438:11",className:"bg-slate-900 border-slate-800",children:[e.jsx(y,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:439:13",className:"pb-3",children:e.jsxs(S,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:440:15",className:"text-sm text-slate-200 flex items-center gap-2",children:[e.jsx(Ye,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:441:17",className:"h-4 w-4 text-emerald-400"}),"Pod 实例 (",R.length,")"]})}),e.jsx(W,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:444:13",className:"p-0",children:e.jsxs(re,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:445:15",children:[e.jsx(ce,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:446:17",children:e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:447:19",className:"border-slate-800 hover:bg-transparent",children:[e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:448:21",className:"text-slate-400",children:"Pod 名称"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:449:21",className:"text-slate-400",children:"状态"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:450:21",className:"text-slate-400",children:"所在节点"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:451:21",className:"text-slate-400",children:"Pod IP"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:452:21",className:"text-slate-400",children:"重启"}),e.jsx(h,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:453:21",className:"text-slate-400",children:"操作"})]})}),e.jsx(le,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:456:17",children:R.length===0?e.jsx(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:458:21",children:e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:458:31",colSpan:6,className:"text-center text-slate-500 py-8",children:"暂无 Pod"})}):R.map(s=>e.jsxs(C,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:460:21",className:"border-slate-800 hover:bg-slate-800/30",children:[e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:461:23",className:"font-medium text-slate-200",children:s.name}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:462:23",children:e.jsx(j,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:463:25",style:{background:`${q(s.status)}22`,color:q(s.status),border:`1px solid ${q(s.status)}44`},children:s.status||"Unknown"})}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:467:23",className:"text-sm text-slate-400",children:s.node_name||s.node||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:468:23",className:"text-sm text-slate-400 font-mono",children:s.ip||s.pod_ip||"-"}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:469:23",className:(s.restart_count||0)>0?"text-yellow-400":"text-slate-500",children:s.restart_count||0}),e.jsx(i,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:470:23",children:e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:471:25",className:"flex items-center gap-1",children:[e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:472:27",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-emerald-400 hover:text-emerald-300 hover:bg-emerald-500/10",onClick:()=>J(s),children:[e.jsx(Ee,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:474:29",className:"h-3.5 w-3.5 mr-1"}),"终端"]}),e.jsxs(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:476:27",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-amber-400 hover:text-amber-300 hover:bg-amber-500/10",onClick:()=>K(s),children:[e.jsx(qe,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:478:29",className:"h-3.5 w-3.5 mr-1"}),"文件浏览器"]})]})})]},s.name))})]})})]})]}),we&&e.jsx("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:493:9",className:"fixed inset-0 bg-black/60 z-50 flex items-center justify-center",onClick:()=>L(!1),children:e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:494:11",className:"bg-slate-900 border border-slate-800 rounded-lg p-6 w-80",onClick:s=>s.stopPropagation(),children:[e.jsx("h3",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:495:13",className:"text-sm font-semibold text-slate-200 mb-4",children:"伸缩 StatefulSet"}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:496:13",className:"flex items-center justify-center gap-4 mb-4",children:[e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:497:15",variant:"outline",size:"icon",className:"h-9 w-9",onClick:()=>F(Math.max(0,v-1)),children:e.jsx(Ie,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:498:17",className:"h-4 w-4"})}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:500:15",className:"text-2xl font-bold text-slate-100 w-12 text-center",children:v}),e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:501:15",variant:"outline",size:"icon",className:"h-9 w-9",onClick:()=>F(v+1),children:e.jsx(Je,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:502:17",className:"h-4 w-4"})})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:505:13",className:"flex gap-2",children:[e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:506:15",variant:"outline",size:"sm",className:"flex-1 border-slate-700 text-slate-400",onClick:()=>L(!1),children:"取消"}),e.jsx(m,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:507:15",size:"sm",className:"flex-1 bg-blue-600 hover:bg-blue-500",disabled:$,onClick:Ve,children:$?"执行中...":"确认"})]})]})}),je&&e.jsx(de,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:517:9",clusterCode:n,namespace:r,resource:p.toLowerCase()+"s",name:l,onClose:()=>G(!1)}),_&&e.jsx(Me,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:528:9",open:!0,onOpenChange:s=>{s||J(null)},clusterId:n,namespace:r,podName:_.name,containers:_.containers?.map(s=>s.name).filter(Boolean)||[]}),D&&e.jsx(Be,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:540:9",open:!0,onOpenChange:s=>{s||K(null)},clusterCode:n,namespace:r,podName:D.name,containers:D.containers?.map(s=>s.name).filter(Boolean)||[]})]})}function me({c:t}){return e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:556:5",className:"border border-slate-800 rounded-lg p-3 bg-slate-950/30",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:557:7",className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:558:9",className:"flex items-center gap-2",children:[e.jsx(he,{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:559:11",className:"h-4 w-4 text-blue-400"}),e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:560:11",className:"text-sm font-semibold text-slate-200",children:t.name})]}),e.jsx("code",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:562:9",className:"text-[11px] text-slate-400 font-mono truncate max-w-[400px]",children:t.image})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:564:7",className:"grid grid-cols-2 md:grid-cols-3 gap-2 text-xs",children:[e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:565:9",className:"text-slate-400",children:["CPU: ",e.jsxs("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:566:16",className:"text-slate-200 font-mono",children:[t.resources?.requests?.cpu||"-","/",t.resources?.limits?.cpu||"-"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:568:9",className:"text-slate-400",children:["内存: ",e.jsxs("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:569:15",className:"text-slate-200 font-mono",children:[t.resources?.requests?.memory||"-","/",t.resources?.limits?.memory||"-"]})]}),e.jsxs("div",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:571:9",className:"text-slate-400",children:["端口: ",e.jsx("span",{"code-path":"src/components/kubernetes/WorkloadViewPage.tsx:572:15",className:"text-slate-200 font-mono",children:(t.ports||[]).map(x=>x.containerPort||x.port).join(", ")||"-"})]})]})]})}export{cs as default}; diff --git a/backend/static/assets/account-Dzyhyahe.js b/backend/static/assets/account-CeWzarwh.js similarity index 91% rename from backend/static/assets/account-Dzyhyahe.js rename to backend/static/assets/account-CeWzarwh.js index b05175d..6734b17 100644 --- a/backend/static/assets/account-Dzyhyahe.js +++ b/backend/static/assets/account-CeWzarwh.js @@ -1 +1 @@ -import{h as c}from"./index-LZWfu62c.js";const o={getAccounts:async()=>c.get("/cloud-accounts"),createAccount:async n=>c.post("/cloud-accounts",n),updateAccount:async(n,t)=>c.put(`/cloud-accounts/${n}`,t),deleteAccount:async n=>c.delete(`/cloud-accounts/${n}`),syncRegions:async n=>c.post(`/cloud-accounts/${n}/sync-regions`),getAccountRegions:async n=>c.get(`/cloud-accounts/${n}/regions`),discoverInstances:async(n,t)=>c.post(`/cloud-accounts/${n}/discover-instances`,{regions:t}),importInstances:async(n,t,s)=>c.post(`/cloud-accounts/${n}/import-instances`,{instances:t,...s}),getDomains:async n=>c.get("/domains",n),createDomain:async n=>c.post("/domains",n),updateDomain:async(n,t)=>c.put(`/domains/${n}`,t),deleteDomain:async n=>c.delete(`/domains/${n}`)};export{o as c}; +import{h as c}from"./index-Bp-M7P_8.js";const o={getAccounts:async()=>c.get("/cloud-accounts"),createAccount:async n=>c.post("/cloud-accounts",n),updateAccount:async(n,t)=>c.put(`/cloud-accounts/${n}`,t),deleteAccount:async n=>c.delete(`/cloud-accounts/${n}`),syncRegions:async n=>c.post(`/cloud-accounts/${n}/sync-regions`),getAccountRegions:async n=>c.get(`/cloud-accounts/${n}/regions`),discoverInstances:async(n,t)=>c.post(`/cloud-accounts/${n}/discover-instances`,{regions:t}),importInstances:async(n,t,s)=>c.post(`/cloud-accounts/${n}/import-instances`,{instances:t,...s}),getDomains:async n=>c.get("/domains",n),createDomain:async n=>c.post("/domains",n),updateDomain:async(n,t)=>c.put(`/domains/${n}`,t),deleteDomain:async n=>c.delete(`/domains/${n}`)};export{o as c}; diff --git a/backend/static/assets/agent-g0Vk8FYK.js b/backend/static/assets/agent-BZUl25f5.js similarity index 94% rename from backend/static/assets/agent-g0Vk8FYK.js rename to backend/static/assets/agent-BZUl25f5.js index 5d9d78f..013a1cd 100644 --- a/backend/static/assets/agent-g0Vk8FYK.js +++ b/backend/static/assets/agent-BZUl25f5.js @@ -1 +1 @@ -import{h as t}from"./index-LZWfu62c.js";const g={getLatest:()=>t.get("/agent/latest"),getHistory:(e,a=1)=>t.get(`/agent/history/${e}?hours=${a}`),createTask:e=>t.post("/agent/tasks",e),listTasks:e=>t.get("/agent/tasks",e),execCommand:e=>t.post("/agent/exec",e),getAggregate:e=>t.get("/agent/aggregate",e),aggregate:e=>t.post("/agent/aggregate",e),listRules:()=>t.get("/agent/rules"),createRule:e=>t.post("/agent/rules",e),updateRule:(e,a)=>t.put(`/agent/rules/${e}`,a),deleteRule:e=>t.delete(`/agent/rules/${e}`),quickSetup:e=>t.post("/agent/rules/quick-setup",{type:e||"ecs"}),uninstallAgent:e=>t.post("/agent/uninstall",e),batchUninstall:e=>t.post("/agent/batch-uninstall",{server_ids:e}),batchUpgrade:e=>t.post("/agent/batch-upgrade",{server_ids:e}),listAlerts:e=>t.get("/agent/alerts",e),resolveAlert:e=>t.post(`/agent/alerts/${e}/resolve`),getHealthProbes:e=>t.get("/agent/health-probes",e),createHealthProbe:e=>t.post("/agent/health-probes",e),updateHealthProbe:(e,a)=>t.put(`/agent/health-probes/${e}`,a),deleteHealthProbe:e=>t.delete(`/agent/health-probes/${e}`),getPortPolicy:e=>t.get(`/agent/port-policies/${e}`),savePortPolicy:(e,a)=>t.put(`/agent/port-policies/${e}`,a)};export{g as a}; +import{h as t}from"./index-Bp-M7P_8.js";const g={getLatest:()=>t.get("/agent/latest"),getHistory:(e,a=1)=>t.get(`/agent/history/${e}?hours=${a}`),createTask:e=>t.post("/agent/tasks",e),listTasks:e=>t.get("/agent/tasks",e),execCommand:e=>t.post("/agent/exec",e),getAggregate:e=>t.get("/agent/aggregate",e),aggregate:e=>t.post("/agent/aggregate",e),listRules:()=>t.get("/agent/rules"),createRule:e=>t.post("/agent/rules",e),updateRule:(e,a)=>t.put(`/agent/rules/${e}`,a),deleteRule:e=>t.delete(`/agent/rules/${e}`),quickSetup:e=>t.post("/agent/rules/quick-setup",{type:e||"ecs"}),uninstallAgent:e=>t.post("/agent/uninstall",e),batchUninstall:e=>t.post("/agent/batch-uninstall",{server_ids:e}),batchUpgrade:e=>t.post("/agent/batch-upgrade",{server_ids:e}),listAlerts:e=>t.get("/agent/alerts",e),resolveAlert:e=>t.post(`/agent/alerts/${e}/resolve`),getHealthProbes:e=>t.get("/agent/health-probes",e),createHealthProbe:e=>t.post("/agent/health-probes",e),updateHealthProbe:(e,a)=>t.put(`/agent/health-probes/${e}`,a),deleteHealthProbe:e=>t.delete(`/agent/health-probes/${e}`),getPortPolicy:e=>t.get(`/agent/port-policies/${e}`),savePortPolicy:(e,a)=>t.put(`/agent/port-policies/${e}`,a)};export{g as a}; diff --git a/backend/static/assets/ai-BMSiZ3PN.js b/backend/static/assets/ai-ACl4D1kQ.js similarity index 95% rename from backend/static/assets/ai-BMSiZ3PN.js rename to backend/static/assets/ai-ACl4D1kQ.js index bb581fe..bcfa3d0 100644 --- a/backend/static/assets/ai-BMSiZ3PN.js +++ b/backend/static/assets/ai-ACl4D1kQ.js @@ -1,4 +1,4 @@ -import{h as o,o as h}from"./index-LZWfu62c.js";const C={getConfig:()=>o.get("/aiops/llm-config"),saveConfig:e=>o.put("/aiops/llm-config",e),testConnection:()=>o.post("/aiops/llm-config/test"),chat:(e,s)=>o.post("/aiops/chat",{messages:e,session_id:s||""}),chatStream:async(e,s,d,g)=>{const c=h.getState().token,n=await fetch("/api/v1/aiops/chat/stream",{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify({messages:e,session_id:g||""}),signal:d});if(n.status===401)throw h.getState().logout(),window.location.href="/login",new Error("登录已过期,请重新登录");if(!n.body)throw new Error("流式响应不可用");const m=n.body.getReader(),u=new TextDecoder("utf-8");let r="",f="";for(;;){const{done:w,value:y}=await m.read();if(w)break;r+=u.decode(y,{stream:!0});const p=r.split(` +import{h as o,o as h}from"./index-Bp-M7P_8.js";const C={getConfig:()=>o.get("/aiops/llm-config"),saveConfig:e=>o.put("/aiops/llm-config",e),testConnection:()=>o.post("/aiops/llm-config/test"),chat:(e,s)=>o.post("/aiops/chat",{messages:e,session_id:s||""}),chatStream:async(e,s,d,g)=>{const c=h.getState().token,n=await fetch("/api/v1/aiops/chat/stream",{method:"POST",headers:{"Content-Type":"application/json",...c?{Authorization:`Bearer ${c}`}:{}},body:JSON.stringify({messages:e,session_id:g||""}),signal:d});if(n.status===401)throw h.getState().logout(),window.location.href="/login",new Error("登录已过期,请重新登录");if(!n.body)throw new Error("流式响应不可用");const m=n.body.getReader(),u=new TextDecoder("utf-8");let r="",f="";for(;;){const{done:w,value:y}=await m.read();if(w)break;r+=u.decode(y,{stream:!0});const p=r.split(` `);r=p.pop()??"";for(const S of p){const b=S.split(` `);let a="message",l=[];for(const t of b)t.startsWith("event:")?a=t.slice(6).trim():t.startsWith("data:")&&l.push(t.slice(5).trim());const i=l.join("");if(i){if(a==="error")try{const t=JSON.parse(i);throw new Error(t.message||"LLM 流式响应错误")}catch(t){throw t instanceof Error&&t.message?t:new Error("LLM 流式响应错误")}if(a!=="done")try{const t=JSON.parse(i);typeof t.content=="string"&&(f+=t.content,s(t.content))}catch{}}}}return f},getHistory:e=>{const s=e?`?session_id=${encodeURIComponent(e)}`:"";return o.get(`/aiops/chat-history${s}`)},clearHistory:()=>o.delete("/aiops/chat-history")};export{C as a}; diff --git a/backend/static/assets/alert-C4MMKcUL.js b/backend/static/assets/alert-CRDraqCb.js similarity index 94% rename from backend/static/assets/alert-C4MMKcUL.js rename to backend/static/assets/alert-CRDraqCb.js index 23f304b..21ed074 100644 --- a/backend/static/assets/alert-C4MMKcUL.js +++ b/backend/static/assets/alert-CRDraqCb.js @@ -1 +1 @@ -import{h as e}from"./index-LZWfu62c.js";const a={getAlerts:async t=>e.get("/alerts",t),getRules:async()=>e.get("/alerts/rules"),createRule:async t=>e.post("/alerts/rules",t),updateRule:async(t,r)=>e.put(`/alerts/rules/${t}`,r),deleteRule:async t=>e.delete(`/alerts/rules/${t}`),batchDeleteRules:async t=>e.delete("/alerts/rules/batch-delete",{ids:t}),toggleRule:async t=>e.post(`/alerts/rules/${t}/toggle`),acknowledge:async t=>e.post(`/alerts/${t}/ack`),getNotifyChannels:async()=>e.get("/alerts/notify-channels"),createNotifyChannel:async t=>e.post("/alerts/notify-channels",t),updateNotifyChannel:async(t,r)=>e.put(`/alerts/notify-channels/${t}`,r),deleteNotifyChannel:async t=>e.delete(`/alerts/notify-channels/${t}`),testNotifyChannel:async t=>e.post(`/alerts/notify-channels/${t}/test`),getContacts:async()=>e.get("/alerts/contacts"),createContact:async t=>e.post("/alerts/contacts",t),updateContact:async(t,r)=>e.put(`/alerts/contacts/${t}`,r),deleteContact:async t=>e.delete(`/alerts/contacts/${t}`),getContactGroups:async()=>e.get("/alerts/contact-groups"),createContactGroup:async t=>e.post("/alerts/contact-groups",t),updateContactGroup:async(t,r)=>e.put(`/alerts/contact-groups/${t}`,r),deleteContactGroup:async t=>e.delete(`/alerts/contact-groups/${t}`)};export{a}; +import{h as e}from"./index-Bp-M7P_8.js";const a={getAlerts:async t=>e.get("/alerts",t),getRules:async()=>e.get("/alerts/rules"),createRule:async t=>e.post("/alerts/rules",t),updateRule:async(t,r)=>e.put(`/alerts/rules/${t}`,r),deleteRule:async t=>e.delete(`/alerts/rules/${t}`),batchDeleteRules:async t=>e.delete("/alerts/rules/batch-delete",{ids:t}),toggleRule:async t=>e.post(`/alerts/rules/${t}/toggle`),acknowledge:async t=>e.post(`/alerts/${t}/ack`),getNotifyChannels:async()=>e.get("/alerts/notify-channels"),createNotifyChannel:async t=>e.post("/alerts/notify-channels",t),updateNotifyChannel:async(t,r)=>e.put(`/alerts/notify-channels/${t}`,r),deleteNotifyChannel:async t=>e.delete(`/alerts/notify-channels/${t}`),testNotifyChannel:async t=>e.post(`/alerts/notify-channels/${t}/test`),getContacts:async()=>e.get("/alerts/contacts"),createContact:async t=>e.post("/alerts/contacts",t),updateContact:async(t,r)=>e.put(`/alerts/contacts/${t}`,r),deleteContact:async t=>e.delete(`/alerts/contacts/${t}`),getContactGroups:async()=>e.get("/alerts/contact-groups"),createContactGroup:async t=>e.post("/alerts/contact-groups",t),updateContactGroup:async(t,r)=>e.put(`/alerts/contact-groups/${t}`,r),deleteContactGroup:async t=>e.delete(`/alerts/contact-groups/${t}`)};export{a}; diff --git a/backend/static/assets/alert-center-dJk4LGZM.js b/backend/static/assets/alert-center-C9EzZkDY.js similarity index 91% rename from backend/static/assets/alert-center-dJk4LGZM.js rename to backend/static/assets/alert-center-C9EzZkDY.js index 2a31d8a..420a0ec 100644 --- a/backend/static/assets/alert-center-dJk4LGZM.js +++ b/backend/static/assets/alert-center-C9EzZkDY.js @@ -1 +1 @@ -import{h as t}from"./index-LZWfu62c.js";const l={getAlerts:async e=>t.get("/alerts",e),getRules:async()=>t.get("/alerts/rules"),getChannels:async()=>t.get("/alerts/notify-channels"),acknowledge:async e=>t.post(`/alerts/${e}/ack`),resolve:async e=>t.post(`/alerts/${e}/ack`),getSilences:async e=>t.get("/alerts/silences",e),createSilence:async e=>t.post("/alerts/silences",e),updateSilence:async(e,s)=>t.put(`/alerts/silences/${e}`,s),deleteSilence:async e=>t.delete(`/alerts/silences/${e}`),toggleSilence:async e=>t.post(`/alerts/silences/${e}/toggle`),toggleRule:async e=>t.post(`/alerts/rules/${e}/toggle`),createRule:async e=>t.post("/alerts/rules",e),deleteRule:async e=>t.delete(`/alerts/rules/${e}`),quickSetup:async(e="ecs")=>t.post("/alerts/quick-setup",{type:e})};export{l as a}; +import{h as t}from"./index-Bp-M7P_8.js";const l={getAlerts:async e=>t.get("/alerts",e),getRules:async()=>t.get("/alerts/rules"),getChannels:async()=>t.get("/alerts/notify-channels"),acknowledge:async e=>t.post(`/alerts/${e}/ack`),resolve:async e=>t.post(`/alerts/${e}/ack`),getSilences:async e=>t.get("/alerts/silences",e),createSilence:async e=>t.post("/alerts/silences",e),updateSilence:async(e,s)=>t.put(`/alerts/silences/${e}`,s),deleteSilence:async e=>t.delete(`/alerts/silences/${e}`),toggleSilence:async e=>t.post(`/alerts/silences/${e}/toggle`),toggleRule:async e=>t.post(`/alerts/rules/${e}/toggle`),createRule:async e=>t.post("/alerts/rules",e),deleteRule:async e=>t.delete(`/alerts/rules/${e}`),quickSetup:async(e="ecs")=>t.post("/alerts/quick-setup",{type:e})};export{l as a}; diff --git a/backend/static/assets/approval-DmGRfKd6.js b/backend/static/assets/approval-BivSGX8T.js similarity index 93% rename from backend/static/assets/approval-DmGRfKd6.js rename to backend/static/assets/approval-BivSGX8T.js index b8c89a5..ac83e25 100644 --- a/backend/static/assets/approval-DmGRfKd6.js +++ b/backend/static/assets/approval-BivSGX8T.js @@ -1 +1 @@ -import{h as a}from"./index-LZWfu62c.js";const t={list:async e=>a.get("/approval-workflows",e),get:async e=>a.get(`/approval-workflows/${e}`),create:async e=>a.post("/approval-workflows",e),update:async(e,s)=>a.put(`/approval-workflows/${e}`,s),delete:async e=>a.delete(`/approval-workflows/${e}`),setDefault:async e=>a.put(`/approval-workflows/${e}/default`),getSteps:async e=>a.get(`/approval-workflows/${e}/steps`)},o={getTemplates:async e=>a.get("/approvals/templates",e),getTemplate:async e=>a.get(`/approvals/templates/${e}`),createTemplate:async e=>a.post("/approvals/templates",e),updateTemplate:async(e,s)=>a.put(`/approvals/templates/${e}`,s),deleteTemplate:async e=>a.delete(`/approvals/templates/${e}`),getProcesses:async e=>a.get("/approvals/processes",e),createProcess:async e=>a.post("/approvals/processes",e),approveProcess:async(e,s)=>a.post(`/approvals/processes/${e}/approve`,{comment:s}),rejectProcess:async(e,s)=>a.post(`/approvals/processes/${e}/reject`,{comment:s})};export{t as a,o as b}; +import{h as a}from"./index-Bp-M7P_8.js";const t={list:async e=>a.get("/approval-workflows",e),get:async e=>a.get(`/approval-workflows/${e}`),create:async e=>a.post("/approval-workflows",e),update:async(e,s)=>a.put(`/approval-workflows/${e}`,s),delete:async e=>a.delete(`/approval-workflows/${e}`),setDefault:async e=>a.put(`/approval-workflows/${e}/default`),getSteps:async e=>a.get(`/approval-workflows/${e}/steps`)},o={getTemplates:async e=>a.get("/approvals/templates",e),getTemplate:async e=>a.get(`/approvals/templates/${e}`),createTemplate:async e=>a.post("/approvals/templates",e),updateTemplate:async(e,s)=>a.put(`/approvals/templates/${e}`,s),deleteTemplate:async e=>a.delete(`/approvals/templates/${e}`),getProcesses:async e=>a.get("/approvals/processes",e),createProcess:async e=>a.post("/approvals/processes",e),approveProcess:async(e,s)=>a.post(`/approvals/processes/${e}/approve`,{comment:s}),rejectProcess:async(e,s)=>a.post(`/approvals/processes/${e}/reject`,{comment:s})};export{t as a,o as b}; diff --git a/backend/static/assets/audit-BiL35K5G.js b/backend/static/assets/audit-BQ_DomYe.js similarity index 88% rename from backend/static/assets/audit-BiL35K5G.js rename to backend/static/assets/audit-BQ_DomYe.js index 251a9c2..0c651ff 100644 --- a/backend/static/assets/audit-BiL35K5G.js +++ b/backend/static/assets/audit-BQ_DomYe.js @@ -1 +1 @@ -import{h as t}from"./index-LZWfu62c.js";const g={getLogs:async s=>t.get("/audit/logs",s),getLogDetail:async s=>t.get(`/audit/logs/${s}`),getModules:async()=>t.get("/audit/modules"),getActions:async()=>t.get("/audit/actions"),getStatistics:async()=>t.get("/audit/statistics"),exportLogs:async s=>{const e=new URLSearchParams;return e.set("format","csv"),s&&Object.entries(s).forEach(([o,a])=>{a!=null&&a!==""&&e.set(o,String(a))}),t.download(`/audit/logs/export?${e.toString()}`)},clearLogs:async()=>t.post("/audit/logs/clear")};export{g as a}; +import{h as t}from"./index-Bp-M7P_8.js";const g={getLogs:async s=>t.get("/audit/logs",s),getLogDetail:async s=>t.get(`/audit/logs/${s}`),getModules:async()=>t.get("/audit/modules"),getActions:async()=>t.get("/audit/actions"),getStatistics:async()=>t.get("/audit/statistics"),exportLogs:async s=>{const e=new URLSearchParams;return e.set("format","csv"),s&&Object.entries(s).forEach(([o,a])=>{a!=null&&a!==""&&e.set(o,String(a))}),t.download(`/audit/logs/export?${e.toString()}`)},clearLogs:async()=>t.post("/audit/logs/clear")};export{g as a}; diff --git a/backend/static/assets/automation-BrmX02Sx.js b/backend/static/assets/automation-BAtbOw0o.js similarity index 92% rename from backend/static/assets/automation-BrmX02Sx.js rename to backend/static/assets/automation-BAtbOw0o.js index eb5008d..3d11bbb 100644 --- a/backend/static/assets/automation-BrmX02Sx.js +++ b/backend/static/assets/automation-BAtbOw0o.js @@ -1 +1 @@ -import{h as e}from"./index-LZWfu62c.js";const c={getJobs:async t=>e.get("/cron-jobs",t),getJob:async t=>e.get(`/cron-jobs/${t}`),createJob:async t=>e.post("/cron-jobs",t),updateJob:async(t,r)=>e.put(`/cron-jobs/${t}`,r),deleteJob:async t=>e.delete(`/cron-jobs/${t}`),toggleJob:async t=>e.post(`/cron-jobs/${t}/toggle`),executeJob:async t=>e.post(`/cron-jobs/${t}/execute`),batchDelete:async t=>e.delete("/cron-jobs/batch-delete",{ids:t})},n={getScripts:async t=>e.get("/scripts",t),getScript:async t=>e.get(`/scripts/${t}`),createScript:async t=>e.post("/scripts",t),updateScript:async(t,r)=>e.put(`/scripts/${t}`,r),deleteScript:async t=>e.delete(`/scripts/${t}`),batchDelete:async t=>e.post("/scripts/batch-delete",{ids:t}),executeScript:async t=>e.post(`/scripts/${t}/execute`)},o={getExecutions:async t=>e.get("/task-executions",t)};export{c,n as s,o as t}; +import{h as e}from"./index-Bp-M7P_8.js";const c={getJobs:async t=>e.get("/cron-jobs",t),getJob:async t=>e.get(`/cron-jobs/${t}`),createJob:async t=>e.post("/cron-jobs",t),updateJob:async(t,r)=>e.put(`/cron-jobs/${t}`,r),deleteJob:async t=>e.delete(`/cron-jobs/${t}`),toggleJob:async t=>e.post(`/cron-jobs/${t}/toggle`),executeJob:async t=>e.post(`/cron-jobs/${t}/execute`),batchDelete:async t=>e.delete("/cron-jobs/batch-delete",{ids:t})},n={getScripts:async t=>e.get("/scripts",t),getScript:async t=>e.get(`/scripts/${t}`),createScript:async t=>e.post("/scripts",t),updateScript:async(t,r)=>e.put(`/scripts/${t}`,r),deleteScript:async t=>e.delete(`/scripts/${t}`),batchDelete:async t=>e.post("/scripts/batch-delete",{ids:t}),executeScript:async t=>e.post(`/scripts/${t}/execute`)},o={getExecutions:async t=>e.get("/task-executions",t)};export{c,n as s,o as t}; diff --git a/backend/static/assets/badge-B0F5ZNtn.js b/backend/static/assets/badge-B00SZHvE.js similarity index 89% rename from backend/static/assets/badge-B0F5ZNtn.js rename to backend/static/assets/badge-B00SZHvE.js index 6a115c0..c7dc4fc 100644 --- a/backend/static/assets/badge-B0F5ZNtn.js +++ b/backend/static/assets/badge-B00SZHvE.js @@ -1 +1 @@ -import{j as n}from"./vendor-codemirror-C7mXSpXt.js";import{S as s,m as o,n as d}from"./index-LZWfu62c.js";const c=d("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function g({className:e,variant:r,asChild:t=!1,...a}){const i=t?s:"span";return n.jsx(i,{"code-path":"src/components/ui/badge.tsx:38:5","data-slot":"badge",className:o(c({variant:r}),e),...a})}export{g as B}; +import{j as n}from"./vendor-codemirror-B1SGo4xl.js";import{S as s,m as o,n as d}from"./index-Bp-M7P_8.js";const c=d("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function g({className:e,variant:r,asChild:t=!1,...a}){const i=t?s:"span";return n.jsx(i,{"code-path":"src/components/ui/badge.tsx:38:5","data-slot":"badge",className:o(c({variant:r}),e),...a})}export{g as B}; diff --git a/backend/static/assets/billing-9Cbmzl6K.js b/backend/static/assets/billing-D8MiPwwH.js similarity index 90% rename from backend/static/assets/billing-9Cbmzl6K.js rename to backend/static/assets/billing-D8MiPwwH.js index 038ae8a..1196031 100644 --- a/backend/static/assets/billing-9Cbmzl6K.js +++ b/backend/static/assets/billing-D8MiPwwH.js @@ -1 +1 @@ -import{h as t}from"./index-LZWfu62c.js";const s={getStats:async()=>t.get("/cloud-billings/stats"),list:async e=>t.get("/cloud-billings",e),create:async e=>t.post("/cloud-billings",e),batchCreate:async e=>t.post("/cloud-billings/batch",{records:e}),remove:async e=>t.delete(`/cloud-billings/${e}`),getProviders:async()=>t.get("/cloud-billings/providers"),listAlertRules:async()=>t.get("/billing-alerts"),createAlertRule:async e=>t.post("/billing-alerts",e),updateAlertRule:async(e,l)=>t.put(`/billing-alerts/${e}`,l),deleteAlertRule:async e=>t.delete(`/billing-alerts/${e}`),toggleAlertRule:async e=>t.post(`/billing-alerts/${e}/toggle`)};export{s as b}; +import{h as t}from"./index-Bp-M7P_8.js";const s={getStats:async()=>t.get("/cloud-billings/stats"),list:async e=>t.get("/cloud-billings",e),create:async e=>t.post("/cloud-billings",e),batchCreate:async e=>t.post("/cloud-billings/batch",{records:e}),remove:async e=>t.delete(`/cloud-billings/${e}`),getProviders:async()=>t.get("/cloud-billings/providers"),listAlertRules:async()=>t.get("/billing-alerts"),createAlertRule:async e=>t.post("/billing-alerts",e),updateAlertRule:async(e,l)=>t.put(`/billing-alerts/${e}`,l),deleteAlertRule:async e=>t.delete(`/billing-alerts/${e}`),toggleAlertRule:async e=>t.post(`/billing-alerts/${e}/toggle`)};export{s as b}; diff --git a/backend/static/assets/card-B-RtdR4H.js b/backend/static/assets/card-BHSBTtub.js similarity index 89% rename from backend/static/assets/card-B-RtdR4H.js rename to backend/static/assets/card-BHSBTtub.js index c59b776..c9a161a 100644 --- a/backend/static/assets/card-B-RtdR4H.js +++ b/backend/static/assets/card-BHSBTtub.js @@ -1 +1 @@ -import{j as r}from"./vendor-codemirror-C7mXSpXt.js";import{m as o}from"./index-LZWfu62c.js";function e({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:7:5","data-slot":"card",className:o("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...t})}function c({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:20:5","data-slot":"card-header",className:o("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...t})}function n({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:33:5","data-slot":"card-title",className:o("leading-none font-semibold",a),...t})}function i({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:43:5","data-slot":"card-description",className:o("text-muted-foreground text-sm",a),...t})}function u({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:66:5","data-slot":"card-content",className:o("px-6",a),...t})}export{e as C,u as a,c as b,n as c,i as d}; +import{j as r}from"./vendor-codemirror-B1SGo4xl.js";import{m as o}from"./index-Bp-M7P_8.js";function e({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:7:5","data-slot":"card",className:o("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...t})}function c({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:20:5","data-slot":"card-header",className:o("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...t})}function n({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:33:5","data-slot":"card-title",className:o("leading-none font-semibold",a),...t})}function i({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:43:5","data-slot":"card-description",className:o("text-muted-foreground text-sm",a),...t})}function u({className:a,...t}){return r.jsx("div",{"code-path":"src/components/ui/card.tsx:66:5","data-slot":"card-content",className:o("px-6",a),...t})}export{e as C,u as a,c as b,n as c,i as d}; diff --git a/backend/static/assets/checkbox-DL3onEGv.js b/backend/static/assets/checkbox-Bsb-ZRm9.js similarity index 95% rename from backend/static/assets/checkbox-DL3onEGv.js rename to backend/static/assets/checkbox-Bsb-ZRm9.js index fd3d6c8..6411a25 100644 --- a/backend/static/assets/checkbox-DL3onEGv.js +++ b/backend/static/assets/checkbox-Bsb-ZRm9.js @@ -1 +1 @@ -import{r as i,j as o}from"./vendor-codemirror-C7mXSpXt.js";import{r as L,P as O,s as _,v as H,w,x as j,y as G,m as K}from"./index-LZWfu62c.js";import{u as U}from"./index-CYARH0Cq.js";import{w as X}from"./vendor-icons-Aso0-eeY.js";var y="Checkbox",[$]=L(y),[J,P]=$(y);function Q(t){const{__scopeCheckbox:n,checked:a,children:l,defaultChecked:s,disabled:e,form:h,name:b,onCheckedChange:d,required:k,value:x="on",internal_do_not_use_render:u}=t,[p,v]=H({prop:a,defaultProp:s??!1,onChange:d,caller:y}),[m,C]=i.useState(null),[g,r]=i.useState(null),c=i.useRef(!1),E=m?!!h||!!m.closest("form"):!0,R={checked:p,disabled:e,setChecked:v,control:m,setControl:C,name:b,form:h,value:x,hasConsumerStoppedPropagationRef:c,required:k,defaultChecked:f(s)?!1:s,isFormControl:E,bubbleInput:g,setBubbleInput:r};return o.jsx(J,{scope:n,...R,children:V(u)?u(R):l})}var N="CheckboxTrigger",S=i.forwardRef(({__scopeCheckbox:t,onKeyDown:n,onClick:a,...l},s)=>{const{control:e,value:h,disabled:b,checked:d,required:k,setControl:x,setChecked:u,hasConsumerStoppedPropagationRef:p,isFormControl:v,bubbleInput:m}=P(N,t),C=w(s,x),g=i.useRef(d);return i.useEffect(()=>{const r=e?.form;if(r){const c=()=>u(g.current);return r.addEventListener("reset",c),()=>r.removeEventListener("reset",c)}},[e,u]),o.jsx(_.button,{type:"button",role:"checkbox","aria-checked":f(d)?"mixed":d,"aria-required":k,"data-state":z(d),"data-disabled":b?"":void 0,disabled:b,value:h,...l,ref:C,onKeyDown:j(n,r=>{r.key==="Enter"&&r.preventDefault()}),onClick:j(a,r=>{u(c=>f(c)?!0:!c),m&&v&&(p.current=r.isPropagationStopped(),p.current||r.stopPropagation())})})});S.displayName=N;var B=i.forwardRef((t,n)=>{const{__scopeCheckbox:a,name:l,checked:s,defaultChecked:e,required:h,disabled:b,value:d,onCheckedChange:k,form:x,...u}=t;return o.jsx(Q,{__scopeCheckbox:a,checked:s,defaultChecked:e,disabled:b,required:h,onCheckedChange:k,name:l,form:x,value:d,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(S,{...u,ref:n,__scopeCheckbox:a}),p&&o.jsx(A,{__scopeCheckbox:a})]})})});B.displayName=y;var M="CheckboxIndicator",T=i.forwardRef((t,n)=>{const{__scopeCheckbox:a,forceMount:l,...s}=t,e=P(M,a);return o.jsx(O,{present:l||f(e.checked)||e.checked===!0,children:o.jsx(_.span,{"data-state":z(e.checked),"data-disabled":e.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...t.style}})})});T.displayName=M;var q="CheckboxBubbleInput",A=i.forwardRef(({__scopeCheckbox:t,...n},a)=>{const{control:l,hasConsumerStoppedPropagationRef:s,checked:e,defaultChecked:h,required:b,disabled:d,name:k,value:x,form:u,bubbleInput:p,setBubbleInput:v}=P(q,t),m=w(a,v),C=U(e),g=G(l);i.useEffect(()=>{const c=p;if(!c)return;const E=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(E,"checked").set,D=!s.current;if(C!==e&&I){const F=new Event("click",{bubbles:D});c.indeterminate=f(e),I.call(c,f(e)?!1:e),c.dispatchEvent(F)}},[p,C,e,s]);const r=i.useRef(f(e)?!1:e);return o.jsx(_.input,{type:"checkbox","aria-hidden":!0,defaultChecked:h??r.current,required:b,disabled:d,name:k,value:x,form:u,...n,tabIndex:-1,ref:m,style:{...n.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});A.displayName=q;function V(t){return typeof t=="function"}function f(t){return t==="indeterminate"}function z(t){return f(t)?"indeterminate":t?"checked":"unchecked"}function te({className:t,...n}){return o.jsx(B,{"code-path":"src/components/ui/checkbox.tsx:14:5","data-slot":"checkbox",className:K("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:o.jsx(T,{"code-path":"src/components/ui/checkbox.tsx:22:7","data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:o.jsx(X,{"code-path":"src/components/ui/checkbox.tsx:26:9",className:"size-3.5"})})})}export{te as C}; +import{r as i,j as o}from"./vendor-codemirror-B1SGo4xl.js";import{r as L,P as O,s as _,v as H,w,x as j,y as G,m as K}from"./index-Bp-M7P_8.js";import{u as U}from"./index-5FEebgvX.js";import{w as X}from"./vendor-icons-BWk-DH7F.js";var y="Checkbox",[$]=L(y),[J,P]=$(y);function Q(t){const{__scopeCheckbox:n,checked:a,children:l,defaultChecked:s,disabled:e,form:h,name:b,onCheckedChange:d,required:k,value:x="on",internal_do_not_use_render:u}=t,[p,v]=H({prop:a,defaultProp:s??!1,onChange:d,caller:y}),[m,C]=i.useState(null),[g,r]=i.useState(null),c=i.useRef(!1),E=m?!!h||!!m.closest("form"):!0,R={checked:p,disabled:e,setChecked:v,control:m,setControl:C,name:b,form:h,value:x,hasConsumerStoppedPropagationRef:c,required:k,defaultChecked:f(s)?!1:s,isFormControl:E,bubbleInput:g,setBubbleInput:r};return o.jsx(J,{scope:n,...R,children:V(u)?u(R):l})}var N="CheckboxTrigger",S=i.forwardRef(({__scopeCheckbox:t,onKeyDown:n,onClick:a,...l},s)=>{const{control:e,value:h,disabled:b,checked:d,required:k,setControl:x,setChecked:u,hasConsumerStoppedPropagationRef:p,isFormControl:v,bubbleInput:m}=P(N,t),C=w(s,x),g=i.useRef(d);return i.useEffect(()=>{const r=e?.form;if(r){const c=()=>u(g.current);return r.addEventListener("reset",c),()=>r.removeEventListener("reset",c)}},[e,u]),o.jsx(_.button,{type:"button",role:"checkbox","aria-checked":f(d)?"mixed":d,"aria-required":k,"data-state":z(d),"data-disabled":b?"":void 0,disabled:b,value:h,...l,ref:C,onKeyDown:j(n,r=>{r.key==="Enter"&&r.preventDefault()}),onClick:j(a,r=>{u(c=>f(c)?!0:!c),m&&v&&(p.current=r.isPropagationStopped(),p.current||r.stopPropagation())})})});S.displayName=N;var B=i.forwardRef((t,n)=>{const{__scopeCheckbox:a,name:l,checked:s,defaultChecked:e,required:h,disabled:b,value:d,onCheckedChange:k,form:x,...u}=t;return o.jsx(Q,{__scopeCheckbox:a,checked:s,defaultChecked:e,disabled:b,required:h,onCheckedChange:k,name:l,form:x,value:d,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(S,{...u,ref:n,__scopeCheckbox:a}),p&&o.jsx(A,{__scopeCheckbox:a})]})})});B.displayName=y;var M="CheckboxIndicator",T=i.forwardRef((t,n)=>{const{__scopeCheckbox:a,forceMount:l,...s}=t,e=P(M,a);return o.jsx(O,{present:l||f(e.checked)||e.checked===!0,children:o.jsx(_.span,{"data-state":z(e.checked),"data-disabled":e.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...t.style}})})});T.displayName=M;var q="CheckboxBubbleInput",A=i.forwardRef(({__scopeCheckbox:t,...n},a)=>{const{control:l,hasConsumerStoppedPropagationRef:s,checked:e,defaultChecked:h,required:b,disabled:d,name:k,value:x,form:u,bubbleInput:p,setBubbleInput:v}=P(q,t),m=w(a,v),C=U(e),g=G(l);i.useEffect(()=>{const c=p;if(!c)return;const E=window.HTMLInputElement.prototype,I=Object.getOwnPropertyDescriptor(E,"checked").set,D=!s.current;if(C!==e&&I){const F=new Event("click",{bubbles:D});c.indeterminate=f(e),I.call(c,f(e)?!1:e),c.dispatchEvent(F)}},[p,C,e,s]);const r=i.useRef(f(e)?!1:e);return o.jsx(_.input,{type:"checkbox","aria-hidden":!0,defaultChecked:h??r.current,required:b,disabled:d,name:k,value:x,form:u,...n,tabIndex:-1,ref:m,style:{...n.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});A.displayName=q;function V(t){return typeof t=="function"}function f(t){return t==="indeterminate"}function z(t){return f(t)?"indeterminate":t?"checked":"unchecked"}function te({className:t,...n}){return o.jsx(B,{"code-path":"src/components/ui/checkbox.tsx:14:5","data-slot":"checkbox",className:K("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:o.jsx(T,{"code-path":"src/components/ui/checkbox.tsx:22:7","data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none",children:o.jsx(X,{"code-path":"src/components/ui/checkbox.tsx:26:9",className:"size-3.5"})})})}export{te as C}; diff --git a/backend/static/assets/config-DAXaHuse.js b/backend/static/assets/config-CBy2SxR-.js similarity index 96% rename from backend/static/assets/config-DAXaHuse.js rename to backend/static/assets/config-CBy2SxR-.js index 220a365..1497f4c 100644 --- a/backend/static/assets/config-DAXaHuse.js +++ b/backend/static/assets/config-CBy2SxR-.js @@ -1 +1 @@ -import{h as o}from"./index-LZWfu62c.js";const p={getRepos:()=>o.get("/deploy/repos"),getRepo:e=>o.get(`/deploy/repos/${e}`),createRepo:e=>o.post("/deploy/repos",e),updateRepo:(e,t)=>o.put(`/deploy/repos/${e}`,t),deleteRepo:e=>o.delete(`/deploy/repos/${e}`),getRegistries:()=>o.get("/deploy/registries"),getRegistry:e=>o.get(`/deploy/registries/${e}`),createRegistry:e=>o.post("/deploy/registries",e),updateRegistry:(e,t)=>o.put(`/deploy/registries/${e}`,t),deleteRegistry:e=>o.delete(`/deploy/registries/${e}`),getEnvironments:()=>o.get("/deploy/environments"),createEnvironment:e=>o.post("/deploy/environments",e),updateEnvironment:(e,t)=>o.put(`/deploy/environments/${e}`,t),deleteEnvironment:e=>o.delete(`/deploy/environments/${e}`),getItemRoles:()=>o.get("/admin/item-roles"),createItemRole:e=>o.post("/admin/item-roles",e),updateItemRole:(e,t)=>o.put(`/admin/item-roles/${e}`,t),deleteItemRole:e=>o.delete(`/admin/item-roles/${e}`),getUserItemRoles:e=>o.get(`/admin/users/${e}/item-roles`),assignItemRole:(e,t)=>o.post(`/admin/users/${e}/item-roles`,t),removeItemRole:(e,t)=>o.delete(`/admin/users/${e}/item-roles/${t}`),getGroups:()=>o.get("/deploy/groups"),createGroup:e=>o.post("/deploy/groups",e),updateGroup:(e,t)=>o.put(`/deploy/groups/${e}`,t),deleteGroup:e=>o.delete(`/deploy/groups/${e}`),getGroupMembers:e=>o.get(`/deploy/groups/${e}/members`),addGroupMember:(e,t)=>o.post(`/deploy/groups/${e}/members`,t),removeGroupMember:(e,t)=>o.delete(`/deploy/groups/${e}/members/${t}`),getTools:()=>o.get("/deploy/tools"),getTool:e=>o.get(`/deploy/tools/${e}`),updateTool:(e,t)=>o.put(`/deploy/tools/${e}`,t),installTool:(e,t)=>o.post(`/deploy/tools/${e}/install`,t?{version:t}:{}),checkTool:e=>o.post(`/deploy/tools/${e}/check`),getToolVersions:e=>o.get(`/deploy/tools/${e}/versions`)};export{p as d}; +import{h as o}from"./index-Bp-M7P_8.js";const p={getRepos:()=>o.get("/deploy/repos"),getRepo:e=>o.get(`/deploy/repos/${e}`),createRepo:e=>o.post("/deploy/repos",e),updateRepo:(e,t)=>o.put(`/deploy/repos/${e}`,t),deleteRepo:e=>o.delete(`/deploy/repos/${e}`),getRegistries:()=>o.get("/deploy/registries"),getRegistry:e=>o.get(`/deploy/registries/${e}`),createRegistry:e=>o.post("/deploy/registries",e),updateRegistry:(e,t)=>o.put(`/deploy/registries/${e}`,t),deleteRegistry:e=>o.delete(`/deploy/registries/${e}`),getEnvironments:()=>o.get("/deploy/environments"),createEnvironment:e=>o.post("/deploy/environments",e),updateEnvironment:(e,t)=>o.put(`/deploy/environments/${e}`,t),deleteEnvironment:e=>o.delete(`/deploy/environments/${e}`),getItemRoles:()=>o.get("/admin/item-roles"),createItemRole:e=>o.post("/admin/item-roles",e),updateItemRole:(e,t)=>o.put(`/admin/item-roles/${e}`,t),deleteItemRole:e=>o.delete(`/admin/item-roles/${e}`),getUserItemRoles:e=>o.get(`/admin/users/${e}/item-roles`),assignItemRole:(e,t)=>o.post(`/admin/users/${e}/item-roles`,t),removeItemRole:(e,t)=>o.delete(`/admin/users/${e}/item-roles/${t}`),getGroups:()=>o.get("/deploy/groups"),createGroup:e=>o.post("/deploy/groups",e),updateGroup:(e,t)=>o.put(`/deploy/groups/${e}`,t),deleteGroup:e=>o.delete(`/deploy/groups/${e}`),getGroupMembers:e=>o.get(`/deploy/groups/${e}/members`),addGroupMember:(e,t)=>o.post(`/deploy/groups/${e}/members`,t),removeGroupMember:(e,t)=>o.delete(`/deploy/groups/${e}/members/${t}`),getTools:()=>o.get("/deploy/tools"),getTool:e=>o.get(`/deploy/tools/${e}`),updateTool:(e,t)=>o.put(`/deploy/tools/${e}`,t),installTool:(e,t)=>o.post(`/deploy/tools/${e}/install`,t?{version:t}:{}),checkTool:e=>o.post(`/deploy/tools/${e}/check`),getToolVersions:e=>o.get(`/deploy/tools/${e}/versions`)};export{p as d}; diff --git a/backend/static/assets/credential-CwQY-4Ba.js b/backend/static/assets/credential-Df-OY-sx.js similarity index 83% rename from backend/static/assets/credential-CwQY-4Ba.js rename to backend/static/assets/credential-Df-OY-sx.js index 7369cdb..cfab6d7 100644 --- a/backend/static/assets/credential-CwQY-4Ba.js +++ b/backend/static/assets/credential-Df-OY-sx.js @@ -1 +1 @@ -import{h as t}from"./index-LZWfu62c.js";const a={list:e=>t.get("/credentials",e),get:e=>t.get(`/credentials/${e}`),create:e=>t.post("/credentials",e),update:(e,s)=>t.put(`/credentials/${e}`,s),delete:e=>t.delete(`/credentials/${e}`),toggleActive:(e,s)=>t.put(`/credentials/${e}`,{is_active:s})},r={assign:(e,s)=>t.post(`/servers/${e}/assign-credential`,{credential_id:s})};export{a as c,r as s}; +import{h as t}from"./index-Bp-M7P_8.js";const a={list:e=>t.get("/credentials",e),get:e=>t.get(`/credentials/${e}`),create:e=>t.post("/credentials",e),update:(e,s)=>t.put(`/credentials/${e}`,s),delete:e=>t.delete(`/credentials/${e}`),toggleActive:(e,s)=>t.put(`/credentials/${e}`,{is_active:s})},r={assign:(e,s)=>t.post(`/servers/${e}/assign-credential`,{credential_id:s})};export{a as c,r as s}; diff --git a/backend/static/assets/dashboard-7Sl2aero.js b/backend/static/assets/dashboard-50x02M_T.js similarity index 80% rename from backend/static/assets/dashboard-7Sl2aero.js rename to backend/static/assets/dashboard-50x02M_T.js index 5e4c43e..3f7ec74 100644 --- a/backend/static/assets/dashboard-7Sl2aero.js +++ b/backend/static/assets/dashboard-50x02M_T.js @@ -1 +1 @@ -import{h as t}from"./index-LZWfu62c.js";const a={getStats:async()=>t.get("/dashboard/stats"),getAlerts:async e=>t.get("/dashboard/recent-alerts",e?{limit:e}:void 0),getReleases:async e=>t.get("/dashboard/recent-releases",e?{limit:e}:void 0),getMetrics:async e=>t.get("/dashboard/metrics",e?{hours:e}:void 0)};export{a as d}; +import{h as t}from"./index-Bp-M7P_8.js";const a={getStats:async()=>t.get("/dashboard/stats"),getAlerts:async e=>t.get("/dashboard/recent-alerts",e?{limit:e}:void 0),getReleases:async e=>t.get("/dashboard/recent-releases",e?{limit:e}:void 0),getMetrics:async e=>t.get("/dashboard/metrics",e?{hours:e}:void 0)};export{a as d}; diff --git a/backend/static/assets/datasource-DuIT0c1H.js b/backend/static/assets/datasource-B9nxnUtk.js similarity index 91% rename from backend/static/assets/datasource-DuIT0c1H.js rename to backend/static/assets/datasource-B9nxnUtk.js index 65a577c..2d8da74 100644 --- a/backend/static/assets/datasource-DuIT0c1H.js +++ b/backend/static/assets/datasource-B9nxnUtk.js @@ -1 +1 @@ -import{h as e}from"./index-LZWfu62c.js";const o={list:()=>e.get("/prometheus-datasources"),get:t=>e.get(`/prometheus-datasources/${t}`),create:t=>e.post("/prometheus-datasources",t),update:(t,s)=>e.put(`/prometheus-datasources/${t}`,s),delete:t=>e.delete(`/prometheus-datasources/${t}`),setDefault:t=>e.post(`/prometheus-datasources/${t}/default`),testConnection:t=>e.post("/prometheus-datasources/test",t)},u={list:()=>e.get("/zabbix-datasources"),get:t=>e.get(`/zabbix-datasources/${t}`),create:t=>e.post("/zabbix-datasources",t),update:(t,s)=>e.put(`/zabbix-datasources/${t}`,s),delete:t=>e.delete(`/zabbix-datasources/${t}`),setDefault:t=>e.post(`/zabbix-datasources/${t}/default`),testConnection:t=>e.post("/zabbix-datasources/test",t)};export{o as p,u as z}; +import{h as e}from"./index-Bp-M7P_8.js";const o={list:()=>e.get("/prometheus-datasources"),get:t=>e.get(`/prometheus-datasources/${t}`),create:t=>e.post("/prometheus-datasources",t),update:(t,s)=>e.put(`/prometheus-datasources/${t}`,s),delete:t=>e.delete(`/prometheus-datasources/${t}`),setDefault:t=>e.post(`/prometheus-datasources/${t}/default`),testConnection:t=>e.post("/prometheus-datasources/test",t)},u={list:()=>e.get("/zabbix-datasources"),get:t=>e.get(`/zabbix-datasources/${t}`),create:t=>e.post("/zabbix-datasources",t),update:(t,s)=>e.put(`/zabbix-datasources/${t}`,s),delete:t=>e.delete(`/zabbix-datasources/${t}`),setDefault:t=>e.post(`/zabbix-datasources/${t}/default`),testConnection:t=>e.post("/zabbix-datasources/test",t)};export{o as p,u as z}; diff --git a/backend/static/assets/index-CYARH0Cq.js b/backend/static/assets/index-5FEebgvX.js similarity index 73% rename from backend/static/assets/index-CYARH0Cq.js rename to backend/static/assets/index-5FEebgvX.js index 8251939..e7f670e 100644 --- a/backend/static/assets/index-CYARH0Cq.js +++ b/backend/static/assets/index-5FEebgvX.js @@ -1 +1 @@ -import{r as u}from"./vendor-codemirror-C7mXSpXt.js";function o(r){const e=u.useRef({value:r,previous:r});return u.useMemo(()=>(e.current.value!==r&&(e.current.previous=e.current.value,e.current.value=r),e.current.previous),[r])}export{o as u}; +import{r as u}from"./vendor-codemirror-B1SGo4xl.js";function o(r){const e=u.useRef({value:r,previous:r});return u.useMemo(()=>(e.current.value!==r&&(e.current.previous=e.current.value,e.current.value=r),e.current.previous),[r])}export{o as u}; diff --git a/backend/static/assets/index-6V28XIIj.css b/backend/static/assets/index-6V28XIIj.css new file mode 100644 index 0000000..12b96e6 --- /dev/null +++ b/backend/static/assets/index-6V28XIIj.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root,[data-theme=ocean-deep]{--background: 220 13% 5%;--foreground: 210 40% 98%;--card: 220 13% 7%;--card-foreground: 210 40% 98%;--popover: 220 13% 7%;--popover-foreground: 210 40% 98%;--primary: 217 91% 60%;--primary-foreground: 0 0% 100%;--secondary: 220 13% 14%;--secondary-foreground: 210 40% 98%;--muted: 220 13% 14%;--muted-foreground: 215 20% 55%;--accent: 220 13% 14%;--accent-foreground: 210 40% 98%;--destructive: 0 62% 50%;--destructive-foreground: 0 0% 100%;--border: 220 13% 18%;--input: 220 13% 14%;--ring: 217 91% 60%;--radius: .625rem;--sidebar-background: 220 13% 7%;--sidebar-foreground: 210 40% 90%;--sidebar-primary: 217 91% 60%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 220 13% 14%;--sidebar-accent-foreground: 210 40% 98%;--sidebar-border: 220 13% 18%;--sidebar-ring: 217 91% 60%;--dg-bg-primary: #0d1117;--dg-bg-secondary: #161b22;--dg-bg-tertiary: #21262d;--dg-bg-hover: #30363d;--dg-bg-active: #3d444d;--dg-border: #30363d;--dg-border-light: #21262d;--dg-border-hover: #484f58;--dg-text-primary: #f0f6fc;--dg-text-secondary: #8b949e;--dg-text-muted: #6e7681;--dg-blue: #58a6ff;--dg-green: #3fb950;--dg-red: #f85149;--dg-orange: #f0883e;--dg-purple: #8957e5;--dg-cyan: #39c5cf;--dg-yellow: #d29922;--dg-card-hover-border: rgba(88, 166, 255, .5);--dg-gradient-start: #2563eb;--dg-gradient-end: #9333ea;--dg-gradient-text-start: #60a5fa;--dg-gradient-text-end: #c084fc;--dg-input-focus-ring: rgba(96, 165, 250, .2);--chart-grid: #1e293b;--chart-axis: #475569;--chart-tooltip-bg: #0f172a;--chart-tooltip-border: #1e293b;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(255, 255, 255, .02);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(88, 166, 255, .15);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #21262d;--skeleton-highlight: #30363d}[data-theme=light-professional],[data-theme=light]{--background: 0 0% 100%;--foreground: 220 14% 10%;--card: 0 0% 100%;--card-foreground: 220 14% 10%;--popover: 0 0% 100%;--popover-foreground: 220 14% 10%;--primary: 217 91% 60%;--primary-foreground: 0 0% 100%;--secondary: 220 14% 96%;--secondary-foreground: 220 14% 10%;--muted: 220 14% 96%;--muted-foreground: 220 10% 46%;--accent: 220 14% 96%;--accent-foreground: 220 14% 10%;--destructive: 0 72% 51%;--destructive-foreground: 0 0% 100%;--border: 220 13% 91%;--input: 220 13% 91%;--ring: 217 91% 60%;--radius: .625rem;--sidebar-background: 0 0% 98%;--sidebar-foreground: 220 14% 20%;--sidebar-primary: 217 91% 60%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 220 14% 94%;--sidebar-accent-foreground: 220 14% 10%;--sidebar-border: 220 13% 91%;--sidebar-ring: 217 91% 60%;--dg-bg-primary: #ffffff;--dg-bg-secondary: #f8f9fb;--dg-bg-tertiary: #f0f1f5;--dg-bg-hover: #e8eaef;--dg-bg-active: #dfe1e8;--dg-border: #e2e5eb;--dg-border-light: #eaecf0;--dg-border-hover: #d0d5dd;--dg-text-primary: #1a1d23;--dg-text-secondary: #5c6370;--dg-text-muted: #9ca3af;--dg-blue: #2563eb;--dg-green: #16a34a;--dg-red: #dc2626;--dg-orange: #ea580c;--dg-purple: #7c3aed;--dg-cyan: #0891b2;--dg-yellow: #ca8a04;--dg-card-hover-border: rgba(37, 99, 235, .3);--dg-gradient-start: #2563eb;--dg-gradient-end: #7c3aed;--dg-gradient-text-start: #1d4ed8;--dg-gradient-text-end: #6d28d9;--dg-input-focus-ring: rgba(37, 99, 235, .15);--chart-grid: #e2e5eb;--chart-axis: #9ca3af;--chart-tooltip-bg: #ffffff;--chart-tooltip-border: #e2e5eb;--shadow-card: 0 1px 3px rgba(0, 0, 0, .06), 0 0 0 1px rgba(0, 0, 0, .04);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .1), 0 0 0 1px rgba(37, 99, 235, .1);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .12);--skeleton-base: #f0f1f5;--skeleton-highlight: #e8eaef}[data-theme=midnight-purple]{--background: 264 56% 4%;--foreground: 280 100% 98%;--card: 264 48% 8%;--card-foreground: 280 100% 98%;--popover: 264 48% 8%;--popover-foreground: 280 100% 98%;--primary: 270 91% 65%;--primary-foreground: 0 0% 100%;--secondary: 264 40% 20%;--secondary-foreground: 280 100% 98%;--muted: 264 40% 20%;--muted-foreground: 280 30% 60%;--accent: 264 40% 20%;--accent-foreground: 280 100% 98%;--destructive: 348 100% 72%;--destructive-foreground: 264 56% 4%;--border: 264 40% 20%;--input: 264 40% 20%;--ring: 270 91% 65%;--radius: .625rem;--sidebar-background: 264 48% 6%;--sidebar-foreground: 280 100% 92%;--sidebar-primary: 270 91% 65%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 264 40% 20%;--sidebar-accent-foreground: 280 100% 98%;--sidebar-border: 264 40% 20%;--sidebar-ring: 270 91% 65%;--dg-bg-primary: #0a0612;--dg-bg-secondary: #130c21;--dg-bg-tertiary: #1c1330;--dg-bg-hover: #2d1f4a;--dg-bg-active: #3d2a5e;--dg-border: #2d1f4a;--dg-border-light: #1c1330;--dg-border-hover: #3d2a5e;--dg-text-primary: #faf5ff;--dg-text-secondary: #b794c7;--dg-text-muted: #7c5a8a;--dg-blue: #818cf8;--dg-green: #34d399;--dg-red: #fb7185;--dg-orange: #fb923c;--dg-purple: #c084fc;--dg-cyan: #22d3ee;--dg-yellow: #facc15;--dg-card-hover-border: rgba(192, 132, 252, .5);--dg-gradient-start: #9333ea;--dg-gradient-end: #c084fc;--dg-gradient-text-start: #a855f7;--dg-gradient-text-end: #c084fc;--dg-input-focus-ring: rgba(192, 132, 252, .2);--chart-grid: #2d1f4a;--chart-axis: #7c5a8a;--chart-tooltip-bg: #130c21;--chart-tooltip-border: #2d1f4a;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(192, 132, 252, .05);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(192, 132, 252, .2);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #1c1330;--skeleton-highlight: #2d1f4a}[data-theme=pine-green]{--background: 150 25% 5%;--foreground: 140 60% 97%;--card: 150 25% 9%;--card-foreground: 140 60% 97%;--popover: 150 25% 9%;--popover-foreground: 140 60% 97%;--primary: 142 71% 45%;--primary-foreground: 150 25% 5%;--secondary: 150 20% 18%;--secondary-foreground: 140 60% 97%;--muted: 150 20% 18%;--muted-foreground: 150 20% 55%;--accent: 150 20% 18%;--accent-foreground: 140 60% 97%;--destructive: 0 90% 72%;--destructive-foreground: 150 25% 5%;--border: 150 20% 18%;--input: 150 20% 18%;--ring: 142 71% 45%;--radius: .625rem;--sidebar-background: 150 25% 7%;--sidebar-foreground: 140 40% 88%;--sidebar-primary: 142 71% 45%;--sidebar-primary-foreground: 150 25% 5%;--sidebar-accent: 150 20% 18%;--sidebar-accent-foreground: 140 60% 97%;--sidebar-border: 150 20% 18%;--sidebar-ring: 142 71% 45%;--dg-bg-primary: #0a1210;--dg-bg-secondary: #111f1a;--dg-bg-tertiary: #192c24;--dg-bg-hover: #253d32;--dg-bg-active: #2f4f3e;--dg-border: #253d32;--dg-border-light: #192c24;--dg-border-hover: #2f4f3e;--dg-text-primary: #f0fdf4;--dg-text-secondary: #86b8a0;--dg-text-muted: #5a7c6b;--dg-blue: #38bdf8;--dg-green: #4ade80;--dg-red: #f87171;--dg-orange: #fb923c;--dg-purple: #c084fc;--dg-cyan: #2dd4bf;--dg-yellow: #facc15;--dg-card-hover-border: rgba(74, 222, 128, .5);--dg-gradient-start: #059669;--dg-gradient-end: #10b981;--dg-gradient-text-start: #059669;--dg-gradient-text-end: #34d399;--dg-input-focus-ring: rgba(74, 222, 128, .2);--chart-grid: #253d32;--chart-axis: #5a7c6b;--chart-tooltip-bg: #111f1a;--chart-tooltip-border: #253d32;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(74, 222, 128, .05);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(74, 222, 128, .2);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #192c24;--skeleton-highlight: #253d32}[data-theme=orange-vitality]{--background: 30 35% 5%;--foreground: 30 100% 97%;--card: 30 30% 9%;--card-foreground: 30 100% 97%;--popover: 30 30% 9%;--popover-foreground: 30 100% 97%;--primary: 25 95% 53%;--primary-foreground: 0 0% 100%;--secondary: 30 25% 18%;--secondary-foreground: 30 100% 97%;--muted: 30 25% 18%;--muted-foreground: 30 25% 55%;--accent: 30 25% 18%;--accent-foreground: 30 100% 97%;--destructive: 0 80% 70%;--destructive-foreground: 30 35% 5%;--border: 30 25% 18%;--input: 30 25% 18%;--ring: 25 95% 53%;--radius: .625rem;--sidebar-background: 30 30% 7%;--sidebar-foreground: 30 80% 88%;--sidebar-primary: 25 95% 53%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 30 25% 18%;--sidebar-accent-foreground: 30 100% 97%;--sidebar-border: 30 25% 18%;--sidebar-ring: 25 95% 53%;--dg-bg-primary: #110d08;--dg-bg-secondary: #1d1610;--dg-bg-tertiary: #2b1f16;--dg-bg-hover: #3d2d20;--dg-bg-active: #4d3928;--dg-border: #3d2d20;--dg-border-light: #2b1f16;--dg-border-hover: #4d3928;--dg-text-primary: #fef7ed;--dg-text-secondary: #d4a574;--dg-text-muted: #9c7a54;--dg-blue: #60a5fa;--dg-green: #4ade80;--dg-red: #f87171;--dg-orange: #fb923c;--dg-purple: #a78bfa;--dg-cyan: #2dd4bf;--dg-yellow: #fcd34d;--dg-card-hover-border: rgba(251, 146, 60, .5);--dg-gradient-start: #ea580c;--dg-gradient-end: #f59e0b;--dg-gradient-text-start: #f97316;--dg-gradient-text-end: #fbbf24;--dg-input-focus-ring: rgba(251, 146, 60, .2);--chart-grid: #3d2d20;--chart-axis: #9c7a54;--chart-tooltip-bg: #1d1610;--chart-tooltip-border: #3d2d20;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(251, 146, 60, .05);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(251, 146, 60, .2);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #2b1f16;--skeleton-highlight: #3d2d20}*{border-color:hsl(var(--border))}html{scroll-behavior:smooth}body{background-color:var(--dg-bg-primary);color:var(--dg-text-primary);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans SC,PingFang SC,Microsoft YaHei,sans-serif;font-feature-settings:"rlig" 1,"calt" 1;transition:background-color .3s ease,color .3s ease}body[data-scroll-locked],body[data-radix-scroll-locked],body[style*=padding-right]{padding-right:0!important}code,pre,.font-mono{font-family:JetBrains Mono,Fira Code,Consolas,SF Mono,monospace}::-moz-selection{background-color:var(--dg-blue);color:#fff}::selection{background-color:var(--dg-blue);color:#fff}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.\!left-0{left:0!important}.\!top-0{top:0!important}.-bottom-12{bottom:-3rem}.-left-12{left:-3rem}.-right-0\.5{right:-.125rem}.-right-12{right:-3rem}.-top-0\.5{top:-.125rem}.-top-12{top:-3rem}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1\/2{left:50%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-3\.5{left:.875rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.top-0{top:0}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-3\.5{top:.875rem}.top-4{top:1rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[1\]{z-index:1}.order-first{order:-9999}.order-last{order:9999}.col-span-1{grid-column:span 1 / span 1}.col-span-2{grid-column:span 2 / span 2}.col-span-3{grid-column:span 3 / span 3}.col-span-4{grid-column:span 4 / span 4}.col-span-full{grid-column:1 / -1}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2 / span 2}.row-start-1{grid-row-start:1}.\!m-0{margin:0!important}.m-4{margin:1rem}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-px{margin-left:-1px;margin-right:-1px}.-my-2{margin-top:-.5rem;margin-bottom:-.5rem}.mx-0\.5{margin-left:.125rem;margin-right:.125rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-3\.5{margin-left:.875rem;margin-right:.875rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0{margin-top:0;margin-bottom:0}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.-mb-px{margin-bottom:-1px}.-ml-4{margin-left:-1rem}.-mt-4{margin-top:-1rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-2\.5{margin-left:.625rem}.ml-4{margin-left:1rem}.ml-9{margin-left:2.25rem}.ml-auto{margin-left:auto}.mr-0\.5{margin-right:.125rem}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mr-2\.5{margin-right:.625rem}.mr-4{margin-right:1rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-2\.5{margin-top:.625rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-row{display:table-row}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-10{width:2.5rem;height:2.5rem}.size-16{width:4rem;height:4rem}.size-2{width:.5rem;height:.5rem}.size-2\.5{width:.625rem;height:.625rem}.size-3{width:.75rem;height:.75rem}.size-3\.5{width:.875rem;height:.875rem}.size-4{width:1rem;height:1rem}.size-5{width:1.25rem;height:1.25rem}.size-6{width:1.5rem;height:1.5rem}.size-7{width:1.75rem;height:1.75rem}.size-8{width:2rem;height:2rem}.size-9{width:2.25rem;height:2.25rem}.size-auto{width:auto;height:auto}.size-full{width:100%;height:100%}.\!h-screen{height:100vh!important}.h-0\.5{height:.125rem}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-56{height:14rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1\.15rem\]{height:1.15rem}.h-\[120px\]{height:120px}.h-\[180px\]{height:180px}.h-\[200px\]{height:200px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[320px\]{height:320px}.h-\[480px\]{height:480px}.h-\[500px\]{height:500px}.h-\[600px\]{height:600px}.h-\[80vh\]{height:80vh}.h-\[85vh\]{height:85vh}.h-\[calc\(100\%-1px\)\]{height:calc(100% - 1px)}.h-\[calc\(100vh-14rem\)\]{height:calc(100vh - 14rem)}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-220px\)\]{height:calc(100vh - 220px)}.h-\[var\(--header-height\)\]{height:var(--header-height)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.h-svh{height:100svh}.max-h-0{max-height:0px}.max-h-32{max-height:8rem}.max-h-40{max-height:10rem}.max-h-48{max-height:12rem}.max-h-52{max-height:13rem}.max-h-60{max-height:15rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-\[120px\]{max-height:120px}.max-h-\[180px\]{max-height:180px}.max-h-\[220px\]{max-height:220px}.max-h-\[300px\]{max-height:300px}.max-h-\[350px\]{max-height:350px}.max-h-\[40vh\]{max-height:40vh}.max-h-\[420px\]{max-height:420px}.max-h-\[45vh\]{max-height:45vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[520px\]{max-height:520px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[65vh\]{max-height:65vh}.max-h-\[720px\]{max-height:720px}.max-h-\[800px\]{max-height:800px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.min-h-0{min-height:0px}.min-h-16{min-height:4rem}.min-h-4{min-height:1rem}.min-h-\[100px\]{min-height:100px}.min-h-\[200px\]{min-height:200px}.min-h-\[360px\]{min-height:360px}.min-h-\[36px\]{min-height:36px}.min-h-\[400px\]{min-height:400px}.min-h-\[50px\]{min-height:50px}.min-h-\[50vh\]{min-height:50vh}.min-h-\[60px\]{min-height:60px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[70px\]{min-height:70px}.min-h-\[80px\]{min-height:80px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.min-h-svh{min-height:100svh}.\!w-screen{width:100vw!important}.w-0{width:0px}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-52{width:13rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-60{width:15rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[100px\]{width:100px}.w-\[110px\]{width:110px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[140px\]{width:140px}.w-\[148px\]{width:148px}.w-\[150px\]{width:150px}.w-\[16\%\]{width:16%}.w-\[160px\]{width:160px}.w-\[170px\]{width:170px}.w-\[20\%\]{width:20%}.w-\[200px\]{width:200px}.w-\[240px\]{width:240px}.w-\[280px\]{width:280px}.w-\[360px\]{width:360px}.w-\[40\%\]{width:40%}.w-\[460px\]{width:460px}.w-\[480px\]{width:480px}.w-\[60px\]{width:60px}.w-\[72px\]{width:72px}.w-\[8\%\]{width:8%}.w-\[80px\]{width:80px}.w-\[88px\]{width:88px}.w-\[90px\]{width:90px}.w-\[90vw\]{width:90vw}.w-\[92vw\]{width:92vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-10{min-width:2.5rem}.min-w-5{min-width:1.25rem}.min-w-8{min-width:2rem}.min-w-9{min-width:2.25rem}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[12rem\]{min-width:12rem}.min-w-\[140px\]{min-width:140px}.min-w-\[160px\]{min-width:160px}.min-w-\[168px\]{min-width:168px}.min-w-\[200px\]{min-width:200px}.min-w-\[280px\]{min-width:280px}.min-w-\[28px\]{min-width:28px}.min-w-\[300px\]{min-width:300px}.min-w-\[30px\]{min-width:30px}.min-w-\[400px\]{min-width:400px}.min-w-\[40px\]{min-width:40px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[90px\]{min-width:90px}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.\!max-w-none{max-width:none!important}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[1600px\]{max-width:1600px}.max-w-\[160px\]{max-width:160px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[250px\]{max-width:250px}.max-w-\[280px\]{max-width:280px}.max-w-\[300px\]{max-width:300px}.max-w-\[320px\]{max-width:320px}.max-w-\[360px\]{max-width:360px}.max-w-\[400px\]{max-width:400px}.max-w-\[80\%\]{max-width:80%}.max-w-\[90vw\]{max-width:90vw}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-\[2\]{flex:2}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.grow-0{flex-grow:0}.basis-full{flex-basis:100%}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.\!translate-x-0{--tw-translate-x: 0px !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.\!translate-y-0{--tw-translate-y: 0px !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-px{--tw-translate-x: -1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-px{--tw-translate-x: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0\.5{--tw-translate-y: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-2{--tw-translate-y: .5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[calc\(-50\%_-_2px\)\]{--tw-translate-y: calc(-50% - 2px) ;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-90{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes caret-blink{0%,70%,to{opacity:1}20%,50%{opacity:0}}.animate-caret-blink{animation:caret-blink 1.25s ease-out infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize-y{resize:vertical}.resize{resize:both}.scroll-my-1{scroll-margin-top:.25rem;scroll-margin-bottom:.25rem}.scroll-py-1{scroll-padding-top:.25rem;scroll-padding-bottom:.25rem}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.auto-rows-min{grid-auto-rows:min-content}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.grid-cols-\[0_1fr\]{grid-template-columns:0 1fr}.grid-cols-\[1fr_1\.4fr_auto\]{grid-template-columns:1fr 1.4fr auto}.grid-cols-\[1fr_100px_1fr_60px_28px\]{grid-template-columns:1fr 100px 1fr 60px 28px}.grid-cols-\[1fr_1fr_100px_auto\]{grid-template-columns:1fr 1fr 100px auto}.grid-cols-\[1fr_1fr_1fr_60px_auto\]{grid-template-columns:1fr 1fr 1fr 60px auto}.grid-cols-\[1fr_80px_1fr_100px_80px_auto\]{grid-template-columns:1fr 80px 1fr 100px 80px auto}.grid-cols-\[1fr_80px_80px_80px_80px_32px\]{grid-template-columns:1fr 80px 80px 80px 80px 32px}.grid-rows-\[auto_auto\]{grid-template-rows:auto auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-items-start{justify-items:start}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-7{gap:1.75rem}.gap-\[--spacing\(var\(--gap\)\)\]{gap:var(--spacing(var(--gap)))}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-6{-moz-column-gap:1.5rem;column-gap:1.5rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-1{row-gap:.25rem}.gap-y-3{row-gap:.75rem}.gap-y-4{row-gap:1rem}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-\[var\(--dg-border\)\]>:not([hidden])~:not([hidden]){border-color:var(--dg-border)}.divide-slate-800>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(30 41 59 / var(--tw-divide-opacity, 1))}.self-start{align-self:flex-start}.self-center{align-self:center}.self-stretch{align-self:stretch}.justify-self-end{justify-self:end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-balance{text-wrap:balance}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.\!rounded-none{border-radius:0!important}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[4px\]{border-radius:4px}.rounded-\[calc\(var\(--radius\)-5px\)\]{border-radius:calc(var(--radius) - 5px)}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-xs{border-radius:calc(var(--radius) - 6px)}.rounded-b-md{border-bottom-right-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-l-full{border-top-left-radius:9999px;border-bottom-left-radius:9999px}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-md{border-top-left-radius:calc(var(--radius) - 2px);border-top-right-radius:calc(var(--radius) - 2px)}.rounded-t-sm{border-top-left-radius:calc(var(--radius) - 4px);border-top-right-radius:calc(var(--radius) - 4px)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-\[1\.5px\]{border-width:1.5px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-b-0{border-bottom-width:0px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-\[var\(--dg-blue\)\]{border-color:var(--dg-blue)}.border-\[var\(--dg-border\)\]{border-color:var(--dg-border)}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-500\/50{border-color:#f59e0b80}.border-amber-600{--tw-border-opacity: 1;border-color:rgb(217 119 6 / var(--tw-border-opacity, 1))}.border-amber-700\/50{border-color:#b4530980}.border-amber-800\/30{border-color:#92400e4d}.border-amber-800\/40{border-color:#92400e66}.border-amber-800\/50{border-color:#92400e80}.border-blue-400{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.border-blue-400\/20{border-color:#60a5fa33}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/20{border-color:#3b82f633}.border-blue-500\/30{border-color:#3b82f64d}.border-blue-500\/50{border-color:#3b82f680}.border-blue-600{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.border-blue-600\/50{border-color:#2563eb80}.border-blue-700\/50{border-color:#1d4ed880}.border-blue-800\/50{border-color:#1e40af80}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-cyan-500{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-cyan-500\/30{border-color:#06b6d44d}.border-emerald-400\/20{border-color:#34d39933}.border-emerald-400\/50{border-color:#34d39980}.border-emerald-500{--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-600{--tw-border-opacity: 1;border-color:rgb(5 150 105 / var(--tw-border-opacity, 1))}.border-emerald-600\/30{border-color:#0596694d}.border-gray-500\/30{border-color:#6b72804d}.border-green-500\/30{border-color:#22c55e4d}.border-indigo-400\/50{border-color:#818cf880}.border-indigo-500{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-orange-500\/30{border-color:#f973164d}.border-primary{border-color:hsl(var(--primary))}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/30{border-color:#a855f74d}.border-purple-700\/50{border-color:#7e22ce80}.border-purple-800\/50{border-color:#6b21a880}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-red-500\/40{border-color:#ef444466}.border-red-600{--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1))}.border-red-600\/30{border-color:#dc26264d}.border-red-700\/50{border-color:#b91c1c80}.border-rose-500\/30{border-color:#f43f5e4d}.border-sidebar-border{border-color:hsl(var(--sidebar-border))}.border-slate-500{--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.border-slate-500\/30{border-color:#64748b4d}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-600\/30{border-color:#4755694d}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-700\/50{border-color:#33415580}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.border-slate-800\/30{border-color:#1e293b4d}.border-slate-800\/50{border-color:#1e293b80}.border-slate-800\/60{border-color:#1e293b99}.border-slate-800\/80{border-color:#1e293bcc}.border-transparent{border-color:transparent}.border-violet-500\/30{border-color:#8b5cf64d}.border-yellow-500\/20{border-color:#eab30833}.border-yellow-500\/30{border-color:#eab3084d}.border-l-\[var\(--dg-warning\)\]{border-left-color:var(--dg-warning)}.border-l-transparent{border-left-color:transparent}.border-t-\[var\(--dg-blue\)\]{border-top-color:var(--dg-blue)}.border-t-blue-500{--tw-border-opacity: 1;border-top-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-t-transparent{border-top-color:transparent}.bg-\[\#0a0e14\]{--tw-bg-opacity: 1;background-color:rgb(10 14 20 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1117\]{--tw-bg-opacity: 1;background-color:rgb(13 17 23 / var(--tw-bg-opacity, 1))}.bg-\[\#0f172a\]{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-\[var\(--dg-accent\)\]{background-color:var(--dg-accent)}.bg-\[var\(--dg-bg-hover\)\]{background-color:var(--dg-bg-hover)}.bg-\[var\(--dg-bg-primary\)\]{background-color:var(--dg-bg-primary)}.bg-\[var\(--dg-bg-secondary\)\]{background-color:var(--dg-bg-secondary)}.bg-\[var\(--dg-bg-tertiary\)\]{background-color:var(--dg-bg-tertiary)}.bg-\[var\(--dg-blue\)\]{background-color:var(--dg-blue)}.bg-\[var\(--dg-border\)\]{background-color:var(--dg-border)}.bg-\[var\(--dg-green\)\]{background-color:var(--dg-green)}.bg-\[var\(--dg-purple\)\]{background-color:var(--dg-purple)}.bg-\[var\(--dg-red\)\]{background-color:var(--dg-red)}.bg-\[var\(--dg-text-secondary\)\]{background-color:var(--dg-text-secondary)}.bg-\[var\(--dg-yellow\)\]{background-color:var(--dg-yellow)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-400\/10{background-color:#fbbf241a}.bg-amber-400\/40{background-color:#fbbf2466}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-amber-500\/60{background-color:#f59e0b99}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-amber-600\/40{background-color:#d9770666}.bg-amber-950\/30{background-color:#451a034d}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-blue-400\/10{background-color:#60a5fa1a}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/15{background-color:#3b82f626}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-500\/5{background-color:#3b82f60d}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-950\/20{background-color:#17255433}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-cyan-400\/10{background-color:#22d3ee1a}.bg-cyan-500\/10{background-color:#06b6d41a}.bg-cyan-500\/20{background-color:#06b6d433}.bg-destructive{--tw-bg-opacity: 1;background-color:hsl(var(--destructive) / var(--tw-bg-opacity, 1))}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-400\/10{background-color:#34d3991a}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/15{background-color:#10b98126}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/30{background-color:#10b9814d}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-500\/60{background-color:#10b98199}.bg-emerald-500\/90{background-color:#10b981e6}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-emerald-600\/20{background-color:#05966933}.bg-emerald-600\/30{background-color:#0596694d}.bg-foreground{background-color:hsl(var(--foreground))}.bg-gray-500{--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.bg-gray-500\/15{background-color:#6b728026}.bg-gray-500\/20{background-color:#6b728033}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/15{background-color:#22c55e26}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-indigo-400\/10{background-color:#818cf81a}.bg-indigo-500\/10{background-color:#6366f11a}.bg-input{background-color:hsl(var(--input))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/40{background-color:hsl(var(--muted) / .4)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/20{background-color:#f9731633}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-purple-400{--tw-bg-opacity: 1;background-color:rgb(192 132 252 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/15{background-color:#a855f726}.bg-purple-500\/20{background-color:#a855f733}.bg-purple-500\/5{background-color:#a855f70d}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-purple-950\/20{background-color:#3b076433}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/15{background-color:#ef444426}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-600\/20{background-color:#dc262633}.bg-red-600\/40{background-color:#dc262666}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-rose-500\/10{background-color:#f43f5e1a}.bg-rose-500\/20{background-color:#f43f5e33}.bg-secondary{background-color:hsl(var(--secondary))}.bg-sidebar{background-color:hsl(var(--sidebar-background))}.bg-sidebar-border{background-color:hsl(var(--sidebar-border))}.bg-sky-500{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.bg-slate-500\/10{background-color:#64748b1a}.bg-slate-500\/15{background-color:#64748b26}.bg-slate-500\/20{background-color:#64748b33}.bg-slate-600{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.bg-slate-600\/10{background-color:#4755691a}.bg-slate-600\/30{background-color:#4755694d}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-700\/50{background-color:#33415580}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-800\/30{background-color:#1e293b4d}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-slate-900\/30{background-color:#0f172a4d}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/50{background-color:#0f172a80}.bg-slate-900\/60{background-color:#0f172a99}.bg-slate-900\/80{background-color:#0f172acc}.bg-slate-950{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.bg-slate-950\/30{background-color:#0206174d}.bg-slate-950\/40{background-color:#02061766}.bg-slate-950\/60{background-color:#02061799}.bg-slate-950\/80{background-color:#020617cc}.bg-transparent{background-color:transparent}.bg-violet-500\/20{background-color:#8b5cf633}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.bg-yellow-400\/15{background-color:#facc1526}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/20{background-color:#eab30833}.bg-yellow-500\/5{background-color:#eab3080d}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-\[var\(--dg-blue\)\]{--tw-gradient-from: var(--dg-blue) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-amber-500{--tw-gradient-from: #f59e0b var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500\/50{--tw-gradient-from: rgb(59 130 246 / .5) var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-600\/60{--tw-gradient-from: rgb(37 99 235 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(37 99 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-\[var\(--dg-cyan\)\]{--tw-gradient-to: var(--dg-cyan) var(--tw-gradient-to-position)}.to-\[var\(--dg-purple\)\]{--tw-gradient-to: var(--dg-purple) var(--tw-gradient-to-position)}.to-amber-500{--tw-gradient-to: #f59e0b var(--tw-gradient-to-position)}.to-blue-400\/80{--tw-gradient-to: rgb(96 165 250 / .8) var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-foreground{fill:hsl(var(--foreground))}.fill-primary{fill:hsl(var(--primary))}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-12{padding:3rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[3px\]{padding:3px}.p-px{padding:1px}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-px{padding-top:1px;padding-bottom:1px}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-px{padding-bottom:1px}.pl-1{padding-left:.25rem}.pl-1\.5{padding-left:.375rem}.pl-10{padding-left:2.5rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-7{padding-left:1.75rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pl-\[88px\]{padding-left:88px}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-6{padding-top:1.5rem}.pt-\[var\(--header-height\)\]{padding-top:var(--header-height)}.pt-px{padding-top:1px}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[15px\]{font-size:15px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-sm\/relaxed{font-size:.875rem;line-height:1.625}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-5{line-height:1.25rem}.leading-none{line-height:1}.leading-normal{line-height:1.5}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[var\(--dg-blue\)\]{color:var(--dg-blue)}.text-\[var\(--dg-border\)\]{color:var(--dg-border)}.text-\[var\(--dg-cyan\)\]{color:var(--dg-cyan)}.text-\[var\(--dg-green\)\]{color:var(--dg-green)}.text-\[var\(--dg-orange\)\]{color:var(--dg-orange)}.text-\[var\(--dg-purple\)\]{color:var(--dg-purple)}.text-\[var\(--dg-red\)\]{color:var(--dg-red)}.text-\[var\(--dg-text-muted\)\]{color:var(--dg-text-muted)}.text-\[var\(--dg-text-primary\)\]{color:var(--dg-text-primary)}.text-\[var\(--dg-text-secondary\)\]{color:var(--dg-text-secondary)}.text-\[var\(--dg-warning\)\]{color:var(--dg-warning)}.text-\[var\(--dg-yellow\)\]{color:var(--dg-yellow)}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-200{--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-300\/80{color:#fcd34dcc}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/80{color:#fbbf24cc}.text-amber-400\/90{color:#fbbf24e6}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-500\/70{color:#f59e0bb3}.text-background{color:hsl(var(--background))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-cyan-500{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-destructive{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.text-emerald-200{--tw-text-opacity: 1;color:rgb(167 243 208 / var(--tw-text-opacity, 1))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/60{color:#34d39999}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-400\/70{color:#4ade80b3}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-muted{color:hsl(var(--muted))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-red-200{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-400\/70{color:#f87171b3}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sidebar-foreground{color:hsl(var(--sidebar-foreground))}.text-sidebar-foreground\/70{color:hsl(var(--sidebar-foreground) / .7)}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-sky-500{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-teal-400{--tw-text-opacity: 1;color:rgb(45 212 191 / var(--tw-text-opacity, 1))}.text-violet-400{--tw-text-opacity: 1;color:rgb(167 139 250 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-400\/80{color:#facc15cc}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.accent-blue-500{accent-color:#3b82f6}.accent-blue-600{accent-color:#2563eb}.accent-cyan-500{accent-color:#06b6d4}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\]{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-border));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xs{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-amber-500\/30{--tw-ring-color: rgb(245 158 11 / .3)}.ring-blue-500\/30{--tw-ring-color: rgb(59 130 246 / .3)}.ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.ring-sidebar-ring{--tw-ring-color: hsl(var(--sidebar-ring))}.ring-offset-0{--tw-ring-offset-width: 0px}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.\!transition-none{transition-property:none!important}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[color\,box-shadow\]{transition-property:color,box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[left\,right\,width\]{transition-property:left,right,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\,opacity\]{transition-property:margin,opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\]{transition-property:margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-none{transition-property:none}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.\!duration-0{transition-duration:0s!important}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in,.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.\!duration-0{animation-duration:0s!important}.duration-100{animation-duration:.1s}.duration-1000{animation-duration:1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{animation-timing-function:linear}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.running{animation-play-state:running}.\!paused{animation-play-state:paused!important}.paused{animation-play-state:paused}.dg-card{border-radius:calc(var(--radius) + 4px);border-width:1px;border-color:var(--dg-border);background-color:var(--dg-bg-secondary);box-shadow:var(--shadow-card);transition:background-color .3s ease,border-color .3s ease,box-shadow .3s ease,transform .3s ease}.dg-card-hover{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s;animation-duration:.3s}.dg-card-hover:hover{border-color:var(--dg-card-hover-border);box-shadow:var(--shadow-card-hover);transform:translateY(-2px)}.dg-input{border-radius:var(--radius);border-color:var(--dg-border);background-color:var(--dg-bg-tertiary);color:var(--dg-text-primary)}.dg-input::-moz-placeholder{color:var(--dg-text-muted)}.dg-input::placeholder{color:var(--dg-text-muted)}.dg-input:focus{border-color:var(--dg-blue);--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.dg-input{transition:border-color .2s ease,box-shadow .2s ease}.dg-input:focus{--tw-ring-color: var(--dg-input-focus-ring);box-shadow:0 0 0 3px var(--dg-input-focus-ring)}.dg-gradient-text{background:linear-gradient(to right,var(--dg-gradient-text-start),var(--dg-gradient-text-end));-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text}.dg-gradient-bg{background:linear-gradient(to right,var(--dg-gradient-start),var(--dg-gradient-end))}.dg-page>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.dg-page{animation:fade-in .35s cubic-bezier(.16,1,.3,1) forwards}.dg-page-header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:1rem}.dg-page-title{font-size:1.5rem;line-height:2rem;font-weight:700;letter-spacing:-.025em;color:var(--dg-text-primary)}.dg-page-subtitle{margin-top:.25rem;font-size:.875rem;line-height:1.25rem;color:var(--dg-text-muted)}.dg-page-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.dg-btn-primary{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));background:linear-gradient(to right,var(--dg-gradient-start),var(--dg-gradient-end));display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:var(--radius);padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.dg-btn-primary:hover{opacity:.9}.dg-btn-primary:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dg-btn-primary{box-shadow:0 4px 16px color-mix(in srgb,var(--dg-gradient-start) 25%,transparent)}.dg-btn-primary:hover{box-shadow:0 6px 24px color-mix(in srgb,var(--dg-gradient-start) 35%,transparent)}.dg-btn-secondary{border-width:1px;border-color:var(--dg-border);background-color:var(--dg-bg-tertiary);color:var(--dg-text-primary);display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:var(--radius);padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.dg-btn-secondary:hover{border-color:var(--dg-border-hover);background-color:var(--dg-bg-hover)}.dg-btn-secondary:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dg-btn-ghost{color:var(--dg-text-secondary);display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:var(--radius);padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.dg-btn-ghost:hover{background-color:var(--dg-bg-hover);color:var(--dg-text-primary)}.dg-badge-blue{background-color:#3b82f61a;--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-green{background-color:#22c55e1a;--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-red{background-color:#ef44441a;--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-yellow{background-color:#eab3081a;--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-purple{background-color:#a855f71a;--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.scrollbar-thin{scrollbar-width:thin;scrollbar-color:var(--dg-border) transparent}.scrollbar-thin::-webkit-scrollbar{width:6px;height:6px}.scrollbar-thin::-webkit-scrollbar-track{background:transparent}.scrollbar-thin::-webkit-scrollbar-thumb{background:var(--dg-border);border-radius:3px}.scrollbar-thin::-webkit-scrollbar-thumb:hover{background:var(--dg-text-muted)}@keyframes fade-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.animate-fade-in{animation:fade-in .35s cubic-bezier(.16,1,.3,1) forwards}.animate-fade-in-delay-1{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .05s both}.animate-fade-in-delay-2{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .1s both}.animate-fade-in-delay-3{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .15s both}.animate-fade-in-delay-4{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .2s both}@keyframes scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.animate-scale-in{animation:scale-in .25s cubic-bezier(.16,1,.3,1) forwards}@keyframes slide-in-right{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes pulse-ring{0%{transform:scale(.8);opacity:.5}to{transform:scale(1.2);opacity:0}}@keyframes shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.dg-skeleton{background:linear-gradient(90deg,var(--skeleton-base) 25%,var(--skeleton-highlight) 50%,var(--skeleton-base) 75%);background-size:200% 100%;animation:shimmer 1.5s ease-in-out infinite;border-radius:.5rem}.glass{background:color-mix(in srgb,var(--dg-bg-secondary) 75%,transparent);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border:1px solid var(--dg-border)}.chart-grid-stroke{stroke:var(--chart-grid)}.chart-tooltip{background-color:var(--chart-tooltip-bg)!important;border:1px solid var(--chart-tooltip-border)!important;border-radius:6px!important;color:var(--dg-text-primary)!important;box-shadow:var(--shadow-dropdown)!important}.\[--cell-size\:--spacing\(8\)\]{--cell-size: var(--spacing(8))}pre{overflow-x:auto;border-radius:var(--radius);padding:1rem;background-color:var(--dg-bg-tertiary);border:1px solid var(--dg-border)}code{font-family:JetBrains Mono,Fira Code,Consolas,SF Mono,monospace;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.875rem;line-height:1.25rem}table{width:100%}th{text-align:left;font-size:.75rem;line-height:1rem;font-weight:500;text-transform:uppercase;letter-spacing:.05em;color:var(--dg-text-secondary)}td{font-size:.875rem;line-height:1.25rem;color:var(--dg-text-primary)}input:focus,textarea:focus,select:focus{outline:none;box-shadow:0 0 0 2px var(--dg-bg-primary),0 0 0 4px var(--dg-blue);border-color:var(--dg-blue)}button{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.terminal{font-family:JetBrains Mono,Fira Code,Consolas,SF Mono,monospace;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.875rem;line-height:1.25rem;background-color:var(--dg-bg-primary);color:var(--dg-text-secondary)}.terminal .prompt{color:var(--dg-green)}.terminal .command{color:var(--dg-text-primary)}.terminal .output{color:var(--dg-text-muted)}.recharts-tooltip-wrapper{z-index:50}.recharts-default-tooltip{background-color:var(--chart-tooltip-bg)!important;border-color:var(--chart-tooltip-border)!important;color:var(--dg-text-primary)!important;border-radius:6px!important;box-shadow:var(--shadow-dropdown)!important}[data-state=open]>[data-radix-dialog-overlay]{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);background-color:color-mix(in srgb,var(--dg-bg-primary) 80%,transparent)}[role=menuitem]{cursor:pointer}@keyframes progress-indeterminate{0%{transform:translate(-100%)}to{transform:translate(100%)}}.progress-indeterminate:after{content:"";position:absolute;inset:0;background-color:currentColor;animation:progress-indeterminate 1.5s ease-in-out infinite}.xterm-terminal-host{width:100%;overflow:hidden;background:#0a0e14}.xterm-terminal-host .xterm{height:100%}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.dg-skeleton{animation:none;background:var(--skeleton-base)}}.selection\:bg-primary *::-moz-selection{background-color:hsl(var(--primary))}.selection\:bg-primary *::selection{background-color:hsl(var(--primary))}.selection\:text-primary-foreground *::-moz-selection{color:hsl(var(--primary-foreground))}.selection\:text-primary-foreground *::selection{color:hsl(var(--primary-foreground))}.selection\:bg-primary::-moz-selection{background-color:hsl(var(--primary))}.selection\:bg-primary::selection{background-color:hsl(var(--primary))}.selection\:text-primary-foreground::-moz-selection{color:hsl(var(--primary-foreground))}.selection\:text-primary-foreground::selection{color:hsl(var(--primary-foreground))}.file\:inline-flex::file-selector-button{display:inline-flex}.file\:h-7::file-selector-button{height:1.75rem}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-\[var\(--dg-text-muted\)\]::-moz-placeholder{color:var(--dg-text-muted)}.placeholder\:text-\[var\(--dg-text-muted\)\]::placeholder{color:var(--dg-text-muted)}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-slate-500::-moz-placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::-moz-placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);inset:-.5rem}.after\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:.25rem}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.first\:rounded-l-md:first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.first\:border-l:first-child{border-left-width:1px}.last\:mt-0:last-child{margin-top:0}.last\:rounded-r-md:last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.last\:border-0:last-child{border-width:0px}.last\:border-b-0:last-child{border-bottom-width:0px}.last\:border-r-0:last-child{border-right-width:0px}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[var\(--dg-border\)\]:hover{border-color:var(--dg-border)}.hover\:border-\[var\(--dg-border-hover\)\]:hover{border-color:var(--dg-border-hover)}.hover\:border-blue-500:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.hover\:border-blue-500\/50:hover{border-color:#3b82f680}.hover\:border-orange-500\/30:hover{border-color:#f973164d}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:border-slate-400:hover{--tw-border-opacity: 1;border-color:rgb(148 163 184 / var(--tw-border-opacity, 1))}.hover\:border-slate-600:hover{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.hover\:border-slate-700:hover{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.hover\:bg-\[var\(--dg-bg-hover\)\]:hover{background-color:var(--dg-bg-hover)}.hover\:bg-\[var\(--dg-bg-primary\)\]:hover{background-color:var(--dg-bg-primary)}.hover\:bg-\[var\(--dg-bg-tertiary\)\]:hover{background-color:var(--dg-bg-tertiary)}.hover\:bg-\[var\(--dg-blue-hover\)\]:hover{background-color:var(--dg-blue-hover)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-500\/10:hover{background-color:#f59e0b1a}.hover\:bg-amber-600\/20:hover{background-color:#d9770633}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/10:hover{background-color:#3b82f61a}.hover\:bg-blue-500\/20:hover{background-color:#3b82f633}.hover\:bg-blue-600\/10:hover{background-color:#2563eb1a}.hover\:bg-blue-600\/20:hover{background-color:#2563eb33}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-cyan-500\/20:hover{background-color:#06b6d433}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/10:hover{background-color:#10b9811a}.hover\:bg-emerald-600\/10:hover{background-color:#0596691a}.hover\:bg-emerald-600\/20:hover{background-color:#05966933}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-green-500\/10:hover{background-color:#22c55e1a}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600\/20:hover{background-color:#dc262633}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-sidebar-accent:hover{background-color:hsl(var(--sidebar-accent))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800\/30:hover{background-color:#1e293b4d}.hover\:bg-slate-800\/50:hover{background-color:#1e293b80}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:bg-white\/\[0\.03\]:hover{background-color:#ffffff08}.hover\:bg-yellow-500\/10:hover{background-color:#eab3081a}.hover\:stroke-blue-500:hover{stroke:#3b82f6}.hover\:text-\[var\(--dg-blue\)\]:hover{color:var(--dg-blue)}.hover\:text-\[var\(--dg-text-primary\)\]:hover{color:var(--dg-text-primary)}.hover\:text-\[var\(--dg-text-secondary\)\]:hover{color:var(--dg-text-secondary)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-300:hover{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.hover\:text-cyan-400:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-emerald-300:hover{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.hover\:text-emerald-400:hover{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-400:hover{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.hover\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-sidebar-accent-foreground:hover{color:hsl(var(--sidebar-accent-foreground))}.hover\:text-slate-100:hover{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:text-yellow-400:hover{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-accent\)\)\]:hover{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-accent));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-4:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:brightness-110:hover{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:hsl(var(--sidebar-border))}.focus\:z-10:focus{z-index:10}.focus\:border-\[var\(--dg-blue\)\]:focus{border-color:var(--dg-blue)}.focus\:border-amber-600:focus{--tw-border-opacity: 1;border-color:rgb(217 119 6 / var(--tw-border-opacity, 1))}.focus\:border-blue-400:focus{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:bg-\[var\(--dg-bg-hover\)\]:focus{background-color:var(--dg-bg-hover)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-red-500\/10:focus{background-color:#ef44441a}.focus\:bg-slate-700:focus{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.focus\:text-\[var\(--dg-text-primary\)\]:focus{color:var(--dg-text-primary)}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-blue-300:focus{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.focus\:text-cyan-300:focus{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.focus\:text-emerald-300:focus{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.focus\:text-red-400:focus{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.focus\:text-slate-100:focus{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:z-10:focus-visible{z-index:10}.focus-visible\:border-ring:focus-visible{border-color:hsl(var(--ring))}.focus-visible\:outline-1:focus-visible{outline-width:1px}.focus-visible\:outline-ring:focus-visible{outline-color:hsl(var(--ring))}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-4:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color: hsl(var(--destructive) / .2)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color: hsl(var(--ring) / .5)}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:scale-\[0\.98\]:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:bg-sidebar-accent:active{background-color:hsl(var(--sidebar-accent))}.active\:text-sidebar-accent-foreground:active{color:hsl(var(--sidebar-accent-foreground))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-20:disabled{opacity:.2}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.group\/menu-item:focus-within .group-focus-within\/menu-item\:opacity-100{opacity:1}.group:hover .group-hover\:block{display:block}.group:hover .group-hover\:from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.group:hover .group-hover\:to-blue-300{--tw-gradient-to: #93c5fd var(--tw-gradient-to-position)}.group:hover .group-hover\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.group\/cmd:hover .group-hover\/cmd\:opacity-100,.group\/menu-item:hover .group-hover\/menu-item\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.peer\/menu-button:hover~.peer-hover\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-50{opacity:.5}.has-\[\>button\]\:ml-\[-0\.45rem\]:has(>button){margin-left:-.45rem}.has-\[\>button\]\:mr-\[-0\.45rem\]:has(>button){margin-right:-.45rem}.has-\[\>kbd\]\:ml-\[-0\.35rem\]:has(>kbd){margin-left:-.35rem}.has-\[\>kbd\]\:mr-\[-0\.35rem\]:has(>kbd){margin-right:-.35rem}.has-\[\>\[data-align\=block-end\]\]\:h-auto:has(>[data-align=block-end]){height:auto}.has-\[\>\[data-align\=block-start\]\]\:h-auto:has(>[data-align=block-start]){height:auto}.has-\[\>textarea\]\:h-auto:has(>textarea){height:auto}.has-\[\>\[data-slot\=field\]\]\:w-full:has(>[data-slot=field]){width:100%}.has-\[\>svg\]\:grid-cols-\[calc\(var\(--spacing\)\*4\)_1fr\]:has(>svg){grid-template-columns:calc(var(--spacing) * 4) 1fr}.has-\[\>\[data-align\=block-end\]\]\:flex-col:has(>[data-align=block-end]){flex-direction:column}.has-\[\>\[data-align\=block-start\]\]\:flex-col:has(>[data-align=block-start]){flex-direction:column}.has-\[\>\[data-slot\=field\]\]\:flex-col:has(>[data-slot=field]){flex-direction:column}.has-\[\>\[data-slot\=field-content\]\]\:items-start:has(>[data-slot=field-content]){align-items:flex-start}.has-\[\>\[data-slot\=button-group\]\]\:gap-2:has(>[data-slot=button-group]){gap:.5rem}.has-\[\>\[data-slot\=checkbox-group\]\]\:gap-3:has(>[data-slot=checkbox-group]){gap:.75rem}.has-\[\>\[data-slot\=radio-group\]\]\:gap-3:has(>[data-slot=radio-group]){gap:.75rem}.has-\[\>svg\]\:gap-x-3:has(>svg){-moz-column-gap:.75rem;column-gap:.75rem}.has-\[\>\[data-slot\=field\]\]\:rounded-md:has(>[data-slot=field]){border-radius:calc(var(--radius) - 2px)}.has-\[\>\[data-slot\=field\]\]\:border:has(>[data-slot=field]){border-width:1px}.has-\[\[data-slot\=input-group-control\]\:focus-visible\]\:border-ring:has([data-slot=input-group-control]:focus-visible){border-color:hsl(var(--ring))}.has-\[\[data-slot\]\[aria-invalid\=true\]\]\:border-destructive:has([data-slot][aria-invalid=true]){--tw-border-opacity: 1;border-color:hsl(var(--destructive) / var(--tw-border-opacity, 1))}.has-\[\>svg\]\:p-0:has(>svg){padding:0}.has-\[\>svg\]\:px-2:has(>svg){padding-left:.5rem;padding-right:.5rem}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-left:.625rem;padding-right:.625rem}.has-\[\>svg\]\:px-3:has(>svg){padding-left:.75rem;padding-right:.75rem}.has-\[\>svg\]\:px-4:has(>svg){padding-left:1rem;padding-right:1rem}.has-\[\[data-slot\=input-group-control\]\:focus-visible\]\:ring-\[3px\]:has([data-slot=input-group-control]:focus-visible){--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.has-\[\[data-slot\=input-group-control\]\:focus-visible\]\:ring-ring\/50:has([data-slot=input-group-control]:focus-visible){--tw-ring-color: hsl(var(--ring) / .5)}.has-\[\[data-slot\]\[aria-invalid\=true\]\]\:ring-destructive\/20:has([data-slot][aria-invalid=true]){--tw-ring-color: hsl(var(--destructive) / .2)}.group\/item:has([data-slot=item-description]) .group-has-\[\[data-slot\=item-description\]\]\/item\:translate-y-0\.5{--tw-translate-y: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group\/item:has([data-slot=item-description]) .group-has-\[\[data-slot\=item-description\]\]\/item\:self-start{align-self:flex-start}.group\/field:has([data-orientation=horizontal]) .group-has-\[\[data-orientation\=horizontal\]\]\/field\:text-balance{text-wrap:balance}.group\/input-group:has(>input) .group-has-\[\>input\]\/input-group\:pb-2\.5{padding-bottom:.625rem}.group\/input-group:has(>input) .group-has-\[\>input\]\/input-group\:pt-2\.5{padding-top:.625rem}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[vaul-drawer-direction\=bottom\]\:inset-x-0[data-vaul-drawer-direction=bottom]{left:0;right:0}.data-\[vaul-drawer-direction\=left\]\:inset-y-0[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:inset-y-0[data-vaul-drawer-direction=right]{top:0;bottom:0}.data-\[vaul-drawer-direction\=top\]\:inset-x-0[data-vaul-drawer-direction=top]{left:0;right:0}.data-\[vaul-drawer-direction\=bottom\]\:bottom-0[data-vaul-drawer-direction=bottom]{bottom:0}.data-\[vaul-drawer-direction\=left\]\:left-0[data-vaul-drawer-direction=left]{left:0}.data-\[vaul-drawer-direction\=right\]\:right-0[data-vaul-drawer-direction=right]{right:0}.data-\[vaul-drawer-direction\=top\]\:top-0[data-vaul-drawer-direction=top]{top:0}.data-\[active\=true\]\:z-10[data-active=true]{z-index:10}.data-\[vaul-drawer-direction\=bottom\]\:mt-24[data-vaul-drawer-direction=bottom]{margin-top:6rem}.data-\[vaul-drawer-direction\=top\]\:mb-24[data-vaul-drawer-direction=top]{margin-bottom:6rem}.data-\[orientation\=horizontal\]\:h-1\.5[data-orientation=horizontal]{height:.375rem}.data-\[orientation\=horizontal\]\:h-full[data-orientation=horizontal]{height:100%}.data-\[orientation\=horizontal\]\:h-px[data-orientation=horizontal]{height:1px}.data-\[orientation\=vertical\]\:h-auto[data-orientation=vertical]{height:auto}.data-\[orientation\=vertical\]\:h-full[data-orientation=vertical]{height:100%}.data-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[size\=default\]\:h-9[data-size=default]{height:2.25rem}.data-\[size\=sm\]\:h-8[data-size=sm]{height:2rem}.data-\[vaul-drawer-direction\=bottom\]\:max-h-\[80vh\][data-vaul-drawer-direction=bottom],.data-\[vaul-drawer-direction\=top\]\:max-h-\[80vh\][data-vaul-drawer-direction=top]{max-height:80vh}.data-\[orientation\=vertical\]\:min-h-44[data-orientation=vertical]{min-height:11rem}.data-\[orientation\=horizontal\]\:w-full[data-orientation=horizontal]{width:100%}.data-\[orientation\=vertical\]\:w-1\.5[data-orientation=vertical]{width:.375rem}.data-\[orientation\=vertical\]\:w-auto[data-orientation=vertical]{width:auto}.data-\[orientation\=vertical\]\:w-full[data-orientation=vertical]{width:100%}.data-\[orientation\=vertical\]\:w-px[data-orientation=vertical]{width:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\[vaul-drawer-direction\=left\]\:w-3\/4[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:w-3\/4[data-vaul-drawer-direction=right]{width:75%}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-\[calc\(100\%-2px\)\][data-state=checked]{--tw-translate-x: calc(100% - 2px) ;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[orientation\=vertical\]\:flex-col[data-orientation=vertical],.data-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\[slot\=checkbox-group\]\:gap-3[data-slot=checkbox-group]{gap:.75rem}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true],.data-\[spacing\=0\]\:rounded-none[data-spacing="0"]{border-radius:0}.data-\[range-end\=true\]\:rounded-r-md[data-range-end=true]{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.data-\[range-start\=true\]\:rounded-l-md[data-range-start=true]{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.data-\[vaul-drawer-direction\=bottom\]\:rounded-t-lg[data-vaul-drawer-direction=bottom]{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.data-\[vaul-drawer-direction\=top\]\:rounded-b-lg[data-vaul-drawer-direction=top]{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.data-\[spacing\=0\]\:data-\[variant\=outline\]\:border-l-0[data-variant=outline][data-spacing="0"]{border-left-width:0px}.data-\[vaul-drawer-direction\=bottom\]\:border-t[data-vaul-drawer-direction=bottom]{border-top-width:1px}.data-\[vaul-drawer-direction\=left\]\:border-r[data-vaul-drawer-direction=left]{border-right-width:1px}.data-\[vaul-drawer-direction\=right\]\:border-l[data-vaul-drawer-direction=right]{border-left-width:1px}.data-\[vaul-drawer-direction\=top\]\:border-b[data-vaul-drawer-direction=top]{border-bottom-width:1px}.data-\[active\=true\]\:border-ring[data-active=true]{border-color:hsl(var(--ring))}.data-\[state\=checked\]\:border-blue-600[data-state=checked]{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.data-\[state\=checked\]\:border-primary[data-state=checked]{border-color:hsl(var(--primary))}.data-\[active\=true\]\:bg-accent\/50[data-active=true]{background-color:hsl(var(--accent) / .5)}.data-\[active\=true\]\:bg-sidebar-accent[data-active=true]{background-color:hsl(var(--sidebar-accent))}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-\[var\(--dg-bg-primary\)\][data-state=active]{background-color:var(--dg-bg-primary)}.data-\[state\=active\]\:bg-\[var\(--dg-bg-tertiary\)\][data-state=active]{background-color:var(--dg-bg-tertiary)}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=active\]\:bg-orange-500\/10[data-state=active]{background-color:#f973161a}.data-\[state\=active\]\:bg-slate-700[data-state=active]{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.data-\[state\=checked\]\:bg-blue-600[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.data-\[state\=checked\]\:bg-emerald-600[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=on\]\:bg-accent[data-state=on],.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[inset\]\:pl-8[data-inset]{padding-left:2rem}.data-\[variant\=label\]\:text-sm[data-variant=label]{font-size:.875rem;line-height:1.25rem}.data-\[variant\=legend\]\:text-base[data-variant=legend]{font-size:1rem;line-height:1.5rem}.data-\[active\=true\]\:font-medium[data-active=true]{font-weight:500}.data-\[active\=true\]\:text-accent-foreground[data-active=true]{color:hsl(var(--accent-foreground))}.data-\[active\=true\]\:text-sidebar-accent-foreground[data-active=true]{color:hsl(var(--sidebar-accent-foreground))}.data-\[error\=true\]\:text-destructive[data-error=true],.data-\[invalid\=true\]\:text-destructive[data-invalid=true]{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-orange-400[data-state=active]{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=on\]\:text-accent-foreground[data-state=on],.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[variant\=destructive\]\:text-destructive[data-variant=destructive]{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=open\]\:opacity-100[data-state=open]{opacity:1}.data-\[spacing\=0\]\:shadow-none[data-spacing="0"]{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[spacing\=default\]\:data-\[variant\=outline\]\:shadow-xs[data-variant=outline][data-spacing=default],.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[active\=true\]\:ring-\[3px\][data-active=true]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.data-\[active\=true\]\:ring-ring\/50[data-active=true]{--tw-ring-color: hsl(var(--ring) / .5)}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed],.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}.\*\:data-\[slot\=select-value\]\:line-clamp-1[data-slot=select-value]>*{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\*\:data-\[slot\=select-value\]\:flex[data-slot=select-value]>*{display:flex}.\*\:data-\[slot\=select-value\]\:items-center[data-slot=select-value]>*{align-items:center}.\*\:data-\[slot\=select-value\]\:gap-2[data-slot=select-value]>*{gap:.5rem}.\*\:data-\[slot\=alert-description\]\:text-destructive\/90[data-slot=alert-description]>*{color:hsl(var(--destructive) / .9)}.data-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:0}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:.25rem}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[spacing\=0\]\:first\:rounded-l-md:first-child[data-spacing="0"]{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.data-\[spacing\=0\]\:data-\[variant\=outline\]\:first\:border-l:first-child[data-variant=outline][data-spacing="0"]{border-left-width:1px}.data-\[spacing\=0\]\:last\:rounded-r-md:last-child[data-spacing="0"]{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.data-\[active\=true\]\:hover\:bg-accent:hover[data-active=true],.data-\[state\=open\]\:hover\:bg-accent:hover[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:hover\:bg-sidebar-accent:hover[data-state=open]{background-color:hsl(var(--sidebar-accent))}.data-\[state\=open\]\:hover\:text-sidebar-accent-foreground:hover[data-state=open]{color:hsl(var(--sidebar-accent-foreground))}.data-\[active\=true\]\:focus\:bg-accent:focus[data-active=true]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:focus\:bg-accent:focus[data-state=open]{background-color:hsl(var(--accent))}.data-\[variant\=destructive\]\:focus\:bg-destructive\/10:focus[data-variant=destructive]{background-color:hsl(var(--destructive) / .1)}.data-\[variant\=destructive\]\:focus\:text-destructive:focus[data-variant=destructive]{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.group[data-disabled=true] .group-data-\[disabled\=true\]\:pointer-events-none{pointer-events:none}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:left-\[calc\(var\(--sidebar-width\)\*-1\)\]{left:calc(var(--sidebar-width) * -1)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:right-\[calc\(var\(--sidebar-width\)\*-1\)\]{right:calc(var(--sidebar-width) * -1)}.group[data-side=left] .group-data-\[side\=left\]\:-right-4{right:-1rem}.group[data-side=right] .group-data-\[side\=right\]\:left-0{left:0}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:top-full{top:100%}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:-mt-8{margin-top:-2rem}.group\/field-group[data-variant=outline] .group-data-\[variant\=outline\]\/field-group\:-mb-2{margin-bottom:-.5rem}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:mt-1\.5{margin-top:.375rem}.group\/drawer-content[data-vaul-drawer-direction=bottom] .group-data-\[vaul-drawer-direction\=bottom\]\/drawer-content\:block{display:block}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:hidden{display:none}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\)\]{width:calc(var(--sidebar-width-icon) + (--spacing(4)))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\+2px\)\]{width:calc(var(--sidebar-width-icon) + (--spacing(4)) + 2px)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:w-0{width:0px}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-side=right] .group-data-\[side\=right\]\:rotate-180,.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:overflow-hidden,.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:overflow-hidden{overflow:hidden}.group[data-variant=floating] .group-data-\[variant\=floating\]\:rounded-lg{border-radius:var(--radius)}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:rounded-md{border-radius:calc(var(--radius) - 2px)}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border,.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:border{border-width:1px}.group[data-side=left] .group-data-\[side\=left\]\:border-r{border-right-width:1px}.group[data-side=right] .group-data-\[side\=right\]\:border-l{border-left-width:1px}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border-sidebar-border{border-color:hsl(var(--sidebar-border))}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:bg-popover{background-color:hsl(var(--popover))}.group\/drawer-content[data-vaul-drawer-direction=bottom] .group-data-\[vaul-drawer-direction\=bottom\]\/drawer-content\:text-center,.group\/drawer-content[data-vaul-drawer-direction=top] .group-data-\[vaul-drawer-direction\=top\]\/drawer-content\:text-center{text-align:center}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:text-popover-foreground{color:hsl(var(--popover-foreground))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:opacity-0{opacity:0}.group\/field[data-disabled=true] .group-data-\[disabled\=true\]\/field\:opacity-50,.group\/input-group[data-disabled=true] .group-data-\[disabled\=true\]\/input-group\:opacity-50,.group[data-disabled=true] .group-data-\[disabled\=true\]\:opacity-50{opacity:.5}.group[data-variant=floating] .group-data-\[variant\=floating\]\:shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:duration-200{transition-duration:.2s;animation-duration:.2s}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:after\:left-full:after{content:var(--tw-content);left:100%}.group[data-collapsible=offcanvas] .hover\:group-data-\[collapsible\=offcanvas\]\:bg-sidebar:hover{background-color:hsl(var(--sidebar-background))}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.peer\/menu-button[data-size=default]~.peer-data-\[size\=default\]\/menu-button\:top-1\.5{top:.375rem}.peer\/menu-button[data-size=lg]~.peer-data-\[size\=lg\]\/menu-button\:top-2\.5{top:.625rem}.peer\/menu-button[data-size=sm]~.peer-data-\[size\=sm\]\/menu-button\:top-1{top:.25rem}.peer\/menu-button[data-active=true]~.peer-data-\[active\=true\]\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.dark\:border-input:is(.dark *){border-color:hsl(var(--input))}.dark\:bg-destructive\/60:is(.dark *){background-color:hsl(var(--destructive) / .6)}.dark\:bg-input\/30:is(.dark *){background-color:hsl(var(--input) / .3)}.dark\:bg-slate-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.dark\:bg-transparent:is(.dark *){background-color:transparent}.dark\:text-muted-foreground:is(.dark *){color:hsl(var(--muted-foreground))}.dark\:hover\:bg-accent\/50:hover:is(.dark *){background-color:hsl(var(--accent) / .5)}.dark\:hover\:bg-input\/50:hover:is(.dark *){background-color:hsl(var(--input) / .5)}.dark\:hover\:text-accent-foreground:hover:is(.dark *){color:hsl(var(--accent-foreground))}.dark\:focus-visible\:ring-destructive\/40:focus-visible:is(.dark *){--tw-ring-color: hsl(var(--destructive) / .4)}.dark\:has-\[\[data-slot\]\[aria-invalid\=true\]\]\:ring-destructive\/40:has([data-slot][aria-invalid=true]):is(.dark *){--tw-ring-color: hsl(var(--destructive) / .4)}.dark\:data-\[state\=active\]\:border-input[data-state=active]:is(.dark *){border-color:hsl(var(--input))}.dark\:data-\[state\=active\]\:bg-input\/30[data-state=active]:is(.dark *){background-color:hsl(var(--input) / .3)}.dark\:data-\[state\=checked\]\:bg-primary[data-state=checked]:is(.dark *){background-color:hsl(var(--primary))}.dark\:data-\[state\=checked\]\:bg-primary-foreground[data-state=checked]:is(.dark *){background-color:hsl(var(--primary-foreground))}.dark\:data-\[state\=unchecked\]\:bg-foreground[data-state=unchecked]:is(.dark *){background-color:hsl(var(--foreground))}.dark\:data-\[state\=unchecked\]\:bg-input\/80[data-state=unchecked]:is(.dark *){background-color:hsl(var(--input) / .8)}.dark\:data-\[state\=active\]\:text-foreground[data-state=active]:is(.dark *){color:hsl(var(--foreground))}.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20:focus[data-variant=destructive]:is(.dark *){background-color:hsl(var(--destructive) / .2)}@media(min-width:640px){.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:table-cell{display:table-cell}.sm\:max-w-\[300px\]{max-width:300px}.sm\:max-w-\[480px\]{max-width:480px}.sm\:max-w-\[620px\]{max-width:620px}.sm\:max-w-\[680px\]{max-width:680px}.sm\:max-w-lg{max-width:32rem}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2{gap:.5rem}.sm\:gap-2\.5{gap:.625rem}.sm\:pl-2\.5{padding-left:.625rem}.sm\:pr-2\.5{padding-right:.625rem}.sm\:text-left{text-align:left}.data-\[vaul-drawer-direction\=left\]\:sm\:max-w-sm[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:sm\:max-w-sm[data-vaul-drawer-direction=right]{max-width:24rem}}@media(min-width:768px){.md\:absolute{position:absolute}.md\:block{display:block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:table-cell{display:table-cell}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-\[400px\]{max-width:400px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-1\.5{gap:.375rem}.md\:p-12{padding:3rem}.md\:text-left{text-align:left}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:opacity-0{opacity:0}.md\:after\:hidden:after{content:var(--tw-content);display:none}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:m-2{margin:.5rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:ml-0{margin-left:0}.peer[data-variant=inset][data-state=collapsed]~.md\:peer-data-\[variant\=inset\]\:peer-data-\[state\=collapsed\]\:ml-2{margin-left:.5rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:rounded-xl{border-radius:calc(var(--radius) + 4px)}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}@media(min-width:1024px){.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-3{grid-column:span 3 / span 3}.lg\:table-cell{display:table-cell}.lg\:w-\[360px\]{width:360px}.lg\:w-\[400px\]{width:400px}.lg\:w-\[600px\]{width:600px}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media(min-width:1280px){.xl\:table-cell{display:table-cell}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}.\[\&\+\[data-slot\=item-content\]\]\:flex-none+[data-slot=item-content]{flex:none}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:nth-child\(2\)\[data-selected\=true\]_button\]\:rounded-l-md:nth-child(2)[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\>\*\:not\(\:first-child\)\]\:rounded-l-none>*:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.\[\&\>\*\:not\(\:first-child\)\]\:rounded-t-none>*:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.\[\&\>\*\:not\(\:first-child\)\]\:border-l-0>*:not(:first-child){border-left-width:0px}.\[\&\>\*\:not\(\:first-child\)\]\:border-t-0>*:not(:first-child){border-top-width:0px}.\[\&\>\*\:not\(\:last-child\)\]\:rounded-b-none>*:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0}.\[\&\>\*\:not\(\:last-child\)\]\:rounded-r-none>*:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.\[\&\>\*\]\:w-full>*{width:100%}.\[\&\>\*\]\:focus-visible\:relative:focus-visible>*{position:relative}.\[\&\>\*\]\:focus-visible\:z-10:focus-visible>*{z-index:10}.\[\&\>\*\]\:data-\[slot\=field\]\:p-4[data-slot=field]>*{padding:1rem}.\[\&\>\.sr-only\]\:w-auto>.sr-only{width:auto}.\[\&\>\[data-slot\=field-group\]\]\:gap-4>[data-slot=field-group]{gap:1rem}.\[\&\>\[data-slot\=field-label\]\]\:flex-auto>[data-slot=field-label]{flex:1 1 auto}.\[\&\>\[data-slot\=progress-indicator\]\]\:bg-amber-500>[data-slot=progress-indicator]{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.\[\&\>\[data-slot\=progress-indicator\]\]\:bg-emerald-500>[data-slot=progress-indicator]{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.\[\&\>\[data-slot\=progress-indicator\]\]\:bg-red-500>[data-slot=progress-indicator]{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.has-\[select\[aria-hidden\=true\]\:last-child\]\:\[\&\>\[data-slot\=select-trigger\]\:last-of-type\]\:rounded-r-md>[data-slot=select-trigger]:last-of-type:has(select[aria-hidden=true]:last-child){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[data-slot\=select-trigger\]\:not\(\[class\*\=\'w-\'\]\)\]\:w-fit>[data-slot=select-trigger]:not([class*=w-]){width:-moz-fit-content;width:fit-content}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>a\:hover\]\:text-primary>a:hover{color:hsl(var(--primary))}.\[\&\>a\]\:underline>a{text-decoration-line:underline}.\[\&\>a\]\:underline-offset-4>a{text-underline-offset:4px}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>input\]\:flex-1>input{flex:1 1 0%}.has-\[\>\[data-align\=block-end\]\]\:\[\&\>input\]\:pt-3>input:has(>[data-align=block-end]){padding-top:.75rem}.has-\[\>\[data-align\=block-start\]\]\:\[\&\>input\]\:pb-3>input:has(>[data-align=block-start]){padding-bottom:.75rem}.has-\[\>\[data-align\=inline-end\]\]\:\[\&\>input\]\:pr-2>input:has(>[data-align=inline-end]){padding-right:.5rem}.has-\[\>\[data-align\=inline-start\]\]\:\[\&\>input\]\:pl-2>input:has(>[data-align=inline-start]){padding-left:.5rem}.\[\&\>kbd\]\:rounded-\[calc\(var\(--radius\)-5px\)\]>kbd{border-radius:calc(var(--radius) - 5px)}.\[\&\>span\:last-child\]\:truncate>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3\.5>svg:not([class*=size-]){width:.875rem;height:.875rem}.\[\&\>svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4>svg:not([class*=size-]){width:1rem;height:1rem}.\[\&\>svg\]\:pointer-events-none>svg{pointer-events:none}.\[\&\>svg\]\:size-3>svg{width:.75rem;height:.75rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:size-4>svg{width:1rem;height:1rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:translate-y-0\.5>svg{--tw-translate-y: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:text-current>svg{color:currentColor}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:hsl(var(--sidebar-accent-foreground))}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_img\]\:size-full img{width:100%;height:100%}.\[\&_img\]\:object-cover img{-o-object-fit:cover;object-fit:cover}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3 svg:not([class*=size-]){width:.75rem;height:.75rem}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:1rem;height:1rem}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-6 svg:not([class*=size-]){width:1.5rem;height:1.5rem}.\[\&_svg\:not\(\[class\*\=\'text-\'\]\)\]\:text-muted-foreground svg:not([class*=text-]){color:hsl(var(--muted-foreground))}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:-.5rem}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:-.5rem}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}[data-slot=tooltip-content] .\[\[data-slot\=tooltip-content\]_\&\]\:bg-background\/20{background-color:hsl(var(--background) / .2)}[data-slot=tooltip-content] .\[\[data-slot\=tooltip-content\]_\&\]\:text-background{color:hsl(var(--background))}[data-slot=tooltip-content] .dark\:\[\[data-slot\=tooltip-content\]_\&\]\:bg-background\/10:is(.dark *){background-color:hsl(var(--background) / .1)}[data-variant=legend]+.\[\[data-variant\=legend\]\+\&\]\:-mt-1\.5{margin-top:-.375rem}a.\[a\&\]\:hover\:bg-accent:hover{background-color:hsl(var(--accent))}a.\[a\&\]\:hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}a.\[a\&\]\:hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}a.\[a\&\]\:hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}a.\[a\&\]\:hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))} diff --git a/backend/static/assets/index-BkulU9RM.js b/backend/static/assets/index-BkulU9RM.js new file mode 100644 index 0000000..6fb4bbc --- /dev/null +++ b/backend/static/assets/index-BkulU9RM.js @@ -0,0 +1,2 @@ +import{h as n,af as u,ag as l,ah as i}from"./index-Bp-M7P_8.js";const m={getClusters:async()=>n.get("/kubernetes-clusters"),getClusterDetail:async e=>n.get(`/kubernetes-clusters/${e}/detail`),createCluster:async e=>n.post("/kubernetes-clusters",e),updateCluster:async(e,s)=>n.put(`/kubernetes-clusters/${e}`,s),deleteCluster:async e=>n.delete(`/kubernetes-clusters/${e}`),getPods:async e=>n.get(`/kubernetes-clusters/${e}/pods`),getDeployments:async e=>n.get(`/kubernetes-clusters/${e}/deployments`),getServices:async e=>n.get(`/kubernetes-clusters/${e}/services`),getIngresses:async e=>n.get(`/kubernetes-clusters/${e}/ingresses`),syncCluster:async e=>n.post(`/kubernetes-clusters/${e}/sync`),exportAllResources:async e=>n.download(`/kubernetes/${e}/export`,`cluster-${e}-resources.tar.gz`),getTopology:async e=>n.get(`/kubernetes-clusters/${e}/topology`),saveTopology:async(e,s)=>n.put(`/kubernetes-clusters/${e}/topology`,{layout_data:s}),getMultiClusterComparison:async()=>n.get("/kubernetes/compare")},y={getNodes:async e=>n.get(`/kubernetes-clusters/${e}/nodes`),getClusterNodes:async e=>n.get(`/kubernetes/${e}/nodes`),getNodeDetail:async(e,s)=>n.get(`/kubernetes/${e}/nodes/${encodeURIComponent(s)}`)};function g(e,s){if(s.length===0)return;const t=Object.keys(s[0]),a=[t.join(","),...s.map(o=>t.map(p=>JSON.stringify(o[p]??"")).join(","))].join(` +`),c=new Blob(["\uFEFF"+a],{type:"text/csv;charset=utf-8;"}),r=document.createElement("a");r.href=URL.createObjectURL(c),r.download=e,r.click(),URL.revokeObjectURL(r.href)}function b(e,s){const t=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),a=document.createElement("a");a.href=URL.createObjectURL(t),a.download=e,a.click(),URL.revokeObjectURL(a.href)}function D(e,s){const t=new Blob([s],{type:"application/x-yaml;charset=utf-8"}),a=document.createElement("a");a.href=URL.createObjectURL(t),a.download=e.endsWith(".yaml")?e:`${e}.yaml`,a.click(),URL.revokeObjectURL(a.href)}function d(e,s,t,a={}){const c=new URLSearchParams;return c.set("stream","true"),a.container&&c.set("container",a.container),a.tailLines&&a.tailLines>0&&c.set("tailLines",String(a.tailLines)),a.previous&&c.set("previous","true"),a.sinceTime&&c.set("sinceTime",a.sinceTime),l(`/kubernetes/${e}/namespace/${s}/pods/${t}/logs`,c)}function k(e,s,t,a,c){const r=new URLSearchParams;a&&r.set("container",a),c&&r.set("command",c);const o=u();o&&r.set("token",o);const p=r.toString();return`${i()}/ws/kubernetes-exec/${e}/namespaces/${s}/pods/${t}${p?`?${p}`:""}`}function $(e,s,t,a,c){const r=new URLSearchParams({path:a});c&&r.set("container",c);const o=u();return o&&r.set("token",o),l(`/kubernetes/${e}/namespace/${s}/pods/${t}/files/download`,r)}async function f(e,s,t,a,c){const r=$(e,s,t,a,c),o=await fetch(r);if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}async function S(e,s,t,a,c,r){const o=new FormData;return o.append("file",c),o.append("path",a),r&&o.append("container",r),n.upload(`/kubernetes/${e}/namespace/${s}/pods/${t}/files/upload`,o)}const h={getPodLogs:async(e,s,t,a=200,c)=>{const r=new URLSearchParams({tail:String(a)});return c&&r.set("container",c),n.get(`/kubernetes/${e}/namespace/${s}/pods/${t}/logs?${r}`)},getPodLogsEnhanced:async(e,s,t,a={})=>{const c=new URLSearchParams;a.container&&c.set("container",a.container),a.tailLines&&a.tailLines>0&&c.set("tailLines",String(a.tailLines)),a.previous&&c.set("previous","true"),a.sinceTime&&c.set("sinceTime",a.sinceTime);const r=c.toString();return n.get(`/kubernetes/${e}/namespace/${s}/pods/${t}/logs${r?`?${r}`:""}`)},buildPodLogsStreamUrl:d,execPod:async(e,s,t,a,c)=>n.post(`/kubernetes/${e}/namespace/${s}/pods/${t}/exec`,{command:a,container:c}),buildPodExecWsUrl:k,listPodFiles:async(e,s,t,a,c)=>n.post(`/kubernetes/${e}/namespace/${s}/pods/${t}/files/list`,{path:a,container:c}),buildPodFileDownloadUrl:$,readPodFileText:f,uploadPodFile:S,getPodMetrics:async(e,s)=>{const t=s?{namespace:s}:void 0;return n.get(`/kubernetes/${e}/metrics/pods`,t)},getAllPods:async e=>n.get(`/kubernetes/${e}/pods`),getNamespacePods:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/pods`)},L={scaleDeployment:async(e,s,t,a)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/scale`,{replicas:a}),restartDeployment:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/restart`),pauseDeployment:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/pause`),resumeDeployment:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/resume`),updateDeploymentImage:async(e,s,t,a,c)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/update-image`,{image:a,container_name:c}),getHPAs:async(e,s)=>s?n.get(`/kubernetes/${e}/namespace/${s}/hpas`):n.get(`/kubernetes/${e}/hpas`),createHPA:async(e,s)=>n.post(`/kubernetes/${e}/namespace/${s.namespace}/hpas`,s),deleteHPA:async(e,s,t)=>n.delete(`/kubernetes/${e}/namespace/${s}/hpas/${t}`),getCronJobs:async(e,s)=>s?n.get(`/kubernetes/${e}/namespace/${s}/cronjobs`):n.get(`/kubernetes-clusters/${e}/cronjobs`),createCronJob:async(e,s)=>n.post(`/kubernetes/${e}/namespace/${s.namespace}/cronjobs`,s),suspendCronJob:async(e,s,t,a)=>n.post(`/kubernetes/${e}/namespace/${s}/cronjobs/${t}/suspend`,{suspend:a}),triggerCronJob:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/cronjobs/${t}/trigger`),deleteCronJob:async(e,s,t)=>n.delete(`/kubernetes/${e}/namespace/${s}/cronjobs/${t}`),getNamespaceDeployments:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/deployments`),getAllDeployments:async e=>n.get(`/kubernetes/${e}/deployments`),getStatefulSets:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/statefulsets`),getDaemonSets:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/daemonsets`),getStatefulSetDetail:async(e,s,t)=>n.get(`/kubernetes/${e}/namespace/${s}/statefulsets/${t}`),getDaemonSetDetail:async(e,s,t)=>n.get(`/kubernetes/${e}/namespace/${s}/daemonsets/${t}`),scaleStatefulSet:async(e,s,t,a)=>n.post(`/kubernetes/${e}/namespace/${s}/statefulsets/${t}/scale`,{replicas:a}),restartStatefulSet:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/statefulsets/${t}/restart`,{}),restartDaemonSet:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/daemonsets/${t}/restart`,{}),getReplicaSets:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/replicasets`),getDeploymentRevisions:async(e,s,t)=>n.get(`/kubernetes/${e}/namespace/${s}/deployments/${t}/revisions`),rollbackDeployment:async(e,s,t,a)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/rollback`,{revision:a}),getDeployment:async(e,s,t)=>{try{return await n.get(`/kubernetes/${e}/namespace/${s}/deployments/${t}`)}catch{const a=await n.get(`/kubernetes/${e}/namespace/${s}/deployments`);return(Array.isArray(a)?a:a?.list||a?.items||a?.data||[]).find(r=>r.name===t)||null}}},R={getNamespaces:async e=>n.get(`/kubernetes/${e}/namespaces`),getNamespacesDetail:async e=>n.get(`/kubernetes/${e}/namespaces/detail`),getNamespaceDetail:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/detail`),createNamespace:async(e,s,t)=>n.post(`/kubernetes/${e}/namespaces`,{name:s,labels:t||{}}),deleteNamespace:async(e,s)=>n.delete(`/kubernetes/${e}/namespaces/${s}`),exportNamespaceResources:async(e,s)=>n.download(`/kubernetes/${e}/namespace/${s}/export`,`${s}-resources.tar.gz`)},w={getNamespaceServices:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/services`),getNamespaceIngresses:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/ingresses`),getNamespaceConfigMaps:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/configmaps`),getNamespaceSecrets:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/secrets`),getPVCs:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/pvcs`),deletePVC:async(e,s,t)=>n.delete(`/kubernetes/${e}/namespace/${s}/pvcs/${t}`),getServiceAccounts:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/serviceaccounts`),getRoles:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/roles`),getRoleBindings:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/rolebindings`),getResourceYaml:async(e,s,t,a)=>n.getRaw(`/kubernetes/${e}/namespace/${s}/${t}/${a}/yaml`),updateResourceYaml:async(e,s,t,a,c)=>n.putRaw(`/kubernetes/${e}/namespace/${s}/${t}/${a}/yaml`,c,"application/yaml"),deleteResourceYaml:async(e,s,t,a)=>n.delete(`/kubernetes/${e}/namespace/${s}/${t}/${a}/yaml`),getEvents:async(e,s,t)=>{const a={};return s&&(a.namespace=s),t&&(a.type=t),n.get(`/kubernetes/${e}/events`,a)},getEventsSummary:async(e,s,t)=>{const a={};return s&&(a.namespace=s),t&&(a.hours=t),n.get(`/kubernetes/${e}/events/summary`,a)},getCapacity:async(e,s)=>{const t=s?{namespace:s}:void 0;return n.get(`/kubernetes/${e}/capacity`,t)},applyYAML:async(e,s)=>n.post(`/kubernetes/${e}/yaml/apply`,{yaml:s})},U={...m,...y,...h,...L,...R,...w,exportAsCSV:g,exportAsJSON:b};export{D as d,U as k}; diff --git a/backend/static/assets/index-LZWfu62c.js b/backend/static/assets/index-Bp-M7P_8.js similarity index 94% rename from backend/static/assets/index-LZWfu62c.js rename to backend/static/assets/index-Bp-M7P_8.js index 1900440..5a02f69 100644 --- a/backend/static/assets/index-LZWfu62c.js +++ b/backend/static/assets/index-Bp-M7P_8.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-DQzWxW5H.js","assets/vendor-codemirror-C7mXSpXt.js","assets/dashboard-7Sl2aero.js","assets/server-BUAZv7ZV.js","assets/index-Z0O8nAcG.js","assets/stat-strip-BPzU38xY.js","assets/card-B-RtdR4H.js","assets/badge-B0F5ZNtn.js","assets/vendor-icons-Aso0-eeY.js","assets/AreaChart-Czgv4pNk.js","assets/ServerManager-D6Uxl03e.js","assets/input-BdDauX3U.js","assets/checkbox-DL3onEGv.js","assets/index-CYARH0Cq.js","assets/table-BPFYQwjr.js","assets/select-4xU_9B3_.js","assets/unwrap-BmWy-KM2.js","assets/useMutation-Bp3lz5hm.js","assets/account-Dzyhyahe.js","assets/vendor-xterm-20M9KZE1.js","assets/vendor-xterm-DXOU9pbP.css","assets/xterm-utils-slbfdUHf.js","assets/credential-CwQY-4Ba.js","assets/region-BZBRxF2X.js","assets/label-u-lNUbKh.js","assets/textarea-BdtIagjy.js","assets/CloudAccountManager-Dth1Gy-B.js","assets/DomainManager-AazO_ekQ.js","assets/RegionManager-BFFP324K.js","assets/PlatformManager-CsXWkkgm.js","assets/platform-g_u95ryi.js","assets/CloudBilling-Dtss07cb.js","assets/switch-C4PJnJ9I.js","assets/billing-9Cbmzl6K.js","assets/KubernetesClusters-DD7SeVKO.js","assets/tabs-kmtfM2I-.js","assets/ClusterOverviewPage-CBfjCIXY.js","assets/use-toast-CkA38LVP.js","assets/NodeDetailPage-CSCwjDLO.js","assets/NamespaceOverviewPage-CrqNiJMQ.js","assets/NamespaceManagementPage-BuGcKQSw.js","assets/NamespaceResourcePage-Cf6hgoD2.js","assets/PodFileBrowser-Bs6KRfHw.js","assets/ResourceVisualEditor-CXyg-7xn.js","assets/DeploymentDetailPage-DEq3tEZd.js","assets/WorkloadViewPage-DSiv67B6.js","assets/TopologyView-DdP6o9Mj.js","assets/KubernetesNodes-B0frAPbY.js","assets/PodMetricsPage-NkW2J2Qd.js","assets/EventsPage-UFe_ZFfW.js","assets/CapacityPage-BucLnYij.js","assets/K8sShortcutRedirect-fX_VMnZ-.js","assets/AlertManager-C0AXwvA2.js","assets/alert-C4MMKcUL.js","assets/AlertRuleDialog-BsJX7bok.js","assets/ApprovalFlow-BziKIUh9.js","assets/approval-DmGRfKd6.js","assets/ApprovalResourcePage-CnDxsH56.js","assets/ApprovalCategoryPage-BdbU4Noo.js","assets/ApprovalAppPage-BrRxxZFx.js","assets/ApprovalPermissionPage-Bv3kKyby.js","assets/ApprovalWorkflowPage-Feqoq_m6.js","assets/ScriptManager-Dz9eHvUK.js","assets/automation-BrmX02Sx.js","assets/SystemManager-B9Kzdis0.js","assets/TerminalAuditTab-D4-qFyPi.js","assets/terminal-BchqP-zB.js","assets/AuditOperationsTab-zpIlq3AD.js","assets/audit-BiL35K5G.js","assets/LoginLogsTab-BZTjs1T3.js","assets/CredentialManager-VPjoE2mR.js","assets/PipelineManager-C_oAjTIU.js","assets/pipeline-Lgvc2XUS.js","assets/config-DAXaHuse.js","assets/DeployCredentials-C7pbsNa2.js","assets/PipelineEditor-BEQjb4Gp.js","assets/PipelineRunDetail-C9e6xlUh.js","assets/DeployRBAC-XP_74TOu.js","assets/UserGroupsManager-CjYJT4qh.js","assets/CronJobManager-Dow5NQrR.js","assets/AIOpsAssistant-annAjw3b.js","assets/agent-g0Vk8FYK.js","assets/ai-BMSiZ3PN.js","assets/AIAlertAnalyzer-DcLlw3nl.js","assets/AIPredictiveAnalytics-PqRHnPeG.js","assets/AlertCenter-VCEUxoOH.js","assets/alert-center-dJk4LGZM.js","assets/TraceManager-JbMTFm_u.js","assets/trace-L8uY5gM3.js","assets/HostMonitor-D4f8NRVg.js","assets/GrafanaDashboard-Cwk6bt47.js","assets/grafana-DTc3taUi.js","assets/datasource-DuIT0c1H.js","assets/metrics-Dj4l07HZ.js","assets/MonitorCenter-DZJmSfOk.js","assets/site-B-pRndoi.js","assets/MetricsExplorer-CBLW7MW5.js","assets/DatasourcePage-7FoNVKhF.js"])))=>i.map(i=>d[i]); -import{b as ty,r as m,g as PS,j as h,a as ct,c as Zd}from"./vendor-codemirror-C7mXSpXt.js";import{i as Td,bd as ny,be as VS,D as ad,ag as zg,G as Lg,M as GS,e as qS,u as kg,h as Ug,g as YS,B as Ds,b as XS,k as QS,N as rd,o as od,j as Ns,p as Xs,t as $o,J as ld,ar as Hg,_ as KS,A as FS,bf as Bg,r as Pg,b3 as ZS,l as ni,av as IS,as as $S,bg as JS,Z as WS,bh as ew,V as tw,Q as nw,I as aw,y as rw,bi as ay,w as ry,bj as ow,U as oy,bk as lw,ap as ly,f as sw,X as iw,ab as cw,aN as uw,aO as dw,x as fw,L as hw,bl as Vg,n as pw}from"./vendor-icons-Aso0-eeY.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const u of i)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function l(i){const u={};return i.integrity&&(u.integrity=i.integrity),i.referrerPolicy&&(u.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?u.credentials="include":i.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(i){if(i.ep)return;i.ep=!0;const u=l(i);fetch(i.href,u)}})();var sd={exports:{}},Yo={},id={exports:{}},cd={};var Gg;function mw(){return Gg||(Gg=1,(function(n){function r(z,X){var B=z.length;z.push(X);e:for(;0>>1,ie=z[F];if(0>>1;Fi(re,B))vei(Ke,re)?(z[F]=Ke,z[ve]=B,F=ve):(z[F]=re,z[Ee]=B,F=Ee);else if(vei(Ke,B))z[F]=Ke,z[ve]=B,F=ve;else break e}}return X}function i(z,X){var B=z.sortIndex-X.sortIndex;return B!==0?B:z.id-X.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var v=[],g=[],x=1,b=null,w=3,A=!1,R=!1,C=!1,E=!1,O=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function U(z){for(var X=l(g);X!==null;){if(X.callback===null)s(g);else if(X.startTime<=z)s(g),X.sortIndex=X.expirationTime,r(v,X);else break;X=l(g)}}function V(z){if(C=!1,U(z),!R)if(l(v)!==null)R=!0,K||(K=!0,ue());else{var X=l(g);X!==null&&de(V,X.startTime-z)}}var K=!1,Q=-1,Y=5,I=-1;function ne(){return E?!0:!(n.unstable_now()-Iz&&ne());){var F=b.callback;if(typeof F=="function"){b.callback=null,w=b.priorityLevel;var ie=F(b.expirationTime<=z);if(z=n.unstable_now(),typeof ie=="function"){b.callback=ie,U(z),X=!0;break t}b===l(v)&&s(v),U(z)}else s(v);b=l(v)}if(b!==null)X=!0;else{var Oe=l(g);Oe!==null&&de(V,Oe.startTime-z),X=!1}}break e}finally{b=null,w=B,A=!1}X=void 0}}finally{X?ue():K=!1}}}var ue;if(typeof N=="function")ue=function(){N(ce)};else if(typeof MessageChannel<"u"){var we=new MessageChannel,me=we.port2;we.port1.onmessage=ce,ue=function(){me.postMessage(null)}}else ue=function(){O(ce,0)};function de(z,X){Q=O(function(){z(n.unstable_now())},X)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(z){z.callback=null},n.unstable_forceFrameRate=function(z){0>z||125F?(z.sortIndex=B,r(g,z),l(v)===null&&z===l(g)&&(C?(L(Q),Q=-1):C=!0,de(V,B-F))):(z.sortIndex=ie,r(v,z),R||A||(R=!0,K||(K=!0,ue()))),z},n.unstable_shouldYield=ne,n.unstable_wrapCallback=function(z){var X=w;return function(){var B=w;w=X;try{return z.apply(this,arguments)}finally{w=B}}}})(cd)),cd}var qg;function gw(){return qg||(qg=1,id.exports=mw()),id.exports}var ud={exports:{}},it={};var Yg;function vw(){if(Yg)return it;Yg=1;var n=ty();function r(v){var g="https://react.dev/errors/"+v;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),ud.exports=vw(),ud.exports}var Qg;function yw(){if(Qg)return Yo;Qg=1;var n=gw(),r=ty(),l=sy();function s(e){var t="https://react.dev/errors/"+e;if(1ie||(e.current=F[ie],F[ie]=null,ie--)}function re(e,t){ie++,F[ie]=e.current,e.current=t}var ve=Oe(null),Ke=Oe(null),Je=Oe(null),fe=Oe(null);function At(e,t){switch(re(Je,t),re(Ke,e),re(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ag(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ag(t),e=rg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ee(ve),re(ve,e)}function Ct(){Ee(ve),Ee(Ke),Ee(Je)}function un(e){e.memoizedState!==null&&re(fe,e);var t=ve.current,a=rg(t,e.type);t!==a&&(re(Ke,e),re(ve,a))}function dn(e){Ke.current===e&&(Ee(ve),Ee(Ke)),fe.current===e&&(Ee(fe),Po._currentValue=B)}var fn,Aa;function Ca(e){if(fn===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);fn=t&&t[1]||"",Aa=-1i.map(i=>d[i]); +import{b as ty,r as m,g as PS,j as h,R as ct,c as Zd}from"./vendor-codemirror-B1SGo4xl.js";import{i as Td,bd as ny,be as VS,D as ad,ag as zg,G as Lg,M as GS,e as qS,u as kg,h as Ug,g as YS,B as Ds,b as XS,k as QS,N as rd,o as od,j as Ns,p as Xs,t as $o,J as ld,ar as Hg,_ as KS,A as FS,bf as Bg,r as Pg,b3 as ZS,l as ni,av as IS,as as $S,bg as JS,Z as WS,bh as ew,V as tw,Q as nw,I as aw,y as rw,bi as ay,w as ry,bj as ow,U as oy,bk as lw,ap as ly,f as sw,X as iw,ab as cw,aK as uw,aL as dw,x as fw,L as hw,bl as Vg,n as pw}from"./vendor-icons-BWk-DH7F.js";(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const u of i)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&s(f)}).observe(document,{childList:!0,subtree:!0});function l(i){const u={};return i.integrity&&(u.integrity=i.integrity),i.referrerPolicy&&(u.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?u.credentials="include":i.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function s(i){if(i.ep)return;i.ep=!0;const u=l(i);fetch(i.href,u)}})();var sd={exports:{}},Yo={},id={exports:{}},cd={};var Gg;function mw(){return Gg||(Gg=1,(function(n){function r(z,X){var B=z.length;z.push(X);e:for(;0>>1,ie=z[F];if(0>>1;Fi(re,B))vei(Ke,re)?(z[F]=Ke,z[ve]=B,F=ve):(z[F]=re,z[Ee]=B,F=Ee);else if(vei(Ke,B))z[F]=Ke,z[ve]=B,F=ve;else break e}}return X}function i(z,X){var B=z.sortIndex-X.sortIndex;return B!==0?B:z.id-X.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var f=Date,p=f.now();n.unstable_now=function(){return f.now()-p}}var v=[],g=[],x=1,b=null,w=3,A=!1,R=!1,C=!1,E=!1,O=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function U(z){for(var X=l(g);X!==null;){if(X.callback===null)s(g);else if(X.startTime<=z)s(g),X.sortIndex=X.expirationTime,r(v,X);else break;X=l(g)}}function V(z){if(C=!1,U(z),!R)if(l(v)!==null)R=!0,K||(K=!0,ue());else{var X=l(g);X!==null&&de(V,X.startTime-z)}}var K=!1,Q=-1,Y=5,I=-1;function ne(){return E?!0:!(n.unstable_now()-Iz&&ne());){var F=b.callback;if(typeof F=="function"){b.callback=null,w=b.priorityLevel;var ie=F(b.expirationTime<=z);if(z=n.unstable_now(),typeof ie=="function"){b.callback=ie,U(z),X=!0;break t}b===l(v)&&s(v),U(z)}else s(v);b=l(v)}if(b!==null)X=!0;else{var Oe=l(g);Oe!==null&&de(V,Oe.startTime-z),X=!1}}break e}finally{b=null,w=B,A=!1}X=void 0}}finally{X?ue():K=!1}}}var ue;if(typeof N=="function")ue=function(){N(ce)};else if(typeof MessageChannel<"u"){var we=new MessageChannel,me=we.port2;we.port1.onmessage=ce,ue=function(){me.postMessage(null)}}else ue=function(){O(ce,0)};function de(z,X){Q=O(function(){z(n.unstable_now())},X)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(z){z.callback=null},n.unstable_forceFrameRate=function(z){0>z||125F?(z.sortIndex=B,r(g,z),l(v)===null&&z===l(g)&&(C?(L(Q),Q=-1):C=!0,de(V,B-F))):(z.sortIndex=ie,r(v,z),R||A||(R=!0,K||(K=!0,ue()))),z},n.unstable_shouldYield=ne,n.unstable_wrapCallback=function(z){var X=w;return function(){var B=w;w=X;try{return z.apply(this,arguments)}finally{w=B}}}})(cd)),cd}var qg;function gw(){return qg||(qg=1,id.exports=mw()),id.exports}var ud={exports:{}},it={};var Yg;function vw(){if(Yg)return it;Yg=1;var n=ty();function r(v){var g="https://react.dev/errors/"+v;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),ud.exports=vw(),ud.exports}var Qg;function yw(){if(Qg)return Yo;Qg=1;var n=gw(),r=ty(),l=sy();function s(e){var t="https://react.dev/errors/"+e;if(1ie||(e.current=F[ie],F[ie]=null,ie--)}function re(e,t){ie++,F[ie]=e.current,e.current=t}var ve=Oe(null),Ke=Oe(null),Je=Oe(null),fe=Oe(null);function At(e,t){switch(re(Je,t),re(Ke,e),re(ve,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?ag(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=ag(t),e=rg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ee(ve),re(ve,e)}function Ct(){Ee(ve),Ee(Ke),Ee(Je)}function un(e){e.memoizedState!==null&&re(fe,e);var t=ve.current,a=rg(t,e.type);t!==a&&(re(Ke,e),re(ve,a))}function dn(e){Ke.current===e&&(Ee(ve),Ee(Ke)),fe.current===e&&(Ee(fe),Po._currentValue=B)}var fn,Aa;function Ca(e){if(fn===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);fn=t&&t[1]||"",Aa=-1)":-1{Zv.success("错误信息已复制到剪贴板,请粘贴到 Issue 中")}).catch(()=>{Zv.error("复制失败,请手动复制错误信息")})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:h.jsx("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:64:9",className:"min-h-[60vh] flex items-center justify-center p-6",children:h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:65:11",className:"dg-card max-w-lg w-full p-8 text-center space-y-6",children:[h.jsx("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:67:13",className:"mx-auto w-16 h-16 rounded-2xl bg-red-500/10 flex items-center justify-center",children:h.jsx(ni,{"code-path":"src/components/layout/ErrorBoundary.tsx:68:15",className:"h-8 w-8 text-red-400"})}),h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:72:13",children:[h.jsx("h2",{"code-path":"src/components/layout/ErrorBoundary.tsx:73:15",className:"text-xl font-bold text-[var(--dg-text-primary)]",children:"页面出现错误"}),h.jsx("p",{"code-path":"src/components/layout/ErrorBoundary.tsx:76:15",className:"text-sm text-[var(--dg-text-muted)] mt-2",children:"抱歉,该页面遇到了意外错误。您可以尝试重新加载或返回首页。"})]}),this.state.error&&h.jsx("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:83:15",className:"text-left",children:h.jsxs("details",{"code-path":"src/components/layout/ErrorBoundary.tsx:84:17",className:"group",children:[h.jsxs("summary",{"code-path":"src/components/layout/ErrorBoundary.tsx:85:19",className:"cursor-pointer text-xs text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] transition-colors flex items-center gap-1.5",children:[h.jsx(Vg,{"code-path":"src/components/layout/ErrorBoundary.tsx:86:21",className:"h-3.5 w-3.5"}),"查看错误详情"]}),h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:89:19",className:"mt-2 p-3 rounded-lg bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] overflow-auto max-h-48",children:[h.jsxs("code",{"code-path":"src/components/layout/ErrorBoundary.tsx:90:21",className:"text-xs text-red-400 font-mono block whitespace-pre-wrap",children:[this.state.error.name,": ",this.state.error.message]}),this.state.errorInfo&&h.jsx("pre",{"code-path":"src/components/layout/ErrorBoundary.tsx:94:23",className:"text-xs text-[var(--dg-text-muted)] mt-2 whitespace-pre-wrap",children:this.state.errorInfo.componentStack})]})]})}),h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:104:13",className:"flex items-center justify-center gap-3",children:[h.jsxs(St,{"code-path":"src/components/layout/ErrorBoundary.tsx:105:15",variant:"outline",className:"dg-btn-secondary",onClick:this.handleGoHome,children:[h.jsx(ly,{"code-path":"src/components/layout/ErrorBoundary.tsx:110:17",className:"h-4 w-4 mr-1.5"}),"返回首页"]}),h.jsxs(St,{"code-path":"src/components/layout/ErrorBoundary.tsx:113:15",className:"dg-btn-primary",onClick:this.handleRetry,children:[h.jsx(pw,{"code-path":"src/components/layout/ErrorBoundary.tsx:117:17",className:"h-4 w-4 mr-1.5"}),"重新加载"]}),h.jsxs(St,{"code-path":"src/components/layout/ErrorBoundary.tsx:120:15",variant:"outline",className:"dg-btn-ghost",onClick:this.handleReport,children:[h.jsx(Vg,{"code-path":"src/components/layout/ErrorBoundary.tsx:125:17",className:"h-4 w-4 mr-1.5"}),"复制错误"]})]})]})}):this.props.children}}const SM=m.lazy(()=>se(()=>import("./Dashboard-DQzWxW5H.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(n=>({default:n.Dashboard}))),wM=m.lazy(()=>se(()=>import("./ServerManager-D6Uxl03e.js"),__vite__mapDeps([10,1,6,11,12,13,8,14,15,16,17,3,5,7,18,19,20,21,22,23,24,25])).then(n=>({default:n.ServerManager}))),EM=m.lazy(()=>se(()=>import("./CloudAccountManager-Dth1Gy-B.js"),__vite__mapDeps([26,1,11,24,6,7,18,8])).then(n=>({default:n.CloudAccountManager}))),AM=m.lazy(()=>se(()=>import("./DomainManager-AazO_ekQ.js"),__vite__mapDeps([27,1,11,24,6,7,18,8])).then(n=>({default:n.DomainManager}))),CM=m.lazy(()=>se(()=>import("./RegionManager-BFFP324K.js"),__vite__mapDeps([28,1,11,24,7,12,13,8,14,15,23])).then(n=>({default:n.RegionManager}))),RM=m.lazy(()=>se(()=>import("./PlatformManager-CsXWkkgm.js"),__vite__mapDeps([29,1,11,24,7,15,13,8,30])).then(n=>({default:n.PlatformManager}))),TM=m.lazy(()=>se(()=>import("./CloudBilling-Dtss07cb.js"),__vite__mapDeps([31,1,11,24,6,7,32,13,15,8,33,5])).then(n=>({default:n.CloudBilling}))),_M=m.lazy(()=>se(()=>import("./KubernetesClusters-DD7SeVKO.js"),__vite__mapDeps([34,1,6,11,7,4,35,8,9,25,24,13,19,20])).then(n=>({default:n.KubernetesClusters}))),OM=m.lazy(()=>se(()=>import("./ClusterOverviewPage-CBfjCIXY.js"),__vite__mapDeps([36,1,6,7,14,4,37,8])).then(n=>({default:n.default}))),jM=m.lazy(()=>se(()=>import("./NodeDetailPage-CSCwjDLO.js"),__vite__mapDeps([38,1,6,7,14,4,8])).then(n=>({default:n.default}))),MM=m.lazy(()=>se(()=>import("./NamespaceOverviewPage-CrqNiJMQ.js"),__vite__mapDeps([39,1,4,8])).then(n=>({default:n.default}))),DM=m.lazy(()=>se(()=>import("./NamespaceManagementPage-BuGcKQSw.js"),__vite__mapDeps([40,1,6,7,11,24,14,4,8])).then(n=>({default:n.default}))),kt=m.lazy(()=>se(()=>import("./NamespaceResourcePage-Cf6hgoD2.js"),__vite__mapDeps([41,1,6,11,7,15,13,8,14,42,37,4,19,20,43,24,25])).then(n=>({default:n.default}))),Iv=m.lazy(()=>se(()=>import("./DeploymentDetailPage-DEq3tEZd.js"),__vite__mapDeps([44,1,6,7,4,37,42,8,15,13,19,20,11,14,24,25,32,43])).then(n=>({default:n.default}))),$v=m.lazy(()=>se(()=>import("./WorkloadViewPage-DSiv67B6.js"),__vite__mapDeps([45,1,6,7,14,4,37,42,8,15,13,19,20])).then(n=>({default:n.default}))),Jv=m.lazy(()=>se(()=>import("./TopologyView-DdP6o9Mj.js"),__vite__mapDeps([46,1,6,11,24,7,15,13,8,25,4])).then(n=>({default:n.TopologyView}))),NM=m.lazy(()=>se(()=>import("./KubernetesNodes-B0frAPbY.js"),__vite__mapDeps([47,1,6,11,7,15,13,8,14,4])).then(n=>({default:n.KubernetesNodes}))),zM=m.lazy(()=>se(()=>import("./PodMetricsPage-NkW2J2Qd.js"),__vite__mapDeps([48,1,6,7,15,13,8,14,4])).then(n=>({default:n.default}))),LM=m.lazy(()=>se(()=>import("./EventsPage-UFe_ZFfW.js"),__vite__mapDeps([49,1,6,15,13,8,14,4])).then(n=>({default:n.default}))),kM=m.lazy(()=>se(()=>import("./CapacityPage-BucLnYij.js"),__vite__mapDeps([50,1,6,7,15,13,8,14,4])).then(n=>({default:n.default}))),UM=m.lazy(()=>se(()=>import("./K8sShortcutRedirect-fX_VMnZ-.js"),__vite__mapDeps([51,1,4,8])).then(n=>({default:n.default}))),Wv=m.lazy(()=>se(()=>import("./AlertManager-C0AXwvA2.js"),__vite__mapDeps([52,1,6,35,53,11,7,14,8,32,13,12,54,24,25,9])).then(n=>({default:n.AlertManager}))),HM=m.lazy(()=>se(()=>import("./ApprovalFlow-BziKIUh9.js"),__vite__mapDeps([55,1,6,7,25,56,11,8,24,15,13])).then(n=>({default:n.ApprovalFlowManager}))),BM=m.lazy(()=>se(()=>import("./ApprovalResourcePage-CnDxsH56.js"),__vite__mapDeps([57,1,58,6,11,7,24,14,15,13,8,56])).then(n=>({default:n.ApprovalResourcePage}))),PM=m.lazy(()=>se(()=>import("./ApprovalAppPage-BrRxxZFx.js"),__vite__mapDeps([59,1,58,6,11,7,24,14,15,13,8,56])).then(n=>({default:n.ApprovalAppPage}))),VM=m.lazy(()=>se(()=>import("./ApprovalPermissionPage-Bv3kKyby.js"),__vite__mapDeps([60,1,58,6,11,7,24,14,15,13,8,56])).then(n=>({default:n.ApprovalPermissionPage}))),GM=m.lazy(()=>se(()=>import("./ApprovalWorkflowPage-Feqoq_m6.js"),__vite__mapDeps([61,1,6,56,8])).then(n=>({default:n.default}))),qM=m.lazy(()=>se(()=>import("./ScriptManager-Dz9eHvUK.js"),__vite__mapDeps([62,1,11,15,13,8,35,12,63,7,24,25,6])).then(n=>({default:n.ScriptManager}))),Rd=m.lazy(()=>se(()=>import("./SystemManager-B9Kzdis0.js"),__vite__mapDeps([64,1,35,7,6,11,14,15,13,8,25,24,12,32])).then(n=>({default:n.SystemManager}))),YM=m.lazy(()=>se(()=>import("./TerminalAuditTab-D4-qFyPi.js"),__vite__mapDeps([65,1,6,11,14,19,20,7,21,8,16,17,66])).then(n=>({default:n.TerminalAuditTab}))),XM=m.lazy(()=>se(()=>import("./AuditOperationsTab-zpIlq3AD.js"),__vite__mapDeps([67,1,6,11,7,14,68,16,8])).then(n=>({default:n.AuditOperationsTab}))),QM=m.lazy(()=>se(()=>import("./LoginLogsTab-BZTjs1T3.js"),__vite__mapDeps([69,1,6,11,7,14,66,8])).then(n=>({default:n.LoginLogsTab}))),KM=m.lazy(()=>se(()=>import("./CredentialManager-VPjoE2mR.js"),__vite__mapDeps([70,1,11,7,15,13,8,16,17,22,24])).then(n=>({default:n.default}))),FM=m.lazy(()=>se(()=>import("./PipelineManager-C_oAjTIU.js"),__vite__mapDeps([71,1,11,72,16,17,6,7,8,25,24,15,13,73,22])).then(n=>({default:n.PipelineManager}))),ZM=m.lazy(()=>se(()=>import("./DeployCredentials-C7pbsNa2.js"),__vite__mapDeps([74,1,11,7,35,24,15,13,8,73,22])).then(n=>({default:n.default}))),ey=m.lazy(()=>se(()=>import("./PipelineEditor-BEQjb4Gp.js"),__vite__mapDeps([75,1,6,11,7,35,15,13,8,25,32,24,72,73])).then(n=>({default:n.default}))),IM=m.lazy(()=>se(()=>import("./PipelineRunDetail-C9e6xlUh.js"),__vite__mapDeps([76,1,7,6,72,8])).then(n=>({default:n.default}))),$M=m.lazy(()=>se(()=>import("./DeployRBAC-XP_74TOu.js"),__vite__mapDeps([77,1,6,11,7,15,13,8,24,72,73])).then(n=>({default:n.default}))),JM=m.lazy(()=>se(()=>import("./UserGroupsManager-CjYJT4qh.js"),__vite__mapDeps([78,1,11,7,24,73,8])).then(n=>({default:n.default}))),WM=m.lazy(()=>se(()=>import("./CronJobManager-Dow5NQrR.js"),__vite__mapDeps([79,1,6,5,11,7,12,13,8,63,15,25,24,14])).then(n=>({default:n.CronJobManager}))),eD=m.lazy(()=>se(()=>import("./AIOpsAssistant-annAjw3b.js"),__vite__mapDeps([80,1,6,11,7,24,15,13,8,32,2,53,81,82])).then(n=>({default:n.AIOpsAssistant}))),tD=m.lazy(()=>se(()=>import("./AIAlertAnalyzer-DcLlw3nl.js"),__vite__mapDeps([83,1,6,7,53,82,8])).then(n=>({default:n.AIAlertAnalyzer}))),nD=m.lazy(()=>se(()=>import("./AIPredictiveAnalytics-PqRHnPeG.js"),__vite__mapDeps([84,1,6,5,7,35,15,13,8,2,3,53])).then(n=>({default:n.AIPredictiveAnalytics}))),aD=m.lazy(()=>se(()=>import("./AlertCenter-VCEUxoOH.js"),__vite__mapDeps([85,1,11,7,6,5,15,13,8,35,32,53,86,16,17,81,24,54,25])).then(n=>({default:n.default}))),rD=m.lazy(()=>se(()=>import("./TraceManager-JbMTFm_u.js"),__vite__mapDeps([87,1,11,7,6,5,15,13,8,35,24,88])).then(n=>({default:n.default}))),oD=m.lazy(()=>se(()=>import("./HostMonitor-D4f8NRVg.js"),__vite__mapDeps([89,1,81,16,6,15,13,8,35,7,9])).then(n=>({default:n.HostMonitor}))),lD=m.lazy(()=>se(()=>import("./GrafanaDashboard-Cwk6bt47.js"),__vite__mapDeps([90,1,11,7,6,15,13,8,24,3,91,92,81,93,5,35,12])).then(n=>({default:n.default}))),sD=m.lazy(()=>se(()=>import("./MonitorCenter-DZJmSfOk.js"),__vite__mapDeps([94,1,89,81,16,6,15,13,8,35,7,9,93,11,24,14,32,95])).then(n=>({default:n.MonitorCenter}))),iD=m.lazy(()=>se(()=>import("./MetricsExplorer-CBLW7MW5.js"),__vite__mapDeps([96,1,6,15,13,8,11,93])).then(n=>({default:n.MetricsExplorer}))),cD=m.lazy(()=>se(()=>import("./DatasourcePage-7FoNVKhF.js"),__vite__mapDeps([97,1,35,7,6,16,17,92,11,24,32,13,15,8])).then(n=>({default:n.default})));function uD(){return h.jsxs("div",{"code-path":"src/App.tsx:67:5",className:"flex flex-col items-center justify-center h-[calc(100vh-14rem)] gap-4",children:[h.jsxs("div",{"code-path":"src/App.tsx:68:7",className:"relative",children:[h.jsx("div",{"code-path":"src/App.tsx:69:9",className:"h-10 w-10 border-3 border-[var(--dg-border)] border-t-[var(--dg-blue)] rounded-full animate-spin"}),h.jsx("div",{"code-path":"src/App.tsx:70:9",className:"absolute inset-0 h-10 w-10 border-3 border-transparent border-t-[var(--dg-blue)] rounded-full animate-spin opacity-30",style:{animationDirection:"reverse",animationDuration:"1s"}})]}),h.jsx("p",{"code-path":"src/App.tsx:72:7",className:"text-sm text-[var(--dg-text-muted)]",children:"加载中..."})]})}function $({children:n}){const r=wt();return h.jsx(bM,{"code-path":"src/App.tsx:81:5",children:h.jsx(fM,{"code-path":"src/App.tsx:82:7",children:h.jsx(m.Suspense,{"code-path":"src/App.tsx:83:9",fallback:h.jsx(uD,{"code-path":"src/App.tsx:83:29"}),children:n})},r.pathname)})}const dD=new jA({defaultOptions:{queries:{staleTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}});function fD(){return h.jsx(QA,{"code-path":"src/App.tsx:103:5",children:h.jsx(MA,{"code-path":"src/App.tsx:104:7",client:dD,children:h.jsx(sM,{"code-path":"src/App.tsx:105:9",children:h.jsx(KE,{"code-path":"src/App.tsx:106:11",children:h.jsxs(wE,{"code-path":"src/App.tsx:107:13",children:[h.jsx(Z,{"code-path":"src/App.tsx:108:15",path:"/login",element:h.jsx(uM,{"code-path":"src/App.tsx:108:45"})}),h.jsxs(Z,{"code-path":"src/App.tsx:109:15",path:"/",element:h.jsx(dM,{"code-path":"src/App.tsx:110:17",children:h.jsx(Oj,{"code-path":"src/App.tsx:111:19"})}),children:[h.jsx(Z,{"code-path":"src/App.tsx:114:17",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:114:39",children:h.jsx(SM,{"code-path":"src/App.tsx:114:49"})})}),h.jsx(Z,{"code-path":"src/App.tsx:115:17",path:"servers",element:h.jsx($,{"code-path":"src/App.tsx:115:48",children:h.jsx(wM,{"code-path":"src/App.tsx:115:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:116:17",path:"cloud-accounts",element:h.jsx($,{"code-path":"src/App.tsx:116:55",children:h.jsx(EM,{"code-path":"src/App.tsx:116:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:117:17",path:"domains",element:h.jsx($,{"code-path":"src/App.tsx:117:48",children:h.jsx(AM,{"code-path":"src/App.tsx:117:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:118:17",path:"regions",element:h.jsx($,{"code-path":"src/App.tsx:118:48",children:h.jsx(CM,{"code-path":"src/App.tsx:118:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:119:17",path:"platforms",element:h.jsx($,{"code-path":"src/App.tsx:119:50",children:h.jsx(RM,{"code-path":"src/App.tsx:119:60"})})}),h.jsx(Z,{"code-path":"src/App.tsx:120:17",path:"cloud-billing",element:h.jsx($,{"code-path":"src/App.tsx:120:54",children:h.jsx(TM,{"code-path":"src/App.tsx:120:64"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:123:17",path:"kubernetes",children:[h.jsx(Z,{"code-path":"src/App.tsx:124:19",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:124:41",children:h.jsx(_M,{"code-path":"src/App.tsx:124:51"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:125:19",path:":clusterCode",children:[h.jsx(Z,{"code-path":"src/App.tsx:126:21",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:126:43",children:h.jsx(OM,{"code-path":"src/App.tsx:126:53"})})}),h.jsx(Z,{"code-path":"src/App.tsx:127:21",path:"metrics/pods",element:h.jsx($,{"code-path":"src/App.tsx:127:57",children:h.jsx(zM,{"code-path":"src/App.tsx:127:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:128:21",path:"events",element:h.jsx($,{"code-path":"src/App.tsx:128:51",children:h.jsx(LM,{"code-path":"src/App.tsx:128:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:129:21",path:"capacity",element:h.jsx($,{"code-path":"src/App.tsx:129:53",children:h.jsx(kM,{"code-path":"src/App.tsx:129:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:130:21",path:"namespaces",element:h.jsx($,{"code-path":"src/App.tsx:130:55",children:h.jsx(DM,{"code-path":"src/App.tsx:130:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:131:21",path:"nodes/:nodeName",element:h.jsx($,{"code-path":"src/App.tsx:131:60",children:h.jsx(jM,{"code-path":"src/App.tsx:131:70"})})}),h.jsx(Z,{"code-path":"src/App.tsx:132:21",path:"topology",element:h.jsx($,{"code-path":"src/App.tsx:132:53",children:h.jsx(Jv,{"code-path":"src/App.tsx:132:63"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:133:21",path:"namespace/:namespace",children:[h.jsx(Z,{"code-path":"src/App.tsx:134:23",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:134:45",children:h.jsx(MM,{"code-path":"src/App.tsx:134:55"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:135:23",path:"workload",children:[h.jsx(Z,{"code-path":"src/App.tsx:136:25",path:":mode/Deployment/:name",element:h.jsx($,{"code-path":"src/App.tsx:136:71",children:h.jsx(Iv,{"code-path":"src/App.tsx:136:81"})})}),h.jsx(Z,{"code-path":"src/App.tsx:137:25",path:":mode/StatefulSet/:name",element:h.jsx($,{"code-path":"src/App.tsx:137:72",children:h.jsx($v,{"code-path":"src/App.tsx:137:82"})})}),h.jsx(Z,{"code-path":"src/App.tsx:138:25",path:":mode/DaemonSet/:name",element:h.jsx($,{"code-path":"src/App.tsx:138:70",children:h.jsx($v,{"code-path":"src/App.tsx:138:80"})})})]}),h.jsx(Z,{"code-path":"src/App.tsx:140:23",path:"deployments",element:h.jsx($,{"code-path":"src/App.tsx:140:58",children:h.jsx(kt,{"code-path":"src/App.tsx:140:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:141:23",path:"deployments/:name",element:h.jsx($,{"code-path":"src/App.tsx:141:64",children:h.jsx(Iv,{"code-path":"src/App.tsx:141:74"})})}),h.jsx(Z,{"code-path":"src/App.tsx:142:23",path:"pods",element:h.jsx($,{"code-path":"src/App.tsx:142:51",children:h.jsx(kt,{"code-path":"src/App.tsx:142:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:143:23",path:"services",element:h.jsx($,{"code-path":"src/App.tsx:143:55",children:h.jsx(kt,{"code-path":"src/App.tsx:143:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:144:23",path:"ingresses",element:h.jsx($,{"code-path":"src/App.tsx:144:56",children:h.jsx(kt,{"code-path":"src/App.tsx:144:66"})})}),h.jsx(Z,{"code-path":"src/App.tsx:145:23",path:"configmaps",element:h.jsx($,{"code-path":"src/App.tsx:145:57",children:h.jsx(kt,{"code-path":"src/App.tsx:145:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:146:23",path:"secrets",element:h.jsx($,{"code-path":"src/App.tsx:146:54",children:h.jsx(kt,{"code-path":"src/App.tsx:146:64"})})}),h.jsx(Z,{"code-path":"src/App.tsx:147:23",path:"hpas",element:h.jsx($,{"code-path":"src/App.tsx:147:51",children:h.jsx(kt,{"code-path":"src/App.tsx:147:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:148:23",path:"cronjobs",element:h.jsx($,{"code-path":"src/App.tsx:148:55",children:h.jsx(kt,{"code-path":"src/App.tsx:148:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:149:23",path:"pvcs",element:h.jsx($,{"code-path":"src/App.tsx:149:51",children:h.jsx(kt,{"code-path":"src/App.tsx:149:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:150:23",path:"statefulsets",element:h.jsx($,{"code-path":"src/App.tsx:150:59",children:h.jsx(kt,{"code-path":"src/App.tsx:150:69"})})}),h.jsx(Z,{"code-path":"src/App.tsx:151:23",path:"daemonsets",element:h.jsx($,{"code-path":"src/App.tsx:151:57",children:h.jsx(kt,{"code-path":"src/App.tsx:151:67"})})})]})]})]}),h.jsx(Z,{"code-path":"src/App.tsx:157:17",path:"workloads",element:h.jsx($,{"code-path":"src/App.tsx:157:50",children:h.jsx(kt,{"code-path":"src/App.tsx:157:60"})})}),h.jsx(Z,{"code-path":"src/App.tsx:158:17",path:"workloads/events",element:h.jsx($,{"code-path":"src/App.tsx:158:57",children:h.jsx(UM,{"code-path":"src/App.tsx:158:67",target:"events"})})}),h.jsx(Z,{"code-path":"src/App.tsx:159:17",path:"workloads/:type",element:h.jsx($,{"code-path":"src/App.tsx:159:56",children:h.jsx(kt,{"code-path":"src/App.tsx:159:66"})})}),h.jsx(Z,{"code-path":"src/App.tsx:160:17",path:"nodes",element:h.jsx($,{"code-path":"src/App.tsx:160:46",children:h.jsx(NM,{"code-path":"src/App.tsx:160:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:161:17",path:"topology",element:h.jsx($,{"code-path":"src/App.tsx:161:49",children:h.jsx(Jv,{"code-path":"src/App.tsx:161:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:164:17",path:"pipelines",element:h.jsx($,{"code-path":"src/App.tsx:164:50",children:h.jsx(FM,{"code-path":"src/App.tsx:164:60"})})}),h.jsx(Z,{"code-path":"src/App.tsx:165:17",path:"pipelines/:code",element:h.jsx($,{"code-path":"src/App.tsx:165:56",children:h.jsx(ey,{"code-path":"src/App.tsx:165:66"})})}),h.jsx(Z,{"code-path":"src/App.tsx:166:17",path:"pipelines/:code/runs",element:h.jsx($,{"code-path":"src/App.tsx:166:61",children:h.jsx(IM,{"code-path":"src/App.tsx:166:71"})})}),h.jsx(Z,{"code-path":"src/App.tsx:167:17",path:"pipelines/:code/edit",element:h.jsx($,{"code-path":"src/App.tsx:167:61",children:h.jsx(ey,{"code-path":"src/App.tsx:167:71"})})}),h.jsx(Z,{"code-path":"src/App.tsx:168:17",path:"deploy/configureTools",element:h.jsx($,{"code-path":"src/App.tsx:168:62",children:h.jsx(ZM,{"code-path":"src/App.tsx:168:72"})})}),h.jsx(Z,{"code-path":"src/App.tsx:169:17",path:"deploy/groups",element:h.jsx($,{"code-path":"src/App.tsx:169:54",children:h.jsx(JM,{"code-path":"src/App.tsx:169:64"})})}),h.jsx(Z,{"code-path":"src/App.tsx:170:17",path:"deploy/rbac",element:h.jsx($,{"code-path":"src/App.tsx:170:52",children:h.jsx($M,{"code-path":"src/App.tsx:170:62"})})}),h.jsx(Z,{"code-path":"src/App.tsx:173:17",path:"metrics",element:h.jsx($,{"code-path":"src/App.tsx:173:48",children:h.jsx(iD,{"code-path":"src/App.tsx:173:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:174:17",path:"datasources",element:h.jsx($,{"code-path":"src/App.tsx:174:52",children:h.jsx(cD,{"code-path":"src/App.tsx:174:62"})})}),h.jsx(Z,{"code-path":"src/App.tsx:175:17",path:"trace",element:h.jsx($,{"code-path":"src/App.tsx:175:46",children:h.jsx(rD,{"code-path":"src/App.tsx:175:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:176:17",path:"dashboards",element:h.jsx($,{"code-path":"src/App.tsx:176:51",children:h.jsx(lD,{"code-path":"src/App.tsx:176:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:177:17",path:"host-monitor",element:h.jsx($,{"code-path":"src/App.tsx:177:53",children:h.jsx(oD,{"code-path":"src/App.tsx:177:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:178:17",path:"alerts",element:h.jsx($,{"code-path":"src/App.tsx:178:47",children:h.jsx(Wv,{"code-path":"src/App.tsx:178:57"})})}),h.jsx(Z,{"code-path":"src/App.tsx:179:17",path:"alert-center",element:h.jsx($,{"code-path":"src/App.tsx:179:53",children:h.jsx(aD,{"code-path":"src/App.tsx:179:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:180:17",path:"monitor-center",element:h.jsx($,{"code-path":"src/App.tsx:180:55",children:h.jsx(sD,{"code-path":"src/App.tsx:180:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:181:17",path:"logs",element:h.jsx($,{"code-path":"src/App.tsx:181:45",children:h.jsx(Wv,{"code-path":"src/App.tsx:181:55"})})}),h.jsx(Z,{"code-path":"src/App.tsx:184:17",path:"approval",element:h.jsx($,{"code-path":"src/App.tsx:184:49",children:h.jsx(HM,{"code-path":"src/App.tsx:184:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:185:17",path:"approval/resource",element:h.jsx($,{"code-path":"src/App.tsx:185:58",children:h.jsx(BM,{"code-path":"src/App.tsx:185:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:186:17",path:"approval/app",element:h.jsx($,{"code-path":"src/App.tsx:186:53",children:h.jsx(PM,{"code-path":"src/App.tsx:186:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:187:17",path:"approval/permission",element:h.jsx($,{"code-path":"src/App.tsx:187:60",children:h.jsx(VM,{"code-path":"src/App.tsx:187:70"})})}),h.jsx(Z,{"code-path":"src/App.tsx:188:17",path:"cronjobs",element:h.jsx($,{"code-path":"src/App.tsx:188:49",children:h.jsx(WM,{"code-path":"src/App.tsx:188:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:189:17",path:"scripts",element:h.jsx($,{"code-path":"src/App.tsx:189:48",children:h.jsx(qM,{"code-path":"src/App.tsx:189:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:193:17",path:"ai-assistant",element:h.jsx($,{"code-path":"src/App.tsx:193:53",children:h.jsx(eD,{"code-path":"src/App.tsx:193:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:194:17",path:"ai-alert-analyzer",element:h.jsx($,{"code-path":"src/App.tsx:194:58",children:h.jsx(tD,{"code-path":"src/App.tsx:194:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:195:17",path:"ai-predictive",element:h.jsx($,{"code-path":"src/App.tsx:195:54",children:h.jsx(nD,{"code-path":"src/App.tsx:195:64"})})}),h.jsx(Z,{"code-path":"src/App.tsx:198:17",path:"audit/terminal",element:h.jsx($,{"code-path":"src/App.tsx:198:55",children:h.jsx(YM,{"code-path":"src/App.tsx:198:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:199:17",path:"audit/operations",element:h.jsx($,{"code-path":"src/App.tsx:199:57",children:h.jsx(XM,{"code-path":"src/App.tsx:199:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:200:17",path:"audit/login-logs",element:h.jsx($,{"code-path":"src/App.tsx:200:57",children:h.jsx(QM,{"code-path":"src/App.tsx:200:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:203:17",path:"users",element:h.jsx($,{"code-path":"src/App.tsx:203:46",children:h.jsx(Rd,{"code-path":"src/App.tsx:203:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:204:17",path:"roles",element:h.jsx($,{"code-path":"src/App.tsx:204:46",children:h.jsx(Rd,{"code-path":"src/App.tsx:204:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:205:17",path:"credentials",element:h.jsx($,{"code-path":"src/App.tsx:205:52",children:h.jsx(KM,{"code-path":"src/App.tsx:205:62"})})}),h.jsx(Z,{"code-path":"src/App.tsx:206:17",path:"settings",element:h.jsx($,{"code-path":"src/App.tsx:206:49",children:h.jsx(Rd,{"code-path":"src/App.tsx:206:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:207:17",path:"approval-workflow",element:h.jsx($,{"code-path":"src/App.tsx:207:58",children:h.jsx(GM,{"code-path":"src/App.tsx:207:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:210:17",path:"*",element:h.jsx(Sy,{"code-path":"src/App.tsx:210:42",to:"/",replace:!0})})]})]})})})})})}bw.createRoot(document.getElementById("root")).render(h.jsx(m.StrictMode,{"code-path":"src/main.tsx:7:3",children:h.jsx(fD,{"code-path":"src/main.tsx:8:5"})}));export{db as $,vD as A,St as B,Wo as C,Wj as D,TA as E,ft as F,xD as G,rn as H,yD as I,sf as J,Xa as K,ri as L,ob as M,h_ as N,wa as O,Et as P,ji as Q,f_ as R,qC as S,Hx as T,tb as U,Bx as V,Yn as W,Mi as X,nf as Y,iT as Z,ut as _,nM as a,nb as a0,Ef as a1,wf as a2,Ci as a3,Px as a4,u2 as a5,Vx as a6,ex as a7,se as a8,Js as a9,Ws as aa,ei as ab,Kd as ac,ti as ad,Fo as ae,Io as af,_j as ag,SD as ah,yA as ai,dA as aj,Nd as ak,Oy as al,cA as am,uA as an,Dd as ao,Ry as ap,AA as aq,pA as ar,gD as as,PC as at,Py as au,aM as b,oM as c,lM as d,rM as e,CD as f,mD as g,Ue as h,sl as i,AD as j,wt as k,wD as l,Ce as m,ZC as n,on as o,qT as p,C2 as q,Ea as r,ke as s,Zv as t,Wb as u,Di as v,Pe as w,oe as x,ZR as y,bi as z}; +`;navigator.clipboard.writeText(s).then(()=>{Zv.success("错误信息已复制到剪贴板,请粘贴到 Issue 中")}).catch(()=>{Zv.error("复制失败,请手动复制错误信息")})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:h.jsx("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:64:9",className:"min-h-[60vh] flex items-center justify-center p-6",children:h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:65:11",className:"dg-card max-w-lg w-full p-8 text-center space-y-6",children:[h.jsx("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:67:13",className:"mx-auto w-16 h-16 rounded-2xl bg-red-500/10 flex items-center justify-center",children:h.jsx(ni,{"code-path":"src/components/layout/ErrorBoundary.tsx:68:15",className:"h-8 w-8 text-red-400"})}),h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:72:13",children:[h.jsx("h2",{"code-path":"src/components/layout/ErrorBoundary.tsx:73:15",className:"text-xl font-bold text-[var(--dg-text-primary)]",children:"页面出现错误"}),h.jsx("p",{"code-path":"src/components/layout/ErrorBoundary.tsx:76:15",className:"text-sm text-[var(--dg-text-muted)] mt-2",children:"抱歉,该页面遇到了意外错误。您可以尝试重新加载或返回首页。"})]}),this.state.error&&h.jsx("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:83:15",className:"text-left",children:h.jsxs("details",{"code-path":"src/components/layout/ErrorBoundary.tsx:84:17",className:"group",children:[h.jsxs("summary",{"code-path":"src/components/layout/ErrorBoundary.tsx:85:19",className:"cursor-pointer text-xs text-[var(--dg-text-secondary)] hover:text-[var(--dg-text-primary)] transition-colors flex items-center gap-1.5",children:[h.jsx(Vg,{"code-path":"src/components/layout/ErrorBoundary.tsx:86:21",className:"h-3.5 w-3.5"}),"查看错误详情"]}),h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:89:19",className:"mt-2 p-3 rounded-lg bg-[var(--dg-bg-tertiary)] border border-[var(--dg-border)] overflow-auto max-h-48",children:[h.jsxs("code",{"code-path":"src/components/layout/ErrorBoundary.tsx:90:21",className:"text-xs text-red-400 font-mono block whitespace-pre-wrap",children:[this.state.error.name,": ",this.state.error.message]}),this.state.errorInfo&&h.jsx("pre",{"code-path":"src/components/layout/ErrorBoundary.tsx:94:23",className:"text-xs text-[var(--dg-text-muted)] mt-2 whitespace-pre-wrap",children:this.state.errorInfo.componentStack})]})]})}),h.jsxs("div",{"code-path":"src/components/layout/ErrorBoundary.tsx:104:13",className:"flex items-center justify-center gap-3",children:[h.jsxs(St,{"code-path":"src/components/layout/ErrorBoundary.tsx:105:15",variant:"outline",className:"dg-btn-secondary",onClick:this.handleGoHome,children:[h.jsx(ly,{"code-path":"src/components/layout/ErrorBoundary.tsx:110:17",className:"h-4 w-4 mr-1.5"}),"返回首页"]}),h.jsxs(St,{"code-path":"src/components/layout/ErrorBoundary.tsx:113:15",className:"dg-btn-primary",onClick:this.handleRetry,children:[h.jsx(pw,{"code-path":"src/components/layout/ErrorBoundary.tsx:117:17",className:"h-4 w-4 mr-1.5"}),"重新加载"]}),h.jsxs(St,{"code-path":"src/components/layout/ErrorBoundary.tsx:120:15",variant:"outline",className:"dg-btn-ghost",onClick:this.handleReport,children:[h.jsx(Vg,{"code-path":"src/components/layout/ErrorBoundary.tsx:125:17",className:"h-4 w-4 mr-1.5"}),"复制错误"]})]})]})}):this.props.children}}const SM=m.lazy(()=>se(()=>import("./Dashboard-DNebnMdf.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(n=>({default:n.Dashboard}))),wM=m.lazy(()=>se(()=>import("./ServerManager-TbveS5oM.js"),__vite__mapDeps([10,1,6,11,12,13,8,14,15,16,17,3,5,7,18,19,20,21,22,23,24,25])).then(n=>({default:n.ServerManager}))),EM=m.lazy(()=>se(()=>import("./CloudAccountManager-CTxUSSuc.js"),__vite__mapDeps([26,1,11,24,6,7,18,8])).then(n=>({default:n.CloudAccountManager}))),AM=m.lazy(()=>se(()=>import("./DomainManager-CzXUFLGH.js"),__vite__mapDeps([27,1,11,24,6,7,18,8])).then(n=>({default:n.DomainManager}))),CM=m.lazy(()=>se(()=>import("./RegionManager-C0q8qzzP.js"),__vite__mapDeps([28,1,11,24,7,12,13,8,14,15,23])).then(n=>({default:n.RegionManager}))),RM=m.lazy(()=>se(()=>import("./PlatformManager-qy5AE7fT.js"),__vite__mapDeps([29,1,11,24,7,15,13,8,30])).then(n=>({default:n.PlatformManager}))),TM=m.lazy(()=>se(()=>import("./CloudBilling-Cz5SvRnO.js"),__vite__mapDeps([31,1,11,24,6,7,32,13,15,8,33,5])).then(n=>({default:n.CloudBilling}))),_M=m.lazy(()=>se(()=>import("./KubernetesClusters-CJYiuz5A.js"),__vite__mapDeps([34,1,6,11,7,4,35,8,9,25,24,13,19,20])).then(n=>({default:n.KubernetesClusters}))),OM=m.lazy(()=>se(()=>import("./ClusterOverviewPage-Bd5kYrZX.js"),__vite__mapDeps([36,1,6,7,14,4,37,8])).then(n=>({default:n.default}))),jM=m.lazy(()=>se(()=>import("./NodeDetailPage-DdJm3Cyj.js"),__vite__mapDeps([38,1,6,7,14,4,8])).then(n=>({default:n.default}))),MM=m.lazy(()=>se(()=>import("./NamespaceOverviewPage-DWvjX0rM.js"),__vite__mapDeps([39,1,4,8])).then(n=>({default:n.default}))),DM=m.lazy(()=>se(()=>import("./NamespaceManagementPage-BDbop8KJ.js"),__vite__mapDeps([40,1,6,7,11,24,14,4,8])).then(n=>({default:n.default}))),kt=m.lazy(()=>se(()=>import("./NamespaceResourcePage-CyDeBbkr.js"),__vite__mapDeps([41,1,6,11,7,15,13,8,14,42,37,4,43,19,20,44,24,25])).then(n=>({default:n.default}))),Iv=m.lazy(()=>se(()=>import("./DeploymentDetailPage-rkL4vpM2.js"),__vite__mapDeps([45,1,6,7,4,37,42,43,8,15,13,19,20,11,46,14,24,25,32,44])).then(n=>({default:n.default}))),$v=m.lazy(()=>se(()=>import("./WorkloadViewPage-C6aQleIG.js"),__vite__mapDeps([47,1,6,7,14,4,37,42,43,8,15,13,19,20])).then(n=>({default:n.default}))),Jv=m.lazy(()=>se(()=>import("./TopologyView-Bs02-3Xu.js"),__vite__mapDeps([48,1,6,11,24,7,15,13,8,25,4])).then(n=>({default:n.TopologyView}))),NM=m.lazy(()=>se(()=>import("./KubernetesNodes-C9RSUKWj.js"),__vite__mapDeps([49,1,6,11,7,15,13,8,14,4])).then(n=>({default:n.KubernetesNodes}))),zM=m.lazy(()=>se(()=>import("./PodMetricsPage-62zYmxhb.js"),__vite__mapDeps([50,1,6,7,15,13,8,14,4])).then(n=>({default:n.default}))),LM=m.lazy(()=>se(()=>import("./EventsPage-CF9p9_2z.js"),__vite__mapDeps([51,1,6,15,13,8,4,46,7,14,43])).then(n=>({default:n.default}))),kM=m.lazy(()=>se(()=>import("./CapacityPage-BQ2ghUzp.js"),__vite__mapDeps([52,1,6,7,15,13,8,14,4])).then(n=>({default:n.default}))),UM=m.lazy(()=>se(()=>import("./K8sShortcutRedirect-C_rbNsgP.js"),__vite__mapDeps([53,1,4,8])).then(n=>({default:n.default}))),Wv=m.lazy(()=>se(()=>import("./AlertManager-sFIXPw82.js"),__vite__mapDeps([54,1,6,35,55,11,7,14,8,32,13,12,56,24,25,9])).then(n=>({default:n.AlertManager}))),HM=m.lazy(()=>se(()=>import("./ApprovalFlow-BYXNIoil.js"),__vite__mapDeps([57,1,6,7,25,58,11,8,24,15,13])).then(n=>({default:n.ApprovalFlowManager}))),BM=m.lazy(()=>se(()=>import("./ApprovalResourcePage-UEMsJGgE.js"),__vite__mapDeps([59,1,60,6,11,7,24,14,15,13,8,58])).then(n=>({default:n.ApprovalResourcePage}))),PM=m.lazy(()=>se(()=>import("./ApprovalAppPage-BdqKjevQ.js"),__vite__mapDeps([61,1,60,6,11,7,24,14,15,13,8,58])).then(n=>({default:n.ApprovalAppPage}))),VM=m.lazy(()=>se(()=>import("./ApprovalPermissionPage-bmqKSj6I.js"),__vite__mapDeps([62,1,60,6,11,7,24,14,15,13,8,58])).then(n=>({default:n.ApprovalPermissionPage}))),GM=m.lazy(()=>se(()=>import("./ApprovalWorkflowPage-_9oj7366.js"),__vite__mapDeps([63,1,6,58,8])).then(n=>({default:n.default}))),qM=m.lazy(()=>se(()=>import("./ScriptManager-C1CLQVy5.js"),__vite__mapDeps([64,1,11,15,13,8,35,12,65,7,24,25,6])).then(n=>({default:n.ScriptManager}))),Rd=m.lazy(()=>se(()=>import("./SystemManager-BVSipLbm.js"),__vite__mapDeps([66,1,35,7,6,11,14,15,13,8,25,24,12,32])).then(n=>({default:n.SystemManager}))),YM=m.lazy(()=>se(()=>import("./TerminalAuditTab-DLfjD3Vi.js"),__vite__mapDeps([67,1,6,11,14,19,20,7,21,8,16,17,68])).then(n=>({default:n.TerminalAuditTab}))),XM=m.lazy(()=>se(()=>import("./AuditOperationsTab-BTBVpMUU.js"),__vite__mapDeps([69,1,6,11,7,14,70,16,8])).then(n=>({default:n.AuditOperationsTab}))),QM=m.lazy(()=>se(()=>import("./LoginLogsTab-CaJThVCv.js"),__vite__mapDeps([71,1,6,11,7,14,68,8])).then(n=>({default:n.LoginLogsTab}))),KM=m.lazy(()=>se(()=>import("./CredentialManager-DwnNccLC.js"),__vite__mapDeps([72,1,11,7,15,13,8,16,17,22,24])).then(n=>({default:n.default}))),FM=m.lazy(()=>se(()=>import("./PipelineManager-DilP4thh.js"),__vite__mapDeps([73,1,11,74,16,17,6,7,8,25,24,15,13,75,22])).then(n=>({default:n.PipelineManager}))),ZM=m.lazy(()=>se(()=>import("./DeployCredentials-DBd0aG3R.js"),__vite__mapDeps([76,1,11,7,35,24,15,13,8,75,22])).then(n=>({default:n.default}))),ey=m.lazy(()=>se(()=>import("./PipelineEditor-DYHqinGQ.js"),__vite__mapDeps([77,1,6,11,7,35,15,13,8,25,32,24,74,75])).then(n=>({default:n.default}))),IM=m.lazy(()=>se(()=>import("./PipelineRunDetail-C0WxXVPh.js"),__vite__mapDeps([78,1,7,6,74,8])).then(n=>({default:n.default}))),$M=m.lazy(()=>se(()=>import("./DeployRBAC-DIvf4JmJ.js"),__vite__mapDeps([79,1,6,11,7,15,13,8,24,74,75])).then(n=>({default:n.default}))),JM=m.lazy(()=>se(()=>import("./UserGroupsManager-BbYcJ9kF.js"),__vite__mapDeps([80,1,11,7,24,75,8])).then(n=>({default:n.default}))),WM=m.lazy(()=>se(()=>import("./CronJobManager-DjJMLSuO.js"),__vite__mapDeps([81,1,6,5,11,7,12,13,8,65,15,25,24,14])).then(n=>({default:n.CronJobManager}))),eD=m.lazy(()=>se(()=>import("./AIOpsAssistant-DHiQGhOG.js"),__vite__mapDeps([82,1,6,11,7,24,15,13,8,32,2,55,83,84])).then(n=>({default:n.AIOpsAssistant}))),tD=m.lazy(()=>se(()=>import("./AIAlertAnalyzer-Bok0txQu.js"),__vite__mapDeps([85,1,6,7,55,84,8])).then(n=>({default:n.AIAlertAnalyzer}))),nD=m.lazy(()=>se(()=>import("./AIPredictiveAnalytics-C6QOvNE6.js"),__vite__mapDeps([86,1,6,5,7,35,15,13,8,2,3,55])).then(n=>({default:n.AIPredictiveAnalytics}))),aD=m.lazy(()=>se(()=>import("./AlertCenter-C6q8Rqrx.js"),__vite__mapDeps([87,1,11,7,6,5,15,13,8,35,32,55,88,16,17,83,24,56,25])).then(n=>({default:n.default}))),rD=m.lazy(()=>se(()=>import("./TraceManager-D3OFjsrO.js"),__vite__mapDeps([89,1,11,7,6,5,15,13,8,35,24,90])).then(n=>({default:n.default}))),oD=m.lazy(()=>se(()=>import("./HostMonitor-BSWHuvXi.js"),__vite__mapDeps([91,1,83,16,6,15,13,8,35,7,9])).then(n=>({default:n.HostMonitor}))),lD=m.lazy(()=>se(()=>import("./GrafanaDashboard-Bv-280xT.js"),__vite__mapDeps([92,1,11,7,6,15,13,8,24,3,93,94,83,95,5,35,12])).then(n=>({default:n.default}))),sD=m.lazy(()=>se(()=>import("./MonitorCenter-DUZK-EX-.js"),__vite__mapDeps([96,1,91,83,16,6,15,13,8,35,7,9,95,11,24,14,32,97])).then(n=>({default:n.MonitorCenter}))),iD=m.lazy(()=>se(()=>import("./MetricsExplorer-4Vq96BvF.js"),__vite__mapDeps([98,1,6,15,13,8,11,95])).then(n=>({default:n.MetricsExplorer}))),cD=m.lazy(()=>se(()=>import("./DatasourcePage-Bk6XpYxr.js"),__vite__mapDeps([99,1,35,7,6,16,17,94,11,24,32,13,15,8])).then(n=>({default:n.default})));function uD(){return h.jsxs("div",{"code-path":"src/App.tsx:67:5",className:"flex flex-col items-center justify-center h-[calc(100vh-14rem)] gap-4",children:[h.jsxs("div",{"code-path":"src/App.tsx:68:7",className:"relative",children:[h.jsx("div",{"code-path":"src/App.tsx:69:9",className:"h-10 w-10 border-3 border-[var(--dg-border)] border-t-[var(--dg-blue)] rounded-full animate-spin"}),h.jsx("div",{"code-path":"src/App.tsx:70:9",className:"absolute inset-0 h-10 w-10 border-3 border-transparent border-t-[var(--dg-blue)] rounded-full animate-spin opacity-30",style:{animationDirection:"reverse",animationDuration:"1s"}})]}),h.jsx("p",{"code-path":"src/App.tsx:72:7",className:"text-sm text-[var(--dg-text-muted)]",children:"加载中..."})]})}function $({children:n}){const r=wt();return h.jsx(bM,{"code-path":"src/App.tsx:81:5",children:h.jsx(fM,{"code-path":"src/App.tsx:82:7",children:h.jsx(m.Suspense,{"code-path":"src/App.tsx:83:9",fallback:h.jsx(uD,{"code-path":"src/App.tsx:83:29"}),children:n})},r.pathname)})}const dD=new jA({defaultOptions:{queries:{staleTime:300*1e3,retry:1,refetchOnWindowFocus:!1}}});function fD(){return h.jsx(QA,{"code-path":"src/App.tsx:103:5",children:h.jsx(MA,{"code-path":"src/App.tsx:104:7",client:dD,children:h.jsx(sM,{"code-path":"src/App.tsx:105:9",children:h.jsx(KE,{"code-path":"src/App.tsx:106:11",children:h.jsxs(wE,{"code-path":"src/App.tsx:107:13",children:[h.jsx(Z,{"code-path":"src/App.tsx:108:15",path:"/login",element:h.jsx(uM,{"code-path":"src/App.tsx:108:45"})}),h.jsxs(Z,{"code-path":"src/App.tsx:109:15",path:"/",element:h.jsx(dM,{"code-path":"src/App.tsx:110:17",children:h.jsx(Oj,{"code-path":"src/App.tsx:111:19"})}),children:[h.jsx(Z,{"code-path":"src/App.tsx:114:17",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:114:39",children:h.jsx(SM,{"code-path":"src/App.tsx:114:49"})})}),h.jsx(Z,{"code-path":"src/App.tsx:115:17",path:"servers",element:h.jsx($,{"code-path":"src/App.tsx:115:48",children:h.jsx(wM,{"code-path":"src/App.tsx:115:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:116:17",path:"cloud-accounts",element:h.jsx($,{"code-path":"src/App.tsx:116:55",children:h.jsx(EM,{"code-path":"src/App.tsx:116:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:117:17",path:"domains",element:h.jsx($,{"code-path":"src/App.tsx:117:48",children:h.jsx(AM,{"code-path":"src/App.tsx:117:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:118:17",path:"regions",element:h.jsx($,{"code-path":"src/App.tsx:118:48",children:h.jsx(CM,{"code-path":"src/App.tsx:118:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:119:17",path:"platforms",element:h.jsx($,{"code-path":"src/App.tsx:119:50",children:h.jsx(RM,{"code-path":"src/App.tsx:119:60"})})}),h.jsx(Z,{"code-path":"src/App.tsx:120:17",path:"cloud-billing",element:h.jsx($,{"code-path":"src/App.tsx:120:54",children:h.jsx(TM,{"code-path":"src/App.tsx:120:64"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:123:17",path:"kubernetes",children:[h.jsx(Z,{"code-path":"src/App.tsx:124:19",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:124:41",children:h.jsx(_M,{"code-path":"src/App.tsx:124:51"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:125:19",path:":clusterCode",children:[h.jsx(Z,{"code-path":"src/App.tsx:126:21",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:126:43",children:h.jsx(OM,{"code-path":"src/App.tsx:126:53"})})}),h.jsx(Z,{"code-path":"src/App.tsx:127:21",path:"metrics/pods",element:h.jsx($,{"code-path":"src/App.tsx:127:57",children:h.jsx(zM,{"code-path":"src/App.tsx:127:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:128:21",path:"events",element:h.jsx($,{"code-path":"src/App.tsx:128:51",children:h.jsx(LM,{"code-path":"src/App.tsx:128:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:129:21",path:"capacity",element:h.jsx($,{"code-path":"src/App.tsx:129:53",children:h.jsx(kM,{"code-path":"src/App.tsx:129:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:130:21",path:"namespaces",element:h.jsx($,{"code-path":"src/App.tsx:130:55",children:h.jsx(DM,{"code-path":"src/App.tsx:130:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:131:21",path:"nodes/:nodeName",element:h.jsx($,{"code-path":"src/App.tsx:131:60",children:h.jsx(jM,{"code-path":"src/App.tsx:131:70"})})}),h.jsx(Z,{"code-path":"src/App.tsx:132:21",path:"topology",element:h.jsx($,{"code-path":"src/App.tsx:132:53",children:h.jsx(Jv,{"code-path":"src/App.tsx:132:63"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:133:21",path:"namespace/:namespace",children:[h.jsx(Z,{"code-path":"src/App.tsx:134:23",index:!0,element:h.jsx($,{"code-path":"src/App.tsx:134:45",children:h.jsx(MM,{"code-path":"src/App.tsx:134:55"})})}),h.jsxs(Z,{"code-path":"src/App.tsx:135:23",path:"workload",children:[h.jsx(Z,{"code-path":"src/App.tsx:136:25",path:":mode/Deployment/:name",element:h.jsx($,{"code-path":"src/App.tsx:136:71",children:h.jsx(Iv,{"code-path":"src/App.tsx:136:81"})})}),h.jsx(Z,{"code-path":"src/App.tsx:137:25",path:":mode/StatefulSet/:name",element:h.jsx($,{"code-path":"src/App.tsx:137:72",children:h.jsx($v,{"code-path":"src/App.tsx:137:82"})})}),h.jsx(Z,{"code-path":"src/App.tsx:138:25",path:":mode/DaemonSet/:name",element:h.jsx($,{"code-path":"src/App.tsx:138:70",children:h.jsx($v,{"code-path":"src/App.tsx:138:80"})})})]}),h.jsx(Z,{"code-path":"src/App.tsx:140:23",path:"deployments",element:h.jsx($,{"code-path":"src/App.tsx:140:58",children:h.jsx(kt,{"code-path":"src/App.tsx:140:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:141:23",path:"deployments/:name",element:h.jsx($,{"code-path":"src/App.tsx:141:64",children:h.jsx(Iv,{"code-path":"src/App.tsx:141:74"})})}),h.jsx(Z,{"code-path":"src/App.tsx:142:23",path:"pods",element:h.jsx($,{"code-path":"src/App.tsx:142:51",children:h.jsx(kt,{"code-path":"src/App.tsx:142:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:143:23",path:"services",element:h.jsx($,{"code-path":"src/App.tsx:143:55",children:h.jsx(kt,{"code-path":"src/App.tsx:143:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:144:23",path:"ingresses",element:h.jsx($,{"code-path":"src/App.tsx:144:56",children:h.jsx(kt,{"code-path":"src/App.tsx:144:66"})})}),h.jsx(Z,{"code-path":"src/App.tsx:145:23",path:"configmaps",element:h.jsx($,{"code-path":"src/App.tsx:145:57",children:h.jsx(kt,{"code-path":"src/App.tsx:145:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:146:23",path:"secrets",element:h.jsx($,{"code-path":"src/App.tsx:146:54",children:h.jsx(kt,{"code-path":"src/App.tsx:146:64"})})}),h.jsx(Z,{"code-path":"src/App.tsx:147:23",path:"hpas",element:h.jsx($,{"code-path":"src/App.tsx:147:51",children:h.jsx(kt,{"code-path":"src/App.tsx:147:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:148:23",path:"cronjobs",element:h.jsx($,{"code-path":"src/App.tsx:148:55",children:h.jsx(kt,{"code-path":"src/App.tsx:148:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:149:23",path:"pvcs",element:h.jsx($,{"code-path":"src/App.tsx:149:51",children:h.jsx(kt,{"code-path":"src/App.tsx:149:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:150:23",path:"statefulsets",element:h.jsx($,{"code-path":"src/App.tsx:150:59",children:h.jsx(kt,{"code-path":"src/App.tsx:150:69"})})}),h.jsx(Z,{"code-path":"src/App.tsx:151:23",path:"daemonsets",element:h.jsx($,{"code-path":"src/App.tsx:151:57",children:h.jsx(kt,{"code-path":"src/App.tsx:151:67"})})})]})]})]}),h.jsx(Z,{"code-path":"src/App.tsx:157:17",path:"workloads",element:h.jsx($,{"code-path":"src/App.tsx:157:50",children:h.jsx(kt,{"code-path":"src/App.tsx:157:60"})})}),h.jsx(Z,{"code-path":"src/App.tsx:158:17",path:"workloads/events",element:h.jsx($,{"code-path":"src/App.tsx:158:57",children:h.jsx(UM,{"code-path":"src/App.tsx:158:67",target:"events"})})}),h.jsx(Z,{"code-path":"src/App.tsx:159:17",path:"workloads/:type",element:h.jsx($,{"code-path":"src/App.tsx:159:56",children:h.jsx(kt,{"code-path":"src/App.tsx:159:66"})})}),h.jsx(Z,{"code-path":"src/App.tsx:160:17",path:"nodes",element:h.jsx($,{"code-path":"src/App.tsx:160:46",children:h.jsx(NM,{"code-path":"src/App.tsx:160:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:161:17",path:"topology",element:h.jsx($,{"code-path":"src/App.tsx:161:49",children:h.jsx(Jv,{"code-path":"src/App.tsx:161:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:164:17",path:"pipelines",element:h.jsx($,{"code-path":"src/App.tsx:164:50",children:h.jsx(FM,{"code-path":"src/App.tsx:164:60"})})}),h.jsx(Z,{"code-path":"src/App.tsx:165:17",path:"pipelines/:code",element:h.jsx($,{"code-path":"src/App.tsx:165:56",children:h.jsx(ey,{"code-path":"src/App.tsx:165:66"})})}),h.jsx(Z,{"code-path":"src/App.tsx:166:17",path:"pipelines/:code/runs",element:h.jsx($,{"code-path":"src/App.tsx:166:61",children:h.jsx(IM,{"code-path":"src/App.tsx:166:71"})})}),h.jsx(Z,{"code-path":"src/App.tsx:167:17",path:"pipelines/:code/edit",element:h.jsx($,{"code-path":"src/App.tsx:167:61",children:h.jsx(ey,{"code-path":"src/App.tsx:167:71"})})}),h.jsx(Z,{"code-path":"src/App.tsx:168:17",path:"deploy/configureTools",element:h.jsx($,{"code-path":"src/App.tsx:168:62",children:h.jsx(ZM,{"code-path":"src/App.tsx:168:72"})})}),h.jsx(Z,{"code-path":"src/App.tsx:169:17",path:"deploy/groups",element:h.jsx($,{"code-path":"src/App.tsx:169:54",children:h.jsx(JM,{"code-path":"src/App.tsx:169:64"})})}),h.jsx(Z,{"code-path":"src/App.tsx:170:17",path:"deploy/rbac",element:h.jsx($,{"code-path":"src/App.tsx:170:52",children:h.jsx($M,{"code-path":"src/App.tsx:170:62"})})}),h.jsx(Z,{"code-path":"src/App.tsx:173:17",path:"metrics",element:h.jsx($,{"code-path":"src/App.tsx:173:48",children:h.jsx(iD,{"code-path":"src/App.tsx:173:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:174:17",path:"datasources",element:h.jsx($,{"code-path":"src/App.tsx:174:52",children:h.jsx(cD,{"code-path":"src/App.tsx:174:62"})})}),h.jsx(Z,{"code-path":"src/App.tsx:175:17",path:"trace",element:h.jsx($,{"code-path":"src/App.tsx:175:46",children:h.jsx(rD,{"code-path":"src/App.tsx:175:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:176:17",path:"dashboards",element:h.jsx($,{"code-path":"src/App.tsx:176:51",children:h.jsx(lD,{"code-path":"src/App.tsx:176:61"})})}),h.jsx(Z,{"code-path":"src/App.tsx:177:17",path:"host-monitor",element:h.jsx($,{"code-path":"src/App.tsx:177:53",children:h.jsx(oD,{"code-path":"src/App.tsx:177:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:178:17",path:"alerts",element:h.jsx($,{"code-path":"src/App.tsx:178:47",children:h.jsx(Wv,{"code-path":"src/App.tsx:178:57"})})}),h.jsx(Z,{"code-path":"src/App.tsx:179:17",path:"alert-center",element:h.jsx($,{"code-path":"src/App.tsx:179:53",children:h.jsx(aD,{"code-path":"src/App.tsx:179:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:180:17",path:"monitor-center",element:h.jsx($,{"code-path":"src/App.tsx:180:55",children:h.jsx(sD,{"code-path":"src/App.tsx:180:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:181:17",path:"logs",element:h.jsx($,{"code-path":"src/App.tsx:181:45",children:h.jsx(Wv,{"code-path":"src/App.tsx:181:55"})})}),h.jsx(Z,{"code-path":"src/App.tsx:184:17",path:"approval",element:h.jsx($,{"code-path":"src/App.tsx:184:49",children:h.jsx(HM,{"code-path":"src/App.tsx:184:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:185:17",path:"approval/resource",element:h.jsx($,{"code-path":"src/App.tsx:185:58",children:h.jsx(BM,{"code-path":"src/App.tsx:185:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:186:17",path:"approval/app",element:h.jsx($,{"code-path":"src/App.tsx:186:53",children:h.jsx(PM,{"code-path":"src/App.tsx:186:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:187:17",path:"approval/permission",element:h.jsx($,{"code-path":"src/App.tsx:187:60",children:h.jsx(VM,{"code-path":"src/App.tsx:187:70"})})}),h.jsx(Z,{"code-path":"src/App.tsx:188:17",path:"cronjobs",element:h.jsx($,{"code-path":"src/App.tsx:188:49",children:h.jsx(WM,{"code-path":"src/App.tsx:188:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:189:17",path:"scripts",element:h.jsx($,{"code-path":"src/App.tsx:189:48",children:h.jsx(qM,{"code-path":"src/App.tsx:189:58"})})}),h.jsx(Z,{"code-path":"src/App.tsx:193:17",path:"ai-assistant",element:h.jsx($,{"code-path":"src/App.tsx:193:53",children:h.jsx(eD,{"code-path":"src/App.tsx:193:63"})})}),h.jsx(Z,{"code-path":"src/App.tsx:194:17",path:"ai-alert-analyzer",element:h.jsx($,{"code-path":"src/App.tsx:194:58",children:h.jsx(tD,{"code-path":"src/App.tsx:194:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:195:17",path:"ai-predictive",element:h.jsx($,{"code-path":"src/App.tsx:195:54",children:h.jsx(nD,{"code-path":"src/App.tsx:195:64"})})}),h.jsx(Z,{"code-path":"src/App.tsx:198:17",path:"audit/terminal",element:h.jsx($,{"code-path":"src/App.tsx:198:55",children:h.jsx(YM,{"code-path":"src/App.tsx:198:65"})})}),h.jsx(Z,{"code-path":"src/App.tsx:199:17",path:"audit/operations",element:h.jsx($,{"code-path":"src/App.tsx:199:57",children:h.jsx(XM,{"code-path":"src/App.tsx:199:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:200:17",path:"audit/login-logs",element:h.jsx($,{"code-path":"src/App.tsx:200:57",children:h.jsx(QM,{"code-path":"src/App.tsx:200:67"})})}),h.jsx(Z,{"code-path":"src/App.tsx:203:17",path:"users",element:h.jsx($,{"code-path":"src/App.tsx:203:46",children:h.jsx(Rd,{"code-path":"src/App.tsx:203:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:204:17",path:"roles",element:h.jsx($,{"code-path":"src/App.tsx:204:46",children:h.jsx(Rd,{"code-path":"src/App.tsx:204:56"})})}),h.jsx(Z,{"code-path":"src/App.tsx:205:17",path:"credentials",element:h.jsx($,{"code-path":"src/App.tsx:205:52",children:h.jsx(KM,{"code-path":"src/App.tsx:205:62"})})}),h.jsx(Z,{"code-path":"src/App.tsx:206:17",path:"settings",element:h.jsx($,{"code-path":"src/App.tsx:206:49",children:h.jsx(Rd,{"code-path":"src/App.tsx:206:59"})})}),h.jsx(Z,{"code-path":"src/App.tsx:207:17",path:"approval-workflow",element:h.jsx($,{"code-path":"src/App.tsx:207:58",children:h.jsx(GM,{"code-path":"src/App.tsx:207:68"})})}),h.jsx(Z,{"code-path":"src/App.tsx:210:17",path:"*",element:h.jsx(Sy,{"code-path":"src/App.tsx:210:42",to:"/",replace:!0})})]})]})})})})})}bw.createRoot(document.getElementById("root")).render(h.jsx(m.StrictMode,{"code-path":"src/main.tsx:7:3",children:h.jsx(fD,{"code-path":"src/main.tsx:8:5"})}));export{db as $,vD as A,St as B,Wo as C,Wj as D,TA as E,ft as F,xD as G,rn as H,yD as I,sf as J,Xa as K,ri as L,ob as M,h_ as N,wa as O,Et as P,ji as Q,f_ as R,qC as S,Hx as T,tb as U,Bx as V,Yn as W,Mi as X,nf as Y,iT as Z,ut as _,nM as a,nb as a0,Ef as a1,wf as a2,Ci as a3,Px as a4,u2 as a5,Vx as a6,ex as a7,Js as a8,Ws as a9,ei as aa,Kd as ab,ti as ac,Fo as ad,se as ae,Io as af,_j as ag,SD as ah,yA as ai,dA as aj,Nd as ak,Oy as al,cA as am,uA as an,Dd as ao,Ry as ap,AA as aq,pA as ar,gD as as,PC as at,Py as au,aM as b,oM as c,lM as d,rM as e,CD as f,mD as g,Ue as h,sl as i,AD as j,wt as k,wD as l,Ce as m,ZC as n,on as o,qT as p,C2 as q,Ea as r,ke as s,Zv as t,Wb as u,Di as v,Pe as w,oe as x,ZR as y,bi as z}; diff --git a/backend/static/assets/index-BzYDIT5o.css b/backend/static/assets/index-BzYDIT5o.css deleted file mode 100644 index 8d132bc..0000000 --- a/backend/static/assets/index-BzYDIT5o.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root,[data-theme=ocean-deep]{--background: 220 13% 5%;--foreground: 210 40% 98%;--card: 220 13% 7%;--card-foreground: 210 40% 98%;--popover: 220 13% 7%;--popover-foreground: 210 40% 98%;--primary: 217 91% 60%;--primary-foreground: 0 0% 100%;--secondary: 220 13% 14%;--secondary-foreground: 210 40% 98%;--muted: 220 13% 14%;--muted-foreground: 215 20% 55%;--accent: 220 13% 14%;--accent-foreground: 210 40% 98%;--destructive: 0 62% 50%;--destructive-foreground: 0 0% 100%;--border: 220 13% 18%;--input: 220 13% 14%;--ring: 217 91% 60%;--radius: .625rem;--sidebar-background: 220 13% 7%;--sidebar-foreground: 210 40% 90%;--sidebar-primary: 217 91% 60%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 220 13% 14%;--sidebar-accent-foreground: 210 40% 98%;--sidebar-border: 220 13% 18%;--sidebar-ring: 217 91% 60%;--dg-bg-primary: #0d1117;--dg-bg-secondary: #161b22;--dg-bg-tertiary: #21262d;--dg-bg-hover: #30363d;--dg-bg-active: #3d444d;--dg-border: #30363d;--dg-border-light: #21262d;--dg-border-hover: #484f58;--dg-text-primary: #f0f6fc;--dg-text-secondary: #8b949e;--dg-text-muted: #6e7681;--dg-blue: #58a6ff;--dg-green: #3fb950;--dg-red: #f85149;--dg-orange: #f0883e;--dg-purple: #8957e5;--dg-cyan: #39c5cf;--dg-yellow: #d29922;--dg-card-hover-border: rgba(88, 166, 255, .5);--dg-gradient-start: #2563eb;--dg-gradient-end: #9333ea;--dg-gradient-text-start: #60a5fa;--dg-gradient-text-end: #c084fc;--dg-input-focus-ring: rgba(96, 165, 250, .2);--chart-grid: #1e293b;--chart-axis: #475569;--chart-tooltip-bg: #0f172a;--chart-tooltip-border: #1e293b;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(255, 255, 255, .02);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(88, 166, 255, .15);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #21262d;--skeleton-highlight: #30363d}[data-theme=light-professional],[data-theme=light]{--background: 0 0% 100%;--foreground: 220 14% 10%;--card: 0 0% 100%;--card-foreground: 220 14% 10%;--popover: 0 0% 100%;--popover-foreground: 220 14% 10%;--primary: 217 91% 60%;--primary-foreground: 0 0% 100%;--secondary: 220 14% 96%;--secondary-foreground: 220 14% 10%;--muted: 220 14% 96%;--muted-foreground: 220 10% 46%;--accent: 220 14% 96%;--accent-foreground: 220 14% 10%;--destructive: 0 72% 51%;--destructive-foreground: 0 0% 100%;--border: 220 13% 91%;--input: 220 13% 91%;--ring: 217 91% 60%;--radius: .625rem;--sidebar-background: 0 0% 98%;--sidebar-foreground: 220 14% 20%;--sidebar-primary: 217 91% 60%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 220 14% 94%;--sidebar-accent-foreground: 220 14% 10%;--sidebar-border: 220 13% 91%;--sidebar-ring: 217 91% 60%;--dg-bg-primary: #ffffff;--dg-bg-secondary: #f8f9fb;--dg-bg-tertiary: #f0f1f5;--dg-bg-hover: #e8eaef;--dg-bg-active: #dfe1e8;--dg-border: #e2e5eb;--dg-border-light: #eaecf0;--dg-border-hover: #d0d5dd;--dg-text-primary: #1a1d23;--dg-text-secondary: #5c6370;--dg-text-muted: #9ca3af;--dg-blue: #2563eb;--dg-green: #16a34a;--dg-red: #dc2626;--dg-orange: #ea580c;--dg-purple: #7c3aed;--dg-cyan: #0891b2;--dg-yellow: #ca8a04;--dg-card-hover-border: rgba(37, 99, 235, .3);--dg-gradient-start: #2563eb;--dg-gradient-end: #7c3aed;--dg-gradient-text-start: #1d4ed8;--dg-gradient-text-end: #6d28d9;--dg-input-focus-ring: rgba(37, 99, 235, .15);--chart-grid: #e2e5eb;--chart-axis: #9ca3af;--chart-tooltip-bg: #ffffff;--chart-tooltip-border: #e2e5eb;--shadow-card: 0 1px 3px rgba(0, 0, 0, .06), 0 0 0 1px rgba(0, 0, 0, .04);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .1), 0 0 0 1px rgba(37, 99, 235, .1);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .12);--skeleton-base: #f0f1f5;--skeleton-highlight: #e8eaef}[data-theme=midnight-purple]{--background: 264 56% 4%;--foreground: 280 100% 98%;--card: 264 48% 8%;--card-foreground: 280 100% 98%;--popover: 264 48% 8%;--popover-foreground: 280 100% 98%;--primary: 270 91% 65%;--primary-foreground: 0 0% 100%;--secondary: 264 40% 20%;--secondary-foreground: 280 100% 98%;--muted: 264 40% 20%;--muted-foreground: 280 30% 60%;--accent: 264 40% 20%;--accent-foreground: 280 100% 98%;--destructive: 348 100% 72%;--destructive-foreground: 264 56% 4%;--border: 264 40% 20%;--input: 264 40% 20%;--ring: 270 91% 65%;--radius: .625rem;--sidebar-background: 264 48% 6%;--sidebar-foreground: 280 100% 92%;--sidebar-primary: 270 91% 65%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 264 40% 20%;--sidebar-accent-foreground: 280 100% 98%;--sidebar-border: 264 40% 20%;--sidebar-ring: 270 91% 65%;--dg-bg-primary: #0a0612;--dg-bg-secondary: #130c21;--dg-bg-tertiary: #1c1330;--dg-bg-hover: #2d1f4a;--dg-bg-active: #3d2a5e;--dg-border: #2d1f4a;--dg-border-light: #1c1330;--dg-border-hover: #3d2a5e;--dg-text-primary: #faf5ff;--dg-text-secondary: #b794c7;--dg-text-muted: #7c5a8a;--dg-blue: #818cf8;--dg-green: #34d399;--dg-red: #fb7185;--dg-orange: #fb923c;--dg-purple: #c084fc;--dg-cyan: #22d3ee;--dg-yellow: #facc15;--dg-card-hover-border: rgba(192, 132, 252, .5);--dg-gradient-start: #9333ea;--dg-gradient-end: #c084fc;--dg-gradient-text-start: #a855f7;--dg-gradient-text-end: #c084fc;--dg-input-focus-ring: rgba(192, 132, 252, .2);--chart-grid: #2d1f4a;--chart-axis: #7c5a8a;--chart-tooltip-bg: #130c21;--chart-tooltip-border: #2d1f4a;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(192, 132, 252, .05);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(192, 132, 252, .2);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #1c1330;--skeleton-highlight: #2d1f4a}[data-theme=pine-green]{--background: 150 25% 5%;--foreground: 140 60% 97%;--card: 150 25% 9%;--card-foreground: 140 60% 97%;--popover: 150 25% 9%;--popover-foreground: 140 60% 97%;--primary: 142 71% 45%;--primary-foreground: 150 25% 5%;--secondary: 150 20% 18%;--secondary-foreground: 140 60% 97%;--muted: 150 20% 18%;--muted-foreground: 150 20% 55%;--accent: 150 20% 18%;--accent-foreground: 140 60% 97%;--destructive: 0 90% 72%;--destructive-foreground: 150 25% 5%;--border: 150 20% 18%;--input: 150 20% 18%;--ring: 142 71% 45%;--radius: .625rem;--sidebar-background: 150 25% 7%;--sidebar-foreground: 140 40% 88%;--sidebar-primary: 142 71% 45%;--sidebar-primary-foreground: 150 25% 5%;--sidebar-accent: 150 20% 18%;--sidebar-accent-foreground: 140 60% 97%;--sidebar-border: 150 20% 18%;--sidebar-ring: 142 71% 45%;--dg-bg-primary: #0a1210;--dg-bg-secondary: #111f1a;--dg-bg-tertiary: #192c24;--dg-bg-hover: #253d32;--dg-bg-active: #2f4f3e;--dg-border: #253d32;--dg-border-light: #192c24;--dg-border-hover: #2f4f3e;--dg-text-primary: #f0fdf4;--dg-text-secondary: #86b8a0;--dg-text-muted: #5a7c6b;--dg-blue: #38bdf8;--dg-green: #4ade80;--dg-red: #f87171;--dg-orange: #fb923c;--dg-purple: #c084fc;--dg-cyan: #2dd4bf;--dg-yellow: #facc15;--dg-card-hover-border: rgba(74, 222, 128, .5);--dg-gradient-start: #059669;--dg-gradient-end: #10b981;--dg-gradient-text-start: #059669;--dg-gradient-text-end: #34d399;--dg-input-focus-ring: rgba(74, 222, 128, .2);--chart-grid: #253d32;--chart-axis: #5a7c6b;--chart-tooltip-bg: #111f1a;--chart-tooltip-border: #253d32;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(74, 222, 128, .05);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(74, 222, 128, .2);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #192c24;--skeleton-highlight: #253d32}[data-theme=orange-vitality]{--background: 30 35% 5%;--foreground: 30 100% 97%;--card: 30 30% 9%;--card-foreground: 30 100% 97%;--popover: 30 30% 9%;--popover-foreground: 30 100% 97%;--primary: 25 95% 53%;--primary-foreground: 0 0% 100%;--secondary: 30 25% 18%;--secondary-foreground: 30 100% 97%;--muted: 30 25% 18%;--muted-foreground: 30 25% 55%;--accent: 30 25% 18%;--accent-foreground: 30 100% 97%;--destructive: 0 80% 70%;--destructive-foreground: 30 35% 5%;--border: 30 25% 18%;--input: 30 25% 18%;--ring: 25 95% 53%;--radius: .625rem;--sidebar-background: 30 30% 7%;--sidebar-foreground: 30 80% 88%;--sidebar-primary: 25 95% 53%;--sidebar-primary-foreground: 0 0% 100%;--sidebar-accent: 30 25% 18%;--sidebar-accent-foreground: 30 100% 97%;--sidebar-border: 30 25% 18%;--sidebar-ring: 25 95% 53%;--dg-bg-primary: #110d08;--dg-bg-secondary: #1d1610;--dg-bg-tertiary: #2b1f16;--dg-bg-hover: #3d2d20;--dg-bg-active: #4d3928;--dg-border: #3d2d20;--dg-border-light: #2b1f16;--dg-border-hover: #4d3928;--dg-text-primary: #fef7ed;--dg-text-secondary: #d4a574;--dg-text-muted: #9c7a54;--dg-blue: #60a5fa;--dg-green: #4ade80;--dg-red: #f87171;--dg-orange: #fb923c;--dg-purple: #a78bfa;--dg-cyan: #2dd4bf;--dg-yellow: #fcd34d;--dg-card-hover-border: rgba(251, 146, 60, .5);--dg-gradient-start: #ea580c;--dg-gradient-end: #f59e0b;--dg-gradient-text-start: #f97316;--dg-gradient-text-end: #fbbf24;--dg-input-focus-ring: rgba(251, 146, 60, .2);--chart-grid: #3d2d20;--chart-axis: #9c7a54;--chart-tooltip-bg: #1d1610;--chart-tooltip-border: #3d2d20;--shadow-card: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 1px rgba(251, 146, 60, .05);--shadow-card-hover: 0 8px 32px rgba(0, 0, 0, .4), 0 0 0 1px rgba(251, 146, 60, .2);--shadow-dropdown: 0 10px 40px rgba(0, 0, 0, .5);--skeleton-base: #2b1f16;--skeleton-highlight: #3d2d20}*{border-color:hsl(var(--border))}html{scroll-behavior:smooth}body{background-color:var(--dg-bg-primary);color:var(--dg-text-primary);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans SC,PingFang SC,Microsoft YaHei,sans-serif;font-feature-settings:"rlig" 1,"calt" 1;transition:background-color .3s ease,color .3s ease}body[data-scroll-locked],body[data-radix-scroll-locked],body[style*=padding-right]{padding-right:0!important}code,pre,.font-mono{font-family:JetBrains Mono,Fira Code,Consolas,SF Mono,monospace}::-moz-selection{background-color:var(--dg-blue);color:#fff}::selection{background-color:var(--dg-blue);color:#fff}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.\!left-0{left:0!important}.\!top-0{top:0!important}.-bottom-12{bottom:-3rem}.-left-12{left:-3rem}.-right-0\.5{right:-.125rem}.-right-12{right:-3rem}.-top-0\.5{top:-.125rem}.-top-12{top:-3rem}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1\/2{left:50%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-3\.5{left:.875rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.top-0{top:0}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-3\.5{top:.875rem}.top-4{top:1rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[1\]{z-index:1}.order-first{order:-9999}.order-last{order:9999}.col-span-1{grid-column:span 1 / span 1}.col-span-2{grid-column:span 2 / span 2}.col-span-3{grid-column:span 3 / span 3}.col-span-4{grid-column:span 4 / span 4}.col-span-full{grid-column:1 / -1}.col-start-2{grid-column-start:2}.row-span-2{grid-row:span 2 / span 2}.row-start-1{grid-row-start:1}.\!m-0{margin:0!important}.m-4{margin:1rem}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-px{margin-left:-1px;margin-right:-1px}.-my-2{margin-top:-.5rem;margin-bottom:-.5rem}.mx-0\.5{margin-left:.125rem;margin-right:.125rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-3\.5{margin-left:.875rem;margin-right:.875rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0{margin-top:0;margin-bottom:0}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.-mb-px{margin-bottom:-1px}.-ml-4{margin-left:-1rem}.-mt-4{margin-top:-1rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-0\.5{margin-left:.125rem}.ml-1{margin-left:.25rem}.ml-1\.5{margin-left:.375rem}.ml-2{margin-left:.5rem}.ml-2\.5{margin-left:.625rem}.ml-4{margin-left:1rem}.ml-9{margin-left:2.25rem}.ml-auto{margin-left:auto}.mr-0\.5{margin-right:.125rem}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mr-2\.5{margin-right:.625rem}.mr-4{margin-right:1rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-2\.5{margin-top:.625rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-row{display:table-row}.grid{display:grid}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-10{width:2.5rem;height:2.5rem}.size-16{width:4rem;height:4rem}.size-2{width:.5rem;height:.5rem}.size-2\.5{width:.625rem;height:.625rem}.size-3{width:.75rem;height:.75rem}.size-3\.5{width:.875rem;height:.875rem}.size-4{width:1rem;height:1rem}.size-5{width:1.25rem;height:1.25rem}.size-6{width:1.5rem;height:1.5rem}.size-7{width:1.75rem;height:1.75rem}.size-8{width:2rem;height:2rem}.size-9{width:2.25rem;height:2.25rem}.size-auto{width:auto;height:auto}.size-full{width:100%;height:100%}.\!h-screen{height:100vh!important}.h-0\.5{height:.125rem}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-56{height:14rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1\.15rem\]{height:1.15rem}.h-\[120px\]{height:120px}.h-\[180px\]{height:180px}.h-\[200px\]{height:200px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[320px\]{height:320px}.h-\[480px\]{height:480px}.h-\[500px\]{height:500px}.h-\[600px\]{height:600px}.h-\[80vh\]{height:80vh}.h-\[88vh\]{height:88vh}.h-\[calc\(100\%-1px\)\]{height:calc(100% - 1px)}.h-\[calc\(100vh-14rem\)\]{height:calc(100vh - 14rem)}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[var\(--header-height\)\]{height:var(--header-height)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.h-svh{height:100svh}.max-h-0{max-height:0px}.max-h-32{max-height:8rem}.max-h-40{max-height:10rem}.max-h-48{max-height:12rem}.max-h-52{max-height:13rem}.max-h-60{max-height:15rem}.max-h-64{max-height:16rem}.max-h-80{max-height:20rem}.max-h-\[120px\]{max-height:120px}.max-h-\[180px\]{max-height:180px}.max-h-\[220px\]{max-height:220px}.max-h-\[300px\]{max-height:300px}.max-h-\[350px\]{max-height:350px}.max-h-\[40vh\]{max-height:40vh}.max-h-\[420px\]{max-height:420px}.max-h-\[45vh\]{max-height:45vh}.max-h-\[50vh\]{max-height:50vh}.max-h-\[520px\]{max-height:520px}.max-h-\[60vh\]{max-height:60vh}.max-h-\[65vh\]{max-height:65vh}.max-h-\[800px\]{max-height:800px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.min-h-0{min-height:0px}.min-h-16{min-height:4rem}.min-h-4{min-height:1rem}.min-h-\[100px\]{min-height:100px}.min-h-\[200px\]{min-height:200px}.min-h-\[360px\]{min-height:360px}.min-h-\[36px\]{min-height:36px}.min-h-\[400px\]{min-height:400px}.min-h-\[50px\]{min-height:50px}.min-h-\[50vh\]{min-height:50vh}.min-h-\[60px\]{min-height:60px}.min-h-\[60vh\]{min-height:60vh}.min-h-\[70px\]{min-height:70px}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.min-h-svh{min-height:100svh}.\!w-screen{width:100vw!important}.w-0{width:0px}.w-0\.5{width:.125rem}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-44{width:11rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-52{width:13rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-60{width:15rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[100px\]{width:100px}.w-\[110px\]{width:110px}.w-\[120px\]{width:120px}.w-\[128px\]{width:128px}.w-\[130px\]{width:130px}.w-\[140px\]{width:140px}.w-\[150px\]{width:150px}.w-\[16\%\]{width:16%}.w-\[160px\]{width:160px}.w-\[170px\]{width:170px}.w-\[20\%\]{width:20%}.w-\[200px\]{width:200px}.w-\[240px\]{width:240px}.w-\[280px\]{width:280px}.w-\[360px\]{width:360px}.w-\[40\%\]{width:40%}.w-\[460px\]{width:460px}.w-\[480px\]{width:480px}.w-\[60px\]{width:60px}.w-\[72px\]{width:72px}.w-\[8\%\]{width:8%}.w-\[80px\]{width:80px}.w-\[88px\]{width:88px}.w-\[90px\]{width:90px}.w-\[90vw\]{width:90vw}.w-\[92vw\]{width:92vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-10{min-width:2.5rem}.min-w-5{min-width:1.25rem}.min-w-8{min-width:2rem}.min-w-9{min-width:2.25rem}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[12rem\]{min-width:12rem}.min-w-\[160px\]{min-width:160px}.min-w-\[180px\]{min-width:180px}.min-w-\[200px\]{min-width:200px}.min-w-\[280px\]{min-width:280px}.min-w-\[28px\]{min-width:28px}.min-w-\[300px\]{min-width:300px}.min-w-\[30px\]{min-width:30px}.min-w-\[400px\]{min-width:400px}.min-w-\[40px\]{min-width:40px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[90px\]{min-width:90px}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.\!max-w-none{max-width:none!important}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[100px\]{max-width:100px}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[1600px\]{max-width:1600px}.max-w-\[160px\]{max-width:160px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[220px\]{max-width:220px}.max-w-\[250px\]{max-width:250px}.max-w-\[280px\]{max-width:280px}.max-w-\[300px\]{max-width:300px}.max-w-\[320px\]{max-width:320px}.max-w-\[400px\]{max-width:400px}.max-w-\[80\%\]{max-width:80%}.max-w-\[90vw\]{max-width:90vw}.max-w-\[calc\(100\%-2rem\)\]{max-width:calc(100% - 2rem)}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-\[2\]{flex:2}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.grow-0{flex-grow:0}.basis-full{flex-basis:100%}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.\!translate-x-0{--tw-translate-x: 0px !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.\!translate-y-0{--tw-translate-y: 0px !important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-px{--tw-translate-x: -1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-px{--tw-translate-x: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0{--tw-translate-y: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0\.5{--tw-translate-y: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-2{--tw-translate-y: .5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[calc\(-50\%_-_2px\)\]{--tw-translate-y: calc(-50% - 2px) ;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-90{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes caret-blink{0%,70%,to{opacity:1}20%,50%{opacity:0}}.animate-caret-blink{animation:caret-blink 1.25s ease-out infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-crosshair{cursor:crosshair}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-grabbing{cursor:grabbing}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize-y{resize:vertical}.resize{resize:both}.scroll-my-1{scroll-margin-top:.25rem;scroll-margin-bottom:.25rem}.scroll-py-1{scroll-padding-top:.25rem;scroll-padding-bottom:.25rem}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.auto-rows-min{grid-auto-rows:min-content}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-12{grid-template-columns:repeat(12,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.grid-cols-\[0_1fr\]{grid-template-columns:0 1fr}.grid-cols-\[1fr_1\.4fr_auto\]{grid-template-columns:1fr 1.4fr auto}.grid-cols-\[1fr_100px_1fr_60px_28px\]{grid-template-columns:1fr 100px 1fr 60px 28px}.grid-cols-\[1fr_1fr_100px_auto\]{grid-template-columns:1fr 1fr 100px auto}.grid-cols-\[1fr_1fr_1fr_60px_auto\]{grid-template-columns:1fr 1fr 1fr 60px auto}.grid-cols-\[1fr_80px_1fr_100px_80px_auto\]{grid-template-columns:1fr 80px 1fr 100px 80px auto}.grid-cols-\[1fr_80px_80px_80px_80px_32px\]{grid-template-columns:1fr 80px 80px 80px 80px 32px}.grid-rows-\[auto_auto\]{grid-template-rows:auto auto}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-items-start{justify-items:start}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-7{gap:1.75rem}.gap-\[--spacing\(var\(--gap\)\)\]{gap:var(--spacing(var(--gap)))}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-6{-moz-column-gap:1.5rem;column-gap:1.5rem}.gap-y-0\.5{row-gap:.125rem}.gap-y-1{row-gap:.25rem}.gap-y-3{row-gap:.75rem}.gap-y-4{row-gap:1rem}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-2\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.625rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-\[var\(--dg-border\)\]>:not([hidden])~:not([hidden]){border-color:var(--dg-border)}.divide-slate-800>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(30 41 59 / var(--tw-divide-opacity, 1))}.self-start{align-self:flex-start}.self-center{align-self:center}.self-stretch{align-self:stretch}.justify-self-end{justify-self:end}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-balance{text-wrap:balance}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.\!rounded-none{border-radius:0!important}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[4px\]{border-radius:4px}.rounded-\[calc\(var\(--radius\)-5px\)\]{border-radius:calc(var(--radius) - 5px)}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-xs{border-radius:calc(var(--radius) - 6px)}.rounded-b-md{border-bottom-right-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-l-full{border-top-left-radius:9999px;border-bottom-left-radius:9999px}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-md{border-top-left-radius:calc(var(--radius) - 2px);border-top-right-radius:calc(var(--radius) - 2px)}.rounded-t-sm{border-top-left-radius:calc(var(--radius) - 4px);border-top-right-radius:calc(var(--radius) - 4px)}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-\[1\.5px\]{border-width:1.5px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-b-0{border-bottom-width:0px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-\[var\(--dg-blue\)\]{border-color:var(--dg-blue)}.border-\[var\(--dg-border\)\]{border-color:var(--dg-border)}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-amber-500\/20{border-color:#f59e0b33}.border-amber-500\/30{border-color:#f59e0b4d}.border-amber-500\/50{border-color:#f59e0b80}.border-amber-600{--tw-border-opacity: 1;border-color:rgb(217 119 6 / var(--tw-border-opacity, 1))}.border-amber-700\/50{border-color:#b4530980}.border-amber-800\/30{border-color:#92400e4d}.border-amber-800\/40{border-color:#92400e66}.border-amber-800\/50{border-color:#92400e80}.border-blue-400{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.border-blue-400\/20{border-color:#60a5fa33}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/20{border-color:#3b82f633}.border-blue-500\/30{border-color:#3b82f64d}.border-blue-500\/50{border-color:#3b82f680}.border-blue-600{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.border-blue-600\/50{border-color:#2563eb80}.border-blue-700\/50{border-color:#1d4ed880}.border-blue-800\/50{border-color:#1e40af80}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-cyan-500{--tw-border-opacity: 1;border-color:rgb(6 182 212 / var(--tw-border-opacity, 1))}.border-cyan-500\/30{border-color:#06b6d44d}.border-emerald-400\/20{border-color:#34d39933}.border-emerald-400\/50{border-color:#34d39980}.border-emerald-500{--tw-border-opacity: 1;border-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-emerald-600{--tw-border-opacity: 1;border-color:rgb(5 150 105 / var(--tw-border-opacity, 1))}.border-emerald-600\/30{border-color:#0596694d}.border-emerald-700\/50{border-color:#04785780}.border-gray-500\/30{border-color:#6b72804d}.border-green-500\/30{border-color:#22c55e4d}.border-indigo-400\/50{border-color:#818cf880}.border-indigo-500{--tw-border-opacity: 1;border-color:rgb(99 102 241 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-orange-500\/30{border-color:#f973164d}.border-primary{border-color:hsl(var(--primary))}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/30{border-color:#a855f74d}.border-purple-700\/50{border-color:#7e22ce80}.border-purple-800\/50{border-color:#6b21a880}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-red-500\/40{border-color:#ef444466}.border-red-600{--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1))}.border-red-600\/30{border-color:#dc26264d}.border-red-700\/50{border-color:#b91c1c80}.border-rose-500\/30{border-color:#f43f5e4d}.border-sidebar-border{border-color:hsl(var(--sidebar-border))}.border-slate-500{--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity, 1))}.border-slate-500\/30{border-color:#64748b4d}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.border-slate-600\/30{border-color:#4755694d}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.border-slate-700\/50{border-color:#33415580}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity, 1))}.border-slate-800\/30{border-color:#1e293b4d}.border-slate-800\/50{border-color:#1e293b80}.border-slate-800\/60{border-color:#1e293b99}.border-slate-800\/80{border-color:#1e293bcc}.border-transparent{border-color:transparent}.border-violet-500\/30{border-color:#8b5cf64d}.border-yellow-500\/20{border-color:#eab30833}.border-yellow-500\/30{border-color:#eab3084d}.border-l-\[var\(--dg-warning\)\]{border-left-color:var(--dg-warning)}.border-l-transparent{border-left-color:transparent}.border-t-\[var\(--dg-blue\)\]{border-top-color:var(--dg-blue)}.border-t-blue-500{--tw-border-opacity: 1;border-top-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-t-transparent{border-top-color:transparent}.bg-\[\#0a0e14\]{--tw-bg-opacity: 1;background-color:rgb(10 14 20 / var(--tw-bg-opacity, 1))}.bg-\[\#0d1117\]{--tw-bg-opacity: 1;background-color:rgb(13 17 23 / var(--tw-bg-opacity, 1))}.bg-\[\#0f172a\]{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-\[var\(--dg-accent\)\]{background-color:var(--dg-accent)}.bg-\[var\(--dg-bg-hover\)\]{background-color:var(--dg-bg-hover)}.bg-\[var\(--dg-bg-primary\)\]{background-color:var(--dg-bg-primary)}.bg-\[var\(--dg-bg-secondary\)\]{background-color:var(--dg-bg-secondary)}.bg-\[var\(--dg-bg-tertiary\)\]{background-color:var(--dg-bg-tertiary)}.bg-\[var\(--dg-blue\)\]{background-color:var(--dg-blue)}.bg-\[var\(--dg-border\)\]{background-color:var(--dg-border)}.bg-\[var\(--dg-green\)\]{background-color:var(--dg-green)}.bg-\[var\(--dg-purple\)\]{background-color:var(--dg-purple)}.bg-\[var\(--dg-red\)\]{background-color:var(--dg-red)}.bg-\[var\(--dg-text-secondary\)\]{background-color:var(--dg-text-secondary)}.bg-\[var\(--dg-yellow\)\]{background-color:var(--dg-yellow)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity, 1))}.bg-amber-400\/10{background-color:#fbbf241a}.bg-amber-400\/40{background-color:#fbbf2466}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-amber-500\/60{background-color:#f59e0b99}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-amber-600\/40{background-color:#d9770666}.bg-amber-950\/30{background-color:#451a034d}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-blue-400\/10{background-color:#60a5fa1a}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/15{background-color:#3b82f626}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-500\/5{background-color:#3b82f60d}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-950\/20{background-color:#17255433}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-cyan-400\/10{background-color:#22d3ee1a}.bg-cyan-500\/10{background-color:#06b6d41a}.bg-cyan-500\/20{background-color:#06b6d433}.bg-destructive{--tw-bg-opacity: 1;background-color:hsl(var(--destructive) / var(--tw-bg-opacity, 1))}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity, 1))}.bg-emerald-400\/10{background-color:#34d3991a}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/15{background-color:#10b98126}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/30{background-color:#10b9814d}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-500\/60{background-color:#10b98199}.bg-emerald-500\/90{background-color:#10b981e6}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-emerald-600\/20{background-color:#05966933}.bg-emerald-600\/30{background-color:#0596694d}.bg-foreground{background-color:hsl(var(--foreground))}.bg-gray-500{--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.bg-gray-500\/15{background-color:#6b728026}.bg-gray-500\/20{background-color:#6b728033}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/15{background-color:#22c55e26}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-indigo-400\/10{background-color:#818cf81a}.bg-indigo-500\/10{background-color:#6366f11a}.bg-input{background-color:hsl(var(--input))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/40{background-color:hsl(var(--muted) / .4)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/20{background-color:#f9731633}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-purple-400{--tw-bg-opacity: 1;background-color:rgb(192 132 252 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/15{background-color:#a855f726}.bg-purple-500\/20{background-color:#a855f733}.bg-purple-500\/5{background-color:#a855f70d}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-purple-950\/20{background-color:#3b076433}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/15{background-color:#ef444426}.bg-red-500\/20{background-color:#ef444433}.bg-red-500\/5{background-color:#ef44440d}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-600\/20{background-color:#dc262633}.bg-red-600\/40{background-color:#dc262666}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-rose-500\/10{background-color:#f43f5e1a}.bg-rose-500\/20{background-color:#f43f5e33}.bg-secondary{background-color:hsl(var(--secondary))}.bg-sidebar{background-color:hsl(var(--sidebar-background))}.bg-sidebar-border{background-color:hsl(var(--sidebar-border))}.bg-sky-500{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity, 1))}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity, 1))}.bg-slate-500\/10{background-color:#64748b1a}.bg-slate-500\/15{background-color:#64748b26}.bg-slate-500\/20{background-color:#64748b33}.bg-slate-600{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity, 1))}.bg-slate-600\/10{background-color:#4755691a}.bg-slate-600\/30{background-color:#4755694d}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-700\/50{background-color:#33415580}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-800\/30{background-color:#1e293b4d}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-slate-900\/30{background-color:#0f172a4d}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/50{background-color:#0f172a80}.bg-slate-900\/60{background-color:#0f172a99}.bg-slate-900\/80{background-color:#0f172acc}.bg-slate-950{--tw-bg-opacity: 1;background-color:rgb(2 6 23 / var(--tw-bg-opacity, 1))}.bg-slate-950\/30{background-color:#0206174d}.bg-slate-950\/60{background-color:#02061799}.bg-slate-950\/80{background-color:#020617cc}.bg-transparent{background-color:transparent}.bg-violet-500\/20{background-color:#8b5cf633}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.bg-yellow-400\/15{background-color:#facc1526}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/20{background-color:#eab30833}.bg-yellow-500\/5{background-color:#eab3080d}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-\[var\(--dg-blue\)\]{--tw-gradient-from: var(--dg-blue) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-amber-500{--tw-gradient-from: #f59e0b var(--tw-gradient-from-position);--tw-gradient-to: rgb(245 158 11 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500\/50{--tw-gradient-from: rgb(59 130 246 / .5) var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-600\/60{--tw-gradient-from: rgb(37 99 235 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(37 99 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-\[var\(--dg-cyan\)\]{--tw-gradient-to: var(--dg-cyan) var(--tw-gradient-to-position)}.to-\[var\(--dg-purple\)\]{--tw-gradient-to: var(--dg-purple) var(--tw-gradient-to-position)}.to-amber-500{--tw-gradient-to: #f59e0b var(--tw-gradient-to-position)}.to-blue-400\/80{--tw-gradient-to: rgb(96 165 250 / .8) var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-foreground{fill:hsl(var(--foreground))}.fill-primary{fill:hsl(var(--primary))}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-12{padding:3rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-3\.5{padding:.875rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[3px\]{padding:3px}.p-px{padding:1px}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.py-px{padding-top:1px;padding-bottom:1px}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pb-px{padding-bottom:1px}.pl-1{padding-left:.25rem}.pl-1\.5{padding-left:.375rem}.pl-10{padding-left:2.5rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pl-7{padding-left:1.75rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-1\.5{padding-top:.375rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-6{padding-top:1.5rem}.pt-\[var\(--header-height\)\]{padding-top:var(--header-height)}.pt-px{padding-top:1px}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[15px\]{font-size:15px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-sm\/relaxed{font-size:.875rem;line-height:1.625}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-5{line-height:1.25rem}.leading-none{line-height:1}.leading-normal{line-height:1.5}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[var\(--dg-blue\)\]{color:var(--dg-blue)}.text-\[var\(--dg-border\)\]{color:var(--dg-border)}.text-\[var\(--dg-cyan\)\]{color:var(--dg-cyan)}.text-\[var\(--dg-green\)\]{color:var(--dg-green)}.text-\[var\(--dg-orange\)\]{color:var(--dg-orange)}.text-\[var\(--dg-purple\)\]{color:var(--dg-purple)}.text-\[var\(--dg-red\)\]{color:var(--dg-red)}.text-\[var\(--dg-text-muted\)\]{color:var(--dg-text-muted)}.text-\[var\(--dg-text-primary\)\]{color:var(--dg-text-primary)}.text-\[var\(--dg-text-secondary\)\]{color:var(--dg-text-secondary)}.text-\[var\(--dg-warning\)\]{color:var(--dg-warning)}.text-\[var\(--dg-yellow\)\]{color:var(--dg-yellow)}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-200{--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-300\/80{color:#fcd34dcc}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-400\/80{color:#fbbf24cc}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-500\/70{color:#f59e0bb3}.text-background{color:hsl(var(--background))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-cyan-500{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-destructive{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.text-emerald-200{--tw-text-opacity: 1;color:rgb(167 243 208 / var(--tw-text-opacity, 1))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-400\/60{color:#34d39999}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-400\/70{color:#4ade80b3}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-muted{color:hsl(var(--muted))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-300{--tw-text-opacity: 1;color:rgb(253 186 116 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-red-200{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity, 1))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-400\/70{color:#f87171b3}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-rose-400{--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sidebar-foreground{color:hsl(var(--sidebar-foreground))}.text-sidebar-foreground\/70{color:hsl(var(--sidebar-foreground) / .7)}.text-sky-400{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity, 1))}.text-sky-500{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity, 1))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-teal-400{--tw-text-opacity: 1;color:rgb(45 212 191 / var(--tw-text-opacity, 1))}.text-violet-400{--tw-text-opacity: 1;color:rgb(167 139 250 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-400\/80{color:#facc15cc}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.accent-blue-500{accent-color:#3b82f6}.accent-blue-600{accent-color:#2563eb}.accent-cyan-500{accent-color:#06b6d4}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\]{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-border));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xs{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-amber-500\/30{--tw-ring-color: rgb(245 158 11 / .3)}.ring-blue-500\/30{--tw-ring-color: rgb(59 130 246 / .3)}.ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.ring-sidebar-ring{--tw-ring-color: hsl(var(--sidebar-ring))}.ring-offset-0{--tw-ring-offset-width: 0px}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.\!transition-none{transition-property:none!important}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[color\,box-shadow\]{transition-property:color,box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[left\,right\,width\]{transition-property:left,right,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\,opacity\]{transition-property:margin,opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\]{transition-property:margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-none{transition-property:none}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.\!duration-0{transition-duration:0s!important}.duration-100{transition-duration:.1s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in,.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.\!duration-0{animation-duration:0s!important}.duration-100{animation-duration:.1s}.duration-1000{animation-duration:1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{animation-timing-function:linear}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.running{animation-play-state:running}.\!paused{animation-play-state:paused!important}.paused{animation-play-state:paused}.dg-card{border-radius:calc(var(--radius) + 4px);border-width:1px;border-color:var(--dg-border);background-color:var(--dg-bg-secondary);box-shadow:var(--shadow-card);transition:background-color .3s ease,border-color .3s ease,box-shadow .3s ease,transform .3s ease}.dg-card-hover{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s;animation-duration:.3s}.dg-card-hover:hover{border-color:var(--dg-card-hover-border);box-shadow:var(--shadow-card-hover);transform:translateY(-2px)}.dg-input{border-radius:var(--radius);border-color:var(--dg-border);background-color:var(--dg-bg-tertiary);color:var(--dg-text-primary)}.dg-input::-moz-placeholder{color:var(--dg-text-muted)}.dg-input::placeholder{color:var(--dg-text-muted)}.dg-input:focus{border-color:var(--dg-blue);--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.dg-input{transition:border-color .2s ease,box-shadow .2s ease}.dg-input:focus{--tw-ring-color: var(--dg-input-focus-ring);box-shadow:0 0 0 3px var(--dg-input-focus-ring)}.dg-gradient-text{background:linear-gradient(to right,var(--dg-gradient-text-start),var(--dg-gradient-text-end));-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text}.dg-gradient-bg{background:linear-gradient(to right,var(--dg-gradient-start),var(--dg-gradient-end))}.dg-page>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.dg-page{animation:fade-in .35s cubic-bezier(.16,1,.3,1) forwards}.dg-page-header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:1rem}.dg-page-title{font-size:1.5rem;line-height:2rem;font-weight:700;letter-spacing:-.025em;color:var(--dg-text-primary)}.dg-page-subtitle{margin-top:.25rem;font-size:.875rem;line-height:1.25rem;color:var(--dg-text-muted)}.dg-page-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.dg-btn-primary{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));background:linear-gradient(to right,var(--dg-gradient-start),var(--dg-gradient-end));display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:var(--radius);padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.dg-btn-primary:hover{opacity:.9}.dg-btn-primary:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dg-btn-primary{box-shadow:0 4px 16px color-mix(in srgb,var(--dg-gradient-start) 25%,transparent)}.dg-btn-primary:hover{box-shadow:0 6px 24px color-mix(in srgb,var(--dg-gradient-start) 35%,transparent)}.dg-btn-secondary{border-width:1px;border-color:var(--dg-border);background-color:var(--dg-bg-tertiary);color:var(--dg-text-primary);display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:var(--radius);padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.dg-btn-secondary:hover{border-color:var(--dg-border-hover);background-color:var(--dg-bg-hover)}.dg-btn-secondary:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dg-btn-ghost{color:var(--dg-text-secondary);display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:var(--radius);padding:.5rem 1rem;font-size:.875rem;line-height:1.25rem;font-weight:500;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.dg-btn-ghost:hover{background-color:var(--dg-bg-hover);color:var(--dg-text-primary)}.dg-badge-blue{background-color:#3b82f61a;--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-green{background-color:#22c55e1a;--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-red{background-color:#ef44441a;--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-yellow{background-color:#eab3081a;--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.dg-badge-purple{background-color:#a855f71a;--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1));display:inline-flex;align-items:center;border-radius:calc(var(--radius) - 2px);padding:.125rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}.scrollbar-thin{scrollbar-width:thin;scrollbar-color:var(--dg-border) transparent}.scrollbar-thin::-webkit-scrollbar{width:6px;height:6px}.scrollbar-thin::-webkit-scrollbar-track{background:transparent}.scrollbar-thin::-webkit-scrollbar-thumb{background:var(--dg-border);border-radius:3px}.scrollbar-thin::-webkit-scrollbar-thumb:hover{background:var(--dg-text-muted)}@keyframes fade-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.animate-fade-in{animation:fade-in .35s cubic-bezier(.16,1,.3,1) forwards}.animate-fade-in-delay-1{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .05s both}.animate-fade-in-delay-2{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .1s both}.animate-fade-in-delay-3{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .15s both}.animate-fade-in-delay-4{animation:fade-in .35s cubic-bezier(.16,1,.3,1) .2s both}@keyframes scale-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.animate-scale-in{animation:scale-in .25s cubic-bezier(.16,1,.3,1) forwards}@keyframes slide-in-right{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes pulse-ring{0%{transform:scale(.8);opacity:.5}to{transform:scale(1.2);opacity:0}}@keyframes shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.dg-skeleton{background:linear-gradient(90deg,var(--skeleton-base) 25%,var(--skeleton-highlight) 50%,var(--skeleton-base) 75%);background-size:200% 100%;animation:shimmer 1.5s ease-in-out infinite;border-radius:.5rem}.glass{background:color-mix(in srgb,var(--dg-bg-secondary) 75%,transparent);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);border:1px solid var(--dg-border)}.chart-grid-stroke{stroke:var(--chart-grid)}.chart-tooltip{background-color:var(--chart-tooltip-bg)!important;border:1px solid var(--chart-tooltip-border)!important;border-radius:6px!important;color:var(--dg-text-primary)!important;box-shadow:var(--shadow-dropdown)!important}.\[--cell-size\:--spacing\(8\)\]{--cell-size: var(--spacing(8))}pre{overflow-x:auto;border-radius:var(--radius);padding:1rem;background-color:var(--dg-bg-tertiary);border:1px solid var(--dg-border)}code{font-family:JetBrains Mono,Fira Code,Consolas,SF Mono,monospace;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.875rem;line-height:1.25rem}table{width:100%}th{text-align:left;font-size:.75rem;line-height:1rem;font-weight:500;text-transform:uppercase;letter-spacing:.05em;color:var(--dg-text-secondary)}td{font-size:.875rem;line-height:1.25rem;color:var(--dg-text-primary)}input:focus,textarea:focus,select:focus{outline:none;box-shadow:0 0 0 2px var(--dg-bg-primary),0 0 0 4px var(--dg-blue);border-color:var(--dg-blue)}button{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;animation-duration:.2s}.terminal{font-family:JetBrains Mono,Fira Code,Consolas,SF Mono,monospace;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.875rem;line-height:1.25rem;background-color:var(--dg-bg-primary);color:var(--dg-text-secondary)}.terminal .prompt{color:var(--dg-green)}.terminal .command{color:var(--dg-text-primary)}.terminal .output{color:var(--dg-text-muted)}.recharts-tooltip-wrapper{z-index:50}.recharts-default-tooltip{background-color:var(--chart-tooltip-bg)!important;border-color:var(--chart-tooltip-border)!important;color:var(--dg-text-primary)!important;border-radius:6px!important;box-shadow:var(--shadow-dropdown)!important}[data-state=open]>[data-radix-dialog-overlay]{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);background-color:color-mix(in srgb,var(--dg-bg-primary) 80%,transparent)}[role=menuitem]{cursor:pointer}@keyframes progress-indeterminate{0%{transform:translate(-100%)}to{transform:translate(100%)}}.progress-indeterminate:after{content:"";position:absolute;inset:0;background-color:currentColor;animation:progress-indeterminate 1.5s ease-in-out infinite}.xterm-terminal-host{width:100%;overflow:hidden;background:#0a0e14}.xterm-terminal-host .xterm{height:100%}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.dg-skeleton{animation:none;background:var(--skeleton-base)}}.selection\:bg-primary *::-moz-selection{background-color:hsl(var(--primary))}.selection\:bg-primary *::selection{background-color:hsl(var(--primary))}.selection\:text-primary-foreground *::-moz-selection{color:hsl(var(--primary-foreground))}.selection\:text-primary-foreground *::selection{color:hsl(var(--primary-foreground))}.selection\:bg-primary::-moz-selection{background-color:hsl(var(--primary))}.selection\:bg-primary::selection{background-color:hsl(var(--primary))}.selection\:text-primary-foreground::-moz-selection{color:hsl(var(--primary-foreground))}.selection\:text-primary-foreground::selection{color:hsl(var(--primary-foreground))}.file\:inline-flex::file-selector-button{display:inline-flex}.file\:h-7::file-selector-button{height:1.75rem}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-\[var\(--dg-text-muted\)\]::-moz-placeholder{color:var(--dg-text-muted)}.placeholder\:text-\[var\(--dg-text-muted\)\]::placeholder{color:var(--dg-text-muted)}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-slate-500::-moz-placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::-moz-placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-600::placeholder{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);inset:-.5rem}.after\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:.25rem}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.first\:rounded-l-md:first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.first\:border-l:first-child{border-left-width:1px}.last\:mt-0:last-child{margin-top:0}.last\:rounded-r-md:last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.last\:border-0:last-child{border-width:0px}.last\:border-b-0:last-child{border-bottom-width:0px}.last\:border-r-0:last-child{border-right-width:0px}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[var\(--dg-border\)\]:hover{border-color:var(--dg-border)}.hover\:border-\[var\(--dg-border-hover\)\]:hover{border-color:var(--dg-border-hover)}.hover\:border-blue-500:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.hover\:border-blue-500\/50:hover{border-color:#3b82f680}.hover\:border-orange-500\/30:hover{border-color:#f973164d}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:border-slate-400:hover{--tw-border-opacity: 1;border-color:rgb(148 163 184 / var(--tw-border-opacity, 1))}.hover\:border-slate-600:hover{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity, 1))}.hover\:border-slate-700:hover{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity, 1))}.hover\:bg-\[var\(--dg-bg-hover\)\]:hover{background-color:var(--dg-bg-hover)}.hover\:bg-\[var\(--dg-bg-primary\)\]:hover{background-color:var(--dg-bg-primary)}.hover\:bg-\[var\(--dg-bg-tertiary\)\]:hover{background-color:var(--dg-bg-tertiary)}.hover\:bg-\[var\(--dg-blue-hover\)\]:hover{background-color:var(--dg-blue-hover)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-500\/10:hover{background-color:#f59e0b1a}.hover\:bg-amber-600\/20:hover{background-color:#d9770633}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/10:hover{background-color:#3b82f61a}.hover\:bg-blue-500\/20:hover{background-color:#3b82f633}.hover\:bg-blue-600\/10:hover{background-color:#2563eb1a}.hover\:bg-blue-600\/20:hover{background-color:#2563eb33}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-cyan-500\/20:hover{background-color:#06b6d433}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/10:hover{background-color:#10b9811a}.hover\:bg-emerald-600\/10:hover{background-color:#0596691a}.hover\:bg-emerald-600\/20:hover{background-color:#05966933}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-green-500\/10:hover{background-color:#22c55e1a}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600\/20:hover{background-color:#dc262633}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-sidebar-accent:hover{background-color:hsl(var(--sidebar-accent))}.hover\:bg-slate-700:hover{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-800\/30:hover{background-color:#1e293b4d}.hover\:bg-slate-800\/50:hover{background-color:#1e293b80}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:bg-white\/\[0\.03\]:hover{background-color:#ffffff08}.hover\:bg-yellow-500\/10:hover{background-color:#eab3081a}.hover\:stroke-blue-500:hover{stroke:#3b82f6}.hover\:text-\[var\(--dg-blue\)\]:hover{color:var(--dg-blue)}.hover\:text-\[var\(--dg-text-primary\)\]:hover{color:var(--dg-text-primary)}.hover\:text-\[var\(--dg-text-secondary\)\]:hover{color:var(--dg-text-secondary)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-300:hover{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.hover\:text-amber-400:hover{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.hover\:text-cyan-400:hover{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.hover\:text-emerald-300:hover{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.hover\:text-emerald-400:hover{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-400:hover{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.hover\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\:text-red-300:hover{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-sidebar-accent-foreground:hover{color:hsl(var(--sidebar-accent-foreground))}.hover\:text-slate-100:hover{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.hover\:text-slate-200:hover{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.hover\:text-slate-300:hover{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:text-yellow-400:hover{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-accent\)\)\]:hover{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-accent));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-4:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:brightness-110:hover{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:hsl(var(--sidebar-border))}.focus\:z-10:focus{z-index:10}.focus\:border-\[var\(--dg-blue\)\]:focus{border-color:var(--dg-blue)}.focus\:border-amber-600:focus{--tw-border-opacity: 1;border-color:rgb(217 119 6 / var(--tw-border-opacity, 1))}.focus\:border-blue-400:focus{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:bg-\[var\(--dg-bg-hover\)\]:focus{background-color:var(--dg-bg-hover)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-red-500\/10:focus{background-color:#ef44441a}.focus\:bg-slate-700:focus{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.focus\:text-\[var\(--dg-text-primary\)\]:focus{color:var(--dg-text-primary)}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-blue-300:focus{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.focus\:text-cyan-300:focus{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity, 1))}.focus\:text-emerald-300:focus{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity, 1))}.focus\:text-red-400:focus{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.focus\:text-slate-100:focus{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-blue-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:z-10:focus-visible{z-index:10}.focus-visible\:border-ring:focus-visible{border-color:hsl(var(--ring))}.focus-visible\:outline-1:focus-visible{outline-width:1px}.focus-visible\:outline-ring:focus-visible{outline-color:hsl(var(--ring))}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-4:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-\[3px\]:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-destructive\/20:focus-visible{--tw-ring-color: hsl(var(--destructive) / .2)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-ring\/50:focus-visible{--tw-ring-color: hsl(var(--ring) / .5)}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:scale-\[0\.98\]:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:bg-sidebar-accent:active{background-color:hsl(var(--sidebar-accent))}.active\:text-sidebar-accent-foreground:active{color:hsl(var(--sidebar-accent-foreground))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-20:disabled{opacity:.2}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.group\/menu-item:focus-within .group-focus-within\/menu-item\:opacity-100{opacity:1}.group:hover .group-hover\:block{display:block}.group:hover .group-hover\:from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.group:hover .group-hover\:to-blue-300{--tw-gradient-to: #93c5fd var(--tw-gradient-to-position)}.group:hover .group-hover\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.group\/cmd:hover .group-hover\/cmd\:opacity-100,.group\/menu-item:hover .group-hover\/menu-item\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.peer\/menu-button:hover~.peer-hover\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-50{opacity:.5}.has-\[\>button\]\:ml-\[-0\.45rem\]:has(>button){margin-left:-.45rem}.has-\[\>button\]\:mr-\[-0\.45rem\]:has(>button){margin-right:-.45rem}.has-\[\>kbd\]\:ml-\[-0\.35rem\]:has(>kbd){margin-left:-.35rem}.has-\[\>kbd\]\:mr-\[-0\.35rem\]:has(>kbd){margin-right:-.35rem}.has-\[\>\[data-align\=block-end\]\]\:h-auto:has(>[data-align=block-end]){height:auto}.has-\[\>\[data-align\=block-start\]\]\:h-auto:has(>[data-align=block-start]){height:auto}.has-\[\>textarea\]\:h-auto:has(>textarea){height:auto}.has-\[\>\[data-slot\=field\]\]\:w-full:has(>[data-slot=field]){width:100%}.has-\[\>svg\]\:grid-cols-\[calc\(var\(--spacing\)\*4\)_1fr\]:has(>svg){grid-template-columns:calc(var(--spacing) * 4) 1fr}.has-\[\>\[data-align\=block-end\]\]\:flex-col:has(>[data-align=block-end]){flex-direction:column}.has-\[\>\[data-align\=block-start\]\]\:flex-col:has(>[data-align=block-start]){flex-direction:column}.has-\[\>\[data-slot\=field\]\]\:flex-col:has(>[data-slot=field]){flex-direction:column}.has-\[\>\[data-slot\=field-content\]\]\:items-start:has(>[data-slot=field-content]){align-items:flex-start}.has-\[\>\[data-slot\=button-group\]\]\:gap-2:has(>[data-slot=button-group]){gap:.5rem}.has-\[\>\[data-slot\=checkbox-group\]\]\:gap-3:has(>[data-slot=checkbox-group]){gap:.75rem}.has-\[\>\[data-slot\=radio-group\]\]\:gap-3:has(>[data-slot=radio-group]){gap:.75rem}.has-\[\>svg\]\:gap-x-3:has(>svg){-moz-column-gap:.75rem;column-gap:.75rem}.has-\[\>\[data-slot\=field\]\]\:rounded-md:has(>[data-slot=field]){border-radius:calc(var(--radius) - 2px)}.has-\[\>\[data-slot\=field\]\]\:border:has(>[data-slot=field]){border-width:1px}.has-\[\[data-slot\=input-group-control\]\:focus-visible\]\:border-ring:has([data-slot=input-group-control]:focus-visible){border-color:hsl(var(--ring))}.has-\[\[data-slot\]\[aria-invalid\=true\]\]\:border-destructive:has([data-slot][aria-invalid=true]){--tw-border-opacity: 1;border-color:hsl(var(--destructive) / var(--tw-border-opacity, 1))}.has-\[\>svg\]\:p-0:has(>svg){padding:0}.has-\[\>svg\]\:px-2:has(>svg){padding-left:.5rem;padding-right:.5rem}.has-\[\>svg\]\:px-2\.5:has(>svg){padding-left:.625rem;padding-right:.625rem}.has-\[\>svg\]\:px-3:has(>svg){padding-left:.75rem;padding-right:.75rem}.has-\[\>svg\]\:px-4:has(>svg){padding-left:1rem;padding-right:1rem}.has-\[\[data-slot\=input-group-control\]\:focus-visible\]\:ring-\[3px\]:has([data-slot=input-group-control]:focus-visible){--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.has-\[\[data-slot\=input-group-control\]\:focus-visible\]\:ring-ring\/50:has([data-slot=input-group-control]:focus-visible){--tw-ring-color: hsl(var(--ring) / .5)}.has-\[\[data-slot\]\[aria-invalid\=true\]\]\:ring-destructive\/20:has([data-slot][aria-invalid=true]){--tw-ring-color: hsl(var(--destructive) / .2)}.group\/item:has([data-slot=item-description]) .group-has-\[\[data-slot\=item-description\]\]\/item\:translate-y-0\.5{--tw-translate-y: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group\/item:has([data-slot=item-description]) .group-has-\[\[data-slot\=item-description\]\]\/item\:self-start{align-self:flex-start}.group\/field:has([data-orientation=horizontal]) .group-has-\[\[data-orientation\=horizontal\]\]\/field\:text-balance{text-wrap:balance}.group\/input-group:has(>input) .group-has-\[\>input\]\/input-group\:pb-2\.5{padding-bottom:.625rem}.group\/input-group:has(>input) .group-has-\[\>input\]\/input-group\:pt-2\.5{padding-top:.625rem}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[vaul-drawer-direction\=bottom\]\:inset-x-0[data-vaul-drawer-direction=bottom]{left:0;right:0}.data-\[vaul-drawer-direction\=left\]\:inset-y-0[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:inset-y-0[data-vaul-drawer-direction=right]{top:0;bottom:0}.data-\[vaul-drawer-direction\=top\]\:inset-x-0[data-vaul-drawer-direction=top]{left:0;right:0}.data-\[vaul-drawer-direction\=bottom\]\:bottom-0[data-vaul-drawer-direction=bottom]{bottom:0}.data-\[vaul-drawer-direction\=left\]\:left-0[data-vaul-drawer-direction=left]{left:0}.data-\[vaul-drawer-direction\=right\]\:right-0[data-vaul-drawer-direction=right]{right:0}.data-\[vaul-drawer-direction\=top\]\:top-0[data-vaul-drawer-direction=top]{top:0}.data-\[active\=true\]\:z-10[data-active=true]{z-index:10}.data-\[vaul-drawer-direction\=bottom\]\:mt-24[data-vaul-drawer-direction=bottom]{margin-top:6rem}.data-\[vaul-drawer-direction\=top\]\:mb-24[data-vaul-drawer-direction=top]{margin-bottom:6rem}.data-\[orientation\=horizontal\]\:h-1\.5[data-orientation=horizontal]{height:.375rem}.data-\[orientation\=horizontal\]\:h-full[data-orientation=horizontal]{height:100%}.data-\[orientation\=horizontal\]\:h-px[data-orientation=horizontal]{height:1px}.data-\[orientation\=vertical\]\:h-auto[data-orientation=vertical]{height:auto}.data-\[orientation\=vertical\]\:h-full[data-orientation=vertical]{height:100%}.data-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[size\=default\]\:h-9[data-size=default]{height:2.25rem}.data-\[size\=sm\]\:h-8[data-size=sm]{height:2rem}.data-\[vaul-drawer-direction\=bottom\]\:max-h-\[80vh\][data-vaul-drawer-direction=bottom],.data-\[vaul-drawer-direction\=top\]\:max-h-\[80vh\][data-vaul-drawer-direction=top]{max-height:80vh}.data-\[orientation\=vertical\]\:min-h-44[data-orientation=vertical]{min-height:11rem}.data-\[orientation\=horizontal\]\:w-full[data-orientation=horizontal]{width:100%}.data-\[orientation\=vertical\]\:w-1\.5[data-orientation=vertical]{width:.375rem}.data-\[orientation\=vertical\]\:w-auto[data-orientation=vertical]{width:auto}.data-\[orientation\=vertical\]\:w-full[data-orientation=vertical]{width:100%}.data-\[orientation\=vertical\]\:w-px[data-orientation=vertical]{width:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\[vaul-drawer-direction\=left\]\:w-3\/4[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:w-3\/4[data-vaul-drawer-direction=right]{width:75%}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-\[calc\(100\%-2px\)\][data-state=checked]{--tw-translate-x: calc(100% - 2px) ;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[orientation\=vertical\]\:flex-col[data-orientation=vertical],.data-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\[slot\=checkbox-group\]\:gap-3[data-slot=checkbox-group]{gap:.75rem}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true],.data-\[spacing\=0\]\:rounded-none[data-spacing="0"]{border-radius:0}.data-\[range-end\=true\]\:rounded-r-md[data-range-end=true]{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.data-\[range-start\=true\]\:rounded-l-md[data-range-start=true]{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.data-\[vaul-drawer-direction\=bottom\]\:rounded-t-lg[data-vaul-drawer-direction=bottom]{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.data-\[vaul-drawer-direction\=top\]\:rounded-b-lg[data-vaul-drawer-direction=top]{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.data-\[spacing\=0\]\:data-\[variant\=outline\]\:border-l-0[data-variant=outline][data-spacing="0"]{border-left-width:0px}.data-\[vaul-drawer-direction\=bottom\]\:border-t[data-vaul-drawer-direction=bottom]{border-top-width:1px}.data-\[vaul-drawer-direction\=left\]\:border-r[data-vaul-drawer-direction=left]{border-right-width:1px}.data-\[vaul-drawer-direction\=right\]\:border-l[data-vaul-drawer-direction=right]{border-left-width:1px}.data-\[vaul-drawer-direction\=top\]\:border-b[data-vaul-drawer-direction=top]{border-bottom-width:1px}.data-\[active\=true\]\:border-ring[data-active=true]{border-color:hsl(var(--ring))}.data-\[state\=checked\]\:border-blue-600[data-state=checked]{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity, 1))}.data-\[state\=checked\]\:border-primary[data-state=checked]{border-color:hsl(var(--primary))}.data-\[active\=true\]\:bg-accent\/50[data-active=true]{background-color:hsl(var(--accent) / .5)}.data-\[active\=true\]\:bg-sidebar-accent[data-active=true]{background-color:hsl(var(--sidebar-accent))}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-\[var\(--dg-bg-primary\)\][data-state=active]{background-color:var(--dg-bg-primary)}.data-\[state\=active\]\:bg-\[var\(--dg-bg-tertiary\)\][data-state=active]{background-color:var(--dg-bg-tertiary)}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=active\]\:bg-orange-500\/10[data-state=active]{background-color:#f973161a}.data-\[state\=active\]\:bg-slate-700[data-state=active]{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.data-\[state\=checked\]\:bg-blue-600[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.data-\[state\=checked\]\:bg-emerald-600[data-state=checked]{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=on\]\:bg-accent[data-state=on],.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[inset\]\:pl-8[data-inset]{padding-left:2rem}.data-\[variant\=label\]\:text-sm[data-variant=label]{font-size:.875rem;line-height:1.25rem}.data-\[variant\=legend\]\:text-base[data-variant=legend]{font-size:1rem;line-height:1.5rem}.data-\[active\=true\]\:font-medium[data-active=true]{font-weight:500}.data-\[active\=true\]\:text-accent-foreground[data-active=true]{color:hsl(var(--accent-foreground))}.data-\[active\=true\]\:text-sidebar-accent-foreground[data-active=true]{color:hsl(var(--sidebar-accent-foreground))}.data-\[error\=true\]\:text-destructive[data-error=true],.data-\[invalid\=true\]\:text-destructive[data-invalid=true]{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-orange-400[data-state=active]{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=on\]\:text-accent-foreground[data-state=on],.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[variant\=destructive\]\:text-destructive[data-variant=destructive]{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=open\]\:opacity-100[data-state=open]{opacity:1}.data-\[spacing\=0\]\:shadow-none[data-spacing="0"]{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[spacing\=default\]\:data-\[variant\=outline\]\:shadow-xs[data-variant=outline][data-spacing=default],.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[active\=true\]\:ring-\[3px\][data-active=true]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.data-\[active\=true\]\:ring-ring\/50[data-active=true]{--tw-ring-color: hsl(var(--ring) / .5)}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed],.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}.\*\:data-\[slot\=select-value\]\:line-clamp-1[data-slot=select-value]>*{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\*\:data-\[slot\=select-value\]\:flex[data-slot=select-value]>*{display:flex}.\*\:data-\[slot\=select-value\]\:items-center[data-slot=select-value]>*{align-items:center}.\*\:data-\[slot\=select-value\]\:gap-2[data-slot=select-value]>*{gap:.5rem}.\*\:data-\[slot\=alert-description\]\:text-destructive\/90[data-slot=alert-description]>*{color:hsl(var(--destructive) / .9)}.data-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:0}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:.25rem}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[spacing\=0\]\:first\:rounded-l-md:first-child[data-spacing="0"]{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.data-\[spacing\=0\]\:data-\[variant\=outline\]\:first\:border-l:first-child[data-variant=outline][data-spacing="0"]{border-left-width:1px}.data-\[spacing\=0\]\:last\:rounded-r-md:last-child[data-spacing="0"]{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.data-\[active\=true\]\:hover\:bg-accent:hover[data-active=true],.data-\[state\=open\]\:hover\:bg-accent:hover[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:hover\:bg-sidebar-accent:hover[data-state=open]{background-color:hsl(var(--sidebar-accent))}.data-\[state\=open\]\:hover\:text-sidebar-accent-foreground:hover[data-state=open]{color:hsl(var(--sidebar-accent-foreground))}.data-\[active\=true\]\:focus\:bg-accent:focus[data-active=true]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:focus\:bg-accent:focus[data-state=open]{background-color:hsl(var(--accent))}.data-\[variant\=destructive\]\:focus\:bg-destructive\/10:focus[data-variant=destructive]{background-color:hsl(var(--destructive) / .1)}.data-\[variant\=destructive\]\:focus\:text-destructive:focus[data-variant=destructive]{--tw-text-opacity: 1;color:hsl(var(--destructive) / var(--tw-text-opacity, 1))}.group[data-disabled=true] .group-data-\[disabled\=true\]\:pointer-events-none{pointer-events:none}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:left-\[calc\(var\(--sidebar-width\)\*-1\)\]{left:calc(var(--sidebar-width) * -1)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:right-\[calc\(var\(--sidebar-width\)\*-1\)\]{right:calc(var(--sidebar-width) * -1)}.group[data-side=left] .group-data-\[side\=left\]\:-right-4{right:-1rem}.group[data-side=right] .group-data-\[side\=right\]\:left-0{left:0}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:top-full{top:100%}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:-mt-8{margin-top:-2rem}.group\/field-group[data-variant=outline] .group-data-\[variant\=outline\]\/field-group\:-mb-2{margin-bottom:-.5rem}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:mt-1\.5{margin-top:.375rem}.group\/drawer-content[data-vaul-drawer-direction=bottom] .group-data-\[vaul-drawer-direction\=bottom\]\/drawer-content\:block{display:block}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:hidden{display:none}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\)\]{width:calc(var(--sidebar-width-icon) + (--spacing(4)))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)\+\(--spacing\(4\)\)\+2px\)\]{width:calc(var(--sidebar-width-icon) + (--spacing(4)) + 2px)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:w-0{width:0px}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-side=right] .group-data-\[side\=right\]\:rotate-180,.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:overflow-hidden,.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:overflow-hidden{overflow:hidden}.group[data-variant=floating] .group-data-\[variant\=floating\]\:rounded-lg{border-radius:var(--radius)}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:rounded-md{border-radius:calc(var(--radius) - 2px)}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border,.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:border{border-width:1px}.group[data-side=left] .group-data-\[side\=left\]\:border-r{border-right-width:1px}.group[data-side=right] .group-data-\[side\=right\]\:border-l{border-left-width:1px}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border-sidebar-border{border-color:hsl(var(--sidebar-border))}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:bg-popover{background-color:hsl(var(--popover))}.group\/drawer-content[data-vaul-drawer-direction=bottom] .group-data-\[vaul-drawer-direction\=bottom\]\/drawer-content\:text-center,.group\/drawer-content[data-vaul-drawer-direction=top] .group-data-\[vaul-drawer-direction\=top\]\/drawer-content\:text-center{text-align:center}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:text-popover-foreground{color:hsl(var(--popover-foreground))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:opacity-0{opacity:0}.group\/field[data-disabled=true] .group-data-\[disabled\=true\]\/field\:opacity-50,.group\/input-group[data-disabled=true] .group-data-\[disabled\=true\]\/input-group\:opacity-50,.group[data-disabled=true] .group-data-\[disabled\=true\]\:opacity-50{opacity:.5}.group[data-variant=floating] .group-data-\[variant\=floating\]\:shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:duration-200{transition-duration:.2s;animation-duration:.2s}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:after\:left-full:after{content:var(--tw-content);left:100%}.group[data-collapsible=offcanvas] .hover\:group-data-\[collapsible\=offcanvas\]\:bg-sidebar:hover{background-color:hsl(var(--sidebar-background))}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.group\/navigation-menu[data-viewport=false] .group-data-\[viewport\=false\]\/navigation-menu\:data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.peer\/menu-button[data-size=default]~.peer-data-\[size\=default\]\/menu-button\:top-1\.5{top:.375rem}.peer\/menu-button[data-size=lg]~.peer-data-\[size\=lg\]\/menu-button\:top-2\.5{top:.625rem}.peer\/menu-button[data-size=sm]~.peer-data-\[size\=sm\]\/menu-button\:top-1{top:.25rem}.peer\/menu-button[data-active=true]~.peer-data-\[active\=true\]\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.dark\:border-input:is(.dark *){border-color:hsl(var(--input))}.dark\:bg-destructive\/60:is(.dark *){background-color:hsl(var(--destructive) / .6)}.dark\:bg-input\/30:is(.dark *){background-color:hsl(var(--input) / .3)}.dark\:bg-slate-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.dark\:bg-transparent:is(.dark *){background-color:transparent}.dark\:text-muted-foreground:is(.dark *){color:hsl(var(--muted-foreground))}.dark\:hover\:bg-accent\/50:hover:is(.dark *){background-color:hsl(var(--accent) / .5)}.dark\:hover\:bg-input\/50:hover:is(.dark *){background-color:hsl(var(--input) / .5)}.dark\:hover\:text-accent-foreground:hover:is(.dark *){color:hsl(var(--accent-foreground))}.dark\:focus-visible\:ring-destructive\/40:focus-visible:is(.dark *){--tw-ring-color: hsl(var(--destructive) / .4)}.dark\:has-\[\[data-slot\]\[aria-invalid\=true\]\]\:ring-destructive\/40:has([data-slot][aria-invalid=true]):is(.dark *){--tw-ring-color: hsl(var(--destructive) / .4)}.dark\:data-\[state\=active\]\:border-input[data-state=active]:is(.dark *){border-color:hsl(var(--input))}.dark\:data-\[state\=active\]\:bg-input\/30[data-state=active]:is(.dark *){background-color:hsl(var(--input) / .3)}.dark\:data-\[state\=checked\]\:bg-primary[data-state=checked]:is(.dark *){background-color:hsl(var(--primary))}.dark\:data-\[state\=checked\]\:bg-primary-foreground[data-state=checked]:is(.dark *){background-color:hsl(var(--primary-foreground))}.dark\:data-\[state\=unchecked\]\:bg-foreground[data-state=unchecked]:is(.dark *){background-color:hsl(var(--foreground))}.dark\:data-\[state\=unchecked\]\:bg-input\/80[data-state=unchecked]:is(.dark *){background-color:hsl(var(--input) / .8)}.dark\:data-\[state\=active\]\:text-foreground[data-state=active]:is(.dark *){color:hsl(var(--foreground))}.dark\:data-\[variant\=destructive\]\:focus\:bg-destructive\/20:focus[data-variant=destructive]:is(.dark *){background-color:hsl(var(--destructive) / .2)}@media(min-width:640px){.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:table-cell{display:table-cell}.sm\:max-w-\[300px\]{max-width:300px}.sm\:max-w-\[480px\]{max-width:480px}.sm\:max-w-\[620px\]{max-width:620px}.sm\:max-w-\[680px\]{max-width:680px}.sm\:max-w-lg{max-width:32rem}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2{gap:.5rem}.sm\:gap-2\.5{gap:.625rem}.sm\:pl-2\.5{padding-left:.625rem}.sm\:pr-2\.5{padding-right:.625rem}.sm\:text-left{text-align:left}.data-\[vaul-drawer-direction\=left\]\:sm\:max-w-sm[data-vaul-drawer-direction=left],.data-\[vaul-drawer-direction\=right\]\:sm\:max-w-sm[data-vaul-drawer-direction=right]{max-width:24rem}}@media(min-width:768px){.md\:absolute{position:absolute}.md\:block{display:block}.md\:inline{display:inline}.md\:flex{display:flex}.md\:table-cell{display:table-cell}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:max-w-\[400px\]{max-width:400px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-1\.5{gap:.375rem}.md\:p-12{padding:3rem}.md\:text-left{text-align:left}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:opacity-0{opacity:0}.md\:after\:hidden:after{content:var(--tw-content);display:none}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:m-2{margin:.5rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:ml-0{margin-left:0}.peer[data-variant=inset][data-state=collapsed]~.md\:peer-data-\[variant\=inset\]\:peer-data-\[state\=collapsed\]\:ml-2{margin-left:.5rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:rounded-xl{border-radius:calc(var(--radius) + 4px)}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}@media(min-width:1024px){.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:col-span-3{grid-column:span 3 / span 3}.lg\:table-cell{display:table-cell}.lg\:w-\[360px\]{width:360px}.lg\:w-\[400px\]{width:400px}.lg\:w-\[600px\]{width:600px}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media(min-width:1280px){.xl\:table-cell{display:table-cell}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}.\[\&\+\[data-slot\=item-content\]\]\:flex-none+[data-slot=item-content]{flex:none}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:nth-child\(2\)\[data-selected\=true\]_button\]\:rounded-l-md:nth-child(2)[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\>\*\:not\(\:first-child\)\]\:rounded-l-none>*:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.\[\&\>\*\:not\(\:first-child\)\]\:rounded-t-none>*:not(:first-child){border-top-left-radius:0;border-top-right-radius:0}.\[\&\>\*\:not\(\:first-child\)\]\:border-l-0>*:not(:first-child){border-left-width:0px}.\[\&\>\*\:not\(\:first-child\)\]\:border-t-0>*:not(:first-child){border-top-width:0px}.\[\&\>\*\:not\(\:last-child\)\]\:rounded-b-none>*:not(:last-child){border-bottom-right-radius:0;border-bottom-left-radius:0}.\[\&\>\*\:not\(\:last-child\)\]\:rounded-r-none>*:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.\[\&\>\*\]\:w-full>*{width:100%}.\[\&\>\*\]\:focus-visible\:relative:focus-visible>*{position:relative}.\[\&\>\*\]\:focus-visible\:z-10:focus-visible>*{z-index:10}.\[\&\>\*\]\:data-\[slot\=field\]\:p-4[data-slot=field]>*{padding:1rem}.\[\&\>\.sr-only\]\:w-auto>.sr-only{width:auto}.\[\&\>\[data-slot\=field-group\]\]\:gap-4>[data-slot=field-group]{gap:1rem}.\[\&\>\[data-slot\=field-label\]\]\:flex-auto>[data-slot=field-label]{flex:1 1 auto}.\[\&\>\[data-slot\=progress-indicator\]\]\:bg-amber-500>[data-slot=progress-indicator]{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.\[\&\>\[data-slot\=progress-indicator\]\]\:bg-emerald-500>[data-slot=progress-indicator]{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.\[\&\>\[data-slot\=progress-indicator\]\]\:bg-red-500>[data-slot=progress-indicator]{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.has-\[select\[aria-hidden\=true\]\:last-child\]\:\[\&\>\[data-slot\=select-trigger\]\:last-of-type\]\:rounded-r-md>[data-slot=select-trigger]:last-of-type:has(select[aria-hidden=true]:last-child){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[data-slot\=select-trigger\]\:not\(\[class\*\=\'w-\'\]\)\]\:w-fit>[data-slot=select-trigger]:not([class*=w-]){width:-moz-fit-content;width:fit-content}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>a\:hover\]\:text-primary>a:hover{color:hsl(var(--primary))}.\[\&\>a\]\:underline>a{text-decoration-line:underline}.\[\&\>a\]\:underline-offset-4>a{text-underline-offset:4px}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>input\]\:flex-1>input{flex:1 1 0%}.has-\[\>\[data-align\=block-end\]\]\:\[\&\>input\]\:pt-3>input:has(>[data-align=block-end]){padding-top:.75rem}.has-\[\>\[data-align\=block-start\]\]\:\[\&\>input\]\:pb-3>input:has(>[data-align=block-start]){padding-bottom:.75rem}.has-\[\>\[data-align\=inline-end\]\]\:\[\&\>input\]\:pr-2>input:has(>[data-align=inline-end]){padding-right:.5rem}.has-\[\>\[data-align\=inline-start\]\]\:\[\&\>input\]\:pl-2>input:has(>[data-align=inline-start]){padding-left:.5rem}.\[\&\>kbd\]\:rounded-\[calc\(var\(--radius\)-5px\)\]>kbd{border-radius:calc(var(--radius) - 5px)}.\[\&\>span\:last-child\]\:truncate>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3\.5>svg:not([class*=size-]){width:.875rem;height:.875rem}.\[\&\>svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4>svg:not([class*=size-]){width:1rem;height:1rem}.\[\&\>svg\]\:pointer-events-none>svg{pointer-events:none}.\[\&\>svg\]\:size-3>svg{width:.75rem;height:.75rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:size-4>svg{width:1rem;height:1rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:translate-y-0\.5>svg{--tw-translate-y: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:text-current>svg{color:currentColor}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:hsl(var(--sidebar-accent-foreground))}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_img\]\:size-full img{width:100%;height:100%}.\[\&_img\]\:object-cover img{-o-object-fit:cover;object-fit:cover}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-3 svg:not([class*=size-]){width:.75rem;height:.75rem}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-4 svg:not([class*=size-]){width:1rem;height:1rem}.\[\&_svg\:not\(\[class\*\=\'size-\'\]\)\]\:size-6 svg:not([class*=size-]){width:1.5rem;height:1.5rem}.\[\&_svg\:not\(\[class\*\=\'text-\'\]\)\]\:text-muted-foreground svg:not([class*=text-]){color:hsl(var(--muted-foreground))}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:-.5rem}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:-.5rem}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}[data-slot=tooltip-content] .\[\[data-slot\=tooltip-content\]_\&\]\:bg-background\/20{background-color:hsl(var(--background) / .2)}[data-slot=tooltip-content] .\[\[data-slot\=tooltip-content\]_\&\]\:text-background{color:hsl(var(--background))}[data-slot=tooltip-content] .dark\:\[\[data-slot\=tooltip-content\]_\&\]\:bg-background\/10:is(.dark *){background-color:hsl(var(--background) / .1)}[data-variant=legend]+.\[\[data-variant\=legend\]\+\&\]\:-mt-1\.5{margin-top:-.375rem}a.\[a\&\]\:hover\:bg-accent:hover{background-color:hsl(var(--accent))}a.\[a\&\]\:hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}a.\[a\&\]\:hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}a.\[a\&\]\:hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}a.\[a\&\]\:hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))} diff --git a/backend/static/assets/index-CoCXV_ZR.js b/backend/static/assets/index-CoCXV_ZR.js new file mode 100644 index 0000000..e6a5590 --- /dev/null +++ b/backend/static/assets/index-CoCXV_ZR.js @@ -0,0 +1 @@ +import{l as s,u as e}from"./index-Bp-M7P_8.js";import{d as t}from"./dashboard-50x02M_T.js";import{s as A}from"./server-B7EY-8NK.js";import{r as f}from"./region-D3lxTXmh.js";import{k as n}from"./index-BkulU9RM.js";import{p as c}from"./pipeline-BGteNHr0.js";import{d as u}from"./config-CBy2SxR-.js";import{c as k,s as v}from"./credential-Df-OY-sx.js";import{c as h,s as y,t as C}from"./automation-BAtbOw0o.js";import{a as P}from"./alert-CRDraqCb.js";import{a as w}from"./alert-center-C9EzZkDY.js";import{s as J}from"./site-CjSdjBc1.js";import{t as W}from"./trace-L8uY5gM3.js";import{d as q}from"./grafana-DTc3taUi.js";import{p as F,z as G}from"./datasource-B9nxnUtk.js";import{m as I,p as K,s as M,z as N}from"./metrics-D_WSC7FH.js";import{a as Q}from"./agent-BZUl25f5.js";import{c as T}from"./account-CeWzarwh.js";import{p as V}from"./platform-lu-CBYjL.js";import{b as Y}from"./billing-D8MiPwwH.js";import{a as _}from"./audit-BQ_DomYe.js";import{l as rr,s as pr,t as or}from"./terminal-DMFQ_5h4.js";import{b as sr,a as er}from"./approval-BivSGX8T.js";import{a as tr}from"./ai-ACl4D1kQ.js";import"./vendor-codemirror-B1SGo4xl.js";import"./vendor-icons-BWk-DH7F.js";export{Q as agentApi,tr as aiApi,P as alertApi,w as alertCenterApi,sr as approvalApi,er as approvalWorkflowApi,_ as auditApi,Y as billingApi,T as cloudApi,k as credentialApi,h as cronJobApi,q as dashboardApi,t as dashboardStatsApi,u as deployApi,n as kubernetesApi,s as ldapApi,rr as loginLogApi,I as metricsApi,c as pipelineApi,V as platformApi,F as promDatasourceApi,K as prometheusProxyApi,f as regionApi,y as scriptApi,A as serverApi,v as serverCredentialApi,pr as sessionCommandApi,J as siteApi,M as snmpApi,C as taskExecutionApi,or as terminalSessionApi,W as traceApi,e as userApi,G as zabbixDatasourceApi,N as zabbixProxyApi}; diff --git a/backend/static/assets/index-D1_Nt40_.js b/backend/static/assets/index-D1_Nt40_.js deleted file mode 100644 index e886a1c..0000000 --- a/backend/static/assets/index-D1_Nt40_.js +++ /dev/null @@ -1 +0,0 @@ -import{l as s,u as e}from"./index-LZWfu62c.js";import{d as t}from"./dashboard-7Sl2aero.js";import{s as A}from"./server-BUAZv7ZV.js";import{r as f}from"./region-BZBRxF2X.js";import{k as n}from"./index-Z0O8nAcG.js";import{p as c}from"./pipeline-Lgvc2XUS.js";import{d as u}from"./config-DAXaHuse.js";import{c as k,s as v}from"./credential-CwQY-4Ba.js";import{c as h,s as y,t as C}from"./automation-BrmX02Sx.js";import{a as P}from"./alert-C4MMKcUL.js";import{a as w}from"./alert-center-dJk4LGZM.js";import{s as J}from"./site-B-pRndoi.js";import{t as W}from"./trace-L8uY5gM3.js";import{d as q}from"./grafana-DTc3taUi.js";import{p as F,z as G}from"./datasource-DuIT0c1H.js";import{m as I,p as K,s as M,z as N}from"./metrics-Dj4l07HZ.js";import{a as Q}from"./agent-g0Vk8FYK.js";import{c as T}from"./account-Dzyhyahe.js";import{p as V}from"./platform-g_u95ryi.js";import{b as Y}from"./billing-9Cbmzl6K.js";import{a as _}from"./audit-BiL35K5G.js";import{l as rr,s as pr,t as or}from"./terminal-BchqP-zB.js";import{b as sr,a as er}from"./approval-DmGRfKd6.js";import{a as tr}from"./ai-BMSiZ3PN.js";import"./vendor-codemirror-C7mXSpXt.js";import"./vendor-icons-Aso0-eeY.js";export{Q as agentApi,tr as aiApi,P as alertApi,w as alertCenterApi,sr as approvalApi,er as approvalWorkflowApi,_ as auditApi,Y as billingApi,T as cloudApi,k as credentialApi,h as cronJobApi,q as dashboardApi,t as dashboardStatsApi,u as deployApi,n as kubernetesApi,s as ldapApi,rr as loginLogApi,I as metricsApi,c as pipelineApi,V as platformApi,F as promDatasourceApi,K as prometheusProxyApi,f as regionApi,y as scriptApi,A as serverApi,v as serverCredentialApi,pr as sessionCommandApi,J as siteApi,M as snmpApi,C as taskExecutionApi,or as terminalSessionApi,W as traceApi,e as userApi,G as zabbixDatasourceApi,N as zabbixProxyApi}; diff --git a/backend/static/assets/index-Z0O8nAcG.js b/backend/static/assets/index-Z0O8nAcG.js deleted file mode 100644 index 1ef84f2..0000000 --- a/backend/static/assets/index-Z0O8nAcG.js +++ /dev/null @@ -1,2 +0,0 @@ -import{h as n,af as u,ag as l,ah as i}from"./index-LZWfu62c.js";const m={getClusters:async()=>n.get("/kubernetes-clusters"),getClusterDetail:async e=>n.get(`/kubernetes-clusters/${e}/detail`),createCluster:async e=>n.post("/kubernetes-clusters",e),updateCluster:async(e,s)=>n.put(`/kubernetes-clusters/${e}`,s),deleteCluster:async e=>n.delete(`/kubernetes-clusters/${e}`),getPods:async e=>n.get(`/kubernetes-clusters/${e}/pods`),getDeployments:async e=>n.get(`/kubernetes-clusters/${e}/deployments`),getServices:async e=>n.get(`/kubernetes-clusters/${e}/services`),getIngresses:async e=>n.get(`/kubernetes-clusters/${e}/ingresses`),syncCluster:async e=>n.post(`/kubernetes-clusters/${e}/sync`),exportAllResources:async e=>n.download(`/kubernetes/${e}/export`,`cluster-${e}-resources.tar.gz`),getTopology:async e=>n.get(`/kubernetes-clusters/${e}/topology`),saveTopology:async(e,s)=>n.put(`/kubernetes-clusters/${e}/topology`,{layout_data:s}),getMultiClusterComparison:async()=>n.get("/kubernetes/compare")},g={getNodes:async e=>n.get(`/kubernetes-clusters/${e}/nodes`),getClusterNodes:async e=>n.get(`/kubernetes/${e}/nodes`),getNodeDetail:async(e,s)=>n.get(`/kubernetes/${e}/nodes/${encodeURIComponent(s)}`)};function y(e,s){if(s.length===0)return;const t=Object.keys(s[0]),a=[t.join(","),...s.map(o=>t.map(p=>JSON.stringify(o[p]??"")).join(","))].join(` -`),r=new Blob(["\uFEFF"+a],{type:"text/csv;charset=utf-8;"}),c=document.createElement("a");c.href=URL.createObjectURL(r),c.download=e,c.click(),URL.revokeObjectURL(c.href)}function b(e,s){const t=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),a=document.createElement("a");a.href=URL.createObjectURL(t),a.download=e,a.click(),URL.revokeObjectURL(a.href)}function d(e,s,t,a={}){const r=new URLSearchParams;return r.set("stream","true"),a.container&&r.set("container",a.container),a.tailLines&&a.tailLines>0&&r.set("tailLines",String(a.tailLines)),a.previous&&r.set("previous","true"),a.sinceTime&&r.set("sinceTime",a.sinceTime),l(`/kubernetes/${e}/namespace/${s}/pods/${t}/logs`,r)}function k(e,s,t,a,r){const c=new URLSearchParams;a&&c.set("container",a),r&&c.set("command",r);const o=u();o&&c.set("token",o);const p=c.toString();return`${i()}/ws/kubernetes-exec/${e}/namespaces/${s}/pods/${t}${p?`?${p}`:""}`}function $(e,s,t,a,r){const c=new URLSearchParams({path:a});r&&c.set("container",r);const o=u();return o&&c.set("token",o),l(`/kubernetes/${e}/namespace/${s}/pods/${t}/files/download`,c)}async function f(e,s,t,a,r){const c=$(e,s,t,a,r),o=await fetch(c);if(!o.ok)throw new Error(`HTTP ${o.status}`);return o.text()}async function S(e,s,t,a,r,c){const o=new FormData;return o.append("file",r),o.append("path",a),c&&o.append("container",c),n.upload(`/kubernetes/${e}/namespace/${s}/pods/${t}/files/upload`,o)}const h={getPodLogs:async(e,s,t,a=200,r)=>{const c=new URLSearchParams({tail:String(a)});return r&&c.set("container",r),n.get(`/kubernetes/${e}/namespace/${s}/pods/${t}/logs?${c}`)},getPodLogsEnhanced:async(e,s,t,a={})=>{const r=new URLSearchParams;a.container&&r.set("container",a.container),a.tailLines&&a.tailLines>0&&r.set("tailLines",String(a.tailLines)),a.previous&&r.set("previous","true"),a.sinceTime&&r.set("sinceTime",a.sinceTime);const c=r.toString();return n.get(`/kubernetes/${e}/namespace/${s}/pods/${t}/logs${c?`?${c}`:""}`)},buildPodLogsStreamUrl:d,execPod:async(e,s,t,a,r)=>n.post(`/kubernetes/${e}/namespace/${s}/pods/${t}/exec`,{command:a,container:r}),buildPodExecWsUrl:k,listPodFiles:async(e,s,t,a,r)=>n.post(`/kubernetes/${e}/namespace/${s}/pods/${t}/files/list`,{path:a,container:r}),buildPodFileDownloadUrl:$,readPodFileText:f,uploadPodFile:S,getPodMetrics:async(e,s)=>{const t=s?{namespace:s}:void 0;return n.get(`/kubernetes/${e}/metrics/pods`,t)},getAllPods:async e=>n.get(`/kubernetes/${e}/pods`),getNamespacePods:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/pods`)},v={scaleDeployment:async(e,s,t,a)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/scale`,{replicas:a}),restartDeployment:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/restart`),pauseDeployment:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/pause`),resumeDeployment:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/resume`),updateDeploymentImage:async(e,s,t,a,r)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/update-image`,{image:a,container_name:r}),getHPAs:async(e,s)=>s?n.get(`/kubernetes/${e}/namespace/${s}/hpas`):n.get(`/kubernetes/${e}/hpas`),createHPA:async(e,s)=>n.post(`/kubernetes/${e}/namespace/${s.namespace}/hpas`,s),deleteHPA:async(e,s,t)=>n.delete(`/kubernetes/${e}/namespace/${s}/hpas/${t}`),getCronJobs:async(e,s)=>s?n.get(`/kubernetes/${e}/namespace/${s}/cronjobs`):n.get(`/kubernetes-clusters/${e}/cronjobs`),createCronJob:async(e,s)=>n.post(`/kubernetes/${e}/namespace/${s.namespace}/cronjobs`,s),suspendCronJob:async(e,s,t,a)=>n.post(`/kubernetes/${e}/namespace/${s}/cronjobs/${t}/suspend`,{suspend:a}),triggerCronJob:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/cronjobs/${t}/trigger`),deleteCronJob:async(e,s,t)=>n.delete(`/kubernetes/${e}/namespace/${s}/cronjobs/${t}`),getNamespaceDeployments:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/deployments`),getAllDeployments:async e=>n.get(`/kubernetes/${e}/deployments`),getStatefulSets:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/statefulsets`),getDaemonSets:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/daemonsets`),getStatefulSetDetail:async(e,s,t)=>n.get(`/kubernetes/${e}/namespace/${s}/statefulsets/${t}`),getDaemonSetDetail:async(e,s,t)=>n.get(`/kubernetes/${e}/namespace/${s}/daemonsets/${t}`),scaleStatefulSet:async(e,s,t,a)=>n.post(`/kubernetes/${e}/namespace/${s}/statefulsets/${t}/scale`,{replicas:a}),restartStatefulSet:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/statefulsets/${t}/restart`,{}),restartDaemonSet:async(e,s,t)=>n.post(`/kubernetes/${e}/namespace/${s}/daemonsets/${t}/restart`,{}),getReplicaSets:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/replicasets`),getDeploymentRevisions:async(e,s,t)=>n.get(`/kubernetes/${e}/namespace/${s}/deployments/${t}/revisions`),rollbackDeployment:async(e,s,t,a)=>n.post(`/kubernetes/${e}/namespace/${s}/deployments/${t}/rollback`,{revision:a}),getDeployment:async(e,s,t)=>{try{return await n.get(`/kubernetes/${e}/namespace/${s}/deployments/${t}`)}catch{const a=await n.get(`/kubernetes/${e}/namespace/${s}/deployments`);return(Array.isArray(a)?a:a?.list||a?.items||a?.data||[]).find(c=>c.name===t)||null}}},L={getNamespaces:async e=>n.get(`/kubernetes/${e}/namespaces`),getNamespacesDetail:async e=>n.get(`/kubernetes/${e}/namespaces/detail`),getNamespaceDetail:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/detail`),createNamespace:async(e,s,t)=>n.post(`/kubernetes/${e}/namespaces`,{name:s,labels:t||{}}),deleteNamespace:async(e,s)=>n.delete(`/kubernetes/${e}/namespaces/${s}`)},w={getNamespaceServices:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/services`),getNamespaceIngresses:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/ingresses`),getNamespaceConfigMaps:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/configmaps`),getNamespaceSecrets:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/secrets`),getPVCs:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/pvcs`),deletePVC:async(e,s,t)=>n.delete(`/kubernetes/${e}/namespace/${s}/pvcs/${t}`),getServiceAccounts:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/serviceaccounts`),getRoles:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/roles`),getRoleBindings:async(e,s)=>n.get(`/kubernetes/${e}/namespace/${s}/rolebindings`),getResourceYaml:async(e,s,t,a)=>n.getRaw(`/kubernetes/${e}/namespace/${s}/${t}/${a}/yaml`),updateResourceYaml:async(e,s,t,a,r)=>n.putRaw(`/kubernetes/${e}/namespace/${s}/${t}/${a}/yaml`,r,"application/yaml"),deleteResourceYaml:async(e,s,t,a)=>n.delete(`/kubernetes/${e}/namespace/${s}/${t}/${a}/yaml`),getEvents:async(e,s,t)=>{const a={};return s&&(a.namespace=s),t&&(a.type=t),n.get(`/kubernetes/${e}/events`,a)},getEventsSummary:async(e,s,t)=>{const a={};return s&&(a.namespace=s),t&&(a.hours=t),n.get(`/kubernetes/${e}/events/summary`,a)},getCapacity:async(e,s)=>{const t=s?{namespace:s}:void 0;return n.get(`/kubernetes/${e}/capacity`,t)},applyYAML:async(e,s)=>n.post(`/kubernetes/${e}/yaml/apply`,{yaml:s})},D={...m,...g,...h,...v,...L,...w,exportAsCSV:y,exportAsJSON:b};export{D as k}; diff --git a/backend/static/assets/input-BdDauX3U.js b/backend/static/assets/input-Bnlm--la.js similarity index 85% rename from backend/static/assets/input-BdDauX3U.js rename to backend/static/assets/input-Bnlm--la.js index c7c7c22..3a41462 100644 --- a/backend/static/assets/input-BdDauX3U.js +++ b/backend/static/assets/input-Bnlm--la.js @@ -1 +1 @@ -import{j as t}from"./vendor-codemirror-C7mXSpXt.js";import{m as n}from"./index-LZWfu62c.js";function a({className:e,type:i,...r}){return t.jsx("input",{"code-path":"src/components/ui/input.tsx:7:5",type:i,"data-slot":"input",className:n("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}export{a as I}; +import{j as t}from"./vendor-codemirror-B1SGo4xl.js";import{m as n}from"./index-Bp-M7P_8.js";function a({className:e,type:i,...r}){return t.jsx("input",{"code-path":"src/components/ui/input.tsx:7:5",type:i,"data-slot":"input",className:n("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}export{a as I}; diff --git a/backend/static/assets/k8s-yaml-utils-4KZB_Bq_.js b/backend/static/assets/k8s-yaml-utils-4KZB_Bq_.js new file mode 100644 index 0000000..a5dce0f --- /dev/null +++ b/backend/static/assets/k8s-yaml-utils-4KZB_Bq_.js @@ -0,0 +1,8 @@ +function F(r){if(!r)return"";const n=r.replace(/\r\n/g,` +`).split(` +`),o=[];let e=0;const w=new Set(["uid","resourceVersion","creationTimestamp","generation","selfLink","clusterName","generateName","deletionTimestamp"]),L=new Set(["managedFields","ownerReferences","finalizers"]),h={dnsPolicy:["ClusterFirst"],restartPolicy:["Always"],schedulerName:["default-scheduler"],terminationGracePeriodSeconds:["30"],serviceAccountName:["default"],enableServiceLinks:["true"],automountServiceAccountToken:["true"],progressDeadlineSeconds:["600"],revisionHistoryLimit:["10"],sessionAffinity:["None"],externalTrafficPolicy:["Cluster"],internalTrafficPolicy:["Cluster"],ipFamilyPolicy:["SingleStack"],allocateLoadBalancerNodePorts:["true"],preemptionPolicy:["PreemptLowerPriority"],priority:["0"]},C={imagePullPolicy:["Always","IfNotPresent"],terminationMessagePath:["/dev/termination-log"],terminationMessagePolicy:["File"],stdin:["false"],tty:["false"],stdinOnce:["false"]},_=new Set(["clusterIP","clusterIPs","ipFamilies","healthCheckNodePort"]),D=new Set(["kubectl.kubernetes.io/last-applied-configuration","kubectl.kubernetes.io/change-cause","deployment.kubernetes.io/revision","deployment.kubernetes.io/desired-replicas","deployment.kubernetes.io/max-replicas","kubectl.kubernetes.io/restartedAt","control-plane.alpha.kubernetes.io/leader","autoscaling.alpha.kubernetes.io/conditions","kubernetes.io/config.hash","pv.kubernetes.io/bind-completed","pv.kubernetes.io/bound-by-controller"]),W=new Set(["pod-template-hash","controller-revision-hash"]),R=["kube-api-access-","default-token-","kube-"];let A=!1,p=!1,I=!1,T=!1,g=!1,S=!1,E=!1,N=!1,M=0;function m(s){return s.length-s.trimStart().length}function P(s){const l=s.trimStart().match(/^([a-zA-Z_][a-zA-Z0-9_./-]*)\s*:/);return l?l[1]:null}function b(s){const l=s.trim().split(":").slice(1).join(":").trim();return l!==""&&!/^[>|]/.test(l)}function d(s){for(e++;el.startsWith(i)):!1}for(;e=2&&i<=4){const a=P(s);if(a&&W.has(a)){e++;continue}}if(i===2&&t&&w.has(t)){b(s)?e++:d(2);continue}if(i===2&&t&&L.has(t)){for(e++;e2||f===2&&u.startsWith("-")){e++;continue}break}continue}if(p&&i>2&&t&&D.has(t)){if(b(s))e++;else{const a=l.split(":").slice(1).join(":").trim();/^[>|]/.test(a)?d(i):e++}continue}}if(I){if(i===2&&t==="template"){o.push(s),e++;continue}if(i===2&&t){if(_.has(t)){b(s)?e++:d(i);continue}if(h[t]){const c=l.split(":").slice(1).join(":").trim();if(h[t].includes(c)){e++;continue}}}if(i===2&&t==="nodeName"){e++;continue}if(i===2&&t==="strategy"){const c=[];let a=e;for(;ae&&m(k)<=i)break;c.push(k),a++}const u=c.join(` +`);if(u.includes("type: RollingUpdate")&&(u.includes("maxUnavailable: 25%")||u.includes("maxUnavailable: 0"))&&(u.includes("maxSurge: 25%")||u.includes("maxSurge: 1"))){e=a;continue}}if(i===2&&t==="spec"){T=!0,M=i,o.push(s),e++;continue}}if(T&&i>M){if(t==="containers"){g=!0,S=!1,o.push(s),e++;continue}if(t==="initContainers"){S=!0,g=!1,o.push(s),e++;continue}if(t==="volumes"){N=!0,o.push(s),e++;continue}if(t&&h[t]){const c=l.split(":").slice(1).join(":").trim();if(h[t].includes(c)){e++;continue}}if(t==="nodeName"){e++;continue}if(t==="serviceAccount"&&l.endsWith(":")){b(s)?e++:d(i);continue}}if((g||S)&&i>=6){if(t&&C[t]){const c=l.split(":").slice(1).join(":").trim();if(C[t].includes(c)){e++;continue}}if(t==="volumeMounts"&&(E=!0),E&&l.startsWith("- name:")){let c=[s],a=e+1,u=!1;for(;a=4&&l.startsWith("- name:")&&$(l)){const c=i;for(e++;e0&&o[o.length-1].trim()===""){e++;continue}o.push(s),e++}return o.join(` +`).replace(/\n{3,}/g,` + +`).trimEnd()+` +`}function x(r){return r.includes("mountPath:")&&(r.includes("/var/run/secrets/kubernetes.io")||r.includes("/var/run/secrets/sa"))}const y={green:"#10b981",orange:"#f59e0b",red:"#ef4444",blue:"#326CE5"};function O(r){if(!r)return"#64748b";const n=r.toLowerCase();return["running","available","ready","active","completed","succeeded"].includes(n)?y.green:["pending","updating","progressing","containercreating"].includes(n)?y.orange:["failed","error","crashloopbackoff","imagepullbackoff","errimageneverpull"].includes(n)?y.red:y.blue}function K(r){if(!r)return"-";const n=new Date(r);if(isNaN(n.getTime()))return r;const o=e=>String(e).padStart(2,"0");return`${n.getFullYear()}-${o(n.getMonth()+1)}-${o(n.getDate())} ${o(n.getHours())}:${o(n.getMinutes())}:${o(n.getSeconds())}`}function U(r,n){if(!r||!n)return null;const o=new Date(r).getTime(),e=new Date(n).getTime();return isNaN(o)||isNaN(e)||e{const t=c(`Primitive.${e}`),r=i.forwardRef((l,n)=>{const{asChild:d,...u}=l,p=d?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(p,{...u,ref:n})});return r.displayName=`Primitive.${e}`,{...a,[e]:r}},{}),x="Label",s=i.forwardRef((a,e)=>o.jsx(b.label,{...a,ref:e,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(a.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName=x;var v=s;function y({className:a,...e}){return o.jsx(v,{"code-path":"src/components/ui/label.tsx:13:5","data-slot":"label",className:m("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...e})}export{y as L}; +import{r as i,j as o}from"./vendor-codemirror-B1SGo4xl.js";import{a7 as c,m}from"./index-Bp-M7P_8.js";var f=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],b=f.reduce((a,e)=>{const t=c(`Primitive.${e}`),r=i.forwardRef((l,n)=>{const{asChild:d,...u}=l,p=d?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(p,{...u,ref:n})});return r.displayName=`Primitive.${e}`,{...a,[e]:r}},{}),x="Label",s=i.forwardRef((a,e)=>o.jsx(b.label,{...a,ref:e,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(a.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));s.displayName=x;var v=s;function y({className:a,...e}){return o.jsx(v,{"code-path":"src/components/ui/label.tsx:13:5","data-slot":"label",className:m("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...e})}export{y as L}; diff --git a/backend/static/assets/metrics-Dj4l07HZ.js b/backend/static/assets/metrics-D_WSC7FH.js similarity index 88% rename from backend/static/assets/metrics-Dj4l07HZ.js rename to backend/static/assets/metrics-D_WSC7FH.js index 13c7933..9060d3d 100644 --- a/backend/static/assets/metrics-Dj4l07HZ.js +++ b/backend/static/assets/metrics-D_WSC7FH.js @@ -1 +1 @@ -import{h as t}from"./index-LZWfu62c.js";const p={getTargets:e=>t.get("/metrics/targets",e),getNames:()=>t.get("/metrics/names"),query:e=>t.get("/metrics/query",e)},r={getStats:()=>t.get("/snmp/stats"),getDevices:()=>t.get("/snmp/devices"),createDevice:e=>t.post("/snmp/devices",e),deleteDevice:e=>t.delete(`/snmp/devices/${e}`)},a={connect:e=>t.post("/prometheus/connect",{url:e}),dashboard:(e,s)=>t.post("/prometheus/dashboard",{url:e,type:s})},n={connect:(e,s,c)=>t.post("/zabbix/connect",{url:e,username:s,password:c})};export{p as m,a as p,r as s,n as z}; +import{h as t}from"./index-Bp-M7P_8.js";const p={getTargets:e=>t.get("/metrics/targets",e),getNames:()=>t.get("/metrics/names"),query:e=>t.get("/metrics/query",e)},r={getStats:()=>t.get("/snmp/stats"),getDevices:()=>t.get("/snmp/devices"),createDevice:e=>t.post("/snmp/devices",e),deleteDevice:e=>t.delete(`/snmp/devices/${e}`)},a={connect:e=>t.post("/prometheus/connect",{url:e}),dashboard:(e,s)=>t.post("/prometheus/dashboard",{url:e,type:s})},n={connect:(e,s,c)=>t.post("/zabbix/connect",{url:e,username:s,password:c})};export{p as m,a as p,r as s,n as z}; diff --git a/backend/static/assets/pipeline-Lgvc2XUS.js b/backend/static/assets/pipeline-BGteNHr0.js similarity index 95% rename from backend/static/assets/pipeline-Lgvc2XUS.js rename to backend/static/assets/pipeline-BGteNHr0.js index fb0560d..8325f0a 100644 --- a/backend/static/assets/pipeline-Lgvc2XUS.js +++ b/backend/static/assets/pipeline-BGteNHr0.js @@ -1 +1 @@ -import{h as s}from"./index-LZWfu62c.js";const i={getPipelines:async e=>s.get("/pipelines",e),getPipelineDetail:async e=>s.get(`/pipelines/${e}`),createPipeline:async e=>s.post("/pipelines",e),updatePipeline:async(e,p)=>s.put(`/pipelines/${e}`,p),deletePipeline:async e=>s.delete(`/pipelines/${e}`),triggerPipeline:async e=>s.post(`/pipelines/${e}/trigger`),getRuns:async e=>s.get(`/pipelines/${e}/runs`),stopRun:async(e,p)=>s.post(`/pipelines/${e}/runs/${p}/stop`),getRunLog:async(e,p)=>s.get(`/pipelines/${e}/runs/${p}/log`),getMembers:async e=>s.get(`/pipelines/${e}/members`),addMember:async(e,p)=>s.post(`/pipelines/${e}/members`,p),removeMember:async(e,p)=>s.delete(`/pipelines/${e}/members/${p}`),assignGroup:async(e,p)=>s.post(`/pipelines/${e}/groups`,p),getByCode:e=>s.get(`/pipelines/${e}`),getRunsByCode:(e,p=50)=>s.get(`/pipelines/${e}/runs`,{page_size:p}),triggerByCode:e=>s.post(`/pipelines/${e}/trigger`,{}),stopRunByCode:(e,p)=>s.post(`/pipelines/${e}/runs/${p}/stop`,{}),batchDeleteRuns:(e,p)=>s.post(`/pipelines/${e}/runs/batch-delete`,{ids:p}),getRunLogStream:e=>s.get(`/pipelines/runs/${e}/log-stream`),getQueue:e=>s.get(`/pipelines/${e}/queue`),removeFromQueue:(e,p)=>s.delete(`/pipelines/${e}/queue/${p}`),getWorkspace:e=>s.get(`/pipelines/runs/${e}/workspace`),listRunFiles:(e,p)=>s.get(`/pipelines/runs/${e}/files`,p?{path:p}:void 0)};export{i as p}; +import{h as s}from"./index-Bp-M7P_8.js";const i={getPipelines:async e=>s.get("/pipelines",e),getPipelineDetail:async e=>s.get(`/pipelines/${e}`),createPipeline:async e=>s.post("/pipelines",e),updatePipeline:async(e,p)=>s.put(`/pipelines/${e}`,p),deletePipeline:async e=>s.delete(`/pipelines/${e}`),triggerPipeline:async e=>s.post(`/pipelines/${e}/trigger`),getRuns:async e=>s.get(`/pipelines/${e}/runs`),stopRun:async(e,p)=>s.post(`/pipelines/${e}/runs/${p}/stop`),getRunLog:async(e,p)=>s.get(`/pipelines/${e}/runs/${p}/log`),getMembers:async e=>s.get(`/pipelines/${e}/members`),addMember:async(e,p)=>s.post(`/pipelines/${e}/members`,p),removeMember:async(e,p)=>s.delete(`/pipelines/${e}/members/${p}`),assignGroup:async(e,p)=>s.post(`/pipelines/${e}/groups`,p),getByCode:e=>s.get(`/pipelines/${e}`),getRunsByCode:(e,p=50)=>s.get(`/pipelines/${e}/runs`,{page_size:p}),triggerByCode:e=>s.post(`/pipelines/${e}/trigger`,{}),stopRunByCode:(e,p)=>s.post(`/pipelines/${e}/runs/${p}/stop`,{}),batchDeleteRuns:(e,p)=>s.post(`/pipelines/${e}/runs/batch-delete`,{ids:p}),getRunLogStream:e=>s.get(`/pipelines/runs/${e}/log-stream`),getQueue:e=>s.get(`/pipelines/${e}/queue`),removeFromQueue:(e,p)=>s.delete(`/pipelines/${e}/queue/${p}`),getWorkspace:e=>s.get(`/pipelines/runs/${e}/workspace`),listRunFiles:(e,p)=>s.get(`/pipelines/runs/${e}/files`,p?{path:p}:void 0)};export{i as p}; diff --git a/backend/static/assets/platform-g_u95ryi.js b/backend/static/assets/platform-lu-CBYjL.js similarity index 71% rename from backend/static/assets/platform-g_u95ryi.js rename to backend/static/assets/platform-lu-CBYjL.js index f7b4b63..9cf3712 100644 --- a/backend/static/assets/platform-g_u95ryi.js +++ b/backend/static/assets/platform-lu-CBYjL.js @@ -1 +1 @@ -import{h as r}from"./index-LZWfu62c.js";const p={list:async()=>r.get("/platforms"),create:async t=>r.post("/platforms",t),update:async(t,e)=>r.put(`/platforms/${t}`,e),delete:async t=>r.delete(`/platforms/${t}`)};export{p}; +import{h as r}from"./index-Bp-M7P_8.js";const p={list:async()=>r.get("/platforms"),create:async t=>r.post("/platforms",t),update:async(t,e)=>r.put(`/platforms/${t}`,e),delete:async t=>r.delete(`/platforms/${t}`)};export{p}; diff --git a/backend/static/assets/region-BZBRxF2X.js b/backend/static/assets/region-D3lxTXmh.js similarity index 77% rename from backend/static/assets/region-BZBRxF2X.js rename to backend/static/assets/region-D3lxTXmh.js index 2d60e72..0f23d47 100644 --- a/backend/static/assets/region-BZBRxF2X.js +++ b/backend/static/assets/region-D3lxTXmh.js @@ -1 +1 @@ -import{h as t}from"./index-LZWfu62c.js";const s={list:async()=>t.get("/regions"),create:async e=>t.post("/regions",e),update:async(e,r)=>t.put(`/regions/${e}`,r),delete:async e=>t.delete(`/regions/${e}`),batchDelete:async e=>t.delete("/regions/batch-delete",{ids:e})};export{s as r}; +import{h as t}from"./index-Bp-M7P_8.js";const s={list:async()=>t.get("/regions"),create:async e=>t.post("/regions",e),update:async(e,r)=>t.put(`/regions/${e}`,r),delete:async e=>t.delete(`/regions/${e}`),batchDelete:async e=>t.delete("/regions/batch-delete",{ids:e})};export{s as r}; diff --git a/backend/static/assets/select-4xU_9B3_.js b/backend/static/assets/select-DbhcBWnH.js similarity index 98% rename from backend/static/assets/select-4xU_9B3_.js rename to backend/static/assets/select-DbhcBWnH.js index f794ded..c65c9fb 100644 --- a/backend/static/assets/select-4xU_9B3_.js +++ b/backend/static/assets/select-DbhcBWnH.js @@ -1 +1 @@ -import{r as n,j as l}from"./vendor-codemirror-C7mXSpXt.js";import{O as ot,Q as Ee,J as nt,v as be,T as rt,r as st,K as Ie,U as lt,w as L,V as at,s as j,x as P,W as $,X as ct,Y as Re,Z as it,_ as dt,$ as ut,a0 as pt,a1 as ft,a2 as mt,a3 as ht,a4 as gt,a5 as Pe,a6 as vt,m as te}from"./index-LZWfu62c.js";import{u as xt}from"./index-CYARH0Cq.js";import{Q as _e,w as St,O as wt}from"./vendor-icons-Aso0-eeY.js";function yt(t){const o=Ct(t),e=n.forwardRef((s,r)=>{const{children:d,...a}=s,c=n.Children.toArray(d),i=c.find(Tt);if(i){const p=i.props.children,g=c.map(x=>x===i?n.Children.count(p)>1?n.Children.only(null):n.isValidElement(p)?p.props.children:null:x);return l.jsx(o,{...a,ref:r,children:n.isValidElement(p)?n.cloneElement(p,void 0,g):null})}return l.jsx(o,{...a,ref:r,children:d})});return e.displayName=`${t}.Slot`,e}function Ct(t){const o=n.forwardRef((e,s)=>{const{children:r,...d}=e;if(n.isValidElement(r)){const a=Pt(r),c=bt(d,r.props);return r.type!==n.Fragment&&(c.ref=s?ot(s,a):a),n.cloneElement(r,c)}return n.Children.count(r)>1?n.Children.only(null):null});return o.displayName=`${t}.SlotClone`,o}var It=Symbol("radix.slottable");function Tt(t){return n.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===It}function bt(t,o){const e={...o};for(const s in o){const r=t[s],d=o[s];/^on[A-Z]/.test(s)?r&&d?e[s]=(...c)=>{const i=d(...c);return r(...c),i}:r&&(e[s]=r):s==="style"?e[s]={...r,...d}:s==="className"&&(e[s]=[r,d].filter(Boolean).join(" "))}return{...t,...e}}function Pt(t){let o=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning;return e?t.ref:(o=Object.getOwnPropertyDescriptor(t,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning,e?t.props.ref:t.props.ref||t.ref)}var Et=[" ","Enter","ArrowUp","ArrowDown"],Rt=[" ","Enter"],Q="Select",[ie,de,_t]=lt(Q),[oe]=st(Q,[_t,Ee]),ue=Ee(),[Nt,G]=oe(Q),[jt,Mt]=oe(Q),Ne=t=>{const{__scopeSelect:o,children:e,open:s,defaultOpen:r,onOpenChange:d,value:a,defaultValue:c,onValueChange:i,dir:p,name:g,autoComplete:x,disabled:E,required:T,form:C}=t,u=ue(o),[h,S]=n.useState(null),[m,v]=n.useState(null),[F,M]=n.useState(!1),ne=nt(p),[R,A]=be({prop:s,defaultProp:r??!1,onChange:d,caller:Q}),[U,Z]=be({prop:a,defaultProp:c,onChange:i,caller:Q}),k=n.useRef(null),V=h?C||!!h.closest("form"):!0,[z,B]=n.useState(new Set),H=Array.from(z).map(_=>_.props.value).join(";");return l.jsx(rt,{...u,children:l.jsxs(Nt,{required:T,scope:o,trigger:h,onTriggerChange:S,valueNode:m,onValueNodeChange:v,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:Ie(),value:U,onValueChange:Z,open:R,onOpenChange:A,dir:ne,triggerPointerDownPosRef:k,disabled:E,children:[l.jsx(ie.Provider,{scope:o,children:l.jsx(jt,{scope:t.__scopeSelect,onNativeOptionAdd:n.useCallback(_=>{B(D=>new Set(D).add(_))},[]),onNativeOptionRemove:n.useCallback(_=>{B(D=>{const W=new Set(D);return W.delete(_),W})},[]),children:e})}),V?l.jsxs(Qe,{"aria-hidden":!0,required:T,tabIndex:-1,name:g,autoComplete:x,value:U,onChange:_=>Z(_.target.value),disabled:E,form:C,children:[U===void 0?l.jsx("option",{value:""}):null,Array.from(z)]},H):null]})})};Ne.displayName=Q;var je="SelectTrigger",Me=n.forwardRef((t,o)=>{const{__scopeSelect:e,disabled:s=!1,...r}=t,d=ue(e),a=G(je,e),c=a.disabled||s,i=L(o,a.onTriggerChange),p=de(e),g=n.useRef("touch"),[x,E,T]=et(u=>{const h=p().filter(v=>!v.disabled),S=h.find(v=>v.value===a.value),m=tt(h,u,S);m!==void 0&&a.onValueChange(m.value)}),C=u=>{c||(a.onOpenChange(!0),T()),u&&(a.triggerPointerDownPosRef.current={x:Math.round(u.pageX),y:Math.round(u.pageY)})};return l.jsx(at,{asChild:!0,...d,children:l.jsx(j.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Je(a.value)?"":void 0,...r,ref:i,onClick:P(r.onClick,u=>{u.currentTarget.focus(),g.current!=="mouse"&&C(u)}),onPointerDown:P(r.onPointerDown,u=>{g.current=u.pointerType;const h=u.target;h.hasPointerCapture(u.pointerId)&&h.releasePointerCapture(u.pointerId),u.button===0&&u.ctrlKey===!1&&u.pointerType==="mouse"&&(C(u),u.preventDefault())}),onKeyDown:P(r.onKeyDown,u=>{const h=x.current!=="";!(u.ctrlKey||u.altKey||u.metaKey)&&u.key.length===1&&E(u.key),!(h&&u.key===" ")&&Et.includes(u.key)&&(C(),u.preventDefault())})})})});Me.displayName=je;var Oe="SelectValue",Ae=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:s,style:r,children:d,placeholder:a="",...c}=t,i=G(Oe,e),{onValueNodeHasChildrenChange:p}=i,g=d!==void 0,x=L(o,i.onValueNodeChange);return $(()=>{p(g)},[p,g]),l.jsx(j.span,{...c,ref:x,style:{pointerEvents:"none"},children:Je(i.value)?l.jsx(l.Fragment,{children:a}):d})});Ae.displayName=Oe;var Ot="SelectIcon",De=n.forwardRef((t,o)=>{const{__scopeSelect:e,children:s,...r}=t;return l.jsx(j.span,{"aria-hidden":!0,...r,ref:o,children:s||"▼"})});De.displayName=Ot;var At="SelectPortal",Le=t=>l.jsx(ct,{asChild:!0,...t});Le.displayName=At;var J="SelectContent",ke=n.forwardRef((t,o)=>{const e=G(J,t.__scopeSelect),[s,r]=n.useState();if($(()=>{r(new DocumentFragment)},[]),!e.open){const d=s;return d?Re.createPortal(l.jsx(Ve,{scope:t.__scopeSelect,children:l.jsx(ie.Slot,{scope:t.__scopeSelect,children:l.jsx("div",{children:t.children})})}),d):null}return l.jsx(Be,{...t,ref:o})});ke.displayName=J;var O=10,[Ve,Y]=oe(J),Dt="SelectContentImpl",Lt=yt("SelectContent.RemoveScroll"),Be=n.forwardRef((t,o)=>{const{__scopeSelect:e,position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:d,onPointerDownOutside:a,side:c,sideOffset:i,align:p,alignOffset:g,arrowPadding:x,collisionBoundary:E,collisionPadding:T,sticky:C,hideWhenDetached:u,avoidCollisions:h,...S}=t,m=G(J,e),[v,F]=n.useState(null),[M,ne]=n.useState(null),R=L(o,f=>F(f)),[A,U]=n.useState(null),[Z,k]=n.useState(null),V=de(e),[z,B]=n.useState(!1),H=n.useRef(!1);n.useEffect(()=>{if(v)return ut(v)},[v]),pt();const _=n.useCallback(f=>{const[I,...N]=V().map(b=>b.ref.current),[w]=N.slice(-1),y=document.activeElement;for(const b of f)if(b===y||(b?.scrollIntoView({block:"nearest"}),b===I&&M&&(M.scrollTop=0),b===w&&M&&(M.scrollTop=M.scrollHeight),b?.focus(),document.activeElement!==y))return},[V,M]),D=n.useCallback(()=>_([A,v]),[_,A,v]);n.useEffect(()=>{z&&D()},[z,D]);const{onOpenChange:W,triggerPointerDownPosRef:K}=m;n.useEffect(()=>{if(v){let f={x:0,y:0};const I=w=>{f={x:Math.abs(Math.round(w.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(w.pageY)-(K.current?.y??0))}},N=w=>{f.x<=10&&f.y<=10?w.preventDefault():v.contains(w.target)||W(!1),document.removeEventListener("pointermove",I),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",I),document.addEventListener("pointerup",N,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",I),document.removeEventListener("pointerup",N,{capture:!0})}}},[v,W,K]),n.useEffect(()=>{const f=()=>W(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[W]);const[pe,le]=et(f=>{const I=V().filter(y=>!y.disabled),N=I.find(y=>y.ref.current===document.activeElement),w=tt(I,f,N);w&&setTimeout(()=>w.ref.current.focus())}),fe=n.useCallback((f,I,N)=>{const w=!H.current&&!N;(m.value!==void 0&&m.value===I||w)&&(U(f),w&&(H.current=!0))},[m.value]),me=n.useCallback(()=>v?.focus(),[v]),ee=n.useCallback((f,I,N)=>{const w=!H.current&&!N;(m.value!==void 0&&m.value===I||w)&&k(f)},[m.value]),ae=s==="popper"?xe:He,re=ae===xe?{side:c,sideOffset:i,align:p,alignOffset:g,arrowPadding:x,collisionBoundary:E,collisionPadding:T,sticky:C,hideWhenDetached:u,avoidCollisions:h}:{};return l.jsx(Ve,{scope:e,content:v,viewport:M,onViewportChange:ne,itemRefCallback:fe,selectedItem:A,onItemLeave:me,itemTextRefCallback:ee,focusSelectedItem:D,selectedItemText:Z,position:s,isPositioned:z,searchRef:pe,children:l.jsx(ft,{as:Lt,allowPinchZoom:!0,children:l.jsx(mt,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(r,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:l.jsx(ht,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:a,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:l.jsx(ae,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...S,...re,onPlaced:()=>B(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:P(S.onKeyDown,f=>{const I=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!I&&f.key.length===1&&le(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let w=V().filter(y=>!y.disabled).map(y=>y.ref.current);if(["ArrowUp","End"].includes(f.key)&&(w=w.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const y=f.target,b=w.indexOf(y);w=w.slice(b+1)}setTimeout(()=>_(w)),f.preventDefault()}})})})})})})});Be.displayName=Dt;var kt="SelectItemAlignedPosition",He=n.forwardRef((t,o)=>{const{__scopeSelect:e,onPlaced:s,...r}=t,d=G(J,e),a=Y(J,e),[c,i]=n.useState(null),[p,g]=n.useState(null),x=L(o,R=>g(R)),E=de(e),T=n.useRef(!1),C=n.useRef(!0),{viewport:u,selectedItem:h,selectedItemText:S,focusSelectedItem:m}=a,v=n.useCallback(()=>{if(d.trigger&&d.valueNode&&c&&p&&u&&h&&S){const R=d.trigger.getBoundingClientRect(),A=p.getBoundingClientRect(),U=d.valueNode.getBoundingClientRect(),Z=S.getBoundingClientRect();if(d.dir!=="rtl"){const y=Z.left-A.left,b=U.left-y,q=R.left-b,X=R.width+q,he=Math.max(X,A.width),ge=window.innerWidth-O,ve=Pe(b,[O,Math.max(O,ge-he)]);c.style.minWidth=X+"px",c.style.left=ve+"px"}else{const y=A.right-Z.right,b=window.innerWidth-U.right-y,q=window.innerWidth-R.right-b,X=R.width+q,he=Math.max(X,A.width),ge=window.innerWidth-O,ve=Pe(b,[O,Math.max(O,ge-he)]);c.style.minWidth=X+"px",c.style.right=ve+"px"}const k=E(),V=window.innerHeight-O*2,z=u.scrollHeight,B=window.getComputedStyle(p),H=parseInt(B.borderTopWidth,10),_=parseInt(B.paddingTop,10),D=parseInt(B.borderBottomWidth,10),W=parseInt(B.paddingBottom,10),K=H+_+z+W+D,pe=Math.min(h.offsetHeight*5,K),le=window.getComputedStyle(u),fe=parseInt(le.paddingTop,10),me=parseInt(le.paddingBottom,10),ee=R.top+R.height/2-O,ae=V-ee,re=h.offsetHeight/2,f=h.offsetTop+re,I=H+_+f,N=K-I;if(I<=ee){const y=k.length>0&&h===k[k.length-1].ref.current;c.style.bottom="0px";const b=p.clientHeight-u.offsetTop-u.offsetHeight,q=Math.max(ae,re+(y?me:0)+b+D),X=I+q;c.style.height=X+"px"}else{const y=k.length>0&&h===k[0].ref.current;c.style.top="0px";const q=Math.max(ee,H+u.offsetTop+(y?fe:0)+re)+N;c.style.height=q+"px",u.scrollTop=I-ee+u.offsetTop}c.style.margin=`${O}px 0`,c.style.minHeight=pe+"px",c.style.maxHeight=V+"px",s?.(),requestAnimationFrame(()=>T.current=!0)}},[E,d.trigger,d.valueNode,c,p,u,h,S,d.dir,s]);$(()=>v(),[v]);const[F,M]=n.useState();$(()=>{p&&M(window.getComputedStyle(p).zIndex)},[p]);const ne=n.useCallback(R=>{R&&C.current===!0&&(v(),m?.(),C.current=!1)},[v,m]);return l.jsx(Bt,{scope:e,contentWrapper:c,shouldExpandOnScrollRef:T,onScrollButtonChange:ne,children:l.jsx("div",{ref:i,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:l.jsx(j.div,{...r,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});He.displayName=kt;var Vt="SelectPopperPosition",xe=n.forwardRef((t,o)=>{const{__scopeSelect:e,align:s="start",collisionPadding:r=O,...d}=t,a=ue(e);return l.jsx(gt,{...a,...d,ref:o,align:s,collisionPadding:r,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xe.displayName=Vt;var[Bt,Te]=oe(J,{}),Se="SelectViewport",We=n.forwardRef((t,o)=>{const{__scopeSelect:e,nonce:s,...r}=t,d=Y(Se,e),a=Te(Se,e),c=L(o,d.onViewportChange),i=n.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(ie.Slot,{scope:e,children:l.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:P(r.onScroll,p=>{const g=p.currentTarget,{contentWrapper:x,shouldExpandOnScrollRef:E}=a;if(E?.current&&x){const T=Math.abs(i.current-g.scrollTop);if(T>0){const C=window.innerHeight-O*2,u=parseFloat(x.style.minHeight),h=parseFloat(x.style.height),S=Math.max(u,h);if(S0?F:0,x.style.justifyContent="flex-end")}}}i.current=g.scrollTop})})})]})});We.displayName=Se;var Fe="SelectGroup",[Ht,Wt]=oe(Fe),Ft=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=Ie();return l.jsx(Ht,{scope:e,id:r,children:l.jsx(j.div,{role:"group","aria-labelledby":r,...s,ref:o})})});Ft.displayName=Fe;var Ue="SelectLabel",Ut=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=Wt(Ue,e);return l.jsx(j.div,{id:r.id,...s,ref:o})});Ut.displayName=Ue;var ce="SelectItem",[zt,ze]=oe(ce),Ke=n.forwardRef((t,o)=>{const{__scopeSelect:e,value:s,disabled:r=!1,textValue:d,...a}=t,c=G(ce,e),i=Y(ce,e),p=c.value===s,[g,x]=n.useState(d??""),[E,T]=n.useState(!1),C=L(o,m=>i.itemRefCallback?.(m,s,r)),u=Ie(),h=n.useRef("touch"),S=()=>{r||(c.onValueChange(s),c.onOpenChange(!1))};if(s==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(zt,{scope:e,value:s,disabled:r,textId:u,isSelected:p,onItemTextChange:n.useCallback(m=>{x(v=>v||(m?.textContent??"").trim())},[]),children:l.jsx(ie.ItemSlot,{scope:e,value:s,disabled:r,textValue:g,children:l.jsx(j.div,{role:"option","aria-labelledby":u,"data-highlighted":E?"":void 0,"aria-selected":p&&E,"data-state":p?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...a,ref:C,onFocus:P(a.onFocus,()=>T(!0)),onBlur:P(a.onBlur,()=>T(!1)),onClick:P(a.onClick,()=>{h.current!=="mouse"&&S()}),onPointerUp:P(a.onPointerUp,()=>{h.current==="mouse"&&S()}),onPointerDown:P(a.onPointerDown,m=>{h.current=m.pointerType}),onPointerMove:P(a.onPointerMove,m=>{h.current=m.pointerType,r?i.onItemLeave?.():h.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(a.onPointerLeave,m=>{m.currentTarget===document.activeElement&&i.onItemLeave?.()}),onKeyDown:P(a.onKeyDown,m=>{i.searchRef?.current!==""&&m.key===" "||(Rt.includes(m.key)&&S(),m.key===" "&&m.preventDefault())})})})})});Ke.displayName=ce;var se="SelectItemText",$e=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:s,style:r,...d}=t,a=G(se,e),c=Y(se,e),i=ze(se,e),p=Mt(se,e),[g,x]=n.useState(null),E=L(o,S=>x(S),i.onItemTextChange,S=>c.itemTextRefCallback?.(S,i.value,i.disabled)),T=g?.textContent,C=n.useMemo(()=>l.jsx("option",{value:i.value,disabled:i.disabled,children:T},i.value),[i.disabled,i.value,T]),{onNativeOptionAdd:u,onNativeOptionRemove:h}=p;return $(()=>(u(C),()=>h(C)),[u,h,C]),l.jsxs(l.Fragment,{children:[l.jsx(j.span,{id:i.textId,...d,ref:E}),i.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Re.createPortal(d.children,a.valueNode):null]})});$e.displayName=se;var Ge="SelectItemIndicator",Ye=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t;return ze(Ge,e).isSelected?l.jsx(j.span,{"aria-hidden":!0,...s,ref:o}):null});Ye.displayName=Ge;var we="SelectScrollUpButton",Ze=n.forwardRef((t,o)=>{const e=Y(we,t.__scopeSelect),s=Te(we,t.__scopeSelect),[r,d]=n.useState(!1),a=L(o,s.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let c=function(){const p=i.scrollTop>0;d(p)};const i=e.viewport;return c(),i.addEventListener("scroll",c),()=>i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),r?l.jsx(Xe,{...t,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop-i.offsetHeight)}}):null});Ze.displayName=we;var ye="SelectScrollDownButton",qe=n.forwardRef((t,o)=>{const e=Y(ye,t.__scopeSelect),s=Te(ye,t.__scopeSelect),[r,d]=n.useState(!1),a=L(o,s.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let c=function(){const p=i.scrollHeight-i.clientHeight,g=Math.ceil(i.scrollTop)i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),r?l.jsx(Xe,{...t,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop+i.offsetHeight)}}):null});qe.displayName=ye;var Xe=n.forwardRef((t,o)=>{const{__scopeSelect:e,onAutoScroll:s,...r}=t,d=Y("SelectScrollButton",e),a=n.useRef(null),c=de(e),i=n.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return n.useEffect(()=>()=>i(),[i]),$(()=>{c().find(g=>g.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),l.jsx(j.div,{"aria-hidden":!0,...r,ref:o,style:{flexShrink:0,...r.style},onPointerDown:P(r.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(s,50))}),onPointerMove:P(r.onPointerMove,()=>{d.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(s,50))}),onPointerLeave:P(r.onPointerLeave,()=>{i()})})}),Kt="SelectSeparator",$t=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t;return l.jsx(j.div,{"aria-hidden":!0,...s,ref:o})});$t.displayName=Kt;var Ce="SelectArrow",Gt=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=ue(e),d=G(Ce,e),a=Y(Ce,e);return d.open&&a.position==="popper"?l.jsx(vt,{...r,...s,ref:o}):null});Gt.displayName=Ce;var Yt="SelectBubbleInput",Qe=n.forwardRef(({__scopeSelect:t,value:o,...e},s)=>{const r=n.useRef(null),d=L(s,r),a=xt(o);return n.useEffect(()=>{const c=r.current;if(!c)return;const i=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(i,"value").set;if(a!==o&&g){const x=new Event("change",{bubbles:!0});g.call(c,o),c.dispatchEvent(x)}},[a,o]),l.jsx(j.select,{...e,style:{...it,...e.style},ref:d,defaultValue:o})});Qe.displayName=Yt;function Je(t){return t===""||t===void 0}function et(t){const o=dt(t),e=n.useRef(""),s=n.useRef(0),r=n.useCallback(a=>{const c=e.current+a;o(c),(function i(p){e.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>i(""),1e3))})(c)},[o]),d=n.useCallback(()=>{e.current="",window.clearTimeout(s.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(s.current),[]),[e,r,d]}function tt(t,o,e){const r=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,d=e?t.indexOf(e):-1;let a=Zt(t,Math.max(d,0));r.length===1&&(a=a.filter(p=>p!==e));const i=a.find(p=>p.textValue.toLowerCase().startsWith(r.toLowerCase()));return i!==e?i:void 0}function Zt(t,o){return t.map((e,s)=>t[(o+s)%t.length])}var qt=Ne,Xt=Me,Qt=Ae,Jt=De,eo=Le,to=ke,oo=We,no=Ke,ro=$e,so=Ye,lo=Ze,ao=qe;function ho({...t}){return l.jsx(qt,{"code-path":"src/components/ui/select.tsx:10:10","data-slot":"select",...t})}function go({...t}){return l.jsx(Qt,{"code-path":"src/components/ui/select.tsx:22:10","data-slot":"select-value",...t})}function vo({className:t,size:o="default",children:e,...s}){return l.jsxs(Xt,{"code-path":"src/components/ui/select.tsx:34:5","data-slot":"select-trigger","data-size":o,className:te("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s,children:[e,l.jsx(Jt,{"code-path":"src/components/ui/select.tsx:44:7",asChild:!0,children:l.jsx(_e,{"code-path":"src/components/ui/select.tsx:45:9",className:"size-4 opacity-50"})})]})}function xo({className:t,children:o,position:e="item-aligned",align:s="center",...r}){return l.jsx(eo,{"code-path":"src/components/ui/select.tsx:59:5",children:l.jsxs(to,{"code-path":"src/components/ui/select.tsx:60:7","data-slot":"select-content",className:te("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",e==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:e,align:s,...r,children:[l.jsx(co,{"code-path":"src/components/ui/select.tsx:72:9"}),l.jsx(oo,{"code-path":"src/components/ui/select.tsx:73:9",className:te("p-1",e==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:o}),l.jsx(io,{"code-path":"src/components/ui/select.tsx:82:9"})]})})}function So({className:t,children:o,...e}){return l.jsxs(no,{"code-path":"src/components/ui/select.tsx:107:5","data-slot":"select-item",className:te("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...e,children:[l.jsx("span",{"code-path":"src/components/ui/select.tsx:115:7","data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:l.jsx(so,{"code-path":"src/components/ui/select.tsx:119:9",children:l.jsx(St,{"code-path":"src/components/ui/select.tsx:120:11",className:"size-4"})})}),l.jsx(ro,{"code-path":"src/components/ui/select.tsx:123:7",children:o})]})}function co({className:t,...o}){return l.jsx(lo,{"code-path":"src/components/ui/select.tsx:146:5","data-slot":"select-scroll-up-button",className:te("flex cursor-default items-center justify-center py-1",t),...o,children:l.jsx(wt,{"code-path":"src/components/ui/select.tsx:154:7",className:"size-4"})})}function io({className:t,...o}){return l.jsx(ao,{"code-path":"src/components/ui/select.tsx:164:5","data-slot":"select-scroll-down-button",className:te("flex cursor-default items-center justify-center py-1",t),...o,children:l.jsx(_e,{"code-path":"src/components/ui/select.tsx:172:7",className:"size-4"})})}export{ho as S,vo as a,go as b,xo as c,So as d}; +import{r as n,j as l}from"./vendor-codemirror-B1SGo4xl.js";import{O as ot,Q as Ee,J as nt,v as be,T as rt,r as st,K as Ie,U as lt,w as L,V as at,s as j,x as P,W as $,X as ct,Y as Re,Z as it,_ as dt,$ as ut,a0 as pt,a1 as ft,a2 as mt,a3 as ht,a4 as gt,a5 as Pe,a6 as vt,m as te}from"./index-Bp-M7P_8.js";import{u as xt}from"./index-5FEebgvX.js";import{Q as _e,w as St,O as wt}from"./vendor-icons-BWk-DH7F.js";function yt(t){const o=Ct(t),e=n.forwardRef((s,r)=>{const{children:d,...a}=s,c=n.Children.toArray(d),i=c.find(Tt);if(i){const p=i.props.children,g=c.map(x=>x===i?n.Children.count(p)>1?n.Children.only(null):n.isValidElement(p)?p.props.children:null:x);return l.jsx(o,{...a,ref:r,children:n.isValidElement(p)?n.cloneElement(p,void 0,g):null})}return l.jsx(o,{...a,ref:r,children:d})});return e.displayName=`${t}.Slot`,e}function Ct(t){const o=n.forwardRef((e,s)=>{const{children:r,...d}=e;if(n.isValidElement(r)){const a=Pt(r),c=bt(d,r.props);return r.type!==n.Fragment&&(c.ref=s?ot(s,a):a),n.cloneElement(r,c)}return n.Children.count(r)>1?n.Children.only(null):null});return o.displayName=`${t}.SlotClone`,o}var It=Symbol("radix.slottable");function Tt(t){return n.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===It}function bt(t,o){const e={...o};for(const s in o){const r=t[s],d=o[s];/^on[A-Z]/.test(s)?r&&d?e[s]=(...c)=>{const i=d(...c);return r(...c),i}:r&&(e[s]=r):s==="style"?e[s]={...r,...d}:s==="className"&&(e[s]=[r,d].filter(Boolean).join(" "))}return{...t,...e}}function Pt(t){let o=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning;return e?t.ref:(o=Object.getOwnPropertyDescriptor(t,"ref")?.get,e=o&&"isReactWarning"in o&&o.isReactWarning,e?t.props.ref:t.props.ref||t.ref)}var Et=[" ","Enter","ArrowUp","ArrowDown"],Rt=[" ","Enter"],Q="Select",[ie,de,_t]=lt(Q),[oe]=st(Q,[_t,Ee]),ue=Ee(),[Nt,G]=oe(Q),[jt,Mt]=oe(Q),Ne=t=>{const{__scopeSelect:o,children:e,open:s,defaultOpen:r,onOpenChange:d,value:a,defaultValue:c,onValueChange:i,dir:p,name:g,autoComplete:x,disabled:E,required:T,form:C}=t,u=ue(o),[h,S]=n.useState(null),[m,v]=n.useState(null),[F,M]=n.useState(!1),ne=nt(p),[R,A]=be({prop:s,defaultProp:r??!1,onChange:d,caller:Q}),[U,Z]=be({prop:a,defaultProp:c,onChange:i,caller:Q}),k=n.useRef(null),V=h?C||!!h.closest("form"):!0,[z,B]=n.useState(new Set),H=Array.from(z).map(_=>_.props.value).join(";");return l.jsx(rt,{...u,children:l.jsxs(Nt,{required:T,scope:o,trigger:h,onTriggerChange:S,valueNode:m,onValueNodeChange:v,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:Ie(),value:U,onValueChange:Z,open:R,onOpenChange:A,dir:ne,triggerPointerDownPosRef:k,disabled:E,children:[l.jsx(ie.Provider,{scope:o,children:l.jsx(jt,{scope:t.__scopeSelect,onNativeOptionAdd:n.useCallback(_=>{B(D=>new Set(D).add(_))},[]),onNativeOptionRemove:n.useCallback(_=>{B(D=>{const W=new Set(D);return W.delete(_),W})},[]),children:e})}),V?l.jsxs(Qe,{"aria-hidden":!0,required:T,tabIndex:-1,name:g,autoComplete:x,value:U,onChange:_=>Z(_.target.value),disabled:E,form:C,children:[U===void 0?l.jsx("option",{value:""}):null,Array.from(z)]},H):null]})})};Ne.displayName=Q;var je="SelectTrigger",Me=n.forwardRef((t,o)=>{const{__scopeSelect:e,disabled:s=!1,...r}=t,d=ue(e),a=G(je,e),c=a.disabled||s,i=L(o,a.onTriggerChange),p=de(e),g=n.useRef("touch"),[x,E,T]=et(u=>{const h=p().filter(v=>!v.disabled),S=h.find(v=>v.value===a.value),m=tt(h,u,S);m!==void 0&&a.onValueChange(m.value)}),C=u=>{c||(a.onOpenChange(!0),T()),u&&(a.triggerPointerDownPosRef.current={x:Math.round(u.pageX),y:Math.round(u.pageY)})};return l.jsx(at,{asChild:!0,...d,children:l.jsx(j.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Je(a.value)?"":void 0,...r,ref:i,onClick:P(r.onClick,u=>{u.currentTarget.focus(),g.current!=="mouse"&&C(u)}),onPointerDown:P(r.onPointerDown,u=>{g.current=u.pointerType;const h=u.target;h.hasPointerCapture(u.pointerId)&&h.releasePointerCapture(u.pointerId),u.button===0&&u.ctrlKey===!1&&u.pointerType==="mouse"&&(C(u),u.preventDefault())}),onKeyDown:P(r.onKeyDown,u=>{const h=x.current!=="";!(u.ctrlKey||u.altKey||u.metaKey)&&u.key.length===1&&E(u.key),!(h&&u.key===" ")&&Et.includes(u.key)&&(C(),u.preventDefault())})})})});Me.displayName=je;var Oe="SelectValue",Ae=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:s,style:r,children:d,placeholder:a="",...c}=t,i=G(Oe,e),{onValueNodeHasChildrenChange:p}=i,g=d!==void 0,x=L(o,i.onValueNodeChange);return $(()=>{p(g)},[p,g]),l.jsx(j.span,{...c,ref:x,style:{pointerEvents:"none"},children:Je(i.value)?l.jsx(l.Fragment,{children:a}):d})});Ae.displayName=Oe;var Ot="SelectIcon",De=n.forwardRef((t,o)=>{const{__scopeSelect:e,children:s,...r}=t;return l.jsx(j.span,{"aria-hidden":!0,...r,ref:o,children:s||"▼"})});De.displayName=Ot;var At="SelectPortal",Le=t=>l.jsx(ct,{asChild:!0,...t});Le.displayName=At;var J="SelectContent",ke=n.forwardRef((t,o)=>{const e=G(J,t.__scopeSelect),[s,r]=n.useState();if($(()=>{r(new DocumentFragment)},[]),!e.open){const d=s;return d?Re.createPortal(l.jsx(Ve,{scope:t.__scopeSelect,children:l.jsx(ie.Slot,{scope:t.__scopeSelect,children:l.jsx("div",{children:t.children})})}),d):null}return l.jsx(Be,{...t,ref:o})});ke.displayName=J;var O=10,[Ve,Y]=oe(J),Dt="SelectContentImpl",Lt=yt("SelectContent.RemoveScroll"),Be=n.forwardRef((t,o)=>{const{__scopeSelect:e,position:s="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:d,onPointerDownOutside:a,side:c,sideOffset:i,align:p,alignOffset:g,arrowPadding:x,collisionBoundary:E,collisionPadding:T,sticky:C,hideWhenDetached:u,avoidCollisions:h,...S}=t,m=G(J,e),[v,F]=n.useState(null),[M,ne]=n.useState(null),R=L(o,f=>F(f)),[A,U]=n.useState(null),[Z,k]=n.useState(null),V=de(e),[z,B]=n.useState(!1),H=n.useRef(!1);n.useEffect(()=>{if(v)return ut(v)},[v]),pt();const _=n.useCallback(f=>{const[I,...N]=V().map(b=>b.ref.current),[w]=N.slice(-1),y=document.activeElement;for(const b of f)if(b===y||(b?.scrollIntoView({block:"nearest"}),b===I&&M&&(M.scrollTop=0),b===w&&M&&(M.scrollTop=M.scrollHeight),b?.focus(),document.activeElement!==y))return},[V,M]),D=n.useCallback(()=>_([A,v]),[_,A,v]);n.useEffect(()=>{z&&D()},[z,D]);const{onOpenChange:W,triggerPointerDownPosRef:K}=m;n.useEffect(()=>{if(v){let f={x:0,y:0};const I=w=>{f={x:Math.abs(Math.round(w.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(w.pageY)-(K.current?.y??0))}},N=w=>{f.x<=10&&f.y<=10?w.preventDefault():v.contains(w.target)||W(!1),document.removeEventListener("pointermove",I),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",I),document.addEventListener("pointerup",N,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",I),document.removeEventListener("pointerup",N,{capture:!0})}}},[v,W,K]),n.useEffect(()=>{const f=()=>W(!1);return window.addEventListener("blur",f),window.addEventListener("resize",f),()=>{window.removeEventListener("blur",f),window.removeEventListener("resize",f)}},[W]);const[pe,le]=et(f=>{const I=V().filter(y=>!y.disabled),N=I.find(y=>y.ref.current===document.activeElement),w=tt(I,f,N);w&&setTimeout(()=>w.ref.current.focus())}),fe=n.useCallback((f,I,N)=>{const w=!H.current&&!N;(m.value!==void 0&&m.value===I||w)&&(U(f),w&&(H.current=!0))},[m.value]),me=n.useCallback(()=>v?.focus(),[v]),ee=n.useCallback((f,I,N)=>{const w=!H.current&&!N;(m.value!==void 0&&m.value===I||w)&&k(f)},[m.value]),ae=s==="popper"?xe:He,re=ae===xe?{side:c,sideOffset:i,align:p,alignOffset:g,arrowPadding:x,collisionBoundary:E,collisionPadding:T,sticky:C,hideWhenDetached:u,avoidCollisions:h}:{};return l.jsx(Ve,{scope:e,content:v,viewport:M,onViewportChange:ne,itemRefCallback:fe,selectedItem:A,onItemLeave:me,itemTextRefCallback:ee,focusSelectedItem:D,selectedItemText:Z,position:s,isPositioned:z,searchRef:pe,children:l.jsx(ft,{as:Lt,allowPinchZoom:!0,children:l.jsx(mt,{asChild:!0,trapped:m.open,onMountAutoFocus:f=>{f.preventDefault()},onUnmountAutoFocus:P(r,f=>{m.trigger?.focus({preventScroll:!0}),f.preventDefault()}),children:l.jsx(ht,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:a,onFocusOutside:f=>f.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:l.jsx(ae,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:f=>f.preventDefault(),...S,...re,onPlaced:()=>B(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:P(S.onKeyDown,f=>{const I=f.ctrlKey||f.altKey||f.metaKey;if(f.key==="Tab"&&f.preventDefault(),!I&&f.key.length===1&&le(f.key),["ArrowUp","ArrowDown","Home","End"].includes(f.key)){let w=V().filter(y=>!y.disabled).map(y=>y.ref.current);if(["ArrowUp","End"].includes(f.key)&&(w=w.slice().reverse()),["ArrowUp","ArrowDown"].includes(f.key)){const y=f.target,b=w.indexOf(y);w=w.slice(b+1)}setTimeout(()=>_(w)),f.preventDefault()}})})})})})})});Be.displayName=Dt;var kt="SelectItemAlignedPosition",He=n.forwardRef((t,o)=>{const{__scopeSelect:e,onPlaced:s,...r}=t,d=G(J,e),a=Y(J,e),[c,i]=n.useState(null),[p,g]=n.useState(null),x=L(o,R=>g(R)),E=de(e),T=n.useRef(!1),C=n.useRef(!0),{viewport:u,selectedItem:h,selectedItemText:S,focusSelectedItem:m}=a,v=n.useCallback(()=>{if(d.trigger&&d.valueNode&&c&&p&&u&&h&&S){const R=d.trigger.getBoundingClientRect(),A=p.getBoundingClientRect(),U=d.valueNode.getBoundingClientRect(),Z=S.getBoundingClientRect();if(d.dir!=="rtl"){const y=Z.left-A.left,b=U.left-y,q=R.left-b,X=R.width+q,he=Math.max(X,A.width),ge=window.innerWidth-O,ve=Pe(b,[O,Math.max(O,ge-he)]);c.style.minWidth=X+"px",c.style.left=ve+"px"}else{const y=A.right-Z.right,b=window.innerWidth-U.right-y,q=window.innerWidth-R.right-b,X=R.width+q,he=Math.max(X,A.width),ge=window.innerWidth-O,ve=Pe(b,[O,Math.max(O,ge-he)]);c.style.minWidth=X+"px",c.style.right=ve+"px"}const k=E(),V=window.innerHeight-O*2,z=u.scrollHeight,B=window.getComputedStyle(p),H=parseInt(B.borderTopWidth,10),_=parseInt(B.paddingTop,10),D=parseInt(B.borderBottomWidth,10),W=parseInt(B.paddingBottom,10),K=H+_+z+W+D,pe=Math.min(h.offsetHeight*5,K),le=window.getComputedStyle(u),fe=parseInt(le.paddingTop,10),me=parseInt(le.paddingBottom,10),ee=R.top+R.height/2-O,ae=V-ee,re=h.offsetHeight/2,f=h.offsetTop+re,I=H+_+f,N=K-I;if(I<=ee){const y=k.length>0&&h===k[k.length-1].ref.current;c.style.bottom="0px";const b=p.clientHeight-u.offsetTop-u.offsetHeight,q=Math.max(ae,re+(y?me:0)+b+D),X=I+q;c.style.height=X+"px"}else{const y=k.length>0&&h===k[0].ref.current;c.style.top="0px";const q=Math.max(ee,H+u.offsetTop+(y?fe:0)+re)+N;c.style.height=q+"px",u.scrollTop=I-ee+u.offsetTop}c.style.margin=`${O}px 0`,c.style.minHeight=pe+"px",c.style.maxHeight=V+"px",s?.(),requestAnimationFrame(()=>T.current=!0)}},[E,d.trigger,d.valueNode,c,p,u,h,S,d.dir,s]);$(()=>v(),[v]);const[F,M]=n.useState();$(()=>{p&&M(window.getComputedStyle(p).zIndex)},[p]);const ne=n.useCallback(R=>{R&&C.current===!0&&(v(),m?.(),C.current=!1)},[v,m]);return l.jsx(Bt,{scope:e,contentWrapper:c,shouldExpandOnScrollRef:T,onScrollButtonChange:ne,children:l.jsx("div",{ref:i,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:l.jsx(j.div,{...r,ref:x,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});He.displayName=kt;var Vt="SelectPopperPosition",xe=n.forwardRef((t,o)=>{const{__scopeSelect:e,align:s="start",collisionPadding:r=O,...d}=t,a=ue(e);return l.jsx(gt,{...a,...d,ref:o,align:s,collisionPadding:r,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xe.displayName=Vt;var[Bt,Te]=oe(J,{}),Se="SelectViewport",We=n.forwardRef((t,o)=>{const{__scopeSelect:e,nonce:s,...r}=t,d=Y(Se,e),a=Te(Se,e),c=L(o,d.onViewportChange),i=n.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(ie.Slot,{scope:e,children:l.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:P(r.onScroll,p=>{const g=p.currentTarget,{contentWrapper:x,shouldExpandOnScrollRef:E}=a;if(E?.current&&x){const T=Math.abs(i.current-g.scrollTop);if(T>0){const C=window.innerHeight-O*2,u=parseFloat(x.style.minHeight),h=parseFloat(x.style.height),S=Math.max(u,h);if(S0?F:0,x.style.justifyContent="flex-end")}}}i.current=g.scrollTop})})})]})});We.displayName=Se;var Fe="SelectGroup",[Ht,Wt]=oe(Fe),Ft=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=Ie();return l.jsx(Ht,{scope:e,id:r,children:l.jsx(j.div,{role:"group","aria-labelledby":r,...s,ref:o})})});Ft.displayName=Fe;var Ue="SelectLabel",Ut=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=Wt(Ue,e);return l.jsx(j.div,{id:r.id,...s,ref:o})});Ut.displayName=Ue;var ce="SelectItem",[zt,ze]=oe(ce),Ke=n.forwardRef((t,o)=>{const{__scopeSelect:e,value:s,disabled:r=!1,textValue:d,...a}=t,c=G(ce,e),i=Y(ce,e),p=c.value===s,[g,x]=n.useState(d??""),[E,T]=n.useState(!1),C=L(o,m=>i.itemRefCallback?.(m,s,r)),u=Ie(),h=n.useRef("touch"),S=()=>{r||(c.onValueChange(s),c.onOpenChange(!1))};if(s==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(zt,{scope:e,value:s,disabled:r,textId:u,isSelected:p,onItemTextChange:n.useCallback(m=>{x(v=>v||(m?.textContent??"").trim())},[]),children:l.jsx(ie.ItemSlot,{scope:e,value:s,disabled:r,textValue:g,children:l.jsx(j.div,{role:"option","aria-labelledby":u,"data-highlighted":E?"":void 0,"aria-selected":p&&E,"data-state":p?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...a,ref:C,onFocus:P(a.onFocus,()=>T(!0)),onBlur:P(a.onBlur,()=>T(!1)),onClick:P(a.onClick,()=>{h.current!=="mouse"&&S()}),onPointerUp:P(a.onPointerUp,()=>{h.current==="mouse"&&S()}),onPointerDown:P(a.onPointerDown,m=>{h.current=m.pointerType}),onPointerMove:P(a.onPointerMove,m=>{h.current=m.pointerType,r?i.onItemLeave?.():h.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(a.onPointerLeave,m=>{m.currentTarget===document.activeElement&&i.onItemLeave?.()}),onKeyDown:P(a.onKeyDown,m=>{i.searchRef?.current!==""&&m.key===" "||(Rt.includes(m.key)&&S(),m.key===" "&&m.preventDefault())})})})})});Ke.displayName=ce;var se="SelectItemText",$e=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:s,style:r,...d}=t,a=G(se,e),c=Y(se,e),i=ze(se,e),p=Mt(se,e),[g,x]=n.useState(null),E=L(o,S=>x(S),i.onItemTextChange,S=>c.itemTextRefCallback?.(S,i.value,i.disabled)),T=g?.textContent,C=n.useMemo(()=>l.jsx("option",{value:i.value,disabled:i.disabled,children:T},i.value),[i.disabled,i.value,T]),{onNativeOptionAdd:u,onNativeOptionRemove:h}=p;return $(()=>(u(C),()=>h(C)),[u,h,C]),l.jsxs(l.Fragment,{children:[l.jsx(j.span,{id:i.textId,...d,ref:E}),i.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Re.createPortal(d.children,a.valueNode):null]})});$e.displayName=se;var Ge="SelectItemIndicator",Ye=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t;return ze(Ge,e).isSelected?l.jsx(j.span,{"aria-hidden":!0,...s,ref:o}):null});Ye.displayName=Ge;var we="SelectScrollUpButton",Ze=n.forwardRef((t,o)=>{const e=Y(we,t.__scopeSelect),s=Te(we,t.__scopeSelect),[r,d]=n.useState(!1),a=L(o,s.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let c=function(){const p=i.scrollTop>0;d(p)};const i=e.viewport;return c(),i.addEventListener("scroll",c),()=>i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),r?l.jsx(Xe,{...t,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop-i.offsetHeight)}}):null});Ze.displayName=we;var ye="SelectScrollDownButton",qe=n.forwardRef((t,o)=>{const e=Y(ye,t.__scopeSelect),s=Te(ye,t.__scopeSelect),[r,d]=n.useState(!1),a=L(o,s.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let c=function(){const p=i.scrollHeight-i.clientHeight,g=Math.ceil(i.scrollTop)i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),r?l.jsx(Xe,{...t,ref:a,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop+i.offsetHeight)}}):null});qe.displayName=ye;var Xe=n.forwardRef((t,o)=>{const{__scopeSelect:e,onAutoScroll:s,...r}=t,d=Y("SelectScrollButton",e),a=n.useRef(null),c=de(e),i=n.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return n.useEffect(()=>()=>i(),[i]),$(()=>{c().find(g=>g.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),l.jsx(j.div,{"aria-hidden":!0,...r,ref:o,style:{flexShrink:0,...r.style},onPointerDown:P(r.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(s,50))}),onPointerMove:P(r.onPointerMove,()=>{d.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(s,50))}),onPointerLeave:P(r.onPointerLeave,()=>{i()})})}),Kt="SelectSeparator",$t=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t;return l.jsx(j.div,{"aria-hidden":!0,...s,ref:o})});$t.displayName=Kt;var Ce="SelectArrow",Gt=n.forwardRef((t,o)=>{const{__scopeSelect:e,...s}=t,r=ue(e),d=G(Ce,e),a=Y(Ce,e);return d.open&&a.position==="popper"?l.jsx(vt,{...r,...s,ref:o}):null});Gt.displayName=Ce;var Yt="SelectBubbleInput",Qe=n.forwardRef(({__scopeSelect:t,value:o,...e},s)=>{const r=n.useRef(null),d=L(s,r),a=xt(o);return n.useEffect(()=>{const c=r.current;if(!c)return;const i=window.HTMLSelectElement.prototype,g=Object.getOwnPropertyDescriptor(i,"value").set;if(a!==o&&g){const x=new Event("change",{bubbles:!0});g.call(c,o),c.dispatchEvent(x)}},[a,o]),l.jsx(j.select,{...e,style:{...it,...e.style},ref:d,defaultValue:o})});Qe.displayName=Yt;function Je(t){return t===""||t===void 0}function et(t){const o=dt(t),e=n.useRef(""),s=n.useRef(0),r=n.useCallback(a=>{const c=e.current+a;o(c),(function i(p){e.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>i(""),1e3))})(c)},[o]),d=n.useCallback(()=>{e.current="",window.clearTimeout(s.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(s.current),[]),[e,r,d]}function tt(t,o,e){const r=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,d=e?t.indexOf(e):-1;let a=Zt(t,Math.max(d,0));r.length===1&&(a=a.filter(p=>p!==e));const i=a.find(p=>p.textValue.toLowerCase().startsWith(r.toLowerCase()));return i!==e?i:void 0}function Zt(t,o){return t.map((e,s)=>t[(o+s)%t.length])}var qt=Ne,Xt=Me,Qt=Ae,Jt=De,eo=Le,to=ke,oo=We,no=Ke,ro=$e,so=Ye,lo=Ze,ao=qe;function ho({...t}){return l.jsx(qt,{"code-path":"src/components/ui/select.tsx:10:10","data-slot":"select",...t})}function go({...t}){return l.jsx(Qt,{"code-path":"src/components/ui/select.tsx:22:10","data-slot":"select-value",...t})}function vo({className:t,size:o="default",children:e,...s}){return l.jsxs(Xt,{"code-path":"src/components/ui/select.tsx:34:5","data-slot":"select-trigger","data-size":o,className:te("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...s,children:[e,l.jsx(Jt,{"code-path":"src/components/ui/select.tsx:44:7",asChild:!0,children:l.jsx(_e,{"code-path":"src/components/ui/select.tsx:45:9",className:"size-4 opacity-50"})})]})}function xo({className:t,children:o,position:e="item-aligned",align:s="center",...r}){return l.jsx(eo,{"code-path":"src/components/ui/select.tsx:59:5",children:l.jsxs(to,{"code-path":"src/components/ui/select.tsx:60:7","data-slot":"select-content",className:te("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",e==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:e,align:s,...r,children:[l.jsx(co,{"code-path":"src/components/ui/select.tsx:72:9"}),l.jsx(oo,{"code-path":"src/components/ui/select.tsx:73:9",className:te("p-1",e==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:o}),l.jsx(io,{"code-path":"src/components/ui/select.tsx:82:9"})]})})}function So({className:t,children:o,...e}){return l.jsxs(no,{"code-path":"src/components/ui/select.tsx:107:5","data-slot":"select-item",className:te("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...e,children:[l.jsx("span",{"code-path":"src/components/ui/select.tsx:115:7","data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:l.jsx(so,{"code-path":"src/components/ui/select.tsx:119:9",children:l.jsx(St,{"code-path":"src/components/ui/select.tsx:120:11",className:"size-4"})})}),l.jsx(ro,{"code-path":"src/components/ui/select.tsx:123:7",children:o})]})}function co({className:t,...o}){return l.jsx(lo,{"code-path":"src/components/ui/select.tsx:146:5","data-slot":"select-scroll-up-button",className:te("flex cursor-default items-center justify-center py-1",t),...o,children:l.jsx(wt,{"code-path":"src/components/ui/select.tsx:154:7",className:"size-4"})})}function io({className:t,...o}){return l.jsx(ao,{"code-path":"src/components/ui/select.tsx:164:5","data-slot":"select-scroll-down-button",className:te("flex cursor-default items-center justify-center py-1",t),...o,children:l.jsx(_e,{"code-path":"src/components/ui/select.tsx:172:7",className:"size-4"})})}export{ho as S,vo as a,go as b,xo as c,So as d}; diff --git a/backend/static/assets/server-BUAZv7ZV.js b/backend/static/assets/server-B7EY-8NK.js similarity index 94% rename from backend/static/assets/server-BUAZv7ZV.js rename to backend/static/assets/server-B7EY-8NK.js index 382bdb7..09cf825 100644 --- a/backend/static/assets/server-BUAZv7ZV.js +++ b/backend/static/assets/server-B7EY-8NK.js @@ -1 +1 @@ -import{h as r}from"./index-LZWfu62c.js";const o={getServers:async e=>r.get("/servers",e),getServerDetail:async e=>r.get(`/servers/${e}`),getServerStats:async()=>r.get("/servers/stats"),createServer:async e=>r.post("/servers",e),updateServer:async(e,t)=>r.put(`/servers/${e}`,t),deleteServer:async e=>r.delete(`/servers/${e}`),batchDelete:async e=>r.post("/servers/batch-delete",{ids:e}),batchCreate:async e=>r.post("/servers/batch",e),getMetrics:async e=>r.get("/dashboard/metrics"),installAgent:async(e,t,n)=>{const s={token:t};return n&&Object.assign(s,n),r.post(`/servers/${e}/install-agent`,s)},batchInstallAgent:async(e,t)=>r.post(`/servers/install-agent?token=${encodeURIComponent(t)}`,{server_ids:e}),listFiles:async(e,t)=>r.get(`/servers/${e}/files?path=${encodeURIComponent(t)}`),downloadFile:async(e,t)=>r.download(`/servers/${e}/files/download?path=${encodeURIComponent(t)}`),uploadFile:async(e,t,n)=>{const s=new FormData;return s.append("file",n),r.upload(`/servers/${e}/files/upload?path=${encodeURIComponent(t)}`,s)},deleteFile:async(e,t)=>r.delete(`/servers/${e}/files?path=${encodeURIComponent(t)}`),mkdir:async(e,t)=>r.post(`/servers/${e}/files/mkdir`,{path:t})};export{o as s}; +import{h as r}from"./index-Bp-M7P_8.js";const o={getServers:async e=>r.get("/servers",e),getServerDetail:async e=>r.get(`/servers/${e}`),getServerStats:async()=>r.get("/servers/stats"),createServer:async e=>r.post("/servers",e),updateServer:async(e,t)=>r.put(`/servers/${e}`,t),deleteServer:async e=>r.delete(`/servers/${e}`),batchDelete:async e=>r.post("/servers/batch-delete",{ids:e}),batchCreate:async e=>r.post("/servers/batch",e),getMetrics:async e=>r.get("/dashboard/metrics"),installAgent:async(e,t,n)=>{const s={token:t};return n&&Object.assign(s,n),r.post(`/servers/${e}/install-agent`,s)},batchInstallAgent:async(e,t)=>r.post(`/servers/install-agent?token=${encodeURIComponent(t)}`,{server_ids:e}),listFiles:async(e,t)=>r.get(`/servers/${e}/files?path=${encodeURIComponent(t)}`),downloadFile:async(e,t)=>r.download(`/servers/${e}/files/download?path=${encodeURIComponent(t)}`),uploadFile:async(e,t,n)=>{const s=new FormData;return s.append("file",n),r.upload(`/servers/${e}/files/upload?path=${encodeURIComponent(t)}`,s)},deleteFile:async(e,t)=>r.delete(`/servers/${e}/files?path=${encodeURIComponent(t)}`),mkdir:async(e,t)=>r.post(`/servers/${e}/files/mkdir`,{path:t})};export{o as s}; diff --git a/backend/static/assets/site-B-pRndoi.js b/backend/static/assets/site-CjSdjBc1.js similarity index 78% rename from backend/static/assets/site-B-pRndoi.js rename to backend/static/assets/site-CjSdjBc1.js index a6447ff..c58e845 100644 --- a/backend/static/assets/site-B-pRndoi.js +++ b/backend/static/assets/site-CjSdjBc1.js @@ -1 +1 @@ -import{h as s}from"./index-LZWfu62c.js";const r={getStats:async()=>s.get("/site/stats"),getTasks:async()=>s.get("/site/tasks"),createTask:async t=>s.post("/site/tasks",t),deleteTask:async t=>s.delete(`/site/tasks/${t}`),toggleTask:async(t,e)=>s.put(`/site/tasks/${t}`,{enabled:e})};export{r as s}; +import{h as s}from"./index-Bp-M7P_8.js";const r={getStats:async()=>s.get("/site/stats"),getTasks:async()=>s.get("/site/tasks"),createTask:async t=>s.post("/site/tasks",t),deleteTask:async t=>s.delete(`/site/tasks/${t}`),toggleTask:async(t,e)=>s.put(`/site/tasks/${t}`,{enabled:e})};export{r as s}; diff --git a/backend/static/assets/stat-strip-BPzU38xY.js b/backend/static/assets/stat-strip-CSMyyoYr.js similarity index 91% rename from backend/static/assets/stat-strip-BPzU38xY.js rename to backend/static/assets/stat-strip-CSMyyoYr.js index 3e00015..459e298 100644 --- a/backend/static/assets/stat-strip-BPzU38xY.js +++ b/backend/static/assets/stat-strip-CSMyyoYr.js @@ -1 +1 @@ -import{j as t}from"./vendor-codemirror-C7mXSpXt.js";import{m as r}from"./index-LZWfu62c.js";const o={blue:{text:"text-blue-400",bg:"bg-blue-500/20"},emerald:{text:"text-emerald-400",bg:"bg-emerald-500/20"},amber:{text:"text-amber-400",bg:"bg-amber-500/20"},red:{text:"text-red-400",bg:"bg-red-500/20"},purple:{text:"text-purple-400",bg:"bg-purple-500/20"},cyan:{text:"text-cyan-400",bg:"bg-cyan-500/20"},muted:{text:"text-[var(--dg-text-secondary)]",bg:"bg-[var(--dg-bg-tertiary)]"}};function d({items:c,className:n}){return t.jsx("div",{"code-path":"src/components/ui/stat-strip.tsx:29:5",className:r("flex items-center gap-1.5 px-3 py-2 rounded-lg","bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]","overflow-x-auto",n),children:c.map((e,s)=>{const a=o[e.color||"muted"]||o.muted;return t.jsxs("div",{"code-path":"src/components/ui/stat-strip.tsx:38:11",className:"flex items-center gap-1.5 shrink-0",children:[s>0&&t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:40:15",className:"w-px h-5 bg-[var(--dg-border)] mx-1 shrink-0"}),t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:42:13",className:r("w-1.5 h-1.5 rounded-full shrink-0",a.bg.replace("/20","").replace("bg-","bg-")||"bg-slate-500"),style:{backgroundColor:e.color?.startsWith("#")?e.color:void 0}}),t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:48:13",className:"text-xs text-[var(--dg-text-muted)]",children:e.label}),t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:49:13",className:r("text-sm font-semibold",a.text),children:e.value})]},s)})})}export{d as S}; +import{j as t}from"./vendor-codemirror-B1SGo4xl.js";import{m as r}from"./index-Bp-M7P_8.js";const o={blue:{text:"text-blue-400",bg:"bg-blue-500/20"},emerald:{text:"text-emerald-400",bg:"bg-emerald-500/20"},amber:{text:"text-amber-400",bg:"bg-amber-500/20"},red:{text:"text-red-400",bg:"bg-red-500/20"},purple:{text:"text-purple-400",bg:"bg-purple-500/20"},cyan:{text:"text-cyan-400",bg:"bg-cyan-500/20"},muted:{text:"text-[var(--dg-text-secondary)]",bg:"bg-[var(--dg-bg-tertiary)]"}};function d({items:c,className:n}){return t.jsx("div",{"code-path":"src/components/ui/stat-strip.tsx:29:5",className:r("flex items-center gap-1.5 px-3 py-2 rounded-lg","bg-[var(--dg-bg-secondary)] border border-[var(--dg-border)]","overflow-x-auto",n),children:c.map((e,s)=>{const a=o[e.color||"muted"]||o.muted;return t.jsxs("div",{"code-path":"src/components/ui/stat-strip.tsx:38:11",className:"flex items-center gap-1.5 shrink-0",children:[s>0&&t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:40:15",className:"w-px h-5 bg-[var(--dg-border)] mx-1 shrink-0"}),t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:42:13",className:r("w-1.5 h-1.5 rounded-full shrink-0",a.bg.replace("/20","").replace("bg-","bg-")||"bg-slate-500"),style:{backgroundColor:e.color?.startsWith("#")?e.color:void 0}}),t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:48:13",className:"text-xs text-[var(--dg-text-muted)]",children:e.label}),t.jsx("span",{"code-path":"src/components/ui/stat-strip.tsx:49:13",className:r("text-sm font-semibold",a.text),children:e.value})]},s)})})}export{d as S}; diff --git a/backend/static/assets/switch-C4PJnJ9I.js b/backend/static/assets/switch-CEwFnSNV.js similarity index 95% rename from backend/static/assets/switch-C4PJnJ9I.js rename to backend/static/assets/switch-CEwFnSNV.js index d77052c..a4d9b0b 100644 --- a/backend/static/assets/switch-C4PJnJ9I.js +++ b/backend/static/assets/switch-CEwFnSNV.js @@ -1 +1 @@ -import{r as o,j as a}from"./vendor-codemirror-C7mXSpXt.js";import{w as C,v as T,r as I,s as y,x as M,y as H,m as g}from"./index-LZWfu62c.js";import{u as z}from"./index-CYARH0Cq.js";var m="Switch",[A]=I(m),[U,q]=A(m),P=o.forwardRef((e,r)=>{const{__scopeSwitch:t,name:n,checked:s,defaultChecked:b,required:d,disabled:c,value:u="on",onCheckedChange:w,form:i,...k}=e,[l,p]=o.useState(null),v=C(r,f=>p(f)),x=o.useRef(!1),S=l?i||!!l.closest("form"):!0,[h,N]=T({prop:s,defaultProp:b??!1,onChange:w,caller:m});return a.jsxs(U,{scope:t,checked:h,disabled:c,children:[a.jsx(y.button,{type:"button",role:"switch","aria-checked":h,"aria-required":d,"data-state":_(h),"data-disabled":c?"":void 0,disabled:c,value:u,...k,ref:v,onClick:M(e.onClick,f=>{N(B=>!B),S&&(x.current=f.isPropagationStopped(),x.current||f.stopPropagation())})}),S&&a.jsx(j,{control:l,bubbles:!x.current,name:n,value:u,checked:h,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});P.displayName=m;var E="SwitchThumb",R=o.forwardRef((e,r)=>{const{__scopeSwitch:t,...n}=e,s=q(E,t);return a.jsx(y.span,{"data-state":_(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:r})});R.displayName=E;var L="SwitchBubbleInput",j=o.forwardRef(({__scopeSwitch:e,control:r,checked:t,bubbles:n=!0,...s},b)=>{const d=o.useRef(null),c=C(d,b),u=z(t),w=H(r);return o.useEffect(()=>{const i=d.current;if(!i)return;const k=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(k,"checked").set;if(u!==t&&p){const v=new Event("click",{bubbles:n});p.call(i,t),i.dispatchEvent(v)}},[u,t,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...s,tabIndex:-1,ref:c,style:{...s.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});j.displayName=L;function _(e){return e?"checked":"unchecked"}var O=P,D=R;function $({className:e,...r}){return a.jsx(O,{"code-path":"src/components/ui/switch.tsx:13:5","data-slot":"switch",className:g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:a.jsx(D,{"code-path":"src/components/ui/switch.tsx:21:7","data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{$ as S}; +import{r as o,j as a}from"./vendor-codemirror-B1SGo4xl.js";import{w as C,v as T,r as I,s as y,x as M,y as H,m as g}from"./index-Bp-M7P_8.js";import{u as z}from"./index-5FEebgvX.js";var m="Switch",[A]=I(m),[U,q]=A(m),P=o.forwardRef((e,r)=>{const{__scopeSwitch:t,name:n,checked:s,defaultChecked:b,required:d,disabled:c,value:u="on",onCheckedChange:w,form:i,...k}=e,[l,p]=o.useState(null),v=C(r,f=>p(f)),x=o.useRef(!1),S=l?i||!!l.closest("form"):!0,[h,N]=T({prop:s,defaultProp:b??!1,onChange:w,caller:m});return a.jsxs(U,{scope:t,checked:h,disabled:c,children:[a.jsx(y.button,{type:"button",role:"switch","aria-checked":h,"aria-required":d,"data-state":_(h),"data-disabled":c?"":void 0,disabled:c,value:u,...k,ref:v,onClick:M(e.onClick,f=>{N(B=>!B),S&&(x.current=f.isPropagationStopped(),x.current||f.stopPropagation())})}),S&&a.jsx(j,{control:l,bubbles:!x.current,name:n,value:u,checked:h,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});P.displayName=m;var E="SwitchThumb",R=o.forwardRef((e,r)=>{const{__scopeSwitch:t,...n}=e,s=q(E,t);return a.jsx(y.span,{"data-state":_(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:r})});R.displayName=E;var L="SwitchBubbleInput",j=o.forwardRef(({__scopeSwitch:e,control:r,checked:t,bubbles:n=!0,...s},b)=>{const d=o.useRef(null),c=C(d,b),u=z(t),w=H(r);return o.useEffect(()=>{const i=d.current;if(!i)return;const k=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(k,"checked").set;if(u!==t&&p){const v=new Event("click",{bubbles:n});p.call(i,t),i.dispatchEvent(v)}},[u,t,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...s,tabIndex:-1,ref:c,style:{...s.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});j.displayName=L;function _(e){return e?"checked":"unchecked"}var O=P,D=R;function $({className:e,...r}){return a.jsx(O,{"code-path":"src/components/ui/switch.tsx:13:5","data-slot":"switch",className:g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...r,children:a.jsx(D,{"code-path":"src/components/ui/switch.tsx:21:7","data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{$ as S}; diff --git a/backend/static/assets/table-BPFYQwjr.js b/backend/static/assets/table-u8V9iTZf.js similarity index 91% rename from backend/static/assets/table-BPFYQwjr.js rename to backend/static/assets/table-u8V9iTZf.js index 0c05dc3..8f0c907 100644 --- a/backend/static/assets/table-BPFYQwjr.js +++ b/backend/static/assets/table-u8V9iTZf.js @@ -1 +1 @@ -import{j as a}from"./vendor-codemirror-C7mXSpXt.js";import{m as o}from"./index-LZWfu62c.js";function r({className:t,...e}){return a.jsx("div",{"code-path":"src/components/ui/table.tsx:7:5","data-slot":"table-container",className:"relative w-full overflow-x-auto",children:a.jsx("table",{"code-path":"src/components/ui/table.tsx:11:7","data-slot":"table",className:o("w-full caption-bottom text-sm",t),...e})})}function c({className:t,...e}){return a.jsx("thead",{"code-path":"src/components/ui/table.tsx:22:5","data-slot":"table-header",className:o("[&_tr]:border-b",t),...e})}function n({className:t,...e}){return a.jsx("tbody",{"code-path":"src/components/ui/table.tsx:32:5","data-slot":"table-body",className:o("[&_tr:last-child]:border-0",t),...e})}function d({className:t,...e}){return a.jsx("tr",{"code-path":"src/components/ui/table.tsx:55:5","data-slot":"table-row",className:o("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...e})}function b({className:t,...e}){return a.jsx("th",{"code-path":"src/components/ui/table.tsx:68:5","data-slot":"table-head",className:o("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}function i({className:t,...e}){return a.jsx("td",{"code-path":"src/components/ui/table.tsx:81:5","data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}export{r as T,c as a,d as b,b as c,n as d,i as e}; +import{j as a}from"./vendor-codemirror-B1SGo4xl.js";import{m as o}from"./index-Bp-M7P_8.js";function r({className:t,...e}){return a.jsx("div",{"code-path":"src/components/ui/table.tsx:7:5","data-slot":"table-container",className:"relative w-full overflow-x-auto",children:a.jsx("table",{"code-path":"src/components/ui/table.tsx:11:7","data-slot":"table",className:o("w-full caption-bottom text-sm",t),...e})})}function c({className:t,...e}){return a.jsx("thead",{"code-path":"src/components/ui/table.tsx:22:5","data-slot":"table-header",className:o("[&_tr]:border-b",t),...e})}function n({className:t,...e}){return a.jsx("tbody",{"code-path":"src/components/ui/table.tsx:32:5","data-slot":"table-body",className:o("[&_tr:last-child]:border-0",t),...e})}function d({className:t,...e}){return a.jsx("tr",{"code-path":"src/components/ui/table.tsx:55:5","data-slot":"table-row",className:o("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...e})}function b({className:t,...e}){return a.jsx("th",{"code-path":"src/components/ui/table.tsx:68:5","data-slot":"table-head",className:o("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}function i({className:t,...e}){return a.jsx("td",{"code-path":"src/components/ui/table.tsx:81:5","data-slot":"table-cell",className:o("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e})}export{r as T,c as a,d as b,b as c,n as d,i as e}; diff --git a/backend/static/assets/tabs-kmtfM2I-.js b/backend/static/assets/tabs-DbNlmoQJ.js similarity index 96% rename from backend/static/assets/tabs-kmtfM2I-.js rename to backend/static/assets/tabs-DbNlmoQJ.js index 178391a..d6af619 100644 --- a/backend/static/assets/tabs-kmtfM2I-.js +++ b/backend/static/assets/tabs-DbNlmoQJ.js @@ -1 +1 @@ -import{r as b,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{J as M,v as P,r as S,K as k,s as p,M as h,R as F,N as $,x as m,P as D,m as g}from"./index-LZWfu62c.js";var x="Tabs",[V]=S(x,[h]),C=h(),[G,T]=V(x),j=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,onValueChange:r,defaultValue:d,orientation:o="horizontal",dir:u,activationMode:v="automatic",...f}=e,i=M(u),[n,l]=P({prop:a,onChange:r,defaultProp:d??"",caller:x});return s.jsx(G,{scope:c,baseId:k(),value:n,onValueChange:l,orientation:o,dir:i,activationMode:v,children:s.jsx(p.div,{dir:i,"data-orientation":o,...f,ref:t})})});j.displayName=x;var y="TabsList",I=b.forwardRef((e,t)=>{const{__scopeTabs:c,loop:a=!0,...r}=e,d=T(y,c),o=C(c);return s.jsx(F,{asChild:!0,...o,orientation:d.orientation,dir:d.dir,loop:a,children:s.jsx(p.div,{role:"tablist","aria-orientation":d.orientation,...r,ref:t})})});I.displayName=y;var _="TabsTrigger",N=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,disabled:r=!1,...d}=e,o=T(_,c),u=C(c),v=A(o.baseId,a),f=E(o.baseId,a),i=a===o.value;return s.jsx($,{asChild:!0,...u,focusable:!r,active:i,children:s.jsx(p.button,{type:"button",role:"tab","aria-selected":i,"aria-controls":f,"data-state":i?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:v,...d,ref:t,onMouseDown:m(e.onMouseDown,n=>{!r&&n.button===0&&n.ctrlKey===!1?o.onValueChange(a):n.preventDefault()}),onKeyDown:m(e.onKeyDown,n=>{[" ","Enter"].includes(n.key)&&o.onValueChange(a)}),onFocus:m(e.onFocus,()=>{const n=o.activationMode!=="manual";!i&&!r&&n&&o.onValueChange(a)})})})});N.displayName=_;var R="TabsContent",w=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,forceMount:r,children:d,...o}=e,u=T(R,c),v=A(u.baseId,a),f=E(u.baseId,a),i=a===u.value,n=b.useRef(i);return b.useEffect(()=>{const l=requestAnimationFrame(()=>n.current=!1);return()=>cancelAnimationFrame(l)},[]),s.jsx(D,{present:r||i,children:({present:l})=>s.jsx(p.div,{"data-state":i?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":v,hidden:!l,id:f,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:n.current?"0s":void 0},children:l&&d})})});w.displayName=R;function A(e,t){return`${e}-trigger-${t}`}function E(e,t){return`${e}-content-${t}`}var L=j,K=I,z=N,B=w;function J({className:e,...t}){return s.jsx(L,{"code-path":"src/components/ui/tabs.tsx:13:5","data-slot":"tabs",className:g("flex flex-col gap-2",e),...t})}function O({className:e,...t}){return s.jsx(K,{"code-path":"src/components/ui/tabs.tsx:26:5","data-slot":"tabs-list",className:g("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function Q({className:e,...t}){return s.jsx(z,{"code-path":"src/components/ui/tabs.tsx:42:5","data-slot":"tabs-trigger",className:g("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function U({className:e,...t}){return s.jsx(B,{"code-path":"src/components/ui/tabs.tsx:58:5","data-slot":"tabs-content",className:g("flex-1 outline-none",e),...t})}export{J as T,O as a,Q as b,U as c}; +import{r as b,j as s}from"./vendor-codemirror-B1SGo4xl.js";import{J as M,v as P,r as S,K as k,s as p,M as h,R as F,N as $,x as m,P as D,m as g}from"./index-Bp-M7P_8.js";var x="Tabs",[V]=S(x,[h]),C=h(),[G,T]=V(x),j=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,onValueChange:r,defaultValue:d,orientation:o="horizontal",dir:u,activationMode:v="automatic",...f}=e,i=M(u),[n,l]=P({prop:a,onChange:r,defaultProp:d??"",caller:x});return s.jsx(G,{scope:c,baseId:k(),value:n,onValueChange:l,orientation:o,dir:i,activationMode:v,children:s.jsx(p.div,{dir:i,"data-orientation":o,...f,ref:t})})});j.displayName=x;var y="TabsList",I=b.forwardRef((e,t)=>{const{__scopeTabs:c,loop:a=!0,...r}=e,d=T(y,c),o=C(c);return s.jsx(F,{asChild:!0,...o,orientation:d.orientation,dir:d.dir,loop:a,children:s.jsx(p.div,{role:"tablist","aria-orientation":d.orientation,...r,ref:t})})});I.displayName=y;var _="TabsTrigger",N=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,disabled:r=!1,...d}=e,o=T(_,c),u=C(c),v=A(o.baseId,a),f=E(o.baseId,a),i=a===o.value;return s.jsx($,{asChild:!0,...u,focusable:!r,active:i,children:s.jsx(p.button,{type:"button",role:"tab","aria-selected":i,"aria-controls":f,"data-state":i?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:v,...d,ref:t,onMouseDown:m(e.onMouseDown,n=>{!r&&n.button===0&&n.ctrlKey===!1?o.onValueChange(a):n.preventDefault()}),onKeyDown:m(e.onKeyDown,n=>{[" ","Enter"].includes(n.key)&&o.onValueChange(a)}),onFocus:m(e.onFocus,()=>{const n=o.activationMode!=="manual";!i&&!r&&n&&o.onValueChange(a)})})})});N.displayName=_;var R="TabsContent",w=b.forwardRef((e,t)=>{const{__scopeTabs:c,value:a,forceMount:r,children:d,...o}=e,u=T(R,c),v=A(u.baseId,a),f=E(u.baseId,a),i=a===u.value,n=b.useRef(i);return b.useEffect(()=>{const l=requestAnimationFrame(()=>n.current=!1);return()=>cancelAnimationFrame(l)},[]),s.jsx(D,{present:r||i,children:({present:l})=>s.jsx(p.div,{"data-state":i?"active":"inactive","data-orientation":u.orientation,role:"tabpanel","aria-labelledby":v,hidden:!l,id:f,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:n.current?"0s":void 0},children:l&&d})})});w.displayName=R;function A(e,t){return`${e}-trigger-${t}`}function E(e,t){return`${e}-content-${t}`}var L=j,K=I,z=N,B=w;function J({className:e,...t}){return s.jsx(L,{"code-path":"src/components/ui/tabs.tsx:13:5","data-slot":"tabs",className:g("flex flex-col gap-2",e),...t})}function O({className:e,...t}){return s.jsx(K,{"code-path":"src/components/ui/tabs.tsx:26:5","data-slot":"tabs-list",className:g("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function Q({className:e,...t}){return s.jsx(z,{"code-path":"src/components/ui/tabs.tsx:42:5","data-slot":"tabs-trigger",className:g("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function U({className:e,...t}){return s.jsx(B,{"code-path":"src/components/ui/tabs.tsx:58:5","data-slot":"tabs-content",className:g("flex-1 outline-none",e),...t})}export{J as T,O as a,Q as b,U as c}; diff --git a/backend/static/assets/terminal-BchqP-zB.js b/backend/static/assets/terminal-DMFQ_5h4.js similarity index 88% rename from backend/static/assets/terminal-BchqP-zB.js rename to backend/static/assets/terminal-DMFQ_5h4.js index 3116eb0..495ab75 100644 --- a/backend/static/assets/terminal-BchqP-zB.js +++ b/backend/static/assets/terminal-DMFQ_5h4.js @@ -1 +1 @@ -import{h as e}from"./index-LZWfu62c.js";const t={list:async s=>e.get("/terminal-sessions",s),get:async s=>e.get(`/terminal-sessions/${s}`),getRecord:async s=>e.get(`/terminal-sessions/${s}/record`),kill:async s=>e.post(`/terminal-sessions/${s}/kill`),download:async s=>e.download(`/terminal-sessions/${s}/download`,`session-${s}.cast`),delete:async s=>e.delete(`/terminal-sessions/${s}`),batchDelete:async s=>e.post("/terminal-sessions/batch-delete",{ids:s})},o={list:async s=>e.get("/session-commands",s)},a={list:async s=>e.get("/login-logs",s)};export{a as l,o as s,t}; +import{h as e}from"./index-Bp-M7P_8.js";const t={list:async s=>e.get("/terminal-sessions",s),get:async s=>e.get(`/terminal-sessions/${s}`),getRecord:async s=>e.get(`/terminal-sessions/${s}/record`),kill:async s=>e.post(`/terminal-sessions/${s}/kill`),download:async s=>e.download(`/terminal-sessions/${s}/download`,`session-${s}.cast`),delete:async s=>e.delete(`/terminal-sessions/${s}`),batchDelete:async s=>e.post("/terminal-sessions/batch-delete",{ids:s})},o={list:async s=>e.get("/session-commands",s)},a={list:async s=>e.get("/login-logs",s)};export{a as l,o as s,t}; diff --git a/backend/static/assets/textarea-BdtIagjy.js b/backend/static/assets/textarea-BvOVhaCD.js similarity index 82% rename from backend/static/assets/textarea-BdtIagjy.js rename to backend/static/assets/textarea-BvOVhaCD.js index c641956..4b6bab1 100644 --- a/backend/static/assets/textarea-BdtIagjy.js +++ b/backend/static/assets/textarea-BvOVhaCD.js @@ -1 +1 @@ -import{j as t}from"./vendor-codemirror-C7mXSpXt.js";import{m as i}from"./index-LZWfu62c.js";function n({className:e,...r}){return t.jsx("textarea",{"code-path":"src/components/ui/textarea.tsx:7:5","data-slot":"textarea",className:i("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...r})}export{n as T}; +import{j as t}from"./vendor-codemirror-B1SGo4xl.js";import{m as i}from"./index-Bp-M7P_8.js";function n({className:e,...r}){return t.jsx("textarea",{"code-path":"src/components/ui/textarea.tsx:7:5","data-slot":"textarea",className:i("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...r})}export{n as T}; diff --git a/backend/static/assets/unwrap-BmWy-KM2.js b/backend/static/assets/unwrap-D6sbt6TG.js similarity index 98% rename from backend/static/assets/unwrap-BmWy-KM2.js rename to backend/static/assets/unwrap-D6sbt6TG.js index a46aec7..1635a4a 100644 --- a/backend/static/assets/unwrap-BmWy-KM2.js +++ b/backend/static/assets/unwrap-D6sbt6TG.js @@ -1 +1 @@ -import{z as G,ai as L,aj as l,A as M,ak as y,H as Q,al as x,am as N,an as J,ao as C,ap as X,aq as Y,ar as j,F as W,I as V,G as Z}from"./index-LZWfu62c.js";import{r as f}from"./vendor-codemirror-C7mXSpXt.js";var $=class extends G{constructor(t,e){super(),this.options=e,this.#s=t,this.#i=null,this.#r=L(),this.bindMethods(),this.setOptions(e)}#s;#t=void 0;#p=void 0;#e=void 0;#a;#u;#r;#i;#m;#l;#f;#o;#h;#n;#d=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),B(this.#t,this.options)?this.#c():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#S(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#s.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof l(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!M(this.options,e)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&H(this.#t,s,this.options,e)&&this.#c(),this.updateResult(),r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||y(this.options.staleTime,this.#t)!==y(e.staleTime,this.#t))&&this.#b();const i=this.#v();r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||i!==this.#n)&&this.#R(i)}getOptimisticResult(t){const e=this.#s.getQueryCache().build(this.#s,t),s=this.createResult(e,t);return tt(this,s)&&(this.#e=s,this.#u=this.options,this.#a=this.#t.state),s}getCurrentResult(){return this.#e}trackResult(t,e){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){this.#d.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#s.defaultQueryOptions(t),s=this.#s.getQueryCache().build(this.#s,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#c({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#e))}#c(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(Q)),e}#b(){this.#g();const t=y(this.options.staleTime,this.#t);if(x.isServer()||this.#e.isStale||!N(t))return;const s=J(this.#e.dataUpdatedAt,t)+1;this.#o=C.setTimeout(()=>{this.#e.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#R(t){this.#S(),this.#n=t,!(x.isServer()||l(this.options.enabled,this.#t)===!1||!N(this.#n)||this.#n===0)&&(this.#h=C.setInterval(()=>{(this.options.refetchIntervalInBackground||X.isFocused())&&this.#c()},this.#n))}#y(){this.#b(),this.#R(this.#v())}#g(){this.#o&&(C.clearTimeout(this.#o),this.#o=void 0)}#S(){this.#h&&(C.clearInterval(this.#h),this.#h=void 0)}createResult(t,e){const s=this.#t,r=this.options,i=this.#e,u=this.#a,n=this.#u,b=t!==s?t.state:this.#p,{state:h}=t;let a={...h},v=!1,o;if(e._optimisticResults){const c=this.hasListeners(),R=!c&&B(t,e),S=c&&H(t,s,e,r);(R||S)&&(a={...a,...Y(h.data,t.options)}),e._optimisticResults==="isRestoring"&&(a.fetchStatus="idle")}let{error:g,errorUpdatedAt:D,status:m}=a;o=a.data;let F=!1;if(e.placeholderData!==void 0&&o===void 0&&m==="pending"){let c;i?.isPlaceholderData&&e.placeholderData===n?.placeholderData?(c=i.data,F=!0):c=typeof e.placeholderData=="function"?e.placeholderData(this.#f?.state.data,this.#f):e.placeholderData,c!==void 0&&(m="success",o=j(i?.data,c,e),v=!0)}if(e.select&&o!==void 0&&!F)if(i&&o===u?.data&&e.select===this.#m)o=this.#l;else try{this.#m=e.select,o=e.select(o),o=j(i?.data,o,e),this.#l=o,this.#i=null}catch(c){this.#i=c}this.#i&&(g=this.#i,o=this.#l,D=Date.now(),m="error");const I=a.fetchStatus==="fetching",T=m==="pending",w=m==="error",U=T&&I,k=o!==void 0,p={status:m,fetchStatus:a.fetchStatus,isPending:T,isSuccess:m==="success",isError:w,isInitialLoading:U,isLoading:U,data:o,dataUpdatedAt:a.dataUpdatedAt,error:g,errorUpdatedAt:D,failureCount:a.fetchFailureCount,failureReason:a.fetchFailureReason,errorUpdateCount:a.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:a.dataUpdateCount>b.dataUpdateCount||a.errorUpdateCount>b.errorUpdateCount,isFetching:I,isRefetching:I&&!T,isLoadingError:w&&!k,isPaused:a.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:w&&k,isStale:P(t,e),refetch:this.refetch,promise:this.#r,isEnabled:l(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const c=p.data!==void 0,R=p.status==="error"&&!c,S=E=>{R?E.reject(p.error):c&&E.resolve(p.data)},A=()=>{const E=this.#r=p.promise=L();S(E)},O=this.#r;switch(O.status){case"pending":t.queryHash===s.queryHash&&S(O);break;case"fulfilled":(R||p.data!==O.value)&&A();break;case"rejected":(!R||p.error!==O.reason)&&A();break}}return p}updateResult(){const t=this.#e,e=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#u=this.options,this.#a.data!==void 0&&(this.#f=this.#t),M(e,t))return;this.#e=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#d.size)return!0;const u=new Set(i??this.#d);return this.options.throwOnError&&u.add("error"),Object.keys(this.#e).some(n=>{const d=n;return this.#e[d]!==t[d]&&u.has(d)})};this.#E({listeners:s()})}#O(){const t=this.#s.getQueryCache().build(this.#s,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#p=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#E(t){W.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#e)}),this.#s.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function q(t,e){return l(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function B(t,e){return q(t,e)||t.state.data!==void 0&&_(t,e,e.refetchOnMount)}function _(t,e,s){if(l(e.enabled,t)!==!1&&y(e.staleTime,t)!=="static"){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&P(t,e)}return!1}function H(t,e,s,r){return(t!==e||l(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&P(t,s)}function P(t,e){return l(e.enabled,t)!==!1&&t.isStaleByTime(y(e.staleTime,t))}function tt(t,e){return!M(t.getCurrentResult(),e)}var K=f.createContext(!1),et=()=>f.useContext(K);K.Provider;function st(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var rt=f.createContext(st()),it=()=>f.useContext(rt),nt=(t,e,s)=>{const r=s?.state.error&&typeof t.throwOnError=="function"?V(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},at=t=>{f.useEffect(()=>{t.clearReset()},[t])},ot=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||V(s,[t.error,r])),ht=t=>{if(t.suspense){const s=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},ct=(t,e)=>t.isLoading&&t.isFetching&&!e,ut=(t,e)=>t?.suspense&&e.isPending,z=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function lt(t,e,s){const r=et(),i=it(),u=Z(),n=u.defaultQueryOptions(t);u.getDefaultOptions().queries?._experimental_beforeQuery?.(n);const d=u.getQueryCache().get(n.queryHash);n._optimisticResults=r?"isRestoring":"optimistic",ht(n),nt(n,i,d),at(i);const b=!u.getQueryCache().get(n.queryHash),[h]=f.useState(()=>new e(u,n)),a=h.getOptimisticResult(n),v=!r&&t.subscribed!==!1;if(f.useSyncExternalStore(f.useCallback(o=>{const g=v?h.subscribe(W.batchCalls(o)):Q;return h.updateResult(),g},[h,v]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),f.useEffect(()=>{h.setOptions(n)},[n,h]),ut(n,a))throw z(n,h,i);if(ot({result:a,errorResetBoundary:i,throwOnError:n.throwOnError,query:d,suspense:n.suspense}))throw a.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(n,a),n.experimental_prefetchInRender&&!x.isServer()&&ct(a,r)&&(b?z(n,h,i):d?.promise)?.catch(Q).finally(()=>{h.updateResult()}),n.notifyOnChangeProps?a:h.trackResult(a)}function bt(t,e){return lt(t,$)}const vt={terminalSessions:t=>["terminal-sessions",t],hostMonitor:{hosts:()=>["host-monitor","hosts"],history:(t,e)=>["host-monitor","history",t,e],probes:t=>["host-monitor","probes",t],portPolicy:t=>["host-monitor","port-policy",t]},servers:t=>["servers",t],pipelines:t=>["pipelines",t],pipelineRuns:t=>["pipeline-runs",t],alerts:t=>["alerts",t],alertRules:()=>["alert-rules"],agentAlertRules:()=>["agent-alert-rules"],auditLogs:t=>["audit-logs",t],sessionCommands:t=>["session-commands",t],k8sClusters:()=>["k8s-clusters"],credentials:t=>["credentials",t],credentialDetail:t=>["credential-detail",t],promDatasources:()=>["prom-datasources"]};function ft(t){if(Array.isArray(t))return t;if(t&&typeof t=="object"){const e=t;if(Array.isArray(e.list))return e.list;if(Array.isArray(e.data))return e.data}return[]}function Rt(t){return t&&typeof t=="object"&&"total"in t?Number(t.total)||0:ft(t).length}export{Rt as a,ft as b,vt as q,bt as u}; +import{z as G,ai as L,aj as l,A as M,ak as y,H as Q,al as x,am as N,an as J,ao as C,ap as X,aq as Y,ar as j,F as W,I as V,G as Z}from"./index-Bp-M7P_8.js";import{r as f}from"./vendor-codemirror-B1SGo4xl.js";var $=class extends G{constructor(t,e){super(),this.options=e,this.#s=t,this.#i=null,this.#r=L(),this.bindMethods(),this.setOptions(e)}#s;#t=void 0;#p=void 0;#e=void 0;#a;#u;#r;#i;#m;#l;#f;#o;#h;#n;#d=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),B(this.#t,this.options)?this.#c():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#g(),this.#S(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#s.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof l(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!M(this.options,e)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&H(this.#t,s,this.options,e)&&this.#c(),this.updateResult(),r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||y(this.options.staleTime,this.#t)!==y(e.staleTime,this.#t))&&this.#b();const i=this.#v();r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||i!==this.#n)&&this.#R(i)}getOptimisticResult(t){const e=this.#s.getQueryCache().build(this.#s,t),s=this.createResult(e,t);return tt(this,s)&&(this.#e=s,this.#u=this.options,this.#a=this.#t.state),s}getCurrentResult(){return this.#e}trackResult(t,e){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){this.#d.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#s.defaultQueryOptions(t),s=this.#s.getQueryCache().build(this.#s,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#c({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#e))}#c(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(Q)),e}#b(){this.#g();const t=y(this.options.staleTime,this.#t);if(x.isServer()||this.#e.isStale||!N(t))return;const s=J(this.#e.dataUpdatedAt,t)+1;this.#o=C.setTimeout(()=>{this.#e.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#R(t){this.#S(),this.#n=t,!(x.isServer()||l(this.options.enabled,this.#t)===!1||!N(this.#n)||this.#n===0)&&(this.#h=C.setInterval(()=>{(this.options.refetchIntervalInBackground||X.isFocused())&&this.#c()},this.#n))}#y(){this.#b(),this.#R(this.#v())}#g(){this.#o&&(C.clearTimeout(this.#o),this.#o=void 0)}#S(){this.#h&&(C.clearInterval(this.#h),this.#h=void 0)}createResult(t,e){const s=this.#t,r=this.options,i=this.#e,u=this.#a,n=this.#u,b=t!==s?t.state:this.#p,{state:h}=t;let a={...h},v=!1,o;if(e._optimisticResults){const c=this.hasListeners(),R=!c&&B(t,e),S=c&&H(t,s,e,r);(R||S)&&(a={...a,...Y(h.data,t.options)}),e._optimisticResults==="isRestoring"&&(a.fetchStatus="idle")}let{error:g,errorUpdatedAt:D,status:m}=a;o=a.data;let F=!1;if(e.placeholderData!==void 0&&o===void 0&&m==="pending"){let c;i?.isPlaceholderData&&e.placeholderData===n?.placeholderData?(c=i.data,F=!0):c=typeof e.placeholderData=="function"?e.placeholderData(this.#f?.state.data,this.#f):e.placeholderData,c!==void 0&&(m="success",o=j(i?.data,c,e),v=!0)}if(e.select&&o!==void 0&&!F)if(i&&o===u?.data&&e.select===this.#m)o=this.#l;else try{this.#m=e.select,o=e.select(o),o=j(i?.data,o,e),this.#l=o,this.#i=null}catch(c){this.#i=c}this.#i&&(g=this.#i,o=this.#l,D=Date.now(),m="error");const I=a.fetchStatus==="fetching",T=m==="pending",w=m==="error",U=T&&I,k=o!==void 0,p={status:m,fetchStatus:a.fetchStatus,isPending:T,isSuccess:m==="success",isError:w,isInitialLoading:U,isLoading:U,data:o,dataUpdatedAt:a.dataUpdatedAt,error:g,errorUpdatedAt:D,failureCount:a.fetchFailureCount,failureReason:a.fetchFailureReason,errorUpdateCount:a.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:a.dataUpdateCount>b.dataUpdateCount||a.errorUpdateCount>b.errorUpdateCount,isFetching:I,isRefetching:I&&!T,isLoadingError:w&&!k,isPaused:a.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:w&&k,isStale:P(t,e),refetch:this.refetch,promise:this.#r,isEnabled:l(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const c=p.data!==void 0,R=p.status==="error"&&!c,S=E=>{R?E.reject(p.error):c&&E.resolve(p.data)},A=()=>{const E=this.#r=p.promise=L();S(E)},O=this.#r;switch(O.status){case"pending":t.queryHash===s.queryHash&&S(O);break;case"fulfilled":(R||p.data!==O.value)&&A();break;case"rejected":(!R||p.error!==O.reason)&&A();break}}return p}updateResult(){const t=this.#e,e=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#u=this.options,this.#a.data!==void 0&&(this.#f=this.#t),M(e,t))return;this.#e=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#d.size)return!0;const u=new Set(i??this.#d);return this.options.throwOnError&&u.add("error"),Object.keys(this.#e).some(n=>{const d=n;return this.#e[d]!==t[d]&&u.has(d)})};this.#E({listeners:s()})}#O(){const t=this.#s.getQueryCache().build(this.#s,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#p=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#E(t){W.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#e)}),this.#s.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function q(t,e){return l(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function B(t,e){return q(t,e)||t.state.data!==void 0&&_(t,e,e.refetchOnMount)}function _(t,e,s){if(l(e.enabled,t)!==!1&&y(e.staleTime,t)!=="static"){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&P(t,e)}return!1}function H(t,e,s,r){return(t!==e||l(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&P(t,s)}function P(t,e){return l(e.enabled,t)!==!1&&t.isStaleByTime(y(e.staleTime,t))}function tt(t,e){return!M(t.getCurrentResult(),e)}var K=f.createContext(!1),et=()=>f.useContext(K);K.Provider;function st(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var rt=f.createContext(st()),it=()=>f.useContext(rt),nt=(t,e,s)=>{const r=s?.state.error&&typeof t.throwOnError=="function"?V(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},at=t=>{f.useEffect(()=>{t.clearReset()},[t])},ot=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||V(s,[t.error,r])),ht=t=>{if(t.suspense){const s=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},ct=(t,e)=>t.isLoading&&t.isFetching&&!e,ut=(t,e)=>t?.suspense&&e.isPending,z=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function lt(t,e,s){const r=et(),i=it(),u=Z(),n=u.defaultQueryOptions(t);u.getDefaultOptions().queries?._experimental_beforeQuery?.(n);const d=u.getQueryCache().get(n.queryHash);n._optimisticResults=r?"isRestoring":"optimistic",ht(n),nt(n,i,d),at(i);const b=!u.getQueryCache().get(n.queryHash),[h]=f.useState(()=>new e(u,n)),a=h.getOptimisticResult(n),v=!r&&t.subscribed!==!1;if(f.useSyncExternalStore(f.useCallback(o=>{const g=v?h.subscribe(W.batchCalls(o)):Q;return h.updateResult(),g},[h,v]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),f.useEffect(()=>{h.setOptions(n)},[n,h]),ut(n,a))throw z(n,h,i);if(ot({result:a,errorResetBoundary:i,throwOnError:n.throwOnError,query:d,suspense:n.suspense}))throw a.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(n,a),n.experimental_prefetchInRender&&!x.isServer()&&ct(a,r)&&(b?z(n,h,i):d?.promise)?.catch(Q).finally(()=>{h.updateResult()}),n.notifyOnChangeProps?a:h.trackResult(a)}function bt(t,e){return lt(t,$)}const vt={terminalSessions:t=>["terminal-sessions",t],hostMonitor:{hosts:()=>["host-monitor","hosts"],history:(t,e)=>["host-monitor","history",t,e],probes:t=>["host-monitor","probes",t],portPolicy:t=>["host-monitor","port-policy",t]},servers:t=>["servers",t],pipelines:t=>["pipelines",t],pipelineRuns:t=>["pipeline-runs",t],alerts:t=>["alerts",t],alertRules:()=>["alert-rules"],agentAlertRules:()=>["agent-alert-rules"],auditLogs:t=>["audit-logs",t],sessionCommands:t=>["session-commands",t],k8sClusters:()=>["k8s-clusters"],credentials:t=>["credentials",t],credentialDetail:t=>["credential-detail",t],promDatasources:()=>["prom-datasources"]};function ft(t){if(Array.isArray(t))return t;if(t&&typeof t=="object"){const e=t;if(Array.isArray(e.list))return e.list;if(Array.isArray(e.data))return e.data}return[]}function Rt(t){return t&&typeof t=="object"&&"total"in t?Number(t.total)||0:ft(t).length}export{Rt as a,ft as b,vt as q,bt as u}; diff --git a/backend/static/assets/use-toast-CkA38LVP.js b/backend/static/assets/use-toast-DNZLibQY.js similarity index 81% rename from backend/static/assets/use-toast-CkA38LVP.js rename to backend/static/assets/use-toast-DNZLibQY.js index 30d40c6..7e56f28 100644 --- a/backend/static/assets/use-toast-CkA38LVP.js +++ b/backend/static/assets/use-toast-DNZLibQY.js @@ -1 +1 @@ -import{r as i}from"./vendor-codemirror-C7mXSpXt.js";function d(){const[r,s]=i.useState([]),c=i.useCallback(o=>{const t=Math.random().toString(36).slice(2),e={id:t,...o};s(a=>[...a,e]),setTimeout(()=>{s(a=>a.filter(u=>u.id!==t))},4e3)},[]),n=i.useCallback(o=>{s(t=>t.filter(e=>e.id!==o))},[]);return{toast:c,toasts:r,dismiss:n}}export{d as u}; +import{r as i}from"./vendor-codemirror-B1SGo4xl.js";function d(){const[r,s]=i.useState([]),c=i.useCallback(o=>{const t=Math.random().toString(36).slice(2),e={id:t,...o};s(a=>[...a,e]),setTimeout(()=>{s(a=>a.filter(u=>u.id!==t))},4e3)},[]),n=i.useCallback(o=>{s(t=>t.filter(e=>e.id!==o))},[]);return{toast:c,toasts:r,dismiss:n}}export{d as u}; diff --git a/backend/static/assets/useMutation-Bp3lz5hm.js b/backend/static/assets/useMutation-DTWI9Q1n.js similarity index 94% rename from backend/static/assets/useMutation-Bp3lz5hm.js rename to backend/static/assets/useMutation-DTWI9Q1n.js index 4326211..6f5c00b 100644 --- a/backend/static/assets/useMutation-Bp3lz5hm.js +++ b/backend/static/assets/useMutation-DTWI9Q1n.js @@ -1 +1 @@ -import{r as o}from"./vendor-codemirror-C7mXSpXt.js";import{z as l,A as d,C as a,E as p,F as h,G as m,H as b,I as v}from"./index-LZWfu62c.js";var y=class extends l{#s;#i=void 0;#t;#e;constructor(t,s){super(),this.#s=t,this.setOptions(s),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#s.defaultMutationOptions(t),d(this.options,s)||this.#s.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&a(s.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(t,s){return this.#e=s,this.#t?.removeObserver(this),this.#t=this.#s.getMutationCache().build(this.#s,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??p();this.#i={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){h.batch(()=>{if(this.#e&&this.hasListeners()){const s=this.#i.variables,r=this.#i.context,e={client:this.#s,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#e.onSuccess?.(t.data,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(t.data,null,s,r,e)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#e.onError?.(t.error,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(void 0,t.error,s,r,e)}catch(i){Promise.reject(i)}}}this.listeners.forEach(s=>{s(this.#i)})})}};function C(t,s){const r=m(),[e]=o.useState(()=>new y(r,t));o.useEffect(()=>{e.setOptions(t)},[e,t]);const i=o.useSyncExternalStore(o.useCallback(n=>e.subscribe(h.batchCalls(n)),[e]),()=>e.getCurrentResult(),()=>e.getCurrentResult()),u=o.useCallback((n,c)=>{e.mutate(n,c).catch(b)},[e]);if(i.error&&v(e.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:u,mutateAsync:i.mutate}}export{C as u}; +import{r as o}from"./vendor-codemirror-B1SGo4xl.js";import{z as l,A as d,C as a,E as p,F as h,G as m,H as b,I as v}from"./index-Bp-M7P_8.js";var y=class extends l{#s;#i=void 0;#t;#e;constructor(t,s){super(),this.#s=t,this.setOptions(s),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const s=this.options;this.options=this.#s.defaultMutationOptions(t),d(this.options,s)||this.#s.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),s?.mutationKey&&this.options.mutationKey&&a(s.mutationKey)!==a(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(t,s){return this.#e=s,this.#t?.removeObserver(this),this.#t=this.#s.getMutationCache().build(this.#s,this.options),this.#t.addObserver(this),this.#t.execute(t)}#r(){const t=this.#t?.state??p();this.#i={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){h.batch(()=>{if(this.#e&&this.hasListeners()){const s=this.#i.variables,r=this.#i.context,e={client:this.#s,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#e.onSuccess?.(t.data,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(t.data,null,s,r,e)}catch(i){Promise.reject(i)}}else if(t?.type==="error"){try{this.#e.onError?.(t.error,s,r,e)}catch(i){Promise.reject(i)}try{this.#e.onSettled?.(void 0,t.error,s,r,e)}catch(i){Promise.reject(i)}}}this.listeners.forEach(s=>{s(this.#i)})})}};function C(t,s){const r=m(),[e]=o.useState(()=>new y(r,t));o.useEffect(()=>{e.setOptions(t)},[e,t]);const i=o.useSyncExternalStore(o.useCallback(n=>e.subscribe(h.batchCalls(n)),[e]),()=>e.getCurrentResult(),()=>e.getCurrentResult()),u=o.useCallback((n,c)=>{e.mutate(n,c).catch(b)},[e]);if(i.error&&v(e.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:u,mutateAsync:i.mutate}}export{C as u}; diff --git a/backend/static/assets/vendor-codemirror-C7mXSpXt.js b/backend/static/assets/vendor-codemirror-B1SGo4xl.js similarity index 99% rename from backend/static/assets/vendor-codemirror-C7mXSpXt.js rename to backend/static/assets/vendor-codemirror-B1SGo4xl.js index fa3fe58..61ac878 100644 --- a/backend/static/assets/vendor-codemirror-C7mXSpXt.js +++ b/backend/static/assets/vendor-codemirror-B1SGo4xl.js @@ -9,4 +9,4 @@ function Ou(n,e){for(var t=0;tDate.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(l=!0),a=n.inputState.lastSelectionOrigin,a=="select.pointer"&&(i=cc(s.facet(un).map(h=>h(n)),i))),n.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function Ho(n,e,t,i=-1){if(E.ios&&n.inputState.flushIOSKey(e))return!0;let s=n.state.selection.main;if(E.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&n.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&fi(n.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||i==8&&e.insert.lengths.head)&&fi(n.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&fi(n.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=Yd(n,e,t));return n.state.facet(Jh).some(a=>a(n,e.from,e.to,r,l))||n.dispatch(l()),!0}function Yd(n,e,t){let i,s=n.state,r=s.selection.main,o=-1;if(e.from==e.to&&e.fromr.to){let a=e.fromf(n)),h,a);e.from==c&&(o=c)}if(o>-1)i={changes:e,selection:k.cursor(e.from+e.insert.length,-1)};else if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let a=r.frome.to?s.sliceDoc(e.to,r.to):"";i=s.replaceSelection(n.state.toText(a+e.insert.sliceString(0,void 0,n.state.lineBreak)+h))}else{let a=s.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(s.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=r.to+10&&e.to>=r.to-10){let c=n.state.sliceDoc(e.from,e.to),f,u=t&&hc(n,t.main.head);if(u){let p=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-p}}else f=n.state.doc.lineAt(r.head);let d=r.to-e.to;i=s.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:a,range:h||p.map(a)};let m=p.to-d,b=m-c.length;if(n.state.sliceDoc(b,m)!=c||m>=f.from&&b<=f.to)return{range:p};let y=s.changes({from:b,to:m,insert:e.insert}),v=p.to-r.to;return{changes:y,range:h?k.range(Math.max(0,h.anchor+v),Math.max(0,h.head+v)):p.map(y)}})}else i={changes:a,selection:h&&s.selection.replaceRange(h)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:l,scrollIntoView:!0})}function dc(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Jd(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new Nl(t,i)),(s!=t||r!=i)&&e.push(new Nl(s,r))),e}function Zd(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?k.single(t+e,i+e):null}function ns(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class ep{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,E.safari&&e.contentDOM.addEventListener("input",()=>null),E.gecko&&mp(e.contentDOM.ownerDocument)}handleEvent(e){!ap(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let s of i.observers)s(this.view,t);for(let s of i.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=tp(e),i=this.handlers,s=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(s.removeEventListener(r,this.handleEvent),l=null),l||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!t[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&mc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),E.android&&E.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return E.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&!e.shiftKey&&((t=pc.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||ip.indexOf(e.key)>-1&&e.ctrlKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from0?!0:E.safari&&!E.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Wl(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(s){Be(t.state,s)}}}function tp(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let s=i.spec,r=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(r)for(let l in r){let a=r[l];a&&t(l).handlers.push(Wl(i.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(Wl(i.value,a))}}for(let i in Ke)t(i).handlers.push(Ke[i]);for(let i in Ie)t(i).observers.push(Ie[i]);return e}const pc=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],ip="dthko",mc=[16,17,18,20,91,92,224,225],vn=6;function wn(n){return Math.max(0,n)*.7+8}function np(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class sp{constructor(e,t,i,s){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Hh(e.contentDOM),this.atoms=e.state.facet(un).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(U.allowMultipleSelections)&&rp(e,t),this.dragging=lp(e,t)&&yc(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&np(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,s=0,r=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Wo(this.view);e.clientX-a.left<=s+vn?t=-wn(s-e.clientX):e.clientX+a.right>=o-vn&&(t=wn(e.clientX-o)),e.clientY-a.top<=r+vn?i=-wn(r-e.clientY):e.clientY+a.bottom>=l-vn&&(i=wn(e.clientY-l)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=cc(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function rp(n,e){let t=n.state.facet(jh);return t.length?t[0](e):E.mac?e.metaKey:e.ctrlKey}function op(n,e){let t=n.state.facet(Kh);return t.length?t[0](e):E.mac?!e.altKey:!e.ctrlKey}function lp(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=Gi(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function ap(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=ae.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const Ke=Object.create(null),Ie=Object.create(null),gc=E.ie&&E.ie_version<15||E.ios&&E.webkit_version<604;function hp(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),bc(n,t.value)},50)}function Ds(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function bc(n,e){e=Ds(n.state,Bo,e);let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(Zr!=null&&t.selection.ranges.every(a=>a.empty)&&Zr==r.toString()){let a=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:k.cursor(h.from+f.length)}})}else o?i=t.changeByRange(a=>{let h=r.line(s++);return{changes:{from:a.from,to:a.to,insert:h.text},range:k.cursor(a.from+h.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}Ie.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};Ie.wheel=Ie.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};Ke.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);Ie.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};Ie.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};Ke.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(Gh))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=fp(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new sp(n,e,t,i)),i&&n.observer.ignore(()=>{Fh(n.contentDOM);let r=n.root.activeElement;r&&!r.contains(n.contentDOM)&&r.blur()});let s=n.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function Hl(n,e,t,i){if(i==1)return k.cursor(e,t);if(i==2)return zd(n.state,e,t);{let s=n.docView.lineAt(e,t),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return lDate.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(Vl+1)%3:1}function fp(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=yc(e),s=n.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,l){let a=n.posAndSideAtCoords({x:r.clientX,y:r.clientY},!1),h,c=Hl(n,a.pos,a.assoc,i);if(t.pos!=a.pos&&!o){let f=Hl(n,t.pos,t.assoc,i),u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u1&&(h=up(s,a.pos))?h:l?s.addRange(c):k.create([c])}}}function up(n,e){for(let t=0;t=e)return k.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Ke.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let s=n.docView.tile.nearest(e.target);if(s&&s.isWidget()){let r=s.posAtStart,o=r+s.length;(r>=t.to||o<=t.from)&&(t=k.range(r,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Ds(n.state,Lo,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ke.dragend=n=>(n.inputState.draggedContent=null,!1);function Ql(n,e,t,i){if(t=Ds(n.state,Bo,t),!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=n.inputState,o=i&&r&&op(n,e)?{from:r.from,to:r.to}:null,l={from:s,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}Ke.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),s=0,r=()=>{++s==t.length&&Ql(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Ql(n,e,i,!0),!0}return!1};Ke.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=gc?null:e.clipboardData;return t?(bc(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(hp(n),!1)};function dp(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function pp(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:Ds(n,Lo,e.join(n.lineBreak)),ranges:t,linewise:i}}let Zr=null;Ke.copy=Ke.cut=(n,e)=>{if(!Fi(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:s}=pp(n.state);if(!t&&!s)return!1;Zr=s?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=gc?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(dp(n,t),!1)};const xc=ct.define();function kc(n,e){let t=[];for(let i of n.facet(Zh)){let s=i(n,e);s&&t.push(s)}return t.length?n.update({effects:t,annotations:xc.of(!0)}):null}function vc(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=kc(n.state,e);t?n.dispatch(t):n.update([])}},10)}Ie.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),vc(n)};Ie.blur=n=>{n.observer.clearSelectionRange(),vc(n)};Ie.compositionstart=Ie.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};Ie.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,E.chrome&&E.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};Ie.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Ke.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let r=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(r&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),h=n.posAtDOM(l.endContainer,l.endOffset);return Ho(n,{from:a,to:h,insert:n.state.toText(r)},null),!0}}let s;if(E.chrome&&E.android&&(s=pc.find(r=>r.inputType==e.inputType))&&(n.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return E.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),E.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>Ie.compositionend(n,e),20),!1};const $l=new Set;function mp(n){$l.has(n)||($l.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const ql=["pre-wrap","normal","pre-line","break-spaces"];let xi=!1;function _l(){xi=!1}class gp{constructor(e){this.lineWrapping=e,this.doc=G.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return ql.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=s,this.lineLength=r,a){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>$n&&(xi=!0),this.height=e)}replace(e,t,i){return Te.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=s[l],u=r.lineAt(a,ne.ByPosNoHeight,i.setDoc(t),0,0),d=u.to>=h?u:r.lineAt(h,ne.ByPosNoHeight,i,0,0);for(f+=d.to-h,h=d.to;l>0&&u.from<=s[l-1].toA;)a=s[l-1].fromA,c=s[l-1].fromB,l--,ar*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s=r&&o(this.lineAt(0,ne.ByPos,i,s,r))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Fe extends wc{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Xe(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof Fe||s instanceof xe&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof xe?s=new Fe(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Te.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setMeasuredHeight(s):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class xe extends Te{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,s);if(t.lineWrapping){let h=s+(e0){let r=i[i.length-1];r instanceof xe?i[i.length-1]=new xe(r.length+s):i.push(null,new xe(s-1))}if(e>0){let r=i[0];r instanceof xe?i[0]=new xe(e+r.length):i.unshift(new xe(e-1),null)}return Te.of(i)}decomposeLeft(e,t){t.push(new xe(e-1),null)}decomposeRight(e,t){t.push(null,new xe(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),a=-1;for(s.from>t&&o.push(new xe(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++],u=0;f<0&&(u=-f,f=s.heights[s.index++]),a==-1?a=f:Math.abs(f-a)>=$n&&(a=-2);let d=new Fe(c,f,u);d.outdated=!1,o.push(d),l+=c+1}l<=r&&o.push(null,new xe(r-l).updateHeight(e,l));let h=Te.of(o);return(a<0||Math.abs(h.height-this.height)>=$n||Math.abs(a-this.heightMetrics(e,t).perLine)>=$n)&&(xi=!0),ss(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class xp extends Te{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return el))return h;let c=t==ne.ByPosNoHeight?ne.ByPosNoHeight:ne.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(h)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,ne.ByPos,i,s,r);e=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&Xl(r,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e2*t.size||t.size>2*e.size?Te.of(this.break?[e,null,t]:[e,t]):(this.left=ss(this.left,e),this.right=ss(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;return s&&s.from<=t+r.length&&s.more?a=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=l+o.length&&s.more?a=o=o.updateHeight(e,l,i,s):o.updateHeight(e,l,i),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Xl(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof xe&&(i=n[e+1])instanceof xe&&n.splice(e-1,3,new xe(t.length+1+i.length))}const kp=5;class Fo{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Fe?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Fe(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=kp)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Fe(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new xe(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Fe)return e;let t=new Fe(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Fe)&&!this.isCovered?this.nodes.push(new Fe(0,-1,0)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();r=Math.max(r,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=Math.min(h==n.parentNode?s.innerHeight:a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function Op(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left0&&e.top0}function Cp(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class er{constructor(e,t,i,s){this.from=e,this.to=t,this.size=i,this.displaySize=s}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new gp(i),this.stateDeco=Kl(t),this.heightMap=Te.empty().applyChanges(this.stateDeco,G.empty,this.heightOracle.setDoc(t.doc),[new ze(0,0,0,t.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=I.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new Sn(r,o))}}return this.viewports=e.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?jl:new Vo(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Ii(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=Kl(this.state);let s=e.changedRanges,r=ze.extendWithRanges(s,vp(i,this.stateDeco,e?e.changes:de.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);_l(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||xi)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(tc)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?te.RTL:te.LTR;let o=this.heightOracle.mustRefreshForWrapping(r)||this.mustMeasureContent==="refresh",l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:C,scaleY:A}=Wh(t,l);(C>.005&&Math.abs(this.scaleX-C)>.005||A>.005&&Math.abs(this.scaleY-A)>.005)&&(this.scaleX=C,this.scaleY=A,h|=16,o=a=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let d=Hh(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=Vh(this.scrollParent||e.win);let m=(this.printing?Cp:Sp)(t,this.paddingTop),b=m.top-this.pixelViewport.top,y=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(a=!0)),!this.inView&&!this.scrollTarget&&!Op(e.dom))return 0;let S=l.width;if((this.contentDOMWidth!=S||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),a){let C=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(C)&&(o=!0),o||s.lineWrapping&&Math.abs(S-this.contentDOMWidth)>s.charWidth){let{lineHeight:A,charWidth:w,textHeight:N}=e.docView.measureTextSize();o=A>0&&s.refresh(r,A,w,N,Math.max(5,S/w),C),o&&(e.docView.minWidth=0,h|=16)}b>0&&y>0?c=Math.max(b,y):b<0&&y<0&&(c=Math.min(b,y)),_l();for(let A of this.viewports){let w=A.from==this.viewport.from?C:e.docView.measureVisibleLineHeights(A);this.heightMap=(o?Te.empty().applyChanges(this.stateDeco,G.empty,this.heightOracle,[new ze(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new bp(A.from,w))}xi&&(h|=2)}let T=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return T&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||T)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Sn(s.lineAt(o-i*1e3,ne.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,ne.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,ne.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=te.LTR&&!i)return[];let l=[],a=(c,f,u,d)=>{if(f-cc&&yy.from>=u.from&&y.to<=u.to&&Math.abs(y.from-c)y.fromv));if(!b){if(fS.from<=f&&S.to>=f)){let S=t.moveToLineBoundary(k.cursor(f),!1,!0).head;S>c&&(f=S)}let y=this.gapSize(u,c,f,d),v=i||y<2e6?y:2e6;b=new er(c,f,y,v)}l.push(b)},h=c=>{if(c.length2e6)for(let A of e)A.from>=c.from&&A.fromc.from&&a(c.from,d,c,f),pt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];_.spans(t,this.viewport.from,this.viewport.to,{span(r,o){i.push({from:r,to:o})},point(){}},20);let s=0;if(i.length!=this.visibleRanges.length)s=12;else for(let r=0;r=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Ii(this.heightMap.lineAt(e,ne.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Ii(this.heightMap.lineAt(this.scaler.fromDOM(e),ne.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Ii(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Sn{constructor(e,t){this.from=e,this.to=t}}function Mp(n,e,t){let i=[],s=n,r=0;return _.spans(t,n,e,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function Cn(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function Tp(n,e){for(let t of n)if(e(t))return t}const jl={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function Kl(n){let e=n.facet(Ms).filter(i=>typeof i!="function"),t=n.facet(No).filter(i=>typeof i!="function");return t.length&&e.push(_.join(t)),e}class Vo{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,ne.ByPos,e,0,0).top,c=t.lineAt(a,ne.ByPos,e,0,0).bottom;return s+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function Ii(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Xe(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(s=>Ii(s,e)):n._content)}const An=D.define({combine:n=>n.join(" ")}),eo=D.define({combine:n=>n.indexOf(!0)>-1}),to=Tt.newName(),Sc=Tt.newName(),Oc=Tt.newName(),Cc={"&light":"."+Sc,"&dark":"."+Oc};function io(n,e,t){return new Tt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const Pp=io("."+to,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Cc),Dp={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},tr=E.ie&&E.ie_version<=11;class Rp{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new ld,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(E.ie&&E.ie_version<=11||E.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&E.android&&e.constructor.EDIT_CONTEXT!==!1&&!(E.chrome&&E.chrome_version<126)&&(this.editContext=new Bp(e),e.state.facet(mt)&&(e.contentDOM.editContext=this.editContext.editContext)),tr&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(mt)?i.root.activeElement!=this.dom:!Fi(this.dom,s))return;let r=s.anchorNode&&i.docView.tile.nearest(s.anchorNode);if(r&&r.isWidget()&&r.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(E.ie&&E.ie_version<=11||E.android&&E.chrome)&&!i.state.selection.main.empty&&s.focusNode&&zi(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Gi(e.root);if(!t)return!1;let i=E.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Ep(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let s=Fi(this.dom,i);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&fi(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&Fi(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Gd(this.view,e,t,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,s=uc(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!ns(this.view.state.selection,t.newSel.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=Gl(t,e.previousSibling||e.target.previousSibling,-1),s=Gl(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(mt)!=e.state.facet(mt)&&(e.view.contentDOM.editContext=e.state.facet(mt)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Gl(n,e,t){for(;e;){let i=ae.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function Yl(n,e){let t=e.startContainer,i=e.startOffset,s=e.endContainer,r=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return zi(o.node,o.offset,s,r)&&([t,i,s,r]=[s,r,t,i]),{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}}function Ep(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return Yl(n,s)}let t=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?Yl(n,t):null}class Bp{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let s=e.state.selection.main,{anchor:r,head:o}=s,l=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let h=a-l>i.text.length;l==this.from&&rthis.to&&(a=r);let c=dc(e.state.sliceDoc(l,a),i.text,(h?s.from:s.to)-l,h?"end":null);if(!c){let u=k.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));ns(u,s)||e.dispatch({selection:u,userEvent:"select"});return}let f={from:c.from+l,to:c.toA+l,insert:G.of(i.text.slice(c.from,c.toB).split(` `))};if((E.mac||E.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:G.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);Ho(e,f,k.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let s=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o{let s=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(r.rangeStart),h=this.toEditorPos(r.rangeEnd);if(a{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=Gi(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,s=this.pendingContextChange;return e.changes.iterChanges((r,o,l,a,h)=>{if(i)return;let c=h.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,t+=c,this.to+=c;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(rthis.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=c}t+=c}),s&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class P{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(s=>s.forEach(r=>i(r,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||ad(e.parent)||document,this.viewState=new Ul(this,e.state||U.create(e)),e.scrollTo&&e.scrollTo.is(kn)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ri).map(s=>new Ks(s));for(let s of this.plugins)s.update(this);this.observer=new Rp(this),this.inputState=new ep(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Ll(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof pe?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(xc))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=kc(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(U.phrases)!=this.state.facet(U.phrases))return this.setState(r);s=es.create(this,r,e),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection,{x:p,y:m}=this.state.facet(P.cursorScrollMargin);f=new ui(d.empty?d:k.cursor(d.head,d.head>d.anchor?-1:1),"nearest","nearest",m,p)}for(let d of u.effects)d.is(kn)&&(f=d.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=rs.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(Li)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(An)!=s.state.facet(An)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let u of this.state.facet(Kr))try{u(s)}catch(d){Be(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!uc(this,c)&&h.force&&fi(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Ul(this,e),this.plugins=e.facet(ri).map(i=>new Ks(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Ll(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(ri),i=e.state.facet(ri);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new Ks(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Vh(i||this.win))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(s);r=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(d=>{try{return d.read(this)}catch(p){return Be(this.state,p),Jl}}),f=es.create(this,this.state,[]),u=!1;f.flags|=a,t?t.flags|=a:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let d=0;d1||p<-1)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+p,i?i.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(Kr))l(t)}get themeClasses(){return to+" "+(this.state.facet(eo)?Oc:Sc)+" "+this.state.facet(An)}updateAttrs(){let e=Zl(this,sc,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(mt)?"true":"false",class:"cm-content",style:`${E.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Zl(this,Io,t);let i=this.observer.ignore(()=>{let s=Tl(this.contentDOM,this.contentAttrs,t),r=Tl(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(P.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Li);let e=this.state.facet(P.cspNonce);Tt.mount(this.root,this.styleModules.concat(Pp).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ti.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return Zs(this,e,Il(this,e,t,i))}moveByGroup(e,t){return Zs(this,e,Il(this,e,t,i=>qd(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=i[t?i.length-1:0];return k.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,i=!0){return $d(this,e,t,i)}moveVertically(e,t,i){return Zs(this,e,_d(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=Jr(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Jr(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[ot.find(r,e-s.from,-1,t)];return Yi(i,o.dir==te.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(ec)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Lp)return Xh(e.length);let t=this.textDirectionAt(e.from),i;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||_h(r.isolates,i=Rl(this,e))))return r.order;i||(i=Rl(this,e));let s=gd(e.text,t,i);return this.bidiCache.push(new rs(e.from,e.to,t,i,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||E.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Fh(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var i,s,r,o;return kn.of(new ui(typeof e=="number"?k.cursor(e):e,(i=t.y)!==null&&i!==void 0?i:"nearest",(s=t.x)!==null&&s!==void 0?s:"nearest",(r=t.yMargin)!==null&&r!==void 0?r:5,(o=t.xMargin)!==null&&o!==void 0?o:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return kn.of(new ui(k.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return he.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return he.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=Tt.newName(),s=[An.of(i),Li.of(io(`.${i}`,e))];return t&&t.dark&&s.push(eo.of(!0)),s}static baseTheme(e){return Zt.lowest(Li.of(io("."+to,e,Cc)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&ae.get(i)||ae.get(e);return((t=s?.root)===null||t===void 0?void 0:t.view)||null}}P.styleModule=Li;P.inputHandler=Jh;P.clipboardInputFilter=Bo;P.clipboardOutputFilter=Lo;P.scrollHandler=ic;P.focusChangeEffect=Zh;P.perLineTextDirection=ec;P.exceptionSink=Yh;P.updateListener=Kr;P.editable=mt;P.mouseSelectionStyle=Gh;P.dragMovesSelection=Kh;P.clickAddsSelectionRange=jh;P.decorations=Ms;P.blockWrappers=rc;P.outerDecorations=No;P.atomicRanges=un;P.bidiIsolatedRanges=oc;P.cursorScrollMargin=D.define({combine:n=>{let e=5,t=5;for(let i of n)typeof i=="number"?e=t=i:{x:e,y:t}=i;return{x:e,y:t}}});P.scrollMargins=lc;P.darkTheme=eo;P.cspNonce=D.define({combine:n=>n.length?n[0]:""});P.contentAttributes=Io;P.editorAttributes=sc;P.lineWrapping=P.contentAttributes.of({class:"cm-lineWrapping"});P.announce=Q.define();const Lp=4096,Jl={};class rs{constructor(e,t,i,s,r,o){this.from=e,this.to=t,this.dir=i,this.isolates=s,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let i=[],s=e.length?e[e.length-1].dir:te.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&Do(o,t)}return t}const Ip=E.mac?"mac":E.windows?"win":E.linux?"linux":"key";function Np(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let a=0;ai.concat(s),[]))),t}function Hp(n,e,t){return Mc(Ac(n.state),e,n,t)}let St=null;const Fp=4e3;function Vp(n,e=Ip){let t=Object.create(null),i=Object.create(null),s=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,h,c)=>{var f,u;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(y=>Np(y,e));for(let y=1;y{let T=St={view:S,prefix:v,scope:o};return setTimeout(()=>{St==T&&(St=null)},Fp),!0}]})}let m=p.join(" ");s(m,!1);let b=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((u=(f=d._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});a&&b.run.push(a),h&&(b.preventDefault=!0),c&&(b.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let u in c)c[u].run.push(d=>f(d,no))}let a=o[e]||o.key;if(a)for(let h of l)r(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let no=null;function Mc(n,e,t,i){no=e;let s=td(e),r=De(s,0),o=st(r)==s.length&&s!=" ",l="",a=!1,h=!1,c=!1;St&&St.view==t&&St.scope==i&&(l=St.prefix+" ",mc.indexOf(e.keyCode)<0&&(h=!0,St=null));let f=new Set,u=b=>{if(b){for(let y of b.run)if(!f.has(y)&&(f.add(y),y(t)))return b.stopPropagation&&(c=!0),!0;b.preventDefault&&(b.stopPropagation&&(c=!0),h=!0)}return!1},d=n[i],p,m;return d&&(u(d[l+Mn(s,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(E.windows&&e.ctrlKey&&e.altKey)&&!(E.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=Pt[e.keyCode])&&p!=s?(u(d[l+Mn(p,e,!0)])||e.shiftKey&&(m=ji[e.keyCode])!=s&&m!=p&&u(d[l+Mn(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(d[l+Mn(s,e,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&c&&e.stopPropagation(),no=null,a}class Xt{constructor(e,t,i,s,r){this.className=e,this.left=t,this.top=i,this.width=s,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let s=e.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let r=Tc(e);return[new Xt(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return zp(e,t,i)}}function Tc(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==te.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function ta(n,e,t,i){let s=n.coordsAtPos(e,t*2);if(!s)return i;let r=n.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,l=n.posAtCoords({x:r.left+1,y:o}),a=n.posAtCoords({x:r.right-1,y:o});return l==null||a==null?i:{from:Math.max(i.from,Math.min(l,a)),to:Math.min(i.to,Math.max(l,a))}}function zp(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),s=Math.min(t.to,n.viewport.to),r=n.textDirection==te.LTR,o=n.contentDOM,l=o.getBoundingClientRect(),a=Tc(n),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),u=l.right-(c?parseInt(c.paddingRight):0),d=Yr(n,i,1),p=Yr(n,s,-1),m=d.type==ve.Text?d:null,b=p.type==ve.Text?p:null;if(m&&(n.lineWrapping||d.widgetLineBreaks)&&(m=ta(n,i,1,m)),b&&(n.lineWrapping||p.widgetLineBreaks)&&(b=ta(n,s,-1,b)),m&&b&&m.from==b.from&&m.to==b.to)return v(S(t.from,t.to,m));{let C=m?S(t.from,null,m):T(d,!1),A=b?S(null,t.to,b):T(p,!0),w=[];return(m||d).to<(b||p).from-(m&&b?1:0)||d.widgetLineBreaks>1&&C.bottom+n.defaultLineHeight/2B&&V.from<$)for(let K=Math.max(V.from,B),J=Math.min(V.to,$);;){let oe=n.state.doc.lineAt(K);for(let be of n.bidiSpans(oe)){let ie=be.from+oe.from,ue=be.to+oe.from;if(ie>=J)break;ue>K&&W(Math.max(ie,K),C==null&&ie<=B,Math.min(ue,J),A==null&&ue>=$,be.dir)}if(K=oe.to+1,K>=J)break}return j.length==0&&W(B,C==null,$,A==null,n.textDirection),{top:N,bottom:H,horizontal:j}}function T(C,A){let w=l.top+(A?C.top:C.bottom);return{top:w,bottom:w,horizontal:[]}}}function Qp(n,e){return n.constructor==e.constructor&&n.eq(e)}class $p{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(qn)!=e.state.facet(qn)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(qn);for(;t!Qp(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[i].constructor&&s.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e,E.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const qn=D.define();function Pc(n){return[he.define(e=>new $p(e,n)),qn.of(n)]}const ki=D.define({combine(n){return ft(n,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function qp(n={}){return[ki.of(n),_p,Xp,Up,tc.of(!0)]}function Dc(n){return n.startState.facet(ki)!=n.state.facet(ki)}const _p=Pc({above:!0,markers(n){let{state:e}=n,t=e.facet(ki),i=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty||t.drawRangeCursor&&!(r&&E.ios&&t.iosSelectionHandles)){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:k.cursor(s.head,s.assoc);for(let a of Xt.forRange(n,o,l))i.push(a)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Dc(n);return t&&ia(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){ia(e.state,n)},class:"cm-cursorLayer"});function ia(n,e){e.style.animationDuration=n.facet(ki).cursorBlinkRate+"ms"}const Xp=Pc({above:!1,markers(n){let e=[],{main:t,ranges:i}=n.state.selection;for(let s of i)if(!s.empty)for(let r of Xt.forRange(n,"cm-selectionBackground",s))e.push(r);if(E.ios&&!t.empty&&n.state.facet(ki).iosSelectionHandles){for(let s of Xt.forRange(n,"cm-selectionHandle cm-selectionHandle-start",k.cursor(t.from,1)))e.push(s);for(let s of Xt.forRange(n,"cm-selectionHandle cm-selectionHandle-end",k.cursor(t.to,1)))e.push(s)}return e},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||Dc(n)},class:"cm-selectionLayer"}),Up=Zt.highest(P.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Rc=Q.define({map(n,e){return n==null?null:e.mapPos(n)}}),Ni=Oe.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(Rc)?i.value:t,n)}}),jp=he.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(Ni);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(Ni)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(Ni),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(Ni)!=n&&this.view.dispatch({effects:Rc.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Kp(){return[Ni,jp]}function na(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)s(o+l.index,l)}function Gp(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class Yp{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(l,a,h,c)=>s(c,h,h+l[0].length,l,a);else if(typeof i=="function")this.addMatch=(l,a,h,c)=>{let f=i(l,a,h);f&&c(h,h+l[0].length,f)};else if(i)this.addMatch=(l,a,h,c)=>c(h,h+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new bt,i=t.add.bind(t);for(let{from:s,to:r}of Gp(e,this.maxLength))na(e.state.doc,this.regexp,s,r,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(i=Math.min(l,i),s=Math.max(a,s))}),e.viewportMoved||s-i>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,s);if(l>=o){let a=e.state.doc.lineAt(o),h=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lu.push(y.range(m,b));if(a==h)for(this.regexp.lastIndex=c-a.from;(d=this.regexp.exec(a.text))&&d.indexthis.addMatch(b,e,m,p));t=t.update({filterFrom:c,filterTo:f,filter:(m,b)=>mf,add:u})}}return t}}const so=/x/.unicode!=null?"gu":"g",Jp=new RegExp(`[\0-\b --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,so),Zp={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let ir=null;function em(){var n;if(ir==null&&typeof document<"u"&&document.body){let e=document.body.style;ir=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return ir||!1}const _n=D.define({combine(n){let e=ft(n,{render:null,specialChars:Jp,addSpecialChars:null});return(e.replaceTabs=!em())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,so)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,so)),e}});function tm(n={}){return[_n.of(n),im()]}let sa=null;function im(){return sa||(sa=he.fromClass(class{constructor(n){this.view=n,this.decorations=I.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(_n)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Yp({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=De(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,a=Oi(o.text,l,i-o.from);return I.replace({widget:new om((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=I.replace({widget:new rm(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(_n);n.startState.facet(_n)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const nm="•";function sm(n){return n>=32?nm:n==10?"␤":String.fromCharCode(9216+n)}class rm extends ut{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=sm(this.code),i=e.state.phrase("Control character")+" "+(Zp[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class om extends ut{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function lm(){return hm}const am=I.line({class:"cm-activeLine"}),hm=he.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let s=n.lineBlockAt(i.head);s.from>e&&(t.push(am.range(s.from)),e=s.from)}return I.set(t)}},{decorations:n=>n.decorations});class cm extends ut{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Vi(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),s=Yi(t[0],i.direction!="rtl"),r=parseInt(i.lineHeight);return s.bottom-s.top>r*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+r}:s}ignoreEvent(){return!1}}function fm(n){let e=he.fromClass(class{constructor(t){this.view=t,this.placeholder=n?I.set([I.widget({widget:new cm(n),side:1}).range(0)]):I.none}get decorations(){return this.view.state.doc.length?I.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,P.contentAttributes.of({"aria-placeholder":n})]:e}const ro=2e3;function um(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>ro||t.off>ro||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=i;a<=s;a++){let h=n.doc.line(a);h.length<=l&&r.push(k.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=s;a++){let h=n.doc.line(a),c=Hr(h.text,o,n.tabSize,!0);if(c<0)r.push(k.cursor(h.to));else{let f=Hr(h.text,l,n.tabSize);r.push(k.range(h.from+c,h.from+f))}}}return r}function dm(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function ra(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>ro?-1:s==i.length?dm(n,e.clientX):Oi(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function pm(n,e){let t=ra(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=ra(n,s);if(!l)return i;let a=um(n.state,t,l);return a.length?o?k.create(a.concat(i.ranges)):k.create(a):i}}:null}function mm(n){let e=(t=>t.altKey&&t.button==0);return P.mouseSelectionStyle.of((t,i)=>e(i)?pm(t,i):null)}const gm={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},bm={style:"cursor: crosshair"};function ym(n={}){let[e,t]=gm[n.key||"Alt"],i=he.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[i,P.contentAttributes.of(s=>{var r;return!((r=s.plugin(i))===null||r===void 0)&&r.isDown?bm:null})]}const Tn="-10000px";class Ec{constructor(e,t,i,s){this.facet=t,this.createTooltipView=i,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=i(o,r))}update(e,t){var i;let s=e.state.facet(this.facet),r=s.filter(a=>a);if(s===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;at[h]=a),t.length=l.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function xm(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const nr=D.define({combine:n=>{var e,t,i;return{position:E.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||xm}}}),oa=new WeakMap,zo=he.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(nr);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Ec(n,Qo,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(nr);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=Tn,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(E.safari){let o=r.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!r.offsetParent&&r.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(n=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),s=Wo(this.view);return{visible:{left:i.left+s.left,top:i.top+s.top,right:i.right-s.right,bottom:i.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(nr).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:t,space:i,scaleX:s,scaleY:r}=n,o=[];for(let l=0;l=Math.min(t.bottom,i.bottom)||f.rightMath.min(t.right,i.right)+.1)){c.style.top=Tn;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=u.right-u.left,b=(e=oa.get(h))!==null&&e!==void 0?e:u.bottom-u.top,y=h.offset||vm,v=this.view.textDirection==te.LTR,S=u.width>i.right-i.left?v?i.left:i.right-u.width:v?Math.max(i.left,Math.min(f.left-(d?14:0)+y.x,i.right-m)):Math.min(Math.max(i.left,f.left-m+(d?14:0)-y.x),i.right-m),T=this.above[l];!a.strictSide&&(T?f.top-b-p-y.yi.bottom)&&T==i.bottom-f.bottom>f.top-i.top&&(T=this.above[l]=!T);let C=(T?f.top-i.top:i.bottom-f.bottom)-p;if(CS&&N.topA&&(A=T?N.top-b-2-p:N.bottom+p+2);if(this.position=="absolute"?(c.style.top=(A-n.parent.top)/r+"px",la(c,(S-n.parent.left)/s)):(c.style.top=A/r+"px",la(c,S/s)),d){let N=f.left+(v?y.x:-y.x)-(S+14-7);d.style.left=N/s+"px"}h.overlap!==!0&&o.push({left:S,top:A,right:w,bottom:A+b}),c.classList.toggle("cm-tooltip-above",T),c.classList.toggle("cm-tooltip-below",!T),h.positioned&&h.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=Tn}},{eventObservers:{scroll(){this.maybeMeasure()}}});function la(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const km=P.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),vm={x:0,y:0},Qo=D.define({enables:[zo,km]}),os=D.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Es{static create(e){return new Es(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Ec(e,os,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let s=i[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const wm=Qo.compute([os],n=>{let e=n.facet(os);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:Es.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),Bc=D.define();class Sm{constructor(e,t,i,s,r,o){this.view=e,this.source=t,this.field=i,this.locked=s,this.setHover=r,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;eo.bottom||t.xo.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(s)).find(h=>h.from<=s&&h.to>=s),a=l&&l.dir==te.RTL?-1:1;r=t.x{if(l&&!(Array.isArray(l)&&!l.length)){let a=Array.isArray(l)?l:[l];s&&this.locked.set(a,s),e.dispatch({effects:this.setHover.of(a)})}};if(r&&"then"in r){let l=this.pending={pos:t};r.then(a=>{this.pending==l&&(this.pending=null,o(a))},a=>Be(e.state,a,"hover tooltip"))}else o(r)}get tooltip(){let e=this.view.plugin(zo),t=e?e.manager.tooltips.findIndex(i=>i.create==Es.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:r}=this;if(s.length&&!this.locked.has(s)&&r&&!Om(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,l=(i=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!Cm(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t);let{active:s}=this;s.length&&!this.locked.has(s)&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Pn=4;function Om(n,e){let{left:t,right:i,top:s,bottom:r}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();s=Math.min(l.top,s),r=Math.max(l.bottom,r)}return e.clientX>=t-Pn&&e.clientX<=i+Pn&&e.clientY>=s-Pn&&e.clientY<=r+Pn}function Cm(n,e,t,i,s,r){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.rights||Math.min(o.bottom,l)=e&&a<=t}function Am(n,e={}){let t=Q.define(),i=new WeakMap,s=Oe.define({create(){return[]},update(o,l){let a=i.get(o);if(o.length&&(e.hideOnChange&&(l.docChanged||l.selection)?o=[]:a&&a(l)?o=[]:e.hideOn&&(o=o.filter(h=>!e.hideOn(l,h)))),l.docChanged&&o.length){let h=[];for(let c of o){let f=l.changes.mapPos(c.pos,-1,Me.TrackDel);if(f!=null){let u=Object.assign(Object.create(null),c);u.pos=f,u.end!=null&&(u.end=l.changes.mapPos(u.end)),h.push(u)}}o=h}for(let h of l.effects)h.is(t)&&(o=h.value,a=void 0),(h.is(Tm)&&!h.value||h.value==s)&&(o=[]);return o.length&&a&&i.set(o,a),o},provide:o=>os.from(o)});const r=he.define(o=>new Sm(o,n,s,i,t,e.hoverTime||300));return{active:s,extension:[s,r,Bc.of(r),wm]}}function Mm(n,e,t,i={}){var s;let r=n.state.facet(Bc).map(o=>n.plugin(o)).filter(o=>!!o);if(i.tooltip&&i.tooltip.active){let o=r.find(l=>l.field==i.tooltip.active);o&&(r=[o])}for(let o of r)o.activateHover(n,e,t,(s=i.until)!==null&&s!==void 0?s:(()=>!1))}function Lc(n,e){let t=n.plugin(zo);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const Tm=Q.define(),aa=D.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function $o(n,e){let t=n.plugin(Ic),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const Ic=he.fromClass(class{constructor(n){this.input=n.state.facet(Zi),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(aa);this.top=new Dn(n,!0,e.topContainer),this.bottom=new Dn(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(aa);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Dn(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Dn(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Zi);if(t!=this.input){let i=t.filter(a=>a),s=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;h<0?(c=a(n.view),l.push(c)):(c=this.panels[h],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>P.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Dn{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=ha(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=ha(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function ha(n){let e=n.nextSibling;return n.remove(),e}const Zi=D.define({enables:Ic});function Pm(n,e){let t,i=new Promise(o=>t=o),s=o=>Dm(o,e,t);n.state.field(sr,!1)?n.dispatch({effects:Nc.of(s)}):n.dispatch({effects:Q.appendConfig.of(sr.init(()=>[s]))});let r=Wc.of(s);return{close:r,result:i.then(o=>((n.win.queueMicrotask||(a=>n.win.setTimeout(a,10)))(()=>{n.state.field(sr).indexOf(s)>-1&&n.dispatch({effects:r})}),o))}}const sr=Oe.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(Nc)?n=[t.value].concat(n):t.is(Wc)&&(n=n.filter(i=>i!=t.value));return n},provide:n=>Zi.computeN([n],e=>e.field(n))}),Nc=Q.define(),Wc=Q.define();function Dm(n,e,t){let i=e.content?e.content(n,()=>o(null)):null;if(!i){if(i=Z("form"),e.input){let l=Z("input",e.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),i.appendChild(Z("label",(e.label||"")+": ",l))}else i.appendChild(document.createTextNode(e.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(Z("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let s=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let l=0;l{h.keyCode==27?(h.preventDefault(),o(null)):h.keyCode==13&&(h.preventDefault(),o(a))}),a.addEventListener("submit",h=>{h.preventDefault(),o(a)})}let r=Z("div",i,Z("button",{onclick:()=>o(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(r.className=e.class),r.classList.add("cm-dialog");function o(l){r.contains(r.ownerDocument.activeElement)&&n.focus(),t(l)}return{dom:r,top:e.top,mount:()=>{if(e.focus){let l;typeof e.focus=="string"?l=i.querySelector(e.focus):l=i.querySelector("input")||i.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class xt extends Mt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}xt.prototype.elementClass="";xt.prototype.toDOM=void 0;xt.prototype.mapMode=Me.TrackBefore;xt.prototype.startSide=xt.prototype.endSide=-1;xt.prototype.point=!0;const Xn=D.define(),Rm=D.define(),Em={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>_.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},$i=D.define();function Bm(n){return[Hc(),$i.of({...Em,...n})]}const ca=D.define({combine:n=>n.some(e=>e)});function Hc(n){return[Lm]}const Lm=he.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet($i).map(e=>new ua(n,e)),this.fixed=!n.state.facet(ca);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(ca)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=_.iter(this.view.state.facet(Xn),this.view.viewport.from),i=[],s=this.gutters.map(r=>new Im(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let l of r.type)if(l.type==ve.Text&&o){oo(t,i,l.from);for(let a of s)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of s)a.widget(this.view,l)}else if(r.type==ve.Text){oo(t,i,r.from);for(let o of s)o.line(this.view,r,i)}else if(r.widget)for(let o of s)o.widget(this.view,r);for(let r of s)r.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet($i),t=n.state.facet($i),i=n.docChanged||n.heightChanged||n.viewportChanged||!_.eq(n.startState.facet(Xn),n.state.facet(Xn),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(n)&&(i=!0);else{i=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new ua(this.view,r)):(this.gutters[o].update(n),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)r.config.side=="after"?this.getDOMAfter().appendChild(r.dom):this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>P.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,s=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==te.LTR?{left:i,right:s}:{right:i,left:s}})});function fa(n){return Array.isArray(n)?n:[n]}function oo(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class Im{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=_.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let l=new Fc(e,o,r,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,o,r,i);this.height=t.bottom,this.i++}line(e,t,i){let s=[];oo(this.cursor,s,t.from),i.length&&(s=s.concat(i));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),s=i?[i]:null;for(let r of e.state.facet(Rm)){let o=r(e,t.widget,t);o&&(s||(s=[])).push(o)}s&&this.addElement(e,t,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class ua{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let a=r.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=s.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,l,s)&&s.preventDefault()});this.markers=fa(t.markers(e)),t.initialSpacer&&(this.spacer=new Fc(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=fa(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let i=e.view.viewport;return!_.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Fc{constructor(e,t,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,s)}update(e,t,i,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),Nm(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let l=o,a=rr(l,a,h)||o(l,a,h):o}return i}})}});class rr extends xt{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function or(n,e){return n.state.facet(oi).formatNumber(e,n.state)}const Fm=$i.compute([oi],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Wm)},lineMarker(e,t,i){return i.some(s=>s.toDOM)?null:new rr(or(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let s of e.state.facet(Hm)){let r=s(e,t,i);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(oi)!=e.state.facet(oi),initialSpacer(e){return new rr(or(e,da(e.state.doc.lines)))},updateSpacer(e,t){let i=or(t.view,da(t.view.state.doc.lines));return i==e.number?e:new rr(i)},domEventHandlers:n.facet(oi).domEventHandlers,side:"before"}));function Vm(n={}){return[oi.of(n),Hc(),Fm]}function da(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(zm.range(s)))}return _.of(e)});function $m(){return Qm}const Vc=1024;let qm=0;class lr{constructor(e,t){this.from=e,this.to=t}}class q{constructor(e={}){this.id=qm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Ne.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}q.closedBy=new q({deserialize:n=>n.split(" ")});q.openedBy=new q({deserialize:n=>n.split(" ")});q.group=new q({deserialize:n=>n.split(" ")});q.isolate=new q({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});q.contextHash=new q({perNode:!0});q.lookAhead=new q({perNode:!0});q.mounted=new q({perNode:!0});class qi{constructor(e,t,i,s=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=s}static get(e){return e&&e.props&&e.props[q.mounted.id]}}const _m=Object.create(null);class Ne{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):_m,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new Ne(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(q.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(q.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}Ne.none=new Ne("",Object.create(null),0,8);class qo{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|le.IncludeAnonymous);;){let h=!1;if(a.from<=r&&a.to>=s&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Uo(Ne.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new fe(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new fe(Ne.none,t,i,s)))}static build(e){return Km(e)}}fe.empty=new fe(Ne.none,[],[],0);class _o{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new _o(this.buffer,this.index)}}class Rt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Ne.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,i){let s=this.buffer,r=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function en(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?l.length:-1;e!=h;e+=t){let c=l[e],f=a[e]+o.from,u;if(!(!(r&le.EnterBracketed&&c instanceof fe&&(u=qi.get(c))&&!u.overlay&&u.bracketed&&i>=f&&i<=f+c.length)&&!zc(s,i,f,f+c.length))){if(c instanceof Rt){if(r&le.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,t,i-f,s);if(d>-1)return new Ct(new Xm(o,c,e,f),null,d)}else if(r&le.IncludeAnonymous||!c.type.isAnonymous||Xo(c)){let d;if(!(r&le.IgnoreMounts)&&(d=qi.get(c))&&!d.overlay)return new qe(d.tree,f,e,o);let p=new qe(c,f,e,o);return r&le.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?c.children.length-1:0,t,i,s,r)}}}if(r&le.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let s;if(!(i&le.IgnoreOverlays)&&(s=qi.get(this._tree))&&s.overlay){let r=e-this.from,o=i&le.EnterBracketed&&s.bracketed;for(let{from:l,to:a}of s.overlay)if((t>0||o?l<=r:l=r:a>r))return new qe(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ma(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=s.type.is(t),!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function lo(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class Xm{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class Ct extends Qc{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new Ct(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&le.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Ct(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Ct(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Ct(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1];e.push(i.slice(s,r,o)),t.push(0)}return new fe(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function $c(n){if(!n.length)return null;let e=0,t=n[0];for(let r=1;rt.from||o.to=e){let l=new qe(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[i])).push(en(l,e,t,!1))}}return s?$c(s):i}class ao{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~le.EnterBracketed,e instanceof qe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof qe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&le.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&le.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&le.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&le.IncludeAnonymous||l instanceof Rt||!l.type.isAnonymous||Xo(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}for(let s=i;s=0;r--){if(r<0)return lo(this._tree,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function Xo(n){return n.children.some(e=>e instanceof Rt||!e.type.isAnonymous||Xo(e))}function Km(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=Vc,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new _o(t,t.length):t,a=i.types,h=0,c=0;function f(C,A,w,N,H,j){let{id:W,start:B,end:$,size:V}=l,K=c,J=h;if(V<0)if(l.next(),V==-1){let g=r[W];w.push(g),N.push(B-C);return}else if(V==-3){h=W;return}else if(V==-4){c=W;return}else throw new RangeError(`Unrecognized record size: ${V}`);let oe=a[W],be,ie,ue=B-C;if($-B<=s&&(ie=b(l.pos-A,H))){let g=new Uint16Array(ie.size-ie.skip),O=l.pos-ie.size,L=g.length;for(;l.pos>O;)L=y(ie.start,g,L);be=new Rt(g,$-ie.start,i),ue=ie.start-C}else{let g=l.pos-V;l.next();let O=[],L=[],R=W>=o?W:-1,z=0,X=$;for(;l.pos>g;)R>=0&&l.id==R&&l.size>=0?(l.end<=X-s&&(p(O,L,B,z,l.end,X,R,K,J),z=O.length,X=l.end),l.next()):j>2500?u(B,g,O,L):f(B,g,O,L,R,j+1);if(R>=0&&z>0&&z-1&&z>0){let Y=d(oe,J);be=Uo(oe,O,L,0,O.length,0,$-B,Y,Y)}else be=m(oe,O,L,$-B,K-$,J)}w.push(be),N.push(ue)}function u(C,A,w,N){let H=[],j=0,W=-1;for(;l.pos>A;){let{id:B,start:$,end:V,size:K}=l;if(K>4)l.next();else{if(W>-1&&$=0;V-=3)B[K++]=H[V],B[K++]=H[V+1]-$,B[K++]=H[V+2]-$,B[K++]=K;w.push(new Rt(B,H[2]-$,i)),N.push($-C)}}function d(C,A){return(w,N,H)=>{let j=0,W=w.length-1,B,$;if(W>=0&&(B=w[W])instanceof fe){if(!W&&B.type==C&&B.length==H)return B;($=B.prop(q.lookAhead))&&(j=N[W]+B.length+$)}return m(C,w,N,H,j,A)}}function p(C,A,w,N,H,j,W,B,$){let V=[],K=[];for(;C.length>N;)V.push(C.pop()),K.push(A.pop()+w-H);C.push(m(i.types[W],V,K,j-H,B-j,$)),A.push(H-w)}function m(C,A,w,N,H,j,W){if(j){let B=[q.contextHash,j];W=W?[B].concat(W):[B]}if(H>25){let B=[q.lookAhead,H];W=W?[B].concat(W):[B]}return new fe(C,A,w,N,W)}function b(C,A){let w=l.fork(),N=0,H=0,j=0,W=w.end-s,B={size:0,start:0,skip:0};e:for(let $=w.pos-C;w.pos>$;){let V=w.size;if(w.id==A&&V>=0){B.size=N,B.start=H,B.skip=j,j+=4,N+=4,w.next();continue}let K=w.pos-V;if(V<0||K<$||w.start=o?4:0,oe=w.start;for(w.next();w.pos>K;){if(w.size<0)if(w.size==-3||w.size==-4)J+=4;else break e;else w.id>=o&&(J+=4);w.next()}H=oe,N+=V,j+=J}return(A<0||N==C)&&(B.size=N,B.start=H,B.skip=j),B.size>4?B:void 0}function y(C,A,w){let{id:N,start:H,end:j,size:W}=l;if(l.next(),W>=0&&N4){let $=l.pos-(W-4);for(;l.pos>$;)w=y(C,A,w)}A[--w]=B,A[--w]=j-C,A[--w]=H-C,A[--w]=N}else W==-3?h=N:W==-4&&(c=N);return w}let v=[],S=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,v,S,-1,0);let T=(e=n.length)!==null&&e!==void 0?e:v.length?S[0]+v[0].length:0;return new fe(a[n.topID],v.reverse(),S.reverse(),T)}const ga=new WeakMap;function Un(n,e){if(!n.isAnonymous||e instanceof Rt||e.type!=n)return 1;let t=ga.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof fe)){t=1;break}t+=Un(n,i)}ga.set(e,t)}return t}function Uo(n,e,t,i,s,r,o,l,a){let h=0;for(let p=i;p=c)break;A+=w}if(S==T+1){if(A>c){let w=p[T];d(w.children,w.positions,0,w.children.length,m[T]+v);continue}f.push(p[T])}else{let w=m[S-1]+p[S-1].length-C;f.push(Uo(n,p,m,T,S,C,w,null,a))}u.push(C+v-r)}}return d(e,t,i,s,0),(l||a)(f,u,o)}class Ut{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new Ut(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||h){let d=Math.max(u.from,a)-h,p=Math.min(u.to,f)-h;u=d>=p?null:new Ut(d,p,u.tree,u.offset+h,l>0,!!c)}if(u&&s.push(u),o.to>f)break;o=rnew lr(s.from,s.to)):[new lr(0,0)]:[new lr(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class Gm{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new q({perNode:!0});let Ym=0,dt=class ho{constructor(e,t,i,s){this.name=e,this.set=t,this.base=i,this.modified=s,this.id=Ym++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof ho&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let s=new ho(i,[],null,[]);if(s.set.push(s),t)for(let r of t.set)s.set.push(r);return s}static defineModifier(e){let t=new ls(e);return i=>i.modified.indexOf(t)>-1?i:ls.get(i.base||i,i.modified.concat(t).sort((s,r)=>s.id-r.id))}},Jm=0;class ls{constructor(e){this.name=e,this.instances=[],this.id=Jm++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&Zm(t,l.modified));if(i)return i;let s=[],r=new dt(e.name,s,e,t);for(let l of t)l.instances.push(r);let o=eg(t);for(let l of e.set)if(!l.modified.length)for(let a of o)s.push(ls.get(l,a));return r}}function Zm(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function eg(n){let e=[[]];for(let t=0;ti.length-t.length)}function _c(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let s of t.split(" "))if(s){let r=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+s);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let d=s[f++];if(f==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+s);let c=new tn(i,o,a>0?r.slice(0,a):null);e[h]=c.sort(e[h])}}return Xc.add(e)}const Xc=new q({combine(n,e){let t,i,s;for(;n||e;){if(!n||e&&n.depth>=e.depth?(s=e,e=e.next):(s=n,n=n.next),t&&t.mode==s.mode&&!s.context&&!t.context)continue;let r=new tn(s.tags,s.mode,s.context);t?t.next=r:i=r,t=r}return i}});class tn{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=s;for(let l of r)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function tg(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function ig(n,e,t,i=0,s=n.length){let r=new ng(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class ng{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=s,c=sg(e)||tn.empty,f=tg(r,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(t,l),h),c.opaque)return;let u=e.tree&&e.tree.prop(q.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(b=>!b.scope||b.scope(u.tree.type)),m=e.firstChild();for(let b=0,y=l;;b++){let v=b=S||!e.nextSibling())););if(!v||S>i)break;y=v.to+l,y>t&&(this.highlightRange(d.cursor(),Math.max(t,v.from+l),Math.min(i,y),"",p),this.startSpan(Math.min(i,y),h))}m&&e.parent()}else if(e.firstChild()){u&&(s="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function sg(n){let e=n.type.prop(Xc);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const M=dt.define,En=M(),vt=M(),ba=M(vt),ya=M(vt),wt=M(),Bn=M(wt),ar=M(wt),it=M(),Wt=M(it),et=M(),tt=M(),co=M(),Ri=M(co),Ln=M(),x={comment:En,lineComment:M(En),blockComment:M(En),docComment:M(En),name:vt,variableName:M(vt),typeName:ba,tagName:M(ba),propertyName:ya,attributeName:M(ya),className:M(vt),labelName:M(vt),namespace:M(vt),macroName:M(vt),literal:wt,string:Bn,docString:M(Bn),character:M(Bn),attributeValue:M(Bn),number:ar,integer:M(ar),float:M(ar),bool:M(wt),regexp:M(wt),escape:M(wt),color:M(wt),url:M(wt),keyword:et,self:M(et),null:M(et),atom:M(et),unit:M(et),modifier:M(et),operatorKeyword:M(et),controlKeyword:M(et),definitionKeyword:M(et),moduleKeyword:M(et),operator:tt,derefOperator:M(tt),arithmeticOperator:M(tt),logicOperator:M(tt),bitwiseOperator:M(tt),compareOperator:M(tt),updateOperator:M(tt),definitionOperator:M(tt),typeOperator:M(tt),controlOperator:M(tt),punctuation:co,separator:M(co),bracket:Ri,angleBracket:M(Ri),squareBracket:M(Ri),paren:M(Ri),brace:M(Ri),content:it,heading:Wt,heading1:M(Wt),heading2:M(Wt),heading3:M(Wt),heading4:M(Wt),heading5:M(Wt),heading6:M(Wt),contentSeparator:M(it),list:M(it),quote:M(it),emphasis:M(it),strong:M(it),link:M(it),monospace:M(it),strikethrough:M(it),inserted:M(),deleted:M(),changed:M(),invalid:M(),meta:Ln,documentMeta:M(Ln),annotation:M(Ln),processingInstruction:M(Ln),definition:dt.defineModifier("definition"),constant:dt.defineModifier("constant"),function:dt.defineModifier("function"),standard:dt.defineModifier("standard"),local:dt.defineModifier("local"),special:dt.defineModifier("special")};for(let n in x){let e=x[n];e instanceof dt&&(e.name=n)}Uc([{tag:x.link,class:"tok-link"},{tag:x.heading,class:"tok-heading"},{tag:x.emphasis,class:"tok-emphasis"},{tag:x.strong,class:"tok-strong"},{tag:x.keyword,class:"tok-keyword"},{tag:x.atom,class:"tok-atom"},{tag:x.bool,class:"tok-bool"},{tag:x.url,class:"tok-url"},{tag:x.labelName,class:"tok-labelName"},{tag:x.inserted,class:"tok-inserted"},{tag:x.deleted,class:"tok-deleted"},{tag:x.literal,class:"tok-literal"},{tag:x.string,class:"tok-string"},{tag:x.number,class:"tok-number"},{tag:[x.regexp,x.escape,x.special(x.string)],class:"tok-string2"},{tag:x.variableName,class:"tok-variableName"},{tag:x.local(x.variableName),class:"tok-variableName tok-local"},{tag:x.definition(x.variableName),class:"tok-variableName tok-definition"},{tag:x.special(x.variableName),class:"tok-variableName2"},{tag:x.definition(x.propertyName),class:"tok-propertyName tok-definition"},{tag:x.typeName,class:"tok-typeName"},{tag:x.namespace,class:"tok-namespace"},{tag:x.className,class:"tok-className"},{tag:x.macroName,class:"tok-macroName"},{tag:x.propertyName,class:"tok-propertyName"},{tag:x.operator,class:"tok-operator"},{tag:x.comment,class:"tok-comment"},{tag:x.meta,class:"tok-meta"},{tag:x.invalid,class:"tok-invalid"},{tag:x.punctuation,class:"tok-punctuation"}]);var hr;const li=new q;function rg(n){return D.define({combine:n?e=>e.concat(n):void 0})}const og=new q;class je{constructor(e,t,i=[],s=""){this.data=e,this.name=s,U.prototype.hasOwnProperty("tree")||Object.defineProperty(U.prototype,"tree",{get(){return Se(this)}}),this.parser=t,this.extension=[Et.of(this),U.languageData.of((r,o,l)=>{let a=xa(r,o,l),h=a.type.prop(li);if(!h)return[];let c=r.facet(h),f=a.type.prop(og);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,r)){let p=r.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return xa(e,t,i).type.prop(li)==this.data}findRegions(e){let t=e.facet(Et);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(li)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(q.mounted);if(l){if(l.tree.prop(li)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;ai.isTop?t:void 0)]}),e.name)}configure(e,t){return new as(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Se(n){let e=n.field(je.state,!1);return e?e.tree:fe.empty}class lg{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Ei=null;class hs{constructor(e,t,i=[],s,r,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new hs(e,t,[],fe.empty,0,i,[],null)}startParse(){return this.parser.startParse(new lg(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=fe.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Ut.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Ei;Ei=this;try{return e()}finally{Ei=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=ka(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=Ut.applyChanges(i,a),s=fe.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);ce.from&&(this.fragments=ka(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends qc{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let a=Ei;if(a){for(let h of s)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new fe(Ne.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Ei}}function ka(n,e,t){return Ut.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class vi{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new vi(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=hs.create(e.facet(Et).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new vi(i)}}je.state=Oe.define({create:vi.init,update(n,e){for(let t of e.effects)if(t.is(je.setState))return t.value;return e.startState.facet(Et)!=e.state.facet(Et)?vi.init(e.state):n.apply(e)}});let jc=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(jc=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const cr=typeof navigator<"u"&&(!((hr=navigator.scheduling)===null||hr===void 0)&&hr.isInputPending)?()=>navigator.scheduling.isInputPending():null,ag=he.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(je.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(je.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=jc(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3,a=r.context.work(()=>cr&&cr()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:je.setState.of(new vi(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Be(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Et=D.define({combine(n){return n.length?n[0]:null},enables:n=>[je.state,ag,P.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class hg{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const cg=D.define(),Bs=D.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function cs(n){let e=n.facet(Bs);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function nn(n,e){let t="",i=n.tabSize,s=n.facet(Bs)[0];if(s==" "){for(;e>=i;)t+=" ",e-=i;s=" "}for(let r=0;r=e?fg(n,t,e):null}class Ls{constructor(e,t={}){this.state=e,this.options=t,this.unit=cs(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:r}=this.options;return s!=null&&s>=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return Oi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Kc=new q;function fg(n,e,t){let i=e.resolveStack(t),s=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(s!=i.node){let r=[];for(let o=s;o&&!(o.fromi.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return Gc(i,n,t)}function Gc(n,e,t){for(let i=n;i;i=i.next){let s=dg(i.node);if(s)return s(Ko.create(e,t,i))}return 0}function ug(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function dg(n){let e=n.type.prop(Kc);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(q.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>Yc(o,!0,1,void 0,r&&!ug(o)?s.from:void 0)}return n.parent==null?pg:null}function pg(){return 0}class Ko extends Ls{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new Ko(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(mg(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return Gc(this.context.next,this.base,this.pos)}}function mg(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function gg(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let h=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+h}}l=a.to}}function va({closing:n,align:e=!0,units:t=1}){return i=>Yc(i,e,t,n)}function Yc(n,e,t,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||s==n.pos+o,a=e?gg(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}const bg=200;function yg(){return U.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,s=t.lineAt(i);if(i>s.from+bg)return n;let r=t.sliceString(s.from,i);if(!e.some(h=>h.test(r)))return n;let{state:o}=n,l=-1,a=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==l)continue;l=c.from;let f=jo(o,c.from);if(f==null)continue;let u=/^\s*/.exec(c.text)[0],d=nn(o,f);u!=d&&a.push({from:c.from,to:c.from+u.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const xg=D.define(),Jc=new q;function kg(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(r&&l.from=e&&h.to>t&&(r=h)}}return r}function wg(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function fs(n,e,t){for(let i of n.facet(xg)){let s=i(n,e,t);if(s)return s}return vg(n,e,t)}function Zc(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const Is=Q.define({map:Zc}),dn=Q.define({map:Zc});function ef(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const Jt=Oe.define({create(){return I.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,i)=>n=wa(n,t,i)),n=n.map(e.changes);for(let t of e.effects)if(t.is(Is)&&!Sg(n,t.value.from,t.value.to)){let{preparePlaceholder:i}=e.state.facet(sf),s=i?I.replace({widget:new Dg(i(e.state,t.value))}):Sa;n=n.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(dn)&&(n=n.update({filter:(i,s)=>t.value.from!=i||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=wa(n,e.selection.main.head)),n},provide:n=>P.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,s)=>{t.push(i,s)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{se&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(s,r)=>s>=t||r<=e}):n}function us(n,e,t){var i;let s=null;return(i=n.field(Jt,!1))===null||i===void 0||i.between(e,t,(r,o)=>{(!s||s.from>r)&&(s={from:r,to:o})}),s}function Sg(n,e,t){let i=!1;return n.between(e,e,(s,r)=>{s==e&&r==t&&(i=!0)}),i}function tf(n,e){return n.field(Jt,!1)?e:e.concat(Q.appendConfig.of(rf()))}const Og=n=>{for(let e of ef(n)){let t=fs(n.state,e.from,e.to);if(t)return n.dispatch({effects:tf(n.state,[Is.of(t),nf(n,t)])}),!0}return!1},Cg=n=>{if(!n.state.field(Jt,!1))return!1;let e=[];for(let t of ef(n)){let i=us(n.state,t.from,t.to);i&&e.push(dn.of(i),nf(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function nf(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,s=n.state.doc.lineAt(e.to).number;return P.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${s}.`)}const Ag=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(Jt,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,s)=>{t.push(dn.of({from:i,to:s}))}),n.dispatch({effects:t}),!0},Tg=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Og},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Cg},{key:"Ctrl-Alt-[",run:Ag},{key:"Ctrl-Alt-]",run:Mg}],Pg={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},sf=D.define({combine(n){return ft(n,Pg)}});function rf(n){return[Jt,Bg]}function of(n,e){let{state:t}=n,i=t.facet(sf),s=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=us(n.state,l.from,l.to);a&&n.dispatch({effects:dn.of(a)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,s,e);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",t.phrase("folded code")),r.title=t.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const Sa=I.replace({widget:new class extends ut{toDOM(n){return of(n,null)}}});class Dg extends ut{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return of(e,this.value)}}const Rg={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class fr extends xt{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function Eg(n={}){let e={...Rg,...n},t=new fr(e,!0),i=new fr(e,!1),s=he.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Et)!=o.state.facet(Et)||o.startState.field(Jt,!1)!=o.state.field(Jt,!1)||Se(o.startState)!=Se(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new bt;for(let a of o.viewportLineBlocks){let h=us(o.state,a.from,a.to)?i:fs(o.state,a.from,a.to)?t:null;h&&l.add(a.from,a.from,h)}return l.finish()}}),{domEventHandlers:r}=e;return[s,Bm({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||_.empty},initialSpacer(){return new fr(e,!1)},domEventHandlers:{...r,click:(o,l,a)=>{if(r.click&&r.click(o,l,a))return!0;let h=us(o.state,l.from,l.to);if(h)return o.dispatch({effects:dn.of(h)}),!0;let c=fs(o.state,l.from,l.to);return c?(o.dispatch({effects:Is.of(c)}),!0):!1}}}),rf()]}const Bg=P.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class pn{constructor(e,t){this.specs=e;let i;function s(l){let a=Tt.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof je?l=>l.prop(li)==o.data:o?l=>l==o:void 0,this.style=Uc(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new Tt(i):null,this.themeType=t.themeType}static define(e,t){return new pn(e,t||{})}}const fo=D.define(),lf=D.define({combine(n){return n.length?[n[0]]:null}});function ur(n){let e=n.facet(fo);return e.length?e:n.facet(lf)}function af(n,e){let t=[Ig],i;return n instanceof pn&&(n.module&&t.push(P.styleModule.of(n.module)),i=n.themeType),e?.fallback?t.push(lf.of(n)):i?t.push(fo.computeN([P.darkTheme],s=>s.facet(P.darkTheme)==(i=="dark")?[n]:[])):t.push(fo.of(n)),t}class Lg{constructor(e){this.markCache=Object.create(null),this.tree=Se(e.state),this.decorations=this.buildDeco(e,ur(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Se(e.state),i=ur(e.state),s=i!=ur(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return I.none;let i=new bt;for(let{from:s,to:r}of e.visibleRanges)ig(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=I.mark({class:a})))},s,r);return i.finish()}}const Ig=Zt.high(he.fromClass(Lg,{decorations:n=>n.decorations})),Ng=pn.define([{tag:x.meta,color:"#404740"},{tag:x.link,textDecoration:"underline"},{tag:x.heading,textDecoration:"underline",fontWeight:"bold"},{tag:x.emphasis,fontStyle:"italic"},{tag:x.strong,fontWeight:"bold"},{tag:x.strikethrough,textDecoration:"line-through"},{tag:x.keyword,color:"#708"},{tag:[x.atom,x.bool,x.url,x.contentSeparator,x.labelName],color:"#219"},{tag:[x.literal,x.inserted],color:"#164"},{tag:[x.string,x.deleted],color:"#a11"},{tag:[x.regexp,x.escape,x.special(x.string)],color:"#e40"},{tag:x.definition(x.variableName),color:"#00f"},{tag:x.local(x.variableName),color:"#30a"},{tag:[x.typeName,x.namespace],color:"#085"},{tag:x.className,color:"#167"},{tag:[x.special(x.variableName),x.macroName],color:"#256"},{tag:x.definition(x.propertyName),color:"#00c"},{tag:x.comment,color:"#940"},{tag:x.invalid,color:"#f00"}]),Wg=P.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),hf=1e4,cf="()[]{}",ff=D.define({combine(n){return ft(n,{afterCursor:!0,brackets:cf,maxScanDistance:hf,renderMatch:Vg})}}),Hg=I.mark({class:"cm-matchingBracket"}),Fg=I.mark({class:"cm-nonmatchingBracket"});function Vg(n){let e=[],t=n.matched?Hg:Fg;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function Oa(n){let e=[],t=n.facet(ff);for(let i of n.selection.ranges){if(!i.empty)continue;let s=lt(n,i.head,-1,t)||i.head>0&<(n,i.head-1,1,t)||t.afterCursor&&(lt(n,i.head,1,t)||i.headn.decorations}),Qg=[zg,Wg];function $g(n={}){return[ff.of(n),Qg]}const qg=new q;function uo(n,e,t){let i=n.prop(e<0?q.openedBy:q.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function po(n){let e=n.type.prop(qg);return e?e(n.node):n}function lt(n,e,t,i={}){let s=i.maxScanDistance||hf,r=i.brackets||cf,o=Se(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=uo(a.type,t,r);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return _g(n,e,t,a,c,h,r)}}return Xg(n,e,t,o,l.type,s,r)}function _g(n,e,t,i,s,r,o){let l=i.parent,a={from:s.from,to:s.to},h=0,c=l?.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let p=e+u*t;for(let m=t>0?0:d.length-1,b=t>0?d.length:-1;m!=b;m+=t){let y=o.indexOf(d[m]);if(!(y<0||i.resolveInner(p+m,1).type!=s))if(y%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:p+m,to:p+m+1},matched:y>>1==a>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:h,matched:!1}:null}const Ug=Object.create(null),Ca=[Ne.none],Aa=[],Ma=Object.create(null),jg=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])jg[n]=Kg(Ug,e);function dr(n,e){Aa.indexOf(n)>-1||(Aa.push(n),console.warn(e))}function Kg(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||x[h];c?typeof c=="function"?a.length?a=a.map(c):dr(h,`Modifier ${h} used at start of tag`):a.length?dr(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:dr(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),s=i+" "+t.map(l=>l.id),r=Ma[s];if(r)return r.id;let o=Ma[s]=Ne.define({id:Ca.length,name:i,props:[_c({[i]:t})]});return Ca.push(o),o.id}te.RTL,te.LTR;const Gg=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Yo(n.state,t.from);return i.line?Yg(n):i.block?Zg(n):!1};function Go(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const Yg=Go(i0,0),Jg=Go(uf,0),Zg=Go((n,e)=>uf(n,e,t0(e)),0);function Yo(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Bi=50;function e0(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-Bi,i),o=n.sliceDoc(s,s+Bi),l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length,h=r.length-l;if(r.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+a,margin:a&&1}};let c,f;s-i<=2*Bi?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+Bi),f=n.sliceDoc(s-Bi,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function t0(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to);s.from>i.from&&s.from==t.to&&(s=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return e}function uf(n,e,t=e.selection.ranges){let i=t.map(r=>Yo(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>e0(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>f.from)){s=f.from;let u=/^\s*/.exec(f.text)[0].length,d=u==f.length,p=f.text.slice(u,u+h.length)==h?u:-1;ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:a,indent:h,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+h,insert:a+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,c=h+a.length;o.text[c-o.from]==" "&&c++,r.push({from:h,to:c})}return{changes:r}}return null}const mo=ct.define(),n0=ct.define(),s0=D.define(),df=D.define({combine(n){return ft(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,s)=>e(i,s)||t(i,s)})}}),pf=Oe.define({create(){return at.empty},update(n,e){let t=e.state.facet(df),i=e.annotation(mo);if(i){let a=Le.fromTransaction(e,i.selection),h=i.side,c=h==0?n.undone:n.done;return a?c=ds(c,c.length,t.minDepth,a):c=bf(c,e.startState.selection),new at(h==0?i.rest:c,h==0?c:i.rest)}let s=e.annotation(n0);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(pe.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=Le.fromTransaction(e),o=e.annotation(pe.time),l=e.annotation(pe.userEvent);return r?n=n.addChanges(r,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new at(n.done.map(Le.fromJSON),n.undone.map(Le.fromJSON))}});function r0(n={}){return[pf,df.of(n),P.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?mf:e.inputType=="historyRedo"?go:null;return i?(e.preventDefault(),i(t)):!1}})]}function Ns(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(pf,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const mf=Ns(0,!1),go=Ns(1,!1),o0=Ns(0,!0),l0=Ns(1,!0);class Le{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new Le(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new Le(e.changes&&de.fromJSON(e.changes),[],e.mapped&&ht.fromJSON(e.mapped),e.startSelection&&k.fromJSON(e.startSelection),e.selectionsAfter.map(k.fromJSON))}static fromTransaction(e,t){let i=Qe;for(let s of e.startState.facet(s0)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new Le(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Qe)}static selection(e){return new Le(void 0,Qe,void 0,void 0,e)}}function ds(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function a0(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let a=0;a=h&&o<=c&&(i=!0)}}),i}function h0(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function gf(n,e){return n.length?e.length?n.concat(e):n:e}const Qe=[],c0=200;function bf(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-c0));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),ds(n,n.length-1,1e9,t.setSelAfter(i)))}else return[Le.selection([e])]}function f0(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function pr(n,e){if(!n.length)return n;let t=n.length,i=Qe;for(;t;){let s=u0(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[Le.selection(i)]:Qe}function u0(n,e,t){let i=gf(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Qe,t);if(!n.changes)return Le.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new Le(s,Q.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const d0=/^(input\.type|delete)($|\.)/;class at{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new at(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||d0.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):Ws(t,e))}function Ce(n){return n.textDirectionAt(n.state.selection.main.head)==te.LTR}const xf=n=>yf(n,!Ce(n)),kf=n=>yf(n,Ce(n));function vf(n,e){return Ye(n,t=>t.empty?n.moveByGroup(t,e):Ws(t,e))}const m0=n=>vf(n,!Ce(n)),g0=n=>vf(n,Ce(n));function b0(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function Hs(n,e,t){let i=Se(n).resolveInner(e.head),s=t?q.closedBy:q.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;b0(n,h,s)?i=h:a=t?h.to:h.from}let r=i.type.prop(s),o,l;return r&&(o=t?lt(n,i.from,1):lt(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,k.cursor(l,t?-1:1)}const y0=n=>Ye(n,e=>Hs(n.state,e,!Ce(n))),x0=n=>Ye(n,e=>Hs(n.state,e,Ce(n)));function wf(n,e){return Ye(n,t=>{if(!t.empty)return Ws(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const Sf=n=>wf(n,!1),Of=n=>wf(n,!0);function Cf(n){let e=n.scrollDOM.clientHeighto.empty?n.moveVertically(o,e,t.height):Ws(o,e));if(s.eq(i.selection))return!1;let r;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottomAf(n,!1),bo=n=>Af(n,!0);function Lt(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=k.cursor(i.from+r))}return s}const k0=n=>Ye(n,e=>Lt(n,e,!0)),v0=n=>Ye(n,e=>Lt(n,e,!1)),w0=n=>Ye(n,e=>Lt(n,e,!Ce(n))),S0=n=>Ye(n,e=>Lt(n,e,Ce(n))),O0=n=>Ye(n,e=>k.cursor(n.lineBlockAt(e.head).from,1)),C0=n=>Ye(n,e=>k.cursor(n.lineBlockAt(e.head).to,-1));function A0(n,e,t){let i=!1,s=Ci(n.selection,r=>{let o=lt(n,r.head,-1)||lt(n,r.head,1)||r.head>0&<(n,r.head-1,1)||r.headA0(n,e);function _e(n,e){let t=Ci(n.state.selection,i=>{let s=e(i);return k.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return t.eq(n.state.selection)?!1:(n.dispatch(Ge(n.state,t)),!0)}function Mf(n,e){return _e(n,t=>n.moveByChar(t,e))}const Tf=n=>Mf(n,!Ce(n)),Pf=n=>Mf(n,Ce(n));function Df(n,e){return _e(n,t=>n.moveByGroup(t,e))}const T0=n=>Df(n,!Ce(n)),P0=n=>Df(n,Ce(n)),D0=n=>_e(n,e=>Hs(n.state,e,!Ce(n))),R0=n=>_e(n,e=>Hs(n.state,e,Ce(n)));function Rf(n,e){return _e(n,t=>n.moveVertically(t,e))}const Ef=n=>Rf(n,!1),Bf=n=>Rf(n,!0);function Lf(n,e){return _e(n,t=>n.moveVertically(t,e,Cf(n).height))}const Pa=n=>Lf(n,!1),Da=n=>Lf(n,!0),E0=n=>_e(n,e=>Lt(n,e,!0)),B0=n=>_e(n,e=>Lt(n,e,!1)),L0=n=>_e(n,e=>Lt(n,e,!Ce(n))),I0=n=>_e(n,e=>Lt(n,e,Ce(n))),N0=n=>_e(n,e=>k.cursor(n.lineBlockAt(e.head).from)),W0=n=>_e(n,e=>k.cursor(n.lineBlockAt(e.head).to)),Ra=({state:n,dispatch:e})=>(e(Ge(n,{anchor:0})),!0),Ea=({state:n,dispatch:e})=>(e(Ge(n,{anchor:n.doc.length})),!0),Ba=({state:n,dispatch:e})=>(e(Ge(n,{anchor:n.selection.main.anchor,head:0})),!0),La=({state:n,dispatch:e})=>(e(Ge(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),H0=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),F0=({state:n,dispatch:e})=>{let t=Fs(n).map(({from:i,to:s})=>k.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:k.create(t),userEvent:"select"})),!0},V0=({state:n,dispatch:e})=>{let t=Ci(n.selection,i=>{let s=Se(n),r=s.resolveStack(i.from,1);if(i.empty){let o=s.resolveStack(i.from,-1);o.node.from>=r.node.from&&o.node.to<=r.node.to&&(r=o)}for(let o=r;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return k.range(l.to,l.from)}return i});return t.eq(n.selection)?!1:(e(Ge(n,t)),!0)};function If(n,e){let{state:t}=n,i=t.selection,s=t.selection.ranges.slice();for(let r of t.selection.ranges){let o=t.doc.lineAt(r.head);if(e?o.to0)for(let l=r;;){let a=n.moveVertically(l,e);if(a.heado.to){s.some(h=>h.head==a.head)||s.push(a);break}else{if(a.head==l.head)break;l=a}}}return s.length==i.ranges.length?!1:(n.dispatch(Ge(t,k.create(s,s.length-1))),!0)}const z0=n=>If(n,!1),Q0=n=>If(n,!0),$0=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=k.create([t.main]):t.main.empty||(i=k.create([k.cursor(t.main.head)])),i?(e(Ge(n,i)),!0):!1};function mn(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,s=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let a=e(r);ao&&(t="delete.forward",a=In(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=In(n,o,!1),l=In(n,l,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:k.cursor(o,os(n)))i.between(e,e,(s,r)=>{se&&(e=t?r:s)});return e}const Nf=(n,e,t)=>mn(n,i=>{let s=i.from,{state:r}=n,o=r.doc.lineAt(s),l,a;if(t&&!e&&s>o.from&&sNf(n,!1,!0),Wf=n=>Nf(n,!0,!1),Hf=(n,e)=>mn(n,t=>{let i=t.head,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t.head&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let a=ge(r.text,i-r.from,e)+r.from,h=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from),c=o(h);if(l!=null&&c!=l)break;(h!=" "||i!=t.head)&&(l=c),i=a}return i}),Ff=n=>Hf(n,!1),q0=n=>Hf(n,!0),_0=n=>mn(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headmn(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),U0=n=>mn(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:G.of(["",""])},range:k.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},K0=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:ge(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:ge(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:k.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Fs(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function Vf(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of Fs(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let a of r.ranges)s.push(k.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let a of r.ranges)s.push(k.range(a.anchor-l,a.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:k.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const G0=({state:n,dispatch:e})=>Vf(n,e,!1),Y0=({state:n,dispatch:e})=>Vf(n,e,!0);function zf(n,e,t){if(n.readOnly)return!1;let i=[];for(let r of Fs(n))t?i.push({from:r.from,insert:n.doc.slice(r.from,r.to)+n.lineBreak}):i.push({from:r.to,insert:n.lineBreak+n.doc.slice(r.from,r.to)});let s=n.changes(i);return e(n.update({changes:s,selection:n.selection.map(s,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const J0=({state:n,dispatch:e})=>zf(n,e,!1),Z0=({state:n,dispatch:e})=>zf(n,e,!0),eb=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(Fs(e).map(({from:s,to:r})=>(s>0?s--:r{let r;if(n.lineWrapping){let o=n.lineBlockAt(s.head),l=n.coordsAtPos(s.head,s.assoc||1);l&&(r=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(s,!0,r)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function tb(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Se(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(q.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from&&!/\S/.test(n.sliceDoc(i.to,s.from))?{from:i.to,to:s.from}:null}const Ia=Qf(!1),ib=Qf(!0);function Qf(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),a=!n&&r==o&&tb(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new Ls(e,{simulateBreak:r,simulateDoubleBreak:!!a}),c=jo(h,r);for(c==null&&(c=Oi(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));ol.from&&r{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,s,i),t=l.number),o=l.to+1}let r=n.changes(s);return{changes:s,range:k.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const nb=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new Ls(n,{overrideIndentation:r=>{let o=t[r];return o??-1}}),s=Jo(n,(r,o,l)=>{let a=jo(i,r.from);if(a==null)return;/\S/.test(r.text)||(a=0);let h=/^\s*/.exec(r.text)[0],c=nn(n,a);(h!=c||l.fromn.readOnly?!1:(e(n.update(Jo(n,(t,i)=>{i.push({from:t.from,insert:n.facet(Bs)})}),{userEvent:"input.indent"})),!0),qf=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Jo(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=Oi(s,n.tabSize),o=0,l=nn(n,Math.max(0,r-cs(n)));for(;o(n.setTabFocusMode(),!0),rb=[{key:"Ctrl-b",run:xf,shift:Tf,preventDefault:!0},{key:"Ctrl-f",run:kf,shift:Pf},{key:"Ctrl-p",run:Sf,shift:Ef},{key:"Ctrl-n",run:Of,shift:Bf},{key:"Ctrl-a",run:O0,shift:N0},{key:"Ctrl-e",run:C0,shift:W0},{key:"Ctrl-d",run:Wf},{key:"Ctrl-h",run:yo},{key:"Ctrl-k",run:_0},{key:"Ctrl-Alt-h",run:Ff},{key:"Ctrl-o",run:j0},{key:"Ctrl-t",run:K0},{key:"Ctrl-v",run:bo}],ob=[{key:"ArrowLeft",run:xf,shift:Tf,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:m0,shift:T0,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:w0,shift:L0,preventDefault:!0},{key:"ArrowRight",run:kf,shift:Pf,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:g0,shift:P0,preventDefault:!0},{mac:"Cmd-ArrowRight",run:S0,shift:I0,preventDefault:!0},{key:"ArrowUp",run:Sf,shift:Ef,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Ra,shift:Ba},{mac:"Ctrl-ArrowUp",run:Ta,shift:Pa},{key:"ArrowDown",run:Of,shift:Bf,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Ea,shift:La},{mac:"Ctrl-ArrowDown",run:bo,shift:Da},{key:"PageUp",run:Ta,shift:Pa},{key:"PageDown",run:bo,shift:Da},{key:"Home",run:v0,shift:B0,preventDefault:!0},{key:"Mod-Home",run:Ra,shift:Ba},{key:"End",run:k0,shift:E0,preventDefault:!0},{key:"Mod-End",run:Ea,shift:La},{key:"Enter",run:Ia,shift:Ia},{key:"Mod-a",run:H0},{key:"Backspace",run:yo,shift:yo,preventDefault:!0},{key:"Delete",run:Wf,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Ff,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:q0,preventDefault:!0},{mac:"Mod-Backspace",run:X0,preventDefault:!0},{mac:"Mod-Delete",run:U0,preventDefault:!0}].concat(rb.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),lb=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:y0,shift:D0},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:x0,shift:R0},{key:"Alt-ArrowUp",run:G0},{key:"Shift-Alt-ArrowUp",run:J0},{key:"Alt-ArrowDown",run:Y0},{key:"Shift-Alt-ArrowDown",run:Z0},{key:"Mod-Alt-ArrowUp",run:z0},{key:"Mod-Alt-ArrowDown",run:Q0},{key:"Escape",run:$0},{key:"Mod-Enter",run:ib},{key:"Alt-l",mac:"Ctrl-l",run:F0},{key:"Mod-i",run:V0,preventDefault:!0},{key:"Mod-[",run:qf},{key:"Mod-]",run:$f},{key:"Mod-Alt-\\",run:nb},{key:"Shift-Mod-k",run:eb},{key:"Shift-Mod-\\",run:M0},{key:"Mod-/",run:Gg},{key:"Alt-A",run:Jg},{key:"Ctrl-m",mac:"Shift-Alt-m",run:sb}].concat(ob),ab={key:"Tab",run:$f,shift:qf},Na=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class wi{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?l=>r(Na(l)):Na,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return De(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Co(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=st(e);let s=this.normalize(t);if(s.length)for(let r=0,o=i,l=!0;;r++){let a=s.charCodeAt(r),h=this.match(a,o,l,this.bufferPos+this.bufferStart,r==s.length-1);if(h)return this.value=h,this;if(r==s.length-1)break;l&&rthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=ps(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let l=new di(t,e.sliceString(t,i));return mr.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,precise:!0,match:t},this.matchPos=ps(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=di.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Xf.prototype[Symbol.iterator]=Uf.prototype[Symbol.iterator]=function(){return this});function hb(n){try{return new RegExp(n,Zo),!0}catch{return!1}}function ps(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}const cb=n=>{let{state:e}=n,t=String(e.doc.lineAt(n.state.selection.main.head).number),{close:i,result:s}=Pm(n,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return s.then(r=>{let o=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!o){n.dispatch({effects:i});return}let l=e.doc.lineAt(e.selection.main.head),[,a,h,c,f]=o,u=c?+c.slice(1):0,d=h?+h:l.number;if(h&&f){let b=d/100;a&&(b=b*(a=="-"?-1:1)+l.number/e.doc.lines),d=Math.round(e.doc.lines*b)}else h&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=e.doc.line(Math.max(1,Math.min(e.doc.lines,d))),m=k.cursor(p.from+Math.max(0,Math.min(u,p.length)));n.dispatch({effects:[i,P.scrollIntoView(m.from,{y:"center"})],selection:m})}),!0},fb={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ub=D.define({combine(n){return ft(n,fb,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function db(n){return[yb,bb]}const pb=I.mark({class:"cm-selectionMatch"}),mb=I.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Wa(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=re.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=re.Word)}function gb(n,e,t,i){return n(e.sliceDoc(t,t+1))==re.Word&&n(e.sliceDoc(i-1,i))==re.Word}const bb=he.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(ub),{state:t}=n,i=t.selection;if(i.ranges.length>1)return I.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return I.none;let a=t.wordAt(s.head);if(!a)return I.none;o=t.charCategorizer(s.head),r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a200)return I.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(Wa(o,t,s.from,s.to)&&gb(o,t,s.from,s.to)))return I.none}else if(r=t.sliceDoc(s.from,s.to),!r)return I.none}let l=[];for(let a of n.visibleRanges){let h=new wi(t.doc,r,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||Wa(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(mb.range(c,f)):(c>=s.to||f<=s.from)&&l.push(pb.range(c,f)),l.length>e.maxMatches))return I.none}}return I.set(l)}},{decorations:n=>n.decorations}),yb=P.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),xb=({state:n,dispatch:e})=>{let{selection:t}=n,i=k.create(t.ranges.map(s=>n.wordAt(s.head)||k.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function kb(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new wi(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new wi(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(r){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const vb=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return xb({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=kb(n,i);return s?(e(n.update({selection:n.selection.addRange(k.range(s.from,s.to),!1),effects:P.scrollIntoView(s.to)})),!0):!1},Ai=D.define({combine(n){return ft(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ib(e),scrollToMatch:e=>P.scrollIntoView(e)})}});class jf{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||hb(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` -`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Mb(this):new Ob(this)}getCursor(e,t=0,i){let s=e.doc?e:U.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?ni(this,s,t,i):ii(this,s,t,i)}}class Kf{constructor(e){this.spec=e}}function wb(n,e,t){return(i,s,r,o)=>{if(t&&!t(i,s,r,o))return!1;let l=i>=o&&s<=o+r.length?r.slice(i-o,s-o):e.doc.sliceString(i,s);return n(l,e,i,s)}}function ii(n,e,t,i){let s;return n.wholeWord&&(s=Sb(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(s=wb(n.test,e,s)),new wi(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:r=>r.toLowerCase(),s)}function Sb(n,e){return(t,i,s,r)=>((r>t||r+s.length=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=ii(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Cb(n,e,t){return(i,s,r)=>(!t||t(i,s,r))&&n(r[0],e,i,s)}function ni(n,e,t,i){let s;return n.wholeWord&&(s=Ab(e.charCategorizer(e.selection.main.head))),n.test&&(s=Cb(n.test,e,s)),new Xf(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:s},t,i)}function ms(n,e){return n.slice(ge(n,e,!1),e)}function gs(n,e){return n.slice(e,ge(n,e))}function Ab(n){return(e,t,i)=>!i[0].length||(n(ms(i.input,i.index))!=re.Word||n(gs(i.input,i.index))!=re.Word)&&(n(gs(i.input,i.index+i[0].length))!=re.Word||n(ms(i.input,i.index+i[0].length))!=re.Word)}class Mb extends Kf{nextMatch(e,t,i){let s=ni(this.spec,e,i,e.doc.length).next();return s.done&&(s=ni(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=ni(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let s=i.length;s>0;s--){let r=+i.slice(0,s);if(r>0&&r=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=ni(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const sn=Q.define(),el=Q.define(),At=Oe.define({create(n){return new gr(xo(n).create(),null)},update(n,e){for(let t of e.effects)t.is(sn)?n=new gr(t.value.create(),n.panel):t.is(el)&&(n=new gr(n.query,t.value?tl:null));return n},provide:n=>Zi.from(n,e=>e.panel)});class gr{constructor(e,t){this.query=e,this.panel=t}}const Tb=I.mark({class:"cm-searchMatch"}),Pb=I.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Db=he.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(At))}update(n){let e=n.state.field(At);(e!=n.startState.field(At)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return I.none;let{view:t}=this,i=new bt;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-500;)a=r[++s].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?Pb:Tb)})}return i.finish()}},{decorations:n=>n.decorations});function gn(n){return e=>{let t=e.state.field(At,!1);return t&&t.query.spec.valid?n(e,t):Jf(e)}}const bs=gn((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let s=k.single(i.from,i.to),r=n.state.facet(Ai);return n.dispatch({selection:s,effects:[il(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"}),Yf(n),!0}),ys=gn((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);if(!s)return!1;let r=k.single(s.from,s.to),o=n.state.facet(Ai);return n.dispatch({selection:r,effects:[il(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),Yf(n),!0}),Rb=gn((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:k.create(t.map(i=>k.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),Eb=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new wi(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(k.range(l.value.from,l.value.to))}return e(n.update({selection:k.create(r,o),userEvent:"select.search.matches"})),!0},Ha=gn((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=r,l=[],a,h,c=[];o.precise?o.from==i&&o.to==s&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),o=e.nextMatch(t,o.from,o.to),c.push(P.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))):o=e.nextMatch(t,o.from,o.to);let f=n.state.changes(l);return o&&(a=k.single(o.from,o.to).map(f),c.push(il(n,o)),c.push(t.facet(Ai).scrollToMatch(a.main,n))),n.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),Bb=gn((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let s of e.matchAll(n.state,1e9)){let{from:r,to:o,precise:l}=s;l&&t.push({from:r,to:o,insert:e.getReplacement(s)})}if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:P.announce.of(i),userEvent:"input.replace.all"}),!0});function tl(n){return n.state.facet(Ai).createPanel(n)}function xo(n,e){var t,i,s,r,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(Ai);return new jf({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(r=e?.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function Gf(n){let e=$o(n,tl);return e&&e.dom.querySelector("[main-field]")}function Yf(n){let e=Gf(n);e&&e==n.root.activeElement&&e.select()}const Jf=n=>{let e=n.state.field(At,!1);if(e&&e.panel){let t=Gf(n);if(t&&t!=n.root.activeElement){let i=xo(n.state,e.query.spec);i.valid&&n.dispatch({effects:sn.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[el.of(!0),e?sn.of(xo(n.state,e.query.spec)):Q.appendConfig.of(Wb)]});return!0},Zf=n=>{let e=n.state.field(At,!1);if(!e||!e.panel)return!1;let t=$o(n,tl);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:el.of(!1)}),!0},Lb=[{key:"Mod-f",run:Jf,scope:"editor search-panel"},{key:"F3",run:bs,shift:ys,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:bs,shift:ys,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Zf,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Eb},{key:"Mod-Alt-g",run:cb},{key:"Mod-d",run:vb,preventDefault:!0}];class Ib{constructor(e){this.view=e;let t=this.query=e.state.field(At).query.spec;this.commit=this.commit.bind(this),this.searchField=Z("input",{value:t.search,placeholder:We(e,"Find"),"aria-label":We(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Z("input",{value:t.replace,placeholder:We(e,"Replace"),"aria-label":We(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Z("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Z("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Z("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return Z("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=Z("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>bs(e),[We(e,"next")]),i("prev",()=>ys(e),[We(e,"previous")]),i("select",()=>Rb(e),[We(e,"all")]),Z("label",null,[this.caseField,We(e,"match case")]),Z("label",null,[this.reField,We(e,"regexp")]),Z("label",null,[this.wordField,We(e,"by word")]),...e.state.readOnly?[]:[Z("br"),this.replaceField,i("replace",()=>Ha(e),[We(e,"replace")]),i("replaceAll",()=>Bb(e),[We(e,"replace all")])],Z("button",{name:"close",onclick:()=>Zf(e),"aria-label":We(e,"close"),type:"button"},["×"])])}commit(){let e=new jf({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:sn.of(e)}))}keydown(e){Hp(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ys:bs)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Ha(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(sn)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ai).top}}function We(n,e){return n.state.phrase(e)}const Nn=30,Wn=/[\s\.,:;?!]/;function il(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-Nn),o=Math.min(s,t+Nn),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;al.length-Nn;a--)if(!Wn.test(l[a-1])&&Wn.test(l[a])){l=l.slice(0,a);break}}return P.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const Nb=P.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Wb=[At,Zt.low(Db),Nb];class eu{constructor(e,t,i,s){this.state=e,this.pos=t,this.explicit=i,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Se(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(tu(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function Fa(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Hb(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:Hb(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}class Va{constructor(e,t,i,s){this.completion=e,this.source=t,this.match=i,this.score=s}}function jt(n){return n.selection.main.from}function tu(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const iu=ct.define();function Vb(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return{...n.changeByRange(l=>{if(l!=s&&t!=i&&n.sliceDoc(l.from+r,l.from+o)!=n.sliceDoc(t,i))return{range:l};let a=n.toText(e);return{changes:{from:l.from+r,to:i==s.from?l.to:l.from+o,insert:a},range:k.cursor(l.from+r+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const za=new WeakMap;function zb(n){if(!Array.isArray(n))return n;let e=za.get(n);return e||za.set(n,e=Fb(n)),e}const xs=Q.define(),rn=Q.define();class Qb{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(A=Co(C))!=A.toLowerCase()?1:A!=A.toUpperCase()?2:0;(!v||w==1&&b||T==0&&w!=0)&&(t[f]==C||i[f]==C&&(u=!0)?o[f++]=v:o.length&&(y=!1)),T=w,v+=st(C)}return f==a&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):f==a?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let l=o+(this.astral?st(De(i,o)):1);r&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return this.ret(e-i.length,s)}}class $b{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:qb,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>Qa(e(i),t(i)),optionClass:(e,t)=>i=>Qa(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Qa(n,e){return n?e?n+" "+e:n:e}function qb(n,e,t,i,s,r){let o=n.textDirection==te.RTL,l=o,a=!1,h="top",c,f,u=e.left-s.left,d=s.right-e.right,p=i.right-i.left,m=i.bottom-i.top;if(l&&u=m||v>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let b=(e.bottom-e.top)/r.offsetHeight,y=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/b}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}const nl=Q.define();function _b(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return at.position-i.position).map(t=>t.render)}function br(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.ceil((n-e)/t);return{from:n-i*t,to:n-(i-1)*t}}class Xb{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,l=e.state.facet(me);this.optionContent=_b(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=br(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:nl.of(c)}),a.preventDefault())}}),this.dom.addEventListener("focusout",a=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(me).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:rn.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=s){let{options:r,selected:o,disabled:l}=i.open;(!s.open||s.open.options!=r)&&(this.range=br(r.length,o,e.state.facet(me).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),l!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=br(t.options.length,t.selected,this.view.state.facet(me).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:r}=s;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(s);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>Be(this.view.state,l,"completion info")):(this.addInfoPane(o,s),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;i.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&jb(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottom{o.target==s&&o.preventDefault()});let r=null;for(let o=i.from;oi.from||i.from==0))if(r=u,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=u}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.tonew Xb(t,n,e)}function jb(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),s=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/s)}function $a(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function Kb(n,e){let t=[],i=null,s=null,r=c=>{t.push(c);let{section:f}=c.completion;if(f){i||(i=[]);let u=typeof f=="string"?f:f.name;i.some(d=>d.name==u)||i.push(typeof f=="string"?{name:u}:f)}},o=e.facet(me);for(let c of n)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)r(new Va(u,c.source,f?f(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),d,p=o.filterStrict?new $b(u):new Qb(u);for(let m of c.result.options)if(d=p.match(m.label)){let b=m.displayLabel?f?f(m,d.matched):[]:d.matched,y=d.score+(m.boost||0);if(r(new Va(m,c.source,b,y)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:v}=m.section;s||(s=Object.create(null)),s[v]=Math.max(y,s[v]||-1e9)}}}}if(i){let c=Object.create(null),f=0,u=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.nameu.score-f.score||h(f.completion,u.completion))){let f=c.completion;!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost?l.push(c):$a(c.completion)>$a(a)&&(l[l.length-1]=c),a=c.completion}return l}class ai{constructor(e,t,i,s,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ai(this.options,qa(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r,o){if(s&&!o&&e.some(h=>h.isPending))return s.setDisabled();let l=Kb(e,t);if(!l.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let a=t.facet(me).selectOnOpen?0:-1;if(s&&s.selected!=a&&s.selected!=-1){let h=s.options[s.selected].completion;for(let c=0;cc.hasResult()?Math.min(h,c.from):h,1e8),create:ty,above:r.aboveCursor},s?s.timestamp:Date.now(),a,!1)}map(e){return new ai(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ai(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class ks{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new ks(Zb,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(me),r=(i.override||t.languageDataAt("autocomplete",jt(t)).map(zb)).map(a=>(this.active.find(c=>c.source==a)||new $e(a,this.active.some(c=>c.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((a,h)=>a==this.active[h])&&(r=this.active);let o=this.open,l=e.effects.some(a=>a.is(sl));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!Gb(r,this.active)||l?o=ai.build(r,t,this.id,o,i,l):o&&o.disabled&&!r.some(a=>a.isPending)&&(o=null),!o&&r.every(a=>!a.isPending)&&r.some(a=>a.hasResult())&&(r=r.map(a=>a.hasResult()?new $e(a.source,0):a));for(let a of e.effects)a.is(nl)&&(o=o&&o.setSelected(a.value,this.id));return r==this.active&&o==this.open?this:new ks(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Yb:Jb}}function Gb(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const Zb=[];function nu(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(iu);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class $e{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=nu(e,t),s=this;(i&8||i&16&&this.touches(e))&&(s=new $e(s.source,0)),i&4&&s.state==0&&(s=new $e(this.source,1)),s=s.updateFor(e,i);for(let r of e.effects)if(r.is(xs))s=new $e(s.source,1,r.value);else if(r.is(rn))s=new $e(s.source,0);else if(r.is(sl))for(let o of r.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(jt(e.state))}}class pi extends $e{constructor(e,t,i,s,r,o){super(e,3,t),this.limit=i,this.result=s,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=jt(e.state);if(l>o||!s||t&2&&(jt(e.startState)==this.from||lt.map(e))}}),Re=Oe.define({create(){return ks.start()},update(n,e){return n.update(e)},provide:n=>[Qo.from(n,e=>e.tooltip),P.contentAttributes.from(n,e=>e.attrs)]});function rl(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(Re).active.find(s=>s.source==e.source);return i instanceof pi?(typeof t=="string"?n.dispatch({...Vb(n.state,t,i.from,i.to),annotations:iu.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const ty=Ub(Re,rl);function Hn(n,e="option"){return t=>{let i=t.state.field(Re,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:nl.of(l)}),!0}}const iy=n=>{let e=n.state.field(Re,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(Re,!1)?(n.dispatch({effects:xs.of(!0)}),!0):!1,ny=n=>{let e=n.state.field(Re,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:rn.of(null)}),!0)};class sy{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const ry=50,oy=1e3,ly=he.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(Re).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(Re),t=n.state.facet(me);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Re)==e)return;let i=n.transactions.some(r=>{let o=nu(r,t);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;rry&&Date.now()-o.time>oy){for(let l of o.context.abortListeners)try{l()}catch(a){Be(this.view.state,a)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(r=>r.effects.some(o=>o.is(xs)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.isPending&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of n.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(Re);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(me).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=jt(e),i=new eu(e,t,n.explicit,this.view),s=new sy(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:rn.of(null)}),Be(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(me).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(me),i=this.view.state.field(Re);for(let s=0;sl.source==r.active.source);if(o&&o.isPending)if(r.done==null){let l=new $e(r.active.source,0);for(let a of r.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:sl.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(Re,!1);if(e&&e.tooltip&&this.view.state.facet(me).closeOnBlur){let t=e.open&&Lc(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:rn.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:xs.of(!1)}),20),this.composing=0}}}),ay=typeof navigator=="object"&&/Win/.test(navigator.platform),hy=Zt.highest(P.domEventHandlers({keydown(n,e){let t=e.state.field(Re,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(ay&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],s=t.active.find(o=>o.source==i.source),r=i.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(n.key)>-1&&rl(e,i),!1}})),cy=P.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),on={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},qt=Q.define({map(n,e){let t=e.mapPos(n,-1,Me.TrackAfter);return t??void 0}}),ol=new class extends Mt{};ol.startSide=1;ol.endSide=-1;const su=Oe.define({create(){return _.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(qt)&&(n=n.update({add:[ol.range(t.value,t.value+1)]}));return n}});function fy(){return[dy,su]}const xr="()[]{}<>«»»«[]{}";function ru(n){for(let e=0;e{if((uy?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&st(De(i,0))==1||e!=s.from||t!=s.to)return!1;let r=gy(n.state,i);return r?(n.dispatch(r),!0):!1}),py=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=ou(n,n.selection.main.head).brackets||on.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=by(n.doc,o.head);for(let a of i)if(a==l&&Vs(n.doc,o.head)==ru(De(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:k.cursor(o.head-a.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},my=[{key:"Backspace",run:py}];function gy(n,e){let t=ou(n,n.selection.main.head),i=t.brackets||on.brackets;for(let s of i){let r=ru(De(s,0));if(e==s)return r==s?ky(n,s,i.indexOf(s+s+s)>-1,t):yy(n,s,r,t.before||on.before);if(e==r&&lu(n,n.selection.main.from))return xy(n,s,r)}return null}function lu(n,e){let t=!1;return n.field(su).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Vs(n,e){let t=n.sliceString(e,e+2);return t.slice(0,st(De(t,0)))}function by(n,e){let t=n.sliceString(e-2,e);return st(De(t,0))==t.length?t:t.slice(1)}function yy(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:qt.of(o.to+e.length),range:k.range(o.anchor+e.length,o.head+e.length)};let l=Vs(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:qt.of(o.head+e.length),range:k.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function xy(n,e,t){let i=null,s=n.changeByRange(r=>r.empty&&Vs(n.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:k.cursor(r.head+t.length)}:i={range:r});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function ky(n,e,t,i){let s=i.stringPrefixes||on.stringPrefixes,r=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:qt.of(l.to+e.length),range:k.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=Vs(n.doc,a),c;if(h==e){if(_a(n,a))return{changes:{insert:e+e,from:a},effects:qt.of(a+e.length),range:k.cursor(a+e.length)};if(lu(n,a)){let u=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:k.cursor(a+u.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(c=Xa(n,a-2*e.length,s))>-1&&_a(n,c))return{changes:{insert:e+e+e+e,from:a},effects:qt.of(a+e.length),range:k.cursor(a+e.length)};if(n.charCategorizer(a)(h)!=re.Word&&Xa(n,a,s)>-1&&!vy(n,a,e,s))return{changes:{insert:e+e,from:a},effects:qt.of(a+e.length),range:k.cursor(a+e.length)}}return{range:r=l}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function _a(n,e){let t=Se(n).resolveInner(e+1);return t.parent&&t.from==e}function vy(n,e,t,i){let s=Se(n).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+a;){if(n.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function Xa(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=re.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=re.Word)return r}return-1}function wy(n={}){return[hy,Re,me.of(n),ly,Sy,cy]}const au=[{key:"Ctrl-Space",run:yr},{mac:"Alt-`",run:yr},{mac:"Alt-i",run:yr},{key:"Escape",run:ny},{key:"ArrowDown",run:Hn(!0)},{key:"ArrowUp",run:Hn(!1)},{key:"PageDown",run:Hn(!0,"page")},{key:"PageUp",run:Hn(!1,"page")},{key:"Enter",run:iy}],Sy=Zt.highest(Rs.computeN([me],n=>n.facet(me).defaultKeymap?[au]:[]));class Ua{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Vt{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=i.facet(ln).markerFilter;s&&(e=s(e,i));let r=e.slice().sort((d,p)=>d.from-p.from||d.to-p.to),o=new bt,l=[],a=0,h=i.doc.iter(),c=0,f=i.doc.length;for(let d=0;;){let p=d==r.length?null:r[d];if(!p&&!l.length)break;let m,b;if(l.length)m=a,b=l.reduce((S,T)=>Math.min(S,T.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;b=p.to,l.push(p),d++}for(;dS.from||S.to==m))l.push(S),d++,b=Math.min(S.to,b);else{b=Math.min(S.from,b);break}}b=Math.min(b,f);let y=!1;if(l.some(S=>S.from==m&&(S.to==b||b==f))&&(y=m==b,!y&&b-m<10)){let S=m-(c+h.value.length);S>0&&(h.next(S),c=m);for(let T=m;;){if(T>=b){y=!0;break}if(!h.lineBreak&&c+h.value.length>T)break;T=c+h.value.length,c+=h.value.length,h.next()}}let v=Ny(l);if(y)o.add(m,m,I.widget({widget:new Ey(v),diagnostics:l.slice()}));else{let S=l.reduce((T,C)=>C.markClass?T+" "+C.markClass:T,"");o.add(m,b,I.mark({class:"cm-lintRange cm-lintRange-"+v+S,diagnostics:l.slice(),inclusiveEnd:l.some(T=>T.to>b)}))}if(a=b,a==f)break;for(let S=0;S{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new Ua(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new Ua(i.from,r,i.diagnostic)}}),i}function Oy(n,e){let t=e.pos,i=e.end||t,s=n.state.facet(ln).hideOn(n,t,i);if(s!=null)return s;let r=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(hu))||n.changes.touchesRange(r.from,Math.max(r.to,i)))}function Cy(n,e){return n.field(Ve,!1)?e:e.concat(Q.appendConfig.of(Wy))}const hu=Q.define(),ll=Q.define(),cu=Q.define(),Ve=Oe.define({create(){return new Vt(I.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,s=n.panel;if(n.selected){let r=e.changes.mapPos(n.selected.from,1);i=Bt(t,n.selected.diagnostic,r)||Bt(t,null,r)}!t.size&&s&&e.state.facet(ln).autoPanel&&(s=null),n=new Vt(t,s,i)}for(let t of e.effects)if(t.is(hu)){let i=e.state.facet(ln).autoPanel?t.value.length?an.open:null:n.panel;n=Vt.init(t.value,i,e.state)}else t.is(ll)?n=new Vt(n.diagnostics,t.value?an.open:null,n.selected):t.is(cu)&&(n=new Vt(n.diagnostics,n.panel,t.value));return n},provide:n=>[Zi.from(n,e=>e.panel),P.decorations.from(n,e=>e.diagnostics)]}),Ay=I.mark({class:"cm-lintRange cm-lintRange-active"});function My(n,e,t){let{diagnostics:i}=n.state.field(Ve),s,r=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{if(e>=a&&e<=h&&(a==h||(e>a||t>0)&&(euu(n,t,!1)))}const Py=n=>{let e=n.state.field(Ve,!1);(!e||!e.panel)&&n.dispatch({effects:Cy(n.state,[ll.of(!0)])});let t=$o(n,an.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},ja=n=>{let e=n.state.field(Ve,!1);return!e||!e.panel?!1:(n.dispatch({effects:ll.of(!1)}),!0)},Dy=n=>{let e=n.state.field(Ve,!1);if(!e)return!1;let t=n.state.selection.main,i=Bt(e.diagnostics,null,t.to+1);return!i&&(i=Bt(e.diagnostics,null,0),!i||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),Mm(n,i.from,1,{tooltip:du,until:s=>s.docChanged||s.newSelection.main.headi.to}),!0)},Ry=[{key:"Mod-Shift-m",run:Py,preventDefault:!0},{key:"F8",run:Dy}],ln=D.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...ft(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Ka,tooltipFilter:Ka,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,s,r)=>e(i,s,r)||t(i,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function Ka(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function fu(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;ir.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function uu(n,e,t){var i;let s=t?fu(e.actions):[];return Z("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Z("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let p=Bt(n.state.field(Ve).diagnostics,e);p&&r.apply(n,p.from,p.to)},{name:h}=r,c=s[o]?h.indexOf(s[o]):-1,f=c<0?h:[h.slice(0,c),Z("u",h.slice(c,c+1)),h.slice(c+1)],u=r.markClass?" "+r.markClass:"";return Z("button",{type:"button",class:"cm-diagnosticAction"+u,onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&Z("div",{class:"cm-diagnosticSource"},e.source))}class Ey extends ut{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Z("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Ga{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=uu(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class an{constructor(e){this.view=e,this.items=[];let t=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)ja(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=fu(r.actions);for(let l=0;l{for(let r=0;rja(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ve).selected;if(!e)return-1;for(let t=0;t{for(let c of h.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,u;for(let d=i;di&&(this.items.splice(i,f-i),s=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),r=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),i++}});i({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let h=a.height/this.list.offsetHeight;l.topa.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Ve),i=Bt(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:cu.of(i)})}static open(e){return new an(e)}}function By(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function Fn(n){return By(``,'width="6" height="3"')}const Ly=P.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Fn("#f11")},".cm-lintRange-warning":{backgroundImage:Fn("orange")},".cm-lintRange-info":{backgroundImage:Fn("#999")},".cm-lintRange-hint":{backgroundImage:Fn("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Iy(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function Ny(n){let e="hint",t=1;for(let i of n){let s=Iy(i.severity);s>t&&(t=s,e=i.severity)}return e}const du=Am(My,{hideOn:Oy}),Wy=[Ve,P.decorations.compute([Ve],n=>{let{selected:e,panel:t}=n.field(Ve);return!e||!t||e.from==e.to?I.none:I.set([Ay.range(e.from,e.to)])}),du,Ly];var Ya=function(e){e===void 0&&(e={});var t=e,i=t.crosshairCursor,s=i===void 0?!1:i,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(my)),e.defaultKeymap!==!1&&(r=r.concat(lb)),e.searchKeymap!==!1&&(r=r.concat(Lb)),e.historyKeymap!==!1&&(r=r.concat(p0)),e.foldKeymap!==!1&&(r=r.concat(Tg)),e.completionKeymap!==!1&&(r=r.concat(au)),e.lintKeymap!==!1&&(r=r.concat(Ry));var o=[];return e.lineNumbers!==!1&&o.push(Vm()),e.highlightActiveLineGutter!==!1&&o.push($m()),e.highlightSpecialChars!==!1&&o.push(tm()),e.history!==!1&&o.push(r0()),e.foldGutter!==!1&&o.push(Eg()),e.drawSelection!==!1&&o.push(qp()),e.dropCursor!==!1&&o.push(Kp()),e.allowMultipleSelections!==!1&&o.push(U.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&o.push(yg()),e.syntaxHighlighting!==!1&&o.push(af(Ng,{fallback:!0})),e.bracketMatching!==!1&&o.push($g()),e.closeBrackets!==!1&&o.push(fy()),e.autocompletion!==!1&&o.push(wy()),e.rectangularSelection!==!1&&o.push(mm()),s!==!1&&o.push(ym()),e.highlightActiveLine!==!1&&o.push(lm()),e.highlightSelectionMatches!==!1&&o.push(db()),e.tabSize&&typeof e.tabSize=="number"&&o.push(Bs.of(" ".repeat(e.tabSize))),o.concat([Rs.of(r.flat())]).filter(Boolean)};const Hy="#e5c07b",Ja="#e06c75",Fy="#56b6c2",Vy="#ffffff",jn="#abb2bf",ko="#7d8799",zy="#61afef",Qy="#98c379",Za="#d19a66",$y="#c678dd",qy="#21252b",eh="#2c313a",th="#282c34",kr="#353a42",_y="#3E4451",ih="#528bff",Xy=P.theme({"&":{color:jn,backgroundColor:th},".cm-content":{caretColor:ih},".cm-cursor, .cm-dropCursor":{borderLeftColor:ih},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:_y},".cm-panels":{backgroundColor:qy,color:jn},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:th,color:ko,border:"none"},".cm-activeLineGutter":{backgroundColor:eh},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:kr},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:kr,borderBottomColor:kr},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:eh,color:jn}}},{dark:!0}),Uy=pn.define([{tag:x.keyword,color:$y},{tag:[x.name,x.deleted,x.character,x.propertyName,x.macroName],color:Ja},{tag:[x.function(x.variableName),x.labelName],color:zy},{tag:[x.color,x.constant(x.name),x.standard(x.name)],color:Za},{tag:[x.definition(x.name),x.separator],color:jn},{tag:[x.typeName,x.className,x.number,x.changed,x.annotation,x.modifier,x.self,x.namespace],color:Hy},{tag:[x.operator,x.operatorKeyword,x.url,x.escape,x.regexp,x.link,x.special(x.string)],color:Fy},{tag:[x.meta,x.comment],color:ko},{tag:x.strong,fontWeight:"bold"},{tag:x.emphasis,fontStyle:"italic"},{tag:x.strikethrough,textDecoration:"line-through"},{tag:x.link,color:ko,textDecoration:"underline"},{tag:x.heading,fontWeight:"bold",color:Ja},{tag:[x.atom,x.bool,x.special(x.variableName)],color:Za},{tag:[x.processingInstruction,x.string,x.inserted],color:Qy},{tag:x.invalid,color:Vy}]),jy=[Xy,af(Uy)];var Ky=P.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Gy=function(e){e===void 0&&(e={});var t=e,i=t.indentWithTab,s=i===void 0?!0:i,r=t.editable,o=r===void 0?!0:r,l=t.readOnly,a=l===void 0?!1:l,h=t.theme,c=h===void 0?"light":h,f=t.placeholder,u=f===void 0?"":f,d=t.basicSetup,p=d===void 0?!0:d,m=[];switch(s&&m.unshift(Rs.of([ab])),p&&(typeof p=="boolean"?m.unshift(Ya()):m.unshift(Ya(p))),u&&m.unshift(fm(u)),c){case"light":m.push(Ky);break;case"dark":m.push(jy);break;case"none":break;default:m.push(c);break}return o===!1&&m.push(P.editable.of(!1)),a&&m.push(U.readOnly.of(!0)),[...m]},Yy=n=>({line:n.state.doc.lineAt(n.state.selection.main.from),lineCount:n.state.doc.lines,lineBreak:n.state.lineBreak,length:n.state.doc.length,readOnly:n.state.readOnly,tabSize:n.state.tabSize,selection:n.state.selection,selectionAsSingle:n.state.selection.asSingle().main,ranges:n.state.selection.ranges,selectionCode:n.state.sliceDoc(n.state.selection.main.from,n.state.selection.main.to),selections:n.state.selection.ranges.map(e=>n.state.sliceDoc(e.from,e.to)),selectedText:n.state.selection.ranges.some(e=>!e.empty)});class Jy{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(t=>{try{t()}catch(i){console.error("TimeoutLatch callback error:",i)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class nh{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var vr=null,Zy=()=>typeof window>"u"?new nh:(vr||(vr=new nh),vr),sh=ct.define(),e1=200,t1=[];function i1(n){var e=n.value,t=n.selection,i=n.onChange,s=n.onStatistics,r=n.onCreateEditor,o=n.onUpdate,l=n.extensions,a=l===void 0?t1:l,h=n.autoFocus,c=n.theme,f=c===void 0?"light":c,u=n.height,d=u===void 0?null:u,p=n.minHeight,m=p===void 0?null:p,b=n.maxHeight,y=b===void 0?null:b,v=n.width,S=v===void 0?null:v,T=n.minWidth,C=T===void 0?null:T,A=n.maxWidth,w=A===void 0?null:A,N=n.placeholder,H=N===void 0?"":N,j=n.editable,W=j===void 0?!0:j,B=n.readOnly,$=B===void 0?!1:B,V=n.indentWithTab,K=V===void 0?!0:V,J=n.basicSetup,oe=J===void 0?!0:J,be=n.root,ie=n.initialState,ue=ye.useState(),g=ue[0],O=ue[1],L=ye.useState(),R=L[0],z=L[1],X=ye.useState(),Y=X[0],Pe=X[1],se=ye.useState(()=>({current:null}))[0],ei=ye.useState(()=>({current:null}))[0],vu=P.theme({"&":{height:d,minHeight:m,maxHeight:y,width:S,minWidth:C,maxWidth:w},"& .cm-scroller":{height:"100% !important"}}),wu=P.updateListener.of(Je=>{if(Je.docChanged&&typeof i=="function"&&!Je.transactions.some(Qs=>Qs.annotation(sh))){se.current?se.current.reset():(se.current=new Jy(()=>{if(ei.current){var Qs=ei.current;ei.current=null,Qs()}se.current=null},e1),Zy().add(se.current));var It=Je.state.doc,Nt=It.toString();i(Nt,Je)}s&&s(Yy(Je))}),Su=Gy({theme:f,editable:W,readOnly:$,placeholder:H,indentWithTab:K,basicSetup:oe}),Mi=[wu,vu,...Su];return o&&typeof o=="function"&&Mi.push(P.updateListener.of(o)),Mi=Mi.concat(a),ye.useLayoutEffect(()=>{if(g&&!Y){var Je={doc:e,selection:t,extensions:Mi},It=ie?U.fromJSON(ie.json,Je,ie.fields):U.create(Je);if(Pe(It),!R){var Nt=new P({state:It,parent:g,root:be});z(Nt),r&&r(Nt,It)}}return()=>{R&&(Pe(void 0),z(void 0))}},[g,Y]),ye.useEffect(()=>{n.container&&O(n.container)},[n.container]),ye.useEffect(()=>()=>{R&&(R.destroy(),z(void 0)),se.current&&(se.current.cancel(),se.current=null)},[R]),ye.useEffect(()=>{h&&R&&R.focus()},[h,R]),ye.useEffect(()=>{R&&R.dispatch({effects:Q.reconfigure.of(Mi)})},[f,a,d,m,y,S,C,w,H,W,$,K,oe,i,o]),ye.useEffect(()=>{if(e!==void 0){var Je=R?R.state.doc.toString():"";if(R&&e!==Je){var It=se.current&&!se.current.isDone,Nt=()=>{R&&e!==R.state.doc.toString()&&R.dispatch({changes:{from:0,to:R.state.doc.toString().length,insert:e||""},annotations:[sh.of(!0)]})};It?ei.current=Nt:Nt()}}},[e,R]),{state:Y,setState:Pe,view:R,setView:z,container:g,setContainer:O}}var n1=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],s1=ye.forwardRef((n,e)=>{var t=n.className,i=n.value,s=i===void 0?"":i,r=n.selection,o=n.extensions,l=o===void 0?[]:o,a=n.onChange,h=n.onStatistics,c=n.onCreateEditor,f=n.onUpdate,u=n.autoFocus,d=n.theme,p=d===void 0?"light":d,m=n.height,b=n.minHeight,y=n.maxHeight,v=n.width,S=n.minWidth,T=n.maxWidth,C=n.basicSetup,A=n.placeholder,w=n.indentWithTab,N=n.editable,H=n.readOnly,j=n.root,W=n.initialState,B=Eu(n,n1),$=ye.useRef(null),V=i1({root:j,value:s,autoFocus:u,theme:p,height:m,minHeight:b,maxHeight:y,width:v,minWidth:S,maxWidth:T,basicSetup:C,placeholder:A,indentWithTab:w,editable:N,readOnly:H,selection:r,onChange:a,onStatistics:h,onCreateEditor:c,onUpdate:f,extensions:l,initialState:W}),K=V.state,J=V.view,oe=V.container,be=V.setContainer;ye.useImperativeHandle(e,()=>({editor:$.current,state:K,view:J}),[$,oe,K,J]);var ie=ye.useCallback(g=>{$.current=g,be(g)},[be]);if(typeof s!="string")throw new Error("value must be typeof string but got "+typeof s);var ue=typeof p=="string"?"cm-theme-"+p:"cm-theme";return Tu.jsx("div",Cr({ref:ie,className:""+ue+(t?" "+t:"")},B))});s1.displayName="CodeMirror";var rh={};class vs{constructor(e,t,i,s,r,o,l,a,h,c=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=s,this.pos=r,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let s=e.parser.context;return new vs(e,[],t,i,i,0,[],0,s?new oh(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,s=e&65535,{parser:r}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[s])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,t,i,s=4,r=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==i)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=i;return}}}if(!r||this.pos==i)this.buffer.push(e,t,i,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>i;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=s}}shift(e,t,i,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let r=e,{parser:o}=this.p;this.pos=s;let l=o.stateFlag(r,1);!l&&(s>i||t<=o.maxNode)&&(this.reducePos=s),this.pushState(r,l?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,s,4)}else this.pos=s,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,s,4)}apply(e,t,i,s){e&65536?this.reduce(e):this.shift(e,t,i,s)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(t,s),this.buffer.push(i,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),s=e.bufferBase+t;for(;e&&s==e.bufferBase;)e=e.parent;return new vs(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new r1(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let s=[];for(let r=0,o;ra&1&&l==o)||s.push(t[r],o)}t=s}let i=[];for(let s=0;s>19,s=t&65535,r=this.stack.length-i*3;if(r<0||e.getGoto(this.stack[r],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(s,r)=>{if(!t.includes(s))return t.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-r;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,r+1);if(l!=null)return l}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class oh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class r1{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=s}}class ws{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ws(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ws(this.stack,this.pos,this.index)}}function Vn(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,s=0;i=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),r+=a,l)break;r*=46}t?t[s++]=r:t=new e(r)}return t}class Kn{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const lh=new Kn;class o1{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=lh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,s=this.rangeIndex,r=this.pos+e;for(;ri.to:r>=i.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];r+=o.from-i.to,i=o}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,s;if(t>=0&&t=this.chunk2Pos&&il.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),s=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),s}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=lh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let s of this.ranges){if(s.from>=t)break;s.to>e&&(i+=this.input.read(Math.max(s.from,e),Math.min(s.to,t)))}return i}}class mi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;l1(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}mi.prototype.contextual=mi.prototype.fallback=mi.prototype.extend=!1;mi.prototype.fallback=mi.prototype.extend=!1;class zs{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function l1(n,e,t,i,s,r){let o=0,l=1<0){let p=n[d];if(a.allows(p)&&(e.token.value==-1||e.token.value==p||a1(p,e.token.value,s,r))){e.acceptToken(p);break}}let c=e.next,f=0,u=n[o+2];if(e.next<0&&u>f&&n[h+u*3-3]==65535){o=n[h+u*3-1];continue e}for(;f>1,p=h+d+(d<<1),m=n[p],b=n[p+1]||65536;if(c=b)f=d+1;else{o=n[p+2],e.advance();continue e}}break}}function ah(n,e,t){for(let i=e,s;(s=n[i])!=65535;i++)if(s==t)return i-e;return-1}function a1(n,e,t,i){let s=ah(t,i,e);return s<0||ah(t,i,n)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class h1{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?hh(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?hh(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(r instanceof fe){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+r.length}}}class c1{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Kn)}getActions(e){let t=0,i=null,{parser:s}=e.p,{tokenizers:r}=s,o=s.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hf.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let u=t;if(f.extended>-1&&(t=this.addActions(e,f.extended,f.end,t)),t=this.addActions(e,f.value,f.end,t),!c.extend&&(i=f,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new Kn,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Kn,{pos:i,p:s}=e;return t.start=i,t.end=Math.min(i+1,s.stream.end),t.value=i==s.stream.end?s.parser.eofTerm:0,t}updateCachedToken(e,t,i){let s=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(s,e),i),e.value>-1){let{parser:r}=i.p;for(let o=0;o=0&&i.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,t,i,s){for(let r=0;re.bufferLength*4?new h1(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],s,r;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)i.push(l);else{if(this.advanceStack(l,i,e))continue;{s||(s=[],r=[]),s.push(l);let a=this.tokens.getMainToken(l);r.push(a.value,a.end)}}break}}if(!i.length){let o=s&&p1(s);if(o)return He&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw He&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,r,i);if(o)return He&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue e}}}i.length>12&&(i.sort((o,l)=>l.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let f=this.fragments.nodeAt(s);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?r.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!h||(f.prop(q.contextHash)||0)==c))return e.useNode(f,u),He&&console.log(o+this.stackID(e)+` (via reuse of ${r.getName(f.type.id)})`),!0;if(!(f instanceof fe)||f.children.length==0||f.positions[0]>0)break;let d=f.children[0];if(d instanceof fe&&f.positions[0]==0)f=d;else break}}let l=r.stateSlot(e.state,4);if(l>0)return e.reduce(l),He&&console.log(o+this.stackID(e)+` (via always-reduce ${r.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hs?t.push(p):i.push(p)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return ch(e,t),!0}}runRecovery(e,t,i){let s=null,r=!1;for(let o=0;o ":"";if(l.deadEnd&&(r||(r=!0,l.restart(),He&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let f=l.split(),u=c;for(let d=0;d<10&&f.forceReduce()&&(He&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));d++)He&&(u=this.stackID(f)+" -> ");for(let d of l.recoverByInsert(a))He&&console.log(c+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,i);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),He&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),ch(l,i)):(!s||s.scoren;class d1{constructor(e){this.start=e.start,this.shift=e.shift||Sr,this.reduce=e.reduce||Sr,this.reuse=e.reuse||Sr,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Ss extends qc{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),s=[];for(let l=0;l=0)r(c,a,l[h++]);else{let f=l[h+-c];for(let u=-c;u>0;u--)r(l[h++],a,f);h++}}}this.nodeSet=new qo(t.map((l,a)=>Ne.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:s[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Vc;let o=Vn(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new mi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let s=new f1(this,e,t,i);for(let r of this.wrappers)s=r(s,e,t,i);return s}getGoto(e,t,i=!1){let s=this.goto;if(t>=s[0])return-1;for(let r=s[t+1];;){let o=s[r++],l=o&1,a=s[r++];if(l&&i)return a;for(let h=r+(o>>1);r0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),s=i?t(i):void 0;for(let r=this.stateSlot(e,1);s==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=pt(this.data,r+2);else break;s=t(pt(this.data,r+1))}return s}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=pt(this.data,i+2);else break;if((this.data[i+2]&1)==0){let s=this.data[i+1];t.some((r,o)=>o&1&&r==s)||t.push(this.data[i],s)}}return t}configure(e){let t=Object.assign(Object.create(Ss.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let s=e.tokenizers.find(r=>r.from==i);return s?s.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,s)=>{let r=e.specializers.find(l=>l.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});return t.specializers[s]=fh(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let r of e.split(" ")){let o=t.indexOf(r);o>=0&&(i[o]=!0)}let s=null;for(let r=0;ri)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scoren.external(t,i)<<1|e}return n.get}const si=63,uh=64,m1=1,g1=2,pu=3,b1=4,mu=5,y1=6,x1=7,gu=65,k1=66,v1=8,w1=9,S1=10,O1=11,C1=12,bu=13,A1=19,M1=20,T1=29,P1=33,D1=34,R1=47,E1=0,al=1,vo=2,hn=3,wo=4;class zt{constructor(e,t,i){this.parent=e,this.depth=t,this.type=i,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+i}}zt.top=new zt(null,-1,E1);function _i(n,e){for(let t=0,i=e-n.pos-1;;i--,t++){let s=n.peek(i);if(kt(s)||s==-1)return t}}function So(n){return n==32||n==9}function kt(n){return n==10||n==13}function yu(n){return So(n)||kt(n)}function _t(n){return n<0||yu(n)}const B1=new d1({start:zt.top,reduce(n,e){return n.type==hn&&(e==M1||e==D1)?n.parent:n},shift(n,e,t,i){if(e==pu)return new zt(n,_i(i,i.pos),al);if(e==gu||e==mu)return new zt(n,_i(i,i.pos),vo);if(e==si)return n.parent;if(e==A1||e==P1)return new zt(n,0,hn);if(e==bu&&n.type==wo)return n.parent;if(e==R1){let s=/[1-9]/.exec(i.read(i.pos,t.pos));if(s)return new zt(n,n.depth+ +s[0],wo)}return n},hash(n){return n.hash}});function Si(n,e,t=0){return n.peek(t)==e&&n.peek(t+1)==e&&n.peek(t+2)==e&&_t(n.peek(t+3))}const L1=new zs((n,e)=>{if(n.next==-1&&e.canShift(uh))return n.acceptToken(uh);let t=n.peek(-1);if((kt(t)||t<0)&&e.context.type!=hn){if(Si(n,45))if(e.canShift(si))n.acceptToken(si);else return n.acceptToken(m1,3);if(Si(n,46))if(e.canShift(si))n.acceptToken(si);else return n.acceptToken(g1,3);let i=0;for(;n.next==32;)i++,n.advance();(i{if(e.context.type==hn){n.next==63&&(n.advance(),_t(n.next)&&n.acceptToken(x1));return}if(n.next==45)n.advance(),_t(n.next)&&n.acceptToken(e.context.type==al&&e.context.depth==_i(n,n.pos-1)?b1:pu);else if(n.next==63)n.advance(),_t(n.next)&&n.acceptToken(e.context.type==vo&&e.context.depth==_i(n,n.pos-1)?y1:mu);else{let t=n.pos;for(;;)if(So(n.next)){if(n.pos==t)return;n.advance()}else if(n.next==33)xu(n);else if(n.next==38)Oo(n);else if(n.next==42){Oo(n);break}else if(n.next==39||n.next==34){if(hl(n,!0))break;return}else if(n.next==91||n.next==123){if(!W1(n))return;break}else{ku(n,!0,!1,0);break}for(;So(n.next);)n.advance();if(n.next==58){if(n.pos==t&&e.canShift(T1))return;let i=n.peek(1);_t(i)&&n.acceptTokenTo(e.context.type==vo&&e.context.depth==_i(n,t)?k1:gu,t)}}},{contextual:!0});function N1(n){return n>32&&n<127&&n!=34&&n!=37&&n!=44&&n!=60&&n!=62&&n!=92&&n!=94&&n!=96&&n!=123&&n!=124&&n!=125}function dh(n){return n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70}function ph(n,e){return n.next==37?(n.advance(),dh(n.next)&&n.advance(),dh(n.next)&&n.advance(),!0):N1(n.next)||e&&n.next==44?(n.advance(),!0):!1}function xu(n){if(n.advance(),n.next==60){for(n.advance();;)if(!ph(n,!0)){n.next==62&&n.advance();break}}else for(;ph(n,!1););}function Oo(n){for(n.advance();!_t(n.next)&&Os(n.next)!="f";)n.advance()}function hl(n,e){let t=n.next,i=!1,s=n.pos;for(n.advance();;){let r=n.next;if(r<0)break;if(n.advance(),r==t)if(r==39)if(n.next==39)n.advance();else break;else break;else if(r==92&&t==34)n.next>=0&&n.advance();else if(kt(r)){if(e)return!1;i=!0}else if(e&&n.pos>=s+1024)return!1}return!i}function W1(n){for(let e=[],t=n.pos+1024;;)if(n.next==91||n.next==123)e.push(n.next),n.advance();else if(n.next==39||n.next==34){if(!hl(n,!0))return!1}else if(n.next==93||n.next==125){if(e[e.length-1]!=n.next-2)return!1;if(e.pop(),n.advance(),!e.length)return!0}else{if(n.next<0||n.pos>t||kt(n.next))return!1;n.advance()}}const H1="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function Os(n){return n<33?"u":n>125?"s":H1[n-33]}function Or(n,e){let t=Os(n);return t!="u"&&!(e&&t=="f")}function ku(n,e,t,i){if(Os(n.next)=="s"||(n.next==63||n.next==58||n.next==45)&&Or(n.peek(1),t))n.advance();else return!1;let s=n.pos;for(;;){let r=n.next,o=0,l=i+1;for(;yu(r);){if(kt(r)){if(e)return!1;l=0}else l++;r=n.peek(++o)}if(!(r>=0&&(r==58?Or(n.peek(o+1),t):r==35?n.peek(o-1)!=32:Or(r,t)))||!t&&l<=i||l==0&&!t&&(Si(n,45,o)||Si(n,46,o)))break;if(e&&Os(r)=="f")return!1;for(let h=o;h>=0;h--)n.advance();if(e&&n.pos>s+1024)return!1}return!0}const F1=new zs((n,e)=>{if(n.next==33)xu(n),n.acceptToken(C1);else if(n.next==38||n.next==42){let t=n.next==38?S1:O1;Oo(n),n.acceptToken(t)}else n.next==39||n.next==34?(hl(n,!1),n.acceptToken(w1)):ku(n,!1,e.context.type==hn,e.context.depth)&&n.acceptToken(v1)}),V1=new zs((n,e)=>{let t=e.context.type==wo?e.context.depth:-1,i=n.pos;e:for(;;){let s=0,r=n.next;for(;r==32;)r=n.peek(++s);if(!s&&(Si(n,45,s)||Si(n,46,s))||!kt(r)&&(t<0&&(t=Math.max(e.context.depth+1,s)),sYAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:B1,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[z1],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[L1,I1,F1,V1,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),$1=as.define({name:"yaml",parser:Q1.configure({props:[Kc.add({Stream:n=>{for(let e=n.node.resolve(n.pos,-1);e&&e.to>=n.pos;e=e.parent){if(e.name=="BlockLiteralContent"&&e.fromn.pos)return null}}return null},FlowMapping:va({closing:"}"}),FlowSequence:va({closing:"]"})}),Jc.add({"FlowMapping FlowSequence":kg,"Item Pair BlockLiteral":(n,e)=>({from:e.doc.lineAt(n.from).to,to:n.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function j1(){return new hg($1)}export{P as E,s1 as R,Ru as a,Du as b,_1 as c,q1 as d,Cu as g,Tu as j,jy as o,ye as r,j1 as y}; +`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Mb(this):new Ob(this)}getCursor(e,t=0,i){let s=e.doc?e:U.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?ni(this,s,t,i):ii(this,s,t,i)}}class Kf{constructor(e){this.spec=e}}function wb(n,e,t){return(i,s,r,o)=>{if(t&&!t(i,s,r,o))return!1;let l=i>=o&&s<=o+r.length?r.slice(i-o,s-o):e.doc.sliceString(i,s);return n(l,e,i,s)}}function ii(n,e,t,i){let s;return n.wholeWord&&(s=Sb(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(s=wb(n.test,e,s)),new wi(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:r=>r.toLowerCase(),s)}function Sb(n,e){return(t,i,s,r)=>((r>t||r+s.length=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=ii(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function Cb(n,e,t){return(i,s,r)=>(!t||t(i,s,r))&&n(r[0],e,i,s)}function ni(n,e,t,i){let s;return n.wholeWord&&(s=Ab(e.charCategorizer(e.selection.main.head))),n.test&&(s=Cb(n.test,e,s)),new Xf(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:s},t,i)}function ms(n,e){return n.slice(ge(n,e,!1),e)}function gs(n,e){return n.slice(e,ge(n,e))}function Ab(n){return(e,t,i)=>!i[0].length||(n(ms(i.input,i.index))!=re.Word||n(gs(i.input,i.index))!=re.Word)&&(n(gs(i.input,i.index+i[0].length))!=re.Word||n(ms(i.input,i.index+i[0].length))!=re.Word)}class Mb extends Kf{nextMatch(e,t,i){let s=ni(this.spec,e,i,e.doc.length).next();return s.done&&(s=ni(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=ni(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let s=i.length;s>0;s--){let r=+i.slice(0,s);if(r>0&&r=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=ni(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const sn=Q.define(),el=Q.define(),At=Oe.define({create(n){return new gr(xo(n).create(),null)},update(n,e){for(let t of e.effects)t.is(sn)?n=new gr(t.value.create(),n.panel):t.is(el)&&(n=new gr(n.query,t.value?tl:null));return n},provide:n=>Zi.from(n,e=>e.panel)});class gr{constructor(e,t){this.query=e,this.panel=t}}const Tb=I.mark({class:"cm-searchMatch"}),Pb=I.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Db=he.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(At))}update(n){let e=n.state.field(At);(e!=n.startState.field(At)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return I.none;let{view:t}=this,i=new bt;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-500;)a=r[++s].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?Pb:Tb)})}return i.finish()}},{decorations:n=>n.decorations});function gn(n){return e=>{let t=e.state.field(At,!1);return t&&t.query.spec.valid?n(e,t):Jf(e)}}const bs=gn((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let s=k.single(i.from,i.to),r=n.state.facet(Ai);return n.dispatch({selection:s,effects:[il(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"}),Yf(n),!0}),ys=gn((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);if(!s)return!1;let r=k.single(s.from,s.to),o=n.state.facet(Ai);return n.dispatch({selection:r,effects:[il(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),Yf(n),!0}),Rb=gn((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:k.create(t.map(i=>k.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),Eb=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new wi(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(k.range(l.value.from,l.value.to))}return e(n.update({selection:k.create(r,o),userEvent:"select.search.matches"})),!0},Ha=gn((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=r,l=[],a,h,c=[];o.precise?o.from==i&&o.to==s&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),o=e.nextMatch(t,o.from,o.to),c.push(P.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))):o=e.nextMatch(t,o.from,o.to);let f=n.state.changes(l);return o&&(a=k.single(o.from,o.to).map(f),c.push(il(n,o)),c.push(t.facet(Ai).scrollToMatch(a.main,n))),n.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),Bb=gn((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let s of e.matchAll(n.state,1e9)){let{from:r,to:o,precise:l}=s;l&&t.push({from:r,to:o,insert:e.getReplacement(s)})}if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:P.announce.of(i),userEvent:"input.replace.all"}),!0});function tl(n){return n.state.facet(Ai).createPanel(n)}function xo(n,e){var t,i,s,r,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(Ai);return new jf({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(r=e?.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function Gf(n){let e=$o(n,tl);return e&&e.dom.querySelector("[main-field]")}function Yf(n){let e=Gf(n);e&&e==n.root.activeElement&&e.select()}const Jf=n=>{let e=n.state.field(At,!1);if(e&&e.panel){let t=Gf(n);if(t&&t!=n.root.activeElement){let i=xo(n.state,e.query.spec);i.valid&&n.dispatch({effects:sn.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[el.of(!0),e?sn.of(xo(n.state,e.query.spec)):Q.appendConfig.of(Wb)]});return!0},Zf=n=>{let e=n.state.field(At,!1);if(!e||!e.panel)return!1;let t=$o(n,tl);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:el.of(!1)}),!0},Lb=[{key:"Mod-f",run:Jf,scope:"editor search-panel"},{key:"F3",run:bs,shift:ys,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:bs,shift:ys,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Zf,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Eb},{key:"Mod-Alt-g",run:cb},{key:"Mod-d",run:vb,preventDefault:!0}];class Ib{constructor(e){this.view=e;let t=this.query=e.state.field(At).query.spec;this.commit=this.commit.bind(this),this.searchField=Z("input",{value:t.search,placeholder:We(e,"Find"),"aria-label":We(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Z("input",{value:t.replace,placeholder:We(e,"Replace"),"aria-label":We(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Z("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Z("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Z("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return Z("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=Z("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>bs(e),[We(e,"next")]),i("prev",()=>ys(e),[We(e,"previous")]),i("select",()=>Rb(e),[We(e,"all")]),Z("label",null,[this.caseField,We(e,"match case")]),Z("label",null,[this.reField,We(e,"regexp")]),Z("label",null,[this.wordField,We(e,"by word")]),...e.state.readOnly?[]:[Z("br"),this.replaceField,i("replace",()=>Ha(e),[We(e,"replace")]),i("replaceAll",()=>Bb(e),[We(e,"replace all")])],Z("button",{name:"close",onclick:()=>Zf(e),"aria-label":We(e,"close"),type:"button"},["×"])])}commit(){let e=new jf({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:sn.of(e)}))}keydown(e){Hp(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ys:bs)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Ha(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(sn)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ai).top}}function We(n,e){return n.state.phrase(e)}const Nn=30,Wn=/[\s\.,:;?!]/;function il(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-Nn),o=Math.min(s,t+Nn),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;al.length-Nn;a--)if(!Wn.test(l[a-1])&&Wn.test(l[a])){l=l.slice(0,a);break}}return P.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const Nb=P.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Wb=[At,Zt.low(Db),Nb];class eu{constructor(e,t,i,s){this.state=e,this.pos=t,this.explicit=i,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Se(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(tu(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function Fa(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Hb(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;rtypeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:Hb(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}class Va{constructor(e,t,i,s){this.completion=e,this.source=t,this.match=i,this.score=s}}function jt(n){return n.selection.main.from}function tu(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const iu=ct.define();function Vb(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return{...n.changeByRange(l=>{if(l!=s&&t!=i&&n.sliceDoc(l.from+r,l.from+o)!=n.sliceDoc(t,i))return{range:l};let a=n.toText(e);return{changes:{from:l.from+r,to:i==s.from?l.to:l.from+o,insert:a},range:k.cursor(l.from+r+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const za=new WeakMap;function zb(n){if(!Array.isArray(n))return n;let e=za.get(n);return e||za.set(n,e=Fb(n)),e}const xs=Q.define(),rn=Q.define();class Qb{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&C<=57||C>=97&&C<=122?2:C>=65&&C<=90?1:0:(A=Co(C))!=A.toLowerCase()?1:A!=A.toUpperCase()?2:0;(!v||w==1&&b||T==0&&w!=0)&&(t[f]==C||i[f]==C&&(u=!0)?o[f++]=v:o.length&&(y=!1)),T=w,v+=st(C)}return f==a&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):f==a?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let l=o+(this.astral?st(De(i,o)):1);r&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return this.ret(e-i.length,s)}}class $b{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:qb,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>Qa(e(i),t(i)),optionClass:(e,t)=>i=>Qa(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Qa(n,e){return n?e?n+" "+e:n:e}function qb(n,e,t,i,s,r){let o=n.textDirection==te.RTL,l=o,a=!1,h="top",c,f,u=e.left-s.left,d=s.right-e.right,p=i.right-i.left,m=i.bottom-i.top;if(l&&u=m||v>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let b=(e.bottom-e.top)/r.offsetHeight,y=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/b}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}const nl=Q.define();function _b(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return at.position-i.position).map(t=>t.render)}function br(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.ceil((n-e)/t);return{from:n-i*t,to:n-(i-1)*t}}class Xb{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,l=e.state.facet(me);this.optionContent=_b(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=br(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:nl.of(c)}),a.preventDefault())}}),this.dom.addEventListener("focusout",a=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(me).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:rn.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=s){let{options:r,selected:o,disabled:l}=i.open;(!s.open||s.open.options!=r)&&(this.range=br(r.length,o,e.state.facet(me).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),l!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=br(t.options.length,t.selected,this.view.state.facet(me).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:r}=s;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(s);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>Be(this.view.state,l,"completion info")):(this.addInfoPane(o,s),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;i.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&jb(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottom{o.target==s&&o.preventDefault()});let r=null;for(let o=i.from;oi.from||i.from==0))if(r=u,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=u}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.tonew Xb(t,n,e)}function jb(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),s=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/s)}function $a(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function Kb(n,e){let t=[],i=null,s=null,r=c=>{t.push(c);let{section:f}=c.completion;if(f){i||(i=[]);let u=typeof f=="string"?f:f.name;i.some(d=>d.name==u)||i.push(typeof f=="string"?{name:u}:f)}},o=e.facet(me);for(let c of n)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)r(new Va(u,c.source,f?f(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),d,p=o.filterStrict?new $b(u):new Qb(u);for(let m of c.result.options)if(d=p.match(m.label)){let b=m.displayLabel?f?f(m,d.matched):[]:d.matched,y=d.score+(m.boost||0);if(r(new Va(m,c.source,b,y)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:v}=m.section;s||(s=Object.create(null)),s[v]=Math.max(y,s[v]||-1e9)}}}}if(i){let c=Object.create(null),f=0,u=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.nameu.score-f.score||h(f.completion,u.completion))){let f=c.completion;!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost?l.push(c):$a(c.completion)>$a(a)&&(l[l.length-1]=c),a=c.completion}return l}class ai{constructor(e,t,i,s,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ai(this.options,qa(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r,o){if(s&&!o&&e.some(h=>h.isPending))return s.setDisabled();let l=Kb(e,t);if(!l.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let a=t.facet(me).selectOnOpen?0:-1;if(s&&s.selected!=a&&s.selected!=-1){let h=s.options[s.selected].completion;for(let c=0;cc.hasResult()?Math.min(h,c.from):h,1e8),create:ty,above:r.aboveCursor},s?s.timestamp:Date.now(),a,!1)}map(e){return new ai(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ai(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class ks{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new ks(Zb,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(me),r=(i.override||t.languageDataAt("autocomplete",jt(t)).map(zb)).map(a=>(this.active.find(c=>c.source==a)||new $e(a,this.active.some(c=>c.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((a,h)=>a==this.active[h])&&(r=this.active);let o=this.open,l=e.effects.some(a=>a.is(sl));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!Gb(r,this.active)||l?o=ai.build(r,t,this.id,o,i,l):o&&o.disabled&&!r.some(a=>a.isPending)&&(o=null),!o&&r.every(a=>!a.isPending)&&r.some(a=>a.hasResult())&&(r=r.map(a=>a.hasResult()?new $e(a.source,0):a));for(let a of e.effects)a.is(nl)&&(o=o&&o.setSelected(a.value,this.id));return r==this.active&&o==this.open?this:new ks(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Yb:Jb}}function Gb(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const Zb=[];function nu(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(iu);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class $e{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=nu(e,t),s=this;(i&8||i&16&&this.touches(e))&&(s=new $e(s.source,0)),i&4&&s.state==0&&(s=new $e(this.source,1)),s=s.updateFor(e,i);for(let r of e.effects)if(r.is(xs))s=new $e(s.source,1,r.value);else if(r.is(rn))s=new $e(s.source,0);else if(r.is(sl))for(let o of r.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(jt(e.state))}}class pi extends $e{constructor(e,t,i,s,r,o){super(e,3,t),this.limit=i,this.result=s,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=jt(e.state);if(l>o||!s||t&2&&(jt(e.startState)==this.from||lt.map(e))}}),Re=Oe.define({create(){return ks.start()},update(n,e){return n.update(e)},provide:n=>[Qo.from(n,e=>e.tooltip),P.contentAttributes.from(n,e=>e.attrs)]});function rl(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(Re).active.find(s=>s.source==e.source);return i instanceof pi?(typeof t=="string"?n.dispatch({...Vb(n.state,t,i.from,i.to),annotations:iu.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const ty=Ub(Re,rl);function Hn(n,e="option"){return t=>{let i=t.state.field(Re,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:nl.of(l)}),!0}}const iy=n=>{let e=n.state.field(Re,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(Re,!1)?(n.dispatch({effects:xs.of(!0)}),!0):!1,ny=n=>{let e=n.state.field(Re,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:rn.of(null)}),!0)};class sy{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const ry=50,oy=1e3,ly=he.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(Re).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(Re),t=n.state.facet(me);if(!n.selectionSet&&!n.docChanged&&n.startState.field(Re)==e)return;let i=n.transactions.some(r=>{let o=nu(r,t);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;rry&&Date.now()-o.time>oy){for(let l of o.context.abortListeners)try{l()}catch(a){Be(this.view.state,a)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(r=>r.effects.some(o=>o.is(xs)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.isPending&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of n.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(Re);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(me).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=jt(e),i=new eu(e,t,n.explicit,this.view),s=new sy(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:rn.of(null)}),Be(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(me).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(me),i=this.view.state.field(Re);for(let s=0;sl.source==r.active.source);if(o&&o.isPending)if(r.done==null){let l=new $e(r.active.source,0);for(let a of r.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:sl.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(Re,!1);if(e&&e.tooltip&&this.view.state.facet(me).closeOnBlur){let t=e.open&&Lc(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:rn.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:xs.of(!1)}),20),this.composing=0}}}),ay=typeof navigator=="object"&&/Win/.test(navigator.platform),hy=Zt.highest(P.domEventHandlers({keydown(n,e){let t=e.state.field(Re,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(ay&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],s=t.active.find(o=>o.source==i.source),r=i.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(n.key)>-1&&rl(e,i),!1}})),cy=P.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),on={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},qt=Q.define({map(n,e){let t=e.mapPos(n,-1,Me.TrackAfter);return t??void 0}}),ol=new class extends Mt{};ol.startSide=1;ol.endSide=-1;const su=Oe.define({create(){return _.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(qt)&&(n=n.update({add:[ol.range(t.value,t.value+1)]}));return n}});function fy(){return[dy,su]}const xr="()[]{}<>«»»«[]{}";function ru(n){for(let e=0;e{if((uy?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&st(De(i,0))==1||e!=s.from||t!=s.to)return!1;let r=gy(n.state,i);return r?(n.dispatch(r),!0):!1}),py=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=ou(n,n.selection.main.head).brackets||on.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=by(n.doc,o.head);for(let a of i)if(a==l&&Vs(n.doc,o.head)==ru(De(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:k.cursor(o.head-a.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},my=[{key:"Backspace",run:py}];function gy(n,e){let t=ou(n,n.selection.main.head),i=t.brackets||on.brackets;for(let s of i){let r=ru(De(s,0));if(e==s)return r==s?ky(n,s,i.indexOf(s+s+s)>-1,t):yy(n,s,r,t.before||on.before);if(e==r&&lu(n,n.selection.main.from))return xy(n,s,r)}return null}function lu(n,e){let t=!1;return n.field(su).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Vs(n,e){let t=n.sliceString(e,e+2);return t.slice(0,st(De(t,0)))}function by(n,e){let t=n.sliceString(e-2,e);return st(De(t,0))==t.length?t:t.slice(1)}function yy(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:qt.of(o.to+e.length),range:k.range(o.anchor+e.length,o.head+e.length)};let l=Vs(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:qt.of(o.head+e.length),range:k.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function xy(n,e,t){let i=null,s=n.changeByRange(r=>r.empty&&Vs(n.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:k.cursor(r.head+t.length)}:i={range:r});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function ky(n,e,t,i){let s=i.stringPrefixes||on.stringPrefixes,r=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:qt.of(l.to+e.length),range:k.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=Vs(n.doc,a),c;if(h==e){if(_a(n,a))return{changes:{insert:e+e,from:a},effects:qt.of(a+e.length),range:k.cursor(a+e.length)};if(lu(n,a)){let u=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:k.cursor(a+u.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(c=Xa(n,a-2*e.length,s))>-1&&_a(n,c))return{changes:{insert:e+e+e+e,from:a},effects:qt.of(a+e.length),range:k.cursor(a+e.length)};if(n.charCategorizer(a)(h)!=re.Word&&Xa(n,a,s)>-1&&!vy(n,a,e,s))return{changes:{insert:e+e,from:a},effects:qt.of(a+e.length),range:k.cursor(a+e.length)}}return{range:r=l}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function _a(n,e){let t=Se(n).resolveInner(e+1);return t.parent&&t.from==e}function vy(n,e,t,i){let s=Se(n).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+a;){if(n.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function Xa(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=re.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=re.Word)return r}return-1}function wy(n={}){return[hy,Re,me.of(n),ly,Sy,cy]}const au=[{key:"Ctrl-Space",run:yr},{mac:"Alt-`",run:yr},{mac:"Alt-i",run:yr},{key:"Escape",run:ny},{key:"ArrowDown",run:Hn(!0)},{key:"ArrowUp",run:Hn(!1)},{key:"PageDown",run:Hn(!0,"page")},{key:"PageUp",run:Hn(!1,"page")},{key:"Enter",run:iy}],Sy=Zt.highest(Rs.computeN([me],n=>n.facet(me).defaultKeymap?[au]:[]));class Ua{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Vt{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=i.facet(ln).markerFilter;s&&(e=s(e,i));let r=e.slice().sort((d,p)=>d.from-p.from||d.to-p.to),o=new bt,l=[],a=0,h=i.doc.iter(),c=0,f=i.doc.length;for(let d=0;;){let p=d==r.length?null:r[d];if(!p&&!l.length)break;let m,b;if(l.length)m=a,b=l.reduce((S,T)=>Math.min(S,T.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;b=p.to,l.push(p),d++}for(;dS.from||S.to==m))l.push(S),d++,b=Math.min(S.to,b);else{b=Math.min(S.from,b);break}}b=Math.min(b,f);let y=!1;if(l.some(S=>S.from==m&&(S.to==b||b==f))&&(y=m==b,!y&&b-m<10)){let S=m-(c+h.value.length);S>0&&(h.next(S),c=m);for(let T=m;;){if(T>=b){y=!0;break}if(!h.lineBreak&&c+h.value.length>T)break;T=c+h.value.length,c+=h.value.length,h.next()}}let v=Ny(l);if(y)o.add(m,m,I.widget({widget:new Ey(v),diagnostics:l.slice()}));else{let S=l.reduce((T,C)=>C.markClass?T+" "+C.markClass:T,"");o.add(m,b,I.mark({class:"cm-lintRange cm-lintRange-"+v+S,diagnostics:l.slice(),inclusiveEnd:l.some(T=>T.to>b)}))}if(a=b,a==f)break;for(let S=0;S{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new Ua(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new Ua(i.from,r,i.diagnostic)}}),i}function Oy(n,e){let t=e.pos,i=e.end||t,s=n.state.facet(ln).hideOn(n,t,i);if(s!=null)return s;let r=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(hu))||n.changes.touchesRange(r.from,Math.max(r.to,i)))}function Cy(n,e){return n.field(Ve,!1)?e:e.concat(Q.appendConfig.of(Wy))}const hu=Q.define(),ll=Q.define(),cu=Q.define(),Ve=Oe.define({create(){return new Vt(I.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,s=n.panel;if(n.selected){let r=e.changes.mapPos(n.selected.from,1);i=Bt(t,n.selected.diagnostic,r)||Bt(t,null,r)}!t.size&&s&&e.state.facet(ln).autoPanel&&(s=null),n=new Vt(t,s,i)}for(let t of e.effects)if(t.is(hu)){let i=e.state.facet(ln).autoPanel?t.value.length?an.open:null:n.panel;n=Vt.init(t.value,i,e.state)}else t.is(ll)?n=new Vt(n.diagnostics,t.value?an.open:null,n.selected):t.is(cu)&&(n=new Vt(n.diagnostics,n.panel,t.value));return n},provide:n=>[Zi.from(n,e=>e.panel),P.decorations.from(n,e=>e.diagnostics)]}),Ay=I.mark({class:"cm-lintRange cm-lintRange-active"});function My(n,e,t){let{diagnostics:i}=n.state.field(Ve),s,r=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{if(e>=a&&e<=h&&(a==h||(e>a||t>0)&&(euu(n,t,!1)))}const Py=n=>{let e=n.state.field(Ve,!1);(!e||!e.panel)&&n.dispatch({effects:Cy(n.state,[ll.of(!0)])});let t=$o(n,an.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},ja=n=>{let e=n.state.field(Ve,!1);return!e||!e.panel?!1:(n.dispatch({effects:ll.of(!1)}),!0)},Dy=n=>{let e=n.state.field(Ve,!1);if(!e)return!1;let t=n.state.selection.main,i=Bt(e.diagnostics,null,t.to+1);return!i&&(i=Bt(e.diagnostics,null,0),!i||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),Mm(n,i.from,1,{tooltip:du,until:s=>s.docChanged||s.newSelection.main.headi.to}),!0)},Ry=[{key:"Mod-Shift-m",run:Py,preventDefault:!0},{key:"F8",run:Dy}],ln=D.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...ft(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Ka,tooltipFilter:Ka,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,s,r)=>e(i,s,r)||t(i,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function Ka(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function fu(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;ir.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function uu(n,e,t){var i;let s=t?fu(e.actions):[];return Z("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Z("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let p=Bt(n.state.field(Ve).diagnostics,e);p&&r.apply(n,p.from,p.to)},{name:h}=r,c=s[o]?h.indexOf(s[o]):-1,f=c<0?h:[h.slice(0,c),Z("u",h.slice(c,c+1)),h.slice(c+1)],u=r.markClass?" "+r.markClass:"";return Z("button",{type:"button",class:"cm-diagnosticAction"+u,onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&Z("div",{class:"cm-diagnosticSource"},e.source))}class Ey extends ut{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Z("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Ga{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=uu(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class an{constructor(e){this.view=e,this.items=[];let t=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)ja(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=fu(r.actions);for(let l=0;l{for(let r=0;rja(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ve).selected;if(!e)return-1;for(let t=0;t{for(let c of h.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,u;for(let d=i;di&&(this.items.splice(i,f-i),s=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),r=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),i++}});i({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let h=a.height/this.list.offsetHeight;l.topa.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Ve),i=Bt(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:cu.of(i)})}static open(e){return new an(e)}}function By(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function Fn(n){return By(``,'width="6" height="3"')}const Ly=P.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Fn("#f11")},".cm-lintRange-warning":{backgroundImage:Fn("orange")},".cm-lintRange-info":{backgroundImage:Fn("#999")},".cm-lintRange-hint":{backgroundImage:Fn("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Iy(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function Ny(n){let e="hint",t=1;for(let i of n){let s=Iy(i.severity);s>t&&(t=s,e=i.severity)}return e}const du=Am(My,{hideOn:Oy}),Wy=[Ve,P.decorations.compute([Ve],n=>{let{selected:e,panel:t}=n.field(Ve);return!e||!t||e.from==e.to?I.none:I.set([Ay.range(e.from,e.to)])}),du,Ly];var Ya=function(e){e===void 0&&(e={});var t=e,i=t.crosshairCursor,s=i===void 0?!1:i,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(my)),e.defaultKeymap!==!1&&(r=r.concat(lb)),e.searchKeymap!==!1&&(r=r.concat(Lb)),e.historyKeymap!==!1&&(r=r.concat(p0)),e.foldKeymap!==!1&&(r=r.concat(Tg)),e.completionKeymap!==!1&&(r=r.concat(au)),e.lintKeymap!==!1&&(r=r.concat(Ry));var o=[];return e.lineNumbers!==!1&&o.push(Vm()),e.highlightActiveLineGutter!==!1&&o.push($m()),e.highlightSpecialChars!==!1&&o.push(tm()),e.history!==!1&&o.push(r0()),e.foldGutter!==!1&&o.push(Eg()),e.drawSelection!==!1&&o.push(qp()),e.dropCursor!==!1&&o.push(Kp()),e.allowMultipleSelections!==!1&&o.push(U.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&o.push(yg()),e.syntaxHighlighting!==!1&&o.push(af(Ng,{fallback:!0})),e.bracketMatching!==!1&&o.push($g()),e.closeBrackets!==!1&&o.push(fy()),e.autocompletion!==!1&&o.push(wy()),e.rectangularSelection!==!1&&o.push(mm()),s!==!1&&o.push(ym()),e.highlightActiveLine!==!1&&o.push(lm()),e.highlightSelectionMatches!==!1&&o.push(db()),e.tabSize&&typeof e.tabSize=="number"&&o.push(Bs.of(" ".repeat(e.tabSize))),o.concat([Rs.of(r.flat())]).filter(Boolean)};const Hy="#e5c07b",Ja="#e06c75",Fy="#56b6c2",Vy="#ffffff",jn="#abb2bf",ko="#7d8799",zy="#61afef",Qy="#98c379",Za="#d19a66",$y="#c678dd",qy="#21252b",eh="#2c313a",th="#282c34",kr="#353a42",_y="#3E4451",ih="#528bff",Xy=P.theme({"&":{color:jn,backgroundColor:th},".cm-content":{caretColor:ih},".cm-cursor, .cm-dropCursor":{borderLeftColor:ih},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:_y},".cm-panels":{backgroundColor:qy,color:jn},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:th,color:ko,border:"none"},".cm-activeLineGutter":{backgroundColor:eh},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:kr},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:kr,borderBottomColor:kr},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:eh,color:jn}}},{dark:!0}),Uy=pn.define([{tag:x.keyword,color:$y},{tag:[x.name,x.deleted,x.character,x.propertyName,x.macroName],color:Ja},{tag:[x.function(x.variableName),x.labelName],color:zy},{tag:[x.color,x.constant(x.name),x.standard(x.name)],color:Za},{tag:[x.definition(x.name),x.separator],color:jn},{tag:[x.typeName,x.className,x.number,x.changed,x.annotation,x.modifier,x.self,x.namespace],color:Hy},{tag:[x.operator,x.operatorKeyword,x.url,x.escape,x.regexp,x.link,x.special(x.string)],color:Fy},{tag:[x.meta,x.comment],color:ko},{tag:x.strong,fontWeight:"bold"},{tag:x.emphasis,fontStyle:"italic"},{tag:x.strikethrough,textDecoration:"line-through"},{tag:x.link,color:ko,textDecoration:"underline"},{tag:x.heading,fontWeight:"bold",color:Ja},{tag:[x.atom,x.bool,x.special(x.variableName)],color:Za},{tag:[x.processingInstruction,x.string,x.inserted],color:Qy},{tag:x.invalid,color:Vy}]),jy=[Xy,af(Uy)];var Ky=P.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Gy=function(e){e===void 0&&(e={});var t=e,i=t.indentWithTab,s=i===void 0?!0:i,r=t.editable,o=r===void 0?!0:r,l=t.readOnly,a=l===void 0?!1:l,h=t.theme,c=h===void 0?"light":h,f=t.placeholder,u=f===void 0?"":f,d=t.basicSetup,p=d===void 0?!0:d,m=[];switch(s&&m.unshift(Rs.of([ab])),p&&(typeof p=="boolean"?m.unshift(Ya()):m.unshift(Ya(p))),u&&m.unshift(fm(u)),c){case"light":m.push(Ky);break;case"dark":m.push(jy);break;case"none":break;default:m.push(c);break}return o===!1&&m.push(P.editable.of(!1)),a&&m.push(U.readOnly.of(!0)),[...m]},Yy=n=>({line:n.state.doc.lineAt(n.state.selection.main.from),lineCount:n.state.doc.lines,lineBreak:n.state.lineBreak,length:n.state.doc.length,readOnly:n.state.readOnly,tabSize:n.state.tabSize,selection:n.state.selection,selectionAsSingle:n.state.selection.asSingle().main,ranges:n.state.selection.ranges,selectionCode:n.state.sliceDoc(n.state.selection.main.from,n.state.selection.main.to),selections:n.state.selection.ranges.map(e=>n.state.sliceDoc(e.from,e.to)),selectedText:n.state.selection.ranges.some(e=>!e.empty)});class Jy{constructor(e,t){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=t,this.timeoutMS=t,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(t=>{try{t()}catch(i){console.error("TimeoutLatch callback error:",i)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class nh{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var vr=null,Zy=()=>typeof window>"u"?new nh:(vr||(vr=new nh),vr),sh=ct.define(),e1=200,t1=[];function i1(n){var e=n.value,t=n.selection,i=n.onChange,s=n.onStatistics,r=n.onCreateEditor,o=n.onUpdate,l=n.extensions,a=l===void 0?t1:l,h=n.autoFocus,c=n.theme,f=c===void 0?"light":c,u=n.height,d=u===void 0?null:u,p=n.minHeight,m=p===void 0?null:p,b=n.maxHeight,y=b===void 0?null:b,v=n.width,S=v===void 0?null:v,T=n.minWidth,C=T===void 0?null:T,A=n.maxWidth,w=A===void 0?null:A,N=n.placeholder,H=N===void 0?"":N,j=n.editable,W=j===void 0?!0:j,B=n.readOnly,$=B===void 0?!1:B,V=n.indentWithTab,K=V===void 0?!0:V,J=n.basicSetup,oe=J===void 0?!0:J,be=n.root,ie=n.initialState,ue=ye.useState(),g=ue[0],O=ue[1],L=ye.useState(),R=L[0],z=L[1],X=ye.useState(),Y=X[0],Pe=X[1],se=ye.useState(()=>({current:null}))[0],ei=ye.useState(()=>({current:null}))[0],vu=P.theme({"&":{height:d,minHeight:m,maxHeight:y,width:S,minWidth:C,maxWidth:w},"& .cm-scroller":{height:"100% !important"}}),wu=P.updateListener.of(Je=>{if(Je.docChanged&&typeof i=="function"&&!Je.transactions.some(Qs=>Qs.annotation(sh))){se.current?se.current.reset():(se.current=new Jy(()=>{if(ei.current){var Qs=ei.current;ei.current=null,Qs()}se.current=null},e1),Zy().add(se.current));var It=Je.state.doc,Nt=It.toString();i(Nt,Je)}s&&s(Yy(Je))}),Su=Gy({theme:f,editable:W,readOnly:$,placeholder:H,indentWithTab:K,basicSetup:oe}),Mi=[wu,vu,...Su];return o&&typeof o=="function"&&Mi.push(P.updateListener.of(o)),Mi=Mi.concat(a),ye.useLayoutEffect(()=>{if(g&&!Y){var Je={doc:e,selection:t,extensions:Mi},It=ie?U.fromJSON(ie.json,Je,ie.fields):U.create(Je);if(Pe(It),!R){var Nt=new P({state:It,parent:g,root:be});z(Nt),r&&r(Nt,It)}}return()=>{R&&(Pe(void 0),z(void 0))}},[g,Y]),ye.useEffect(()=>{n.container&&O(n.container)},[n.container]),ye.useEffect(()=>()=>{R&&(R.destroy(),z(void 0)),se.current&&(se.current.cancel(),se.current=null)},[R]),ye.useEffect(()=>{h&&R&&R.focus()},[h,R]),ye.useEffect(()=>{R&&R.dispatch({effects:Q.reconfigure.of(Mi)})},[f,a,d,m,y,S,C,w,H,W,$,K,oe,i,o]),ye.useEffect(()=>{if(e!==void 0){var Je=R?R.state.doc.toString():"";if(R&&e!==Je){var It=se.current&&!se.current.isDone,Nt=()=>{R&&e!==R.state.doc.toString()&&R.dispatch({changes:{from:0,to:R.state.doc.toString().length,insert:e||""},annotations:[sh.of(!0)]})};It?ei.current=Nt:Nt()}}},[e,R]),{state:Y,setState:Pe,view:R,setView:z,container:g,setContainer:O}}var n1=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],s1=ye.forwardRef((n,e)=>{var t=n.className,i=n.value,s=i===void 0?"":i,r=n.selection,o=n.extensions,l=o===void 0?[]:o,a=n.onChange,h=n.onStatistics,c=n.onCreateEditor,f=n.onUpdate,u=n.autoFocus,d=n.theme,p=d===void 0?"light":d,m=n.height,b=n.minHeight,y=n.maxHeight,v=n.width,S=n.minWidth,T=n.maxWidth,C=n.basicSetup,A=n.placeholder,w=n.indentWithTab,N=n.editable,H=n.readOnly,j=n.root,W=n.initialState,B=Eu(n,n1),$=ye.useRef(null),V=i1({root:j,value:s,autoFocus:u,theme:p,height:m,minHeight:b,maxHeight:y,width:v,minWidth:S,maxWidth:T,basicSetup:C,placeholder:A,indentWithTab:w,editable:N,readOnly:H,selection:r,onChange:a,onStatistics:h,onCreateEditor:c,onUpdate:f,extensions:l,initialState:W}),K=V.state,J=V.view,oe=V.container,be=V.setContainer;ye.useImperativeHandle(e,()=>({editor:$.current,state:K,view:J}),[$,oe,K,J]);var ie=ye.useCallback(g=>{$.current=g,be(g)},[be]);if(typeof s!="string")throw new Error("value must be typeof string but got "+typeof s);var ue=typeof p=="string"?"cm-theme-"+p:"cm-theme";return Tu.jsx("div",Cr({ref:ie,className:""+ue+(t?" "+t:"")},B))});s1.displayName="CodeMirror";var rh={};class vs{constructor(e,t,i,s,r,o,l,a,h,c=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=s,this.pos=r,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let s=e.parser.context;return new vs(e,[],t,i,i,0,[],0,s?new oh(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,s=e&65535,{parser:r}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[s])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,t,i,s=4,r=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==i)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=i;return}}}if(!r||this.pos==i)this.buffer.push(e,t,i,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>i;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=s}}shift(e,t,i,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let r=e,{parser:o}=this.p;this.pos=s;let l=o.stateFlag(r,1);!l&&(s>i||t<=o.maxNode)&&(this.reducePos=s),this.pushState(r,l?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,s,4)}else this.pos=s,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,s,4)}apply(e,t,i,s){e&65536?this.reduce(e):this.shift(e,t,i,s)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(t,s),this.buffer.push(i,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),s=e.bufferBase+t;for(;e&&s==e.bufferBase;)e=e.parent;return new vs(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new r1(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let s=[];for(let r=0,o;ra&1&&l==o)||s.push(t[r],o)}t=s}let i=[];for(let s=0;s>19,s=t&65535,r=this.stack.length-i*3;if(r<0||e.getGoto(this.stack[r],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(s,r)=>{if(!t.includes(s))return t.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-r;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,r+1);if(l!=null)return l}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class oh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class r1{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=s}}class ws{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ws(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new ws(this.stack,this.pos,this.index)}}function Vn(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,s=0;i=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),r+=a,l)break;r*=46}t?t[s++]=r:t=new e(r)}return t}class Kn{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const lh=new Kn;class o1{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=lh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,s=this.rangeIndex,r=this.pos+e;for(;ri.to:r>=i.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];r+=o.from-i.to,i=o}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,s;if(t>=0&&t=this.chunk2Pos&&il.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),s=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),s}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=lh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let s of this.ranges){if(s.from>=t)break;s.to>e&&(i+=this.input.read(Math.max(s.from,e),Math.min(s.to,t)))}return i}}class mi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;l1(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}mi.prototype.contextual=mi.prototype.fallback=mi.prototype.extend=!1;mi.prototype.fallback=mi.prototype.extend=!1;class zs{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function l1(n,e,t,i,s,r){let o=0,l=1<0){let p=n[d];if(a.allows(p)&&(e.token.value==-1||e.token.value==p||a1(p,e.token.value,s,r))){e.acceptToken(p);break}}let c=e.next,f=0,u=n[o+2];if(e.next<0&&u>f&&n[h+u*3-3]==65535){o=n[h+u*3-1];continue e}for(;f>1,p=h+d+(d<<1),m=n[p],b=n[p+1]||65536;if(c=b)f=d+1;else{o=n[p+2],e.advance();continue e}}break}}function ah(n,e,t){for(let i=e,s;(s=n[i])!=65535;i++)if(s==t)return i-e;return-1}function a1(n,e,t,i){let s=ah(t,i,e);return s<0||ah(t,i,n)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class h1{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?hh(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?hh(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(r instanceof fe){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+r.length}}}class c1{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Kn)}getActions(e){let t=0,i=null,{parser:s}=e.p,{tokenizers:r}=s,o=s.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hf.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let u=t;if(f.extended>-1&&(t=this.addActions(e,f.extended,f.end,t)),t=this.addActions(e,f.value,f.end,t),!c.extend&&(i=f,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new Kn,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Kn,{pos:i,p:s}=e;return t.start=i,t.end=Math.min(i+1,s.stream.end),t.value=i==s.stream.end?s.parser.eofTerm:0,t}updateCachedToken(e,t,i){let s=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(s,e),i),e.value>-1){let{parser:r}=i.p;for(let o=0;o=0&&i.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,t,i,s){for(let r=0;re.bufferLength*4?new h1(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],s,r;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)i.push(l);else{if(this.advanceStack(l,i,e))continue;{s||(s=[],r=[]),s.push(l);let a=this.tokens.getMainToken(l);r.push(a.value,a.end)}}break}}if(!i.length){let o=s&&p1(s);if(o)return He&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw He&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,r,i);if(o)return He&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue e}}}i.length>12&&(i.sort((o,l)=>l.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let f=this.fragments.nodeAt(s);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?r.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!h||(f.prop(q.contextHash)||0)==c))return e.useNode(f,u),He&&console.log(o+this.stackID(e)+` (via reuse of ${r.getName(f.type.id)})`),!0;if(!(f instanceof fe)||f.children.length==0||f.positions[0]>0)break;let d=f.children[0];if(d instanceof fe&&f.positions[0]==0)f=d;else break}}let l=r.stateSlot(e.state,4);if(l>0)return e.reduce(l),He&&console.log(o+this.stackID(e)+` (via always-reduce ${r.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hs?t.push(p):i.push(p)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return ch(e,t),!0}}runRecovery(e,t,i){let s=null,r=!1;for(let o=0;o ":"";if(l.deadEnd&&(r||(r=!0,l.restart(),He&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let f=l.split(),u=c;for(let d=0;d<10&&f.forceReduce()&&(He&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));d++)He&&(u=this.stackID(f)+" -> ");for(let d of l.recoverByInsert(a))He&&console.log(c+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,i);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),He&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),ch(l,i)):(!s||s.scoren;class d1{constructor(e){this.start=e.start,this.shift=e.shift||Sr,this.reduce=e.reduce||Sr,this.reuse=e.reuse||Sr,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Ss extends qc{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),s=[];for(let l=0;l=0)r(c,a,l[h++]);else{let f=l[h+-c];for(let u=-c;u>0;u--)r(l[h++],a,f);h++}}}this.nodeSet=new qo(t.map((l,a)=>Ne.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:s[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Vc;let o=Vn(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new mi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let s=new f1(this,e,t,i);for(let r of this.wrappers)s=r(s,e,t,i);return s}getGoto(e,t,i=!1){let s=this.goto;if(t>=s[0])return-1;for(let r=s[t+1];;){let o=s[r++],l=o&1,a=s[r++];if(l&&i)return a;for(let h=r+(o>>1);r0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),s=i?t(i):void 0;for(let r=this.stateSlot(e,1);s==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=pt(this.data,r+2);else break;s=t(pt(this.data,r+1))}return s}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=pt(this.data,i+2);else break;if((this.data[i+2]&1)==0){let s=this.data[i+1];t.some((r,o)=>o&1&&r==s)||t.push(this.data[i],s)}}return t}configure(e){let t=Object.assign(Object.create(Ss.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let s=e.tokenizers.find(r=>r.from==i);return s?s.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,s)=>{let r=e.specializers.find(l=>l.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});return t.specializers[s]=fh(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let r of e.split(" ")){let o=t.indexOf(r);o>=0&&(i[o]=!0)}let s=null;for(let r=0;ri)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scoren.external(t,i)<<1|e}return n.get}const si=63,uh=64,m1=1,g1=2,pu=3,b1=4,mu=5,y1=6,x1=7,gu=65,k1=66,v1=8,w1=9,S1=10,O1=11,C1=12,bu=13,A1=19,M1=20,T1=29,P1=33,D1=34,R1=47,E1=0,al=1,vo=2,hn=3,wo=4;class zt{constructor(e,t,i){this.parent=e,this.depth=t,this.type=i,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+i}}zt.top=new zt(null,-1,E1);function _i(n,e){for(let t=0,i=e-n.pos-1;;i--,t++){let s=n.peek(i);if(kt(s)||s==-1)return t}}function So(n){return n==32||n==9}function kt(n){return n==10||n==13}function yu(n){return So(n)||kt(n)}function _t(n){return n<0||yu(n)}const B1=new d1({start:zt.top,reduce(n,e){return n.type==hn&&(e==M1||e==D1)?n.parent:n},shift(n,e,t,i){if(e==pu)return new zt(n,_i(i,i.pos),al);if(e==gu||e==mu)return new zt(n,_i(i,i.pos),vo);if(e==si)return n.parent;if(e==A1||e==P1)return new zt(n,0,hn);if(e==bu&&n.type==wo)return n.parent;if(e==R1){let s=/[1-9]/.exec(i.read(i.pos,t.pos));if(s)return new zt(n,n.depth+ +s[0],wo)}return n},hash(n){return n.hash}});function Si(n,e,t=0){return n.peek(t)==e&&n.peek(t+1)==e&&n.peek(t+2)==e&&_t(n.peek(t+3))}const L1=new zs((n,e)=>{if(n.next==-1&&e.canShift(uh))return n.acceptToken(uh);let t=n.peek(-1);if((kt(t)||t<0)&&e.context.type!=hn){if(Si(n,45))if(e.canShift(si))n.acceptToken(si);else return n.acceptToken(m1,3);if(Si(n,46))if(e.canShift(si))n.acceptToken(si);else return n.acceptToken(g1,3);let i=0;for(;n.next==32;)i++,n.advance();(i{if(e.context.type==hn){n.next==63&&(n.advance(),_t(n.next)&&n.acceptToken(x1));return}if(n.next==45)n.advance(),_t(n.next)&&n.acceptToken(e.context.type==al&&e.context.depth==_i(n,n.pos-1)?b1:pu);else if(n.next==63)n.advance(),_t(n.next)&&n.acceptToken(e.context.type==vo&&e.context.depth==_i(n,n.pos-1)?y1:mu);else{let t=n.pos;for(;;)if(So(n.next)){if(n.pos==t)return;n.advance()}else if(n.next==33)xu(n);else if(n.next==38)Oo(n);else if(n.next==42){Oo(n);break}else if(n.next==39||n.next==34){if(hl(n,!0))break;return}else if(n.next==91||n.next==123){if(!W1(n))return;break}else{ku(n,!0,!1,0);break}for(;So(n.next);)n.advance();if(n.next==58){if(n.pos==t&&e.canShift(T1))return;let i=n.peek(1);_t(i)&&n.acceptTokenTo(e.context.type==vo&&e.context.depth==_i(n,t)?k1:gu,t)}}},{contextual:!0});function N1(n){return n>32&&n<127&&n!=34&&n!=37&&n!=44&&n!=60&&n!=62&&n!=92&&n!=94&&n!=96&&n!=123&&n!=124&&n!=125}function dh(n){return n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70}function ph(n,e){return n.next==37?(n.advance(),dh(n.next)&&n.advance(),dh(n.next)&&n.advance(),!0):N1(n.next)||e&&n.next==44?(n.advance(),!0):!1}function xu(n){if(n.advance(),n.next==60){for(n.advance();;)if(!ph(n,!0)){n.next==62&&n.advance();break}}else for(;ph(n,!1););}function Oo(n){for(n.advance();!_t(n.next)&&Os(n.next)!="f";)n.advance()}function hl(n,e){let t=n.next,i=!1,s=n.pos;for(n.advance();;){let r=n.next;if(r<0)break;if(n.advance(),r==t)if(r==39)if(n.next==39)n.advance();else break;else break;else if(r==92&&t==34)n.next>=0&&n.advance();else if(kt(r)){if(e)return!1;i=!0}else if(e&&n.pos>=s+1024)return!1}return!i}function W1(n){for(let e=[],t=n.pos+1024;;)if(n.next==91||n.next==123)e.push(n.next),n.advance();else if(n.next==39||n.next==34){if(!hl(n,!0))return!1}else if(n.next==93||n.next==125){if(e[e.length-1]!=n.next-2)return!1;if(e.pop(),n.advance(),!e.length)return!0}else{if(n.next<0||n.pos>t||kt(n.next))return!1;n.advance()}}const H1="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function Os(n){return n<33?"u":n>125?"s":H1[n-33]}function Or(n,e){let t=Os(n);return t!="u"&&!(e&&t=="f")}function ku(n,e,t,i){if(Os(n.next)=="s"||(n.next==63||n.next==58||n.next==45)&&Or(n.peek(1),t))n.advance();else return!1;let s=n.pos;for(;;){let r=n.next,o=0,l=i+1;for(;yu(r);){if(kt(r)){if(e)return!1;l=0}else l++;r=n.peek(++o)}if(!(r>=0&&(r==58?Or(n.peek(o+1),t):r==35?n.peek(o-1)!=32:Or(r,t)))||!t&&l<=i||l==0&&!t&&(Si(n,45,o)||Si(n,46,o)))break;if(e&&Os(r)=="f")return!1;for(let h=o;h>=0;h--)n.advance();if(e&&n.pos>s+1024)return!1}return!0}const F1=new zs((n,e)=>{if(n.next==33)xu(n),n.acceptToken(C1);else if(n.next==38||n.next==42){let t=n.next==38?S1:O1;Oo(n),n.acceptToken(t)}else n.next==39||n.next==34?(hl(n,!1),n.acceptToken(w1)):ku(n,!1,e.context.type==hn,e.context.depth)&&n.acceptToken(v1)}),V1=new zs((n,e)=>{let t=e.context.type==wo?e.context.depth:-1,i=n.pos;e:for(;;){let s=0,r=n.next;for(;r==32;)r=n.peek(++s);if(!s&&(Si(n,45,s)||Si(n,46,s))||!kt(r)&&(t<0&&(t=Math.max(e.context.depth+1,s)),sYAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:B1,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[z1],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[L1,I1,F1,V1,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),$1=as.define({name:"yaml",parser:Q1.configure({props:[Kc.add({Stream:n=>{for(let e=n.node.resolve(n.pos,-1);e&&e.to>=n.pos;e=e.parent){if(e.name=="BlockLiteralContent"&&e.fromn.pos)return null}}return null},FlowMapping:va({closing:"}"}),FlowSequence:va({closing:"]"})}),Jc.add({"FlowMapping FlowSequence":kg,"Item Pair BlockLiteral":(n,e)=>({from:e.doc.lineAt(n.from).to,to:n.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function j1(){return new hg($1)}export{P as E,Ru as R,s1 as a,Du as b,_1 as c,q1 as d,Cu as g,Tu as j,jy as o,ye as r,j1 as y}; diff --git a/backend/static/assets/vendor-icons-Aso0-eeY.js b/backend/static/assets/vendor-icons-BWk-DH7F.js similarity index 99% rename from backend/static/assets/vendor-icons-Aso0-eeY.js rename to backend/static/assets/vendor-icons-BWk-DH7F.js index 63f274a..74ac875 100644 --- a/backend/static/assets/vendor-icons-Aso0-eeY.js +++ b/backend/static/assets/vendor-icons-BWk-DH7F.js @@ -1 +1 @@ -import{r as y}from"./vendor-codemirror-C7mXSpXt.js";const M=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,o,c)=>c?c.toUpperCase():o.toLowerCase()),s=t=>{const e=_(t);return e.charAt(0).toUpperCase()+e.slice(1)},k=(...t)=>t.filter((e,o,c)=>!!e&&e.trim()!==""&&c.indexOf(e)===o).join(" ").trim(),x=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var v={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const m=y.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:n="",children:h,iconNode:i,...d},p)=>y.createElement("svg",{ref:p,...v,width:e,height:e,stroke:t,strokeWidth:c?Number(o)*24/Number(e):o,className:k("lucide",n),...!h&&!x(d)&&{"aria-hidden":"true"},...d},[...i.map(([r,l])=>y.createElement(r,l)),...Array.isArray(h)?h:[h]]));const a=(t,e)=>{const o=y.forwardRef(({className:c,...n},h)=>y.createElement(m,{ref:h,iconNode:e,className:k(`lucide-${M(s(t))}`,`lucide-${t}`,c),...n}));return o.displayName=s(t),o};const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Y2=a("activity",g);const f=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],a0=a("arrow-down",f);const w=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],e0=a("arrow-left",w);const u=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],t0=a("arrow-right",u);const $=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],o0=a("arrow-up-down",$);const N=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],c0=a("arrow-up",N);const z=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],h0=a("bell",z);const b=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],y0=a("bot",b);const q=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],n0=a("box",q);const A=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],d0=a("boxes",A);const C=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],s0=a("brain",C);const j=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],k0=a("bug",j);const H=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],i0=a("calendar",H);const V=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],p0=a("chart-column",V);const L=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],r0=a("chart-line",L);const S=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],l0=a("check-check",S);const P=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],M0=a("check",P);const R=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_0=a("chevron-down",R);const B=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],x0=a("chevron-left",B);const T=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],v0=a("chevron-right",T);const U=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],m0=a("chevron-up",U);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],g0=a("circle-alert",Z);const F=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],f0=a("circle-check-big",F);const D=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],w0=a("circle-check",D);const E=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],u0=a("circle-play",E);const O=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],$0=a("circle-stop",O);const W=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],N0=a("circle-x",W);const I=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],z0=a("circle",I);const X=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],b0=a("clock",X);const G=[["path",{d:"m10.852 19.772-.383.924",key:"r7sl7d"}],["path",{d:"m13.148 14.228.383-.923",key:"1d5zpm"}],["path",{d:"M13.148 19.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1ydik7"}],["path",{d:"m13.53 20.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1m1vsf"}],["path",{d:"m14.772 15.852.923-.383",key:"660p6e"}],["path",{d:"m14.772 18.148.923.383",key:"hrcpis"}],["path",{d:"M4.2 15.1a7 7 0 1 1 9.93-9.858A7 7 0 0 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2",key:"j2q98n"}],["path",{d:"m9.228 15.852-.923-.383",key:"1p9ong"}],["path",{d:"m9.228 18.148-.923.383",key:"6558rz"}]],q0=a("cloud-cog",G);const K=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],A0=a("cloud",K);const J=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],C0=a("code",J);const Q=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],j0=a("container",Q);const Y=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],H0=a("copy",Y);const a1=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],V0=a("cpu",a1);const e1=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],L0=a("database",e1);const t1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],S0=a("disc",t1);const o1=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],P0=a("download",o1);const c1=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],R0=a("ellipsis",c1);const h1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],B0=a("external-link",h1);const y1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],T0=a("eye-off",y1);const n1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],U0=a("eye",n1);const d1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],Z0=a("file-code",d1);const s1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],F0=a("file-search",s1);const k1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],D0=a("file-spreadsheet",k1);const i1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],E0=a("file-text",i1);const p1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],O0=a("file",p1);const r1=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],W0=a("flask-conical",r1);const l1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],I0=a("folder-open",l1);const M1=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],X0=a("folder-plus",M1);const _1=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],G0=a("folder",_1);const x1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],K0=a("funnel",x1);const v1=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],J0=a("git-branch",v1);const m1=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],Q0=a("git-commit-horizontal",m1);const g1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Y0=a("globe",g1);const f1=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]],aa=a("hand",f1);const w1=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],ea=a("hard-drive",w1);const u1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],ta=a("hash",u1);const $1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}],["path",{d:"M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"auskq0"}]],oa=a("heart-pulse",$1);const N1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],ca=a("heart",N1);const z1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],ha=a("history",z1);const b1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],ya=a("house",b1);const q1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],na=a("image",q1);const A1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],da=a("info",A1);const C1=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],sa=a("key-round",C1);const j1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],ka=a("key",j1);const H1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],ia=a("layers",H1);const V1=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],pa=a("layout-dashboard",V1);const L1=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],ra=a("link-2",L1);const S1=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],la=a("list",S1);const P1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ma=a("loader-circle",P1);const R1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],_a=a("lock",R1);const B1=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],xa=a("log-in",B1);const T1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],va=a("log-out",T1);const U1=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],ma=a("mail",U1);const Z1=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],ga=a("map-pin",Z1);const F1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],fa=a("maximize-2",F1);const D1=[["path",{d:"M12 12v-2",key:"fwoke6"}],["path",{d:"M12 18v-2",key:"qj6yno"}],["path",{d:"M16 12v-2",key:"heuere"}],["path",{d:"M16 18v-2",key:"s1ct0w"}],["path",{d:"M2 11h1.5",key:"15p63e"}],["path",{d:"M20 18v-2",key:"12ehxp"}],["path",{d:"M20.5 11H22",key:"khsy7a"}],["path",{d:"M4 18v-2",key:"1c3oqr"}],["path",{d:"M8 12v-2",key:"1mwtfd"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["rect",{x:"2",y:"6",width:"20",height:"10",rx:"2",key:"1qcswk"}]],wa=a("memory-stick",D1);const E1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],ua=a("menu",E1);const O1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],$a=a("message-square",O1);const W1=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Na=a("minimize-2",W1);const I1=[["path",{d:"M5 12h14",key:"1ays0h"}]],za=a("minus",I1);const X1=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],ba=a("monitor",X1);const G1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],qa=a("network",G1);const K1=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Aa=a("octagon-x",K1);const J1=[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]],Ca=a("package-open",J1);const Q1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],ja=a("package",Q1);const Y1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],Ha=a("palette",Y1);const a2=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Va=a("pause",a2);const e2=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],La=a("pen",e2);const t2=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Sa=a("pencil",t2);const o2=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],Pa=a("phone",o2);const c2=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Ra=a("play",c2);const h2=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],Ba=a("plug",h2);const y2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ta=a("plus",y2);const n2=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Ua=a("radio",n2);const d2=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Za=a("refresh-cw",d2);const s2=[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]],Fa=a("regex",s2);const k2=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],Da=a("repeat",k2);const i2=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],Ea=a("rocket",i2);const p2=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Oa=a("rotate-ccw",p2);const r2=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Wa=a("rotate-cw",r2);const l2=[["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6.01 18H6",key:"19vcac"}],["path",{d:"M10.01 18H10",key:"uamcmx"}],["path",{d:"M15 10v4",key:"qjz1xs"}],["path",{d:"M17.84 7.17a4 4 0 0 0-5.66 0",key:"1rif40"}],["path",{d:"M20.66 4.34a8 8 0 0 0-11.31 0",key:"6a5xfq"}]],Ia=a("router",l2);const M2=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Xa=a("save",M2);const _2=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],Ga=a("scroll-text",_2);const x2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ka=a("search",x2);const v2=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Ja=a("send",v2);const m2=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Qa=a("server",m2);const g2=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ya=a("settings",g2);const f2=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ae=a("settings-2",f2);const w2=[["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"}]],ee=a("shield-check",w2);const u2=[["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"}]],te=a("shield",u2);const $2=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],oe=a("sparkles",$2);const N2=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ce=a("square-check-big",N2);const z2=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],he=a("square-pen",z2);const b2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ye=a("square",b2);const q2=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],ne=a("star",q2);const A2=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],de=a("tag",A2);const C2=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],se=a("tags",C2);const j2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ke=a("terminal",j2);const H2=[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]],ie=a("timer-off",H2);const V2=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],pe=a("timer",V2);const L2=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],re=a("trash-2",L2);const S2=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],le=a("trending-down",S2);const P2=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Me=a("trending-up",P2);const R2=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],_e=a("triangle-alert",R2);const B2=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],xe=a("upload",B2);const T2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ve=a("user-plus",T2);const U2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]],me=a("user-x",U2);const Z2=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ge=a("user",Z2);const F2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],fe=a("users",F2);const D2=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],we=a("volume-x",D2);const E2=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],ue=a("wallet",E2);const O2=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],$e=a("webhook",O2);const W2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Ne=a("wifi-off",W2);const I2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],ze=a("wifi",I2);const X2=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],be=a("workflow",X2);const G2=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],qe=a("wrench",G2);const K2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ae=a("x",K2);const J2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ce=a("zap",J2);export{Xa as $,Y2 as A,d0 as B,w0 as C,L0 as D,B0 as E,E0 as F,Y0 as G,ea as H,da as I,J0 as J,ne as K,Ma as L,ga as M,qa as N,m0 as O,Ta as P,_0 as Q,Za as R,Ka as S,re as T,ge as U,fe as V,c0 as W,Ae as X,a0 as Y,xa as Z,ba as _,N0 as a,Aa as a$,$e as a0,aa as a1,$0 as a2,ve as a3,Ce as a4,W0 as a5,qe as a6,Ga as a7,Fa as a8,me as a9,le as aA,ue as aB,Ca as aC,Va as aD,he as aE,H0 as aF,z0 as aG,Ia as aH,Ua as aI,o0 as aJ,Wa as aK,G0 as aL,O0 as aM,_a as aN,T0 as aO,R0 as aP,Q0 as aQ,ze as aR,Ne as aS,ja as aT,ia as aU,be as aV,Ba as aW,we as aX,Da as aY,pe as aZ,ie as a_,Me as aa,g0 as ab,C0 as ac,n0 as ad,t0 as ae,K0 as af,ka as ag,xe as ah,ra as ai,$a as aj,Pa as ak,ma as al,I0 as am,Na as an,fa as ao,ya as ap,ha as aq,Ea as ar,ee as as,ye as at,ae as au,s0 as av,i0 as aw,r0 as ax,oe as ay,wa as az,b0 as b,la as b0,oa as b1,S0 as b2,y0 as b3,Ja as b4,x0 as b5,X0 as b6,D0 as b7,ta as b8,se as b9,ca as ba,sa as bb,na as bc,ua as bd,pa as be,u0 as bf,ce as bg,F0 as bh,Ha as bi,l0 as bj,va as bk,k0 as bl,La as c,Sa as d,q0 as e,v0 as f,V0 as g,Qa as h,A0 as i,te as j,j0 as k,_e as l,e0 as m,Oa as n,Z0 as o,Ya as p,de as q,ke as r,za as s,h0 as t,p0 as u,P0 as v,M0 as w,U0 as x,f0 as y,Ra as z}; +import{r as y}from"./vendor-codemirror-B1SGo4xl.js";const M=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,o,c)=>c?c.toUpperCase():o.toLowerCase()),s=t=>{const e=_(t);return e.charAt(0).toUpperCase()+e.slice(1)},k=(...t)=>t.filter((e,o,c)=>!!e&&e.trim()!==""&&c.indexOf(e)===o).join(" ").trim(),x=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var v={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const m=y.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:o=2,absoluteStrokeWidth:c,className:n="",children:h,iconNode:i,...d},p)=>y.createElement("svg",{ref:p,...v,width:e,height:e,stroke:t,strokeWidth:c?Number(o)*24/Number(e):o,className:k("lucide",n),...!h&&!x(d)&&{"aria-hidden":"true"},...d},[...i.map(([r,l])=>y.createElement(r,l)),...Array.isArray(h)?h:[h]]));const a=(t,e)=>{const o=y.forwardRef(({className:c,...n},h)=>y.createElement(m,{ref:h,iconNode:e,className:k(`lucide-${M(s(t))}`,`lucide-${t}`,c),...n}));return o.displayName=s(t),o};const g=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Y2=a("activity",g);const f=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],a0=a("arrow-down",f);const w=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],e0=a("arrow-left",w);const u=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],t0=a("arrow-right",u);const $=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],o0=a("arrow-up-down",$);const N=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],c0=a("arrow-up",N);const z=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],h0=a("bell",z);const b=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],y0=a("bot",b);const q=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],n0=a("box",q);const A=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],d0=a("boxes",A);const C=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],s0=a("brain",C);const j=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],k0=a("bug",j);const H=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],i0=a("calendar",H);const V=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],p0=a("chart-column",V);const L=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],r0=a("chart-line",L);const S=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],l0=a("check-check",S);const P=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],M0=a("check",P);const R=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],_0=a("chevron-down",R);const B=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],x0=a("chevron-left",B);const T=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],v0=a("chevron-right",T);const U=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],m0=a("chevron-up",U);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],g0=a("circle-alert",Z);const F=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],f0=a("circle-check-big",F);const D=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],w0=a("circle-check",D);const E=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],u0=a("circle-play",E);const O=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],$0=a("circle-stop",O);const W=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],N0=a("circle-x",W);const I=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],z0=a("circle",I);const X=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],b0=a("clock",X);const G=[["path",{d:"m10.852 19.772-.383.924",key:"r7sl7d"}],["path",{d:"m13.148 14.228.383-.923",key:"1d5zpm"}],["path",{d:"M13.148 19.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1ydik7"}],["path",{d:"m13.53 20.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1m1vsf"}],["path",{d:"m14.772 15.852.923-.383",key:"660p6e"}],["path",{d:"m14.772 18.148.923.383",key:"hrcpis"}],["path",{d:"M4.2 15.1a7 7 0 1 1 9.93-9.858A7 7 0 0 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2",key:"j2q98n"}],["path",{d:"m9.228 15.852-.923-.383",key:"1p9ong"}],["path",{d:"m9.228 18.148-.923.383",key:"6558rz"}]],q0=a("cloud-cog",G);const K=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],A0=a("cloud",K);const J=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],C0=a("code",J);const Q=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],j0=a("container",Q);const Y=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],H0=a("copy",Y);const a1=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],V0=a("cpu",a1);const e1=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],L0=a("database",e1);const t1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],S0=a("disc",t1);const o1=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],P0=a("download",o1);const c1=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],R0=a("ellipsis",c1);const h1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],B0=a("external-link",h1);const y1=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],T0=a("eye-off",y1);const n1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],U0=a("eye",n1);const d1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],Z0=a("file-code",d1);const s1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],F0=a("file-search",s1);const k1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],D0=a("file-spreadsheet",k1);const i1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],E0=a("file-text",i1);const p1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],O0=a("file",p1);const r1=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],W0=a("flask-conical",r1);const l1=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],I0=a("folder-open",l1);const M1=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],X0=a("folder-plus",M1);const _1=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],G0=a("folder",_1);const x1=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],K0=a("funnel",x1);const v1=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],J0=a("git-branch",v1);const m1=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],Q0=a("git-commit-horizontal",m1);const g1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Y0=a("globe",g1);const f1=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]],aa=a("hand",f1);const w1=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],ea=a("hard-drive",w1);const u1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],ta=a("hash",u1);const $1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}],["path",{d:"M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"auskq0"}]],oa=a("heart-pulse",$1);const N1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],ca=a("heart",N1);const z1=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],ha=a("history",z1);const b1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],ya=a("house",b1);const q1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],na=a("image",q1);const A1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],da=a("info",A1);const C1=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],sa=a("key-round",C1);const j1=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],ka=a("key",j1);const H1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],ia=a("layers",H1);const V1=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],pa=a("layout-dashboard",V1);const L1=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],ra=a("link-2",L1);const S1=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],la=a("list",S1);const P1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ma=a("loader-circle",P1);const R1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],_a=a("lock",R1);const B1=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],xa=a("log-in",B1);const T1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],va=a("log-out",T1);const U1=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],ma=a("mail",U1);const Z1=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],ga=a("map-pin",Z1);const F1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],fa=a("maximize-2",F1);const D1=[["path",{d:"M12 12v-2",key:"fwoke6"}],["path",{d:"M12 18v-2",key:"qj6yno"}],["path",{d:"M16 12v-2",key:"heuere"}],["path",{d:"M16 18v-2",key:"s1ct0w"}],["path",{d:"M2 11h1.5",key:"15p63e"}],["path",{d:"M20 18v-2",key:"12ehxp"}],["path",{d:"M20.5 11H22",key:"khsy7a"}],["path",{d:"M4 18v-2",key:"1c3oqr"}],["path",{d:"M8 12v-2",key:"1mwtfd"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["rect",{x:"2",y:"6",width:"20",height:"10",rx:"2",key:"1qcswk"}]],wa=a("memory-stick",D1);const E1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],ua=a("menu",E1);const O1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],$a=a("message-square",O1);const W1=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],Na=a("minimize-2",W1);const I1=[["path",{d:"M5 12h14",key:"1ays0h"}]],za=a("minus",I1);const X1=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],ba=a("monitor",X1);const G1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],qa=a("network",G1);const K1=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Aa=a("octagon-x",K1);const J1=[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]],Ca=a("package-open",J1);const Q1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],ja=a("package",Q1);const Y1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],Ha=a("palette",Y1);const a2=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Va=a("pause",a2);const e2=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],La=a("pen",e2);const t2=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Sa=a("pencil",t2);const o2=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],Pa=a("phone",o2);const c2=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],Ra=a("play",c2);const h2=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],Ba=a("plug",h2);const y2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ta=a("plus",y2);const n2=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Ua=a("radio",n2);const d2=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Za=a("refresh-cw",d2);const s2=[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]],Fa=a("regex",s2);const k2=[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]],Da=a("repeat",k2);const i2=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],Ea=a("rocket",i2);const p2=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Oa=a("rotate-ccw",p2);const r2=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Wa=a("rotate-cw",r2);const l2=[["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6.01 18H6",key:"19vcac"}],["path",{d:"M10.01 18H10",key:"uamcmx"}],["path",{d:"M15 10v4",key:"qjz1xs"}],["path",{d:"M17.84 7.17a4 4 0 0 0-5.66 0",key:"1rif40"}],["path",{d:"M20.66 4.34a8 8 0 0 0-11.31 0",key:"6a5xfq"}]],Ia=a("router",l2);const M2=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Xa=a("save",M2);const _2=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],Ga=a("scroll-text",_2);const x2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ka=a("search",x2);const v2=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Ja=a("send",v2);const m2=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Qa=a("server",m2);const g2=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ya=a("settings",g2);const f2=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],ae=a("settings-2",f2);const w2=[["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"}]],ee=a("shield-check",w2);const u2=[["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"}]],te=a("shield",u2);const $2=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],oe=a("sparkles",$2);const N2=[["path",{d:"M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344",key:"2acyp4"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ce=a("square-check-big",N2);const z2=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],he=a("square-pen",z2);const b2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ye=a("square",b2);const q2=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],ne=a("star",q2);const A2=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],de=a("tag",A2);const C2=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],se=a("tags",C2);const j2=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ke=a("terminal",j2);const H2=[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]],ie=a("timer-off",H2);const V2=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],pe=a("timer",V2);const L2=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],re=a("trash-2",L2);const S2=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],le=a("trending-down",S2);const P2=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Me=a("trending-up",P2);const R2=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],_e=a("triangle-alert",R2);const B2=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],xe=a("upload",B2);const T2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],ve=a("user-plus",T2);const U2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]],me=a("user-x",U2);const Z2=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ge=a("user",Z2);const F2=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],fe=a("users",F2);const D2=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],we=a("volume-x",D2);const E2=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],ue=a("wallet",E2);const O2=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],$e=a("webhook",O2);const W2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Ne=a("wifi-off",W2);const I2=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],ze=a("wifi",I2);const X2=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],be=a("workflow",X2);const G2=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],qe=a("wrench",G2);const K2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ae=a("x",K2);const J2=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ce=a("zap",J2);export{Xa as $,Y2 as A,d0 as B,w0 as C,L0 as D,B0 as E,E0 as F,Y0 as G,ea as H,da as I,J0 as J,ne as K,Ma as L,ga as M,qa as N,m0 as O,Ta as P,_0 as Q,Za as R,Ka as S,re as T,ge as U,fe as V,c0 as W,Ae as X,a0 as Y,xa as Z,ba as _,N0 as a,Aa as a$,$e as a0,aa as a1,$0 as a2,ve as a3,Ce as a4,W0 as a5,qe as a6,Ga as a7,Fa as a8,me as a9,le as aA,ue as aB,Ca as aC,Va as aD,he as aE,H0 as aF,z0 as aG,Ia as aH,Ua as aI,o0 as aJ,_a as aK,T0 as aL,R0 as aM,Q0 as aN,ze as aO,Ne as aP,ja as aQ,ia as aR,be as aS,Ba as aT,Wa as aU,G0 as aV,O0 as aW,we as aX,Da as aY,pe as aZ,ie as a_,Me as aa,g0 as ab,C0 as ac,n0 as ad,t0 as ae,K0 as af,ka as ag,xe as ah,ra as ai,$a as aj,Pa as ak,ma as al,I0 as am,Na as an,fa as ao,ya as ap,ha as aq,Ea as ar,ee as as,ye as at,ae as au,s0 as av,i0 as aw,r0 as ax,oe as ay,wa as az,b0 as b,la as b0,oa as b1,S0 as b2,y0 as b3,Ja as b4,x0 as b5,X0 as b6,D0 as b7,ta as b8,se as b9,ca as ba,sa as bb,na as bc,ua as bd,pa as be,u0 as bf,ce as bg,F0 as bh,Ha as bi,l0 as bj,va as bk,k0 as bl,La as c,Sa as d,q0 as e,v0 as f,V0 as g,Qa as h,A0 as i,te as j,j0 as k,_e as l,e0 as m,Oa as n,Z0 as o,Ya as p,de as q,ke as r,za as s,h0 as t,p0 as u,P0 as v,M0 as w,U0 as x,f0 as y,Ra as z}; diff --git a/backend/static/index.html b/backend/static/index.html index 0334400..cbc178e 100644 --- a/backend/static/index.html +++ b/backend/static/index.html @@ -7,10 +7,10 @@ AIOps智能运维平台 - - - - + + + +