import{r as e}from"./rolldown-runtime-BM3Ffeng.js";import{A as t,D as n,E as r,I as i,N as a,P as o,Tt as s,Xt as c,Z as l,et as u,ht as d,it as f,k as p,nt as m,qt as h,x as g}from"./vue-vendor-DMUmTARL.js";import{Ai as _,Ur as v,cn as y,mn as b,sn as x}from"./icons-vendor-Db5MGAkr.js";import{f as S}from"./admin-setting-Cf6ZvkT2.js";import{t as C}from"./dns-CGv0i6_J.js";var w={id:`dns`,class:`rounded-2xl border border-zinc-200/70 bg-white p-5 dark:border-zinc-800 dark:bg-zinc-900 sm:p-6`},ee={class:`mb-4 flex items-center justify-between`},T={class:`flex items-center gap-2 text-sm font-semibold text-zinc-900 dark:text-zinc-100`},E={key:0,class:`grid grid-cols-2 gap-3 sm:grid-cols-4`},D={class:`grid grid-cols-2 gap-3 sm:grid-cols-4`},O={class:`rounded-xl border border-zinc-100 bg-zinc-50/60 p-4 dark:border-zinc-800 dark:bg-zinc-800/30`},k={class:`flex items-center gap-1.5 text-xs text-zinc-500`},A={class:`mt-1.5 text-sm font-semibold text-zinc-700 dark:text-zinc-200`},j={class:`rounded-xl border border-zinc-100 bg-zinc-50/60 p-4 dark:border-zinc-800 dark:bg-zinc-800/30`},M={class:`flex items-center gap-1.5 text-xs text-zinc-500`},N=[`title`],P={class:`rounded-xl border border-zinc-100 bg-zinc-50/60 p-4 dark:border-zinc-800 dark:bg-zinc-800/30`},F={class:`flex items-center gap-1.5 text-xs text-zinc-500`},I={class:`mt-1.5 text-sm font-semibold text-zinc-700 dark:text-zinc-200`},L={class:`rounded-xl border border-zinc-100 bg-zinc-50/60 p-4 dark:border-zinc-800 dark:bg-zinc-800/30`},R={class:`flex items-center gap-1.5 text-xs text-zinc-500`},z={class:`mt-1.5 flex items-center gap-1.5`},B=[`title`],V={key:0,class:`mt-3 flex items-center gap-1 text-[11px] text-zinc-400`},H=i({__name:`DnsStatusSection`,setup(e,{expose:i}){let H=s(null),U=s(!0),W=async()=>{U.value=!0;try{H.value=C((await S())?.data)}catch(e){console.error(`获取 DNS 状态失败:`,e)}finally{U.value=!1}},G=r(()=>H.value?.dnsMode===`custom`?`自定义 DNS`:`系统 DNS`),K=r(()=>H.value?.customDnsServer||`系统默认`),q=r(()=>H.value?.lastCheckStatus??null),J=r(()=>{switch(q.value){case`success`:return`正常`;case`warn`:return`告警`;case`fail`:return`异常`;default:return`未检测`}}),Y=r(()=>{switch(q.value){case`success`:return`bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400`;case`warn`:return`bg-amber-50 text-amber-600 dark:bg-amber-500/10 dark:text-amber-400`;case`fail`:return`bg-red-50 text-red-600 dark:bg-red-500/10 dark:text-red-400`;default:return`bg-zinc-100 text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400`}}),X=r(()=>{switch(q.value){case`success`:return`text-emerald-600 dark:text-emerald-400`;case`warn`:return`text-amber-600 dark:text-amber-400`;case`fail`:return`text-red-600 dark:text-red-400`;default:return`text-zinc-700 dark:text-zinc-200`}}),Z=r(()=>{switch(q.value){case`success`:return`bg-emerald-500`;case`warn`:return`bg-amber-500`;case`fail`:return`bg-red-500`;default:return`bg-zinc-300 dark:bg-zinc-600`}}),Q=r(()=>{let e=H.value?.lastCheckTime;return e?new Date(e).toLocaleString():`尚未检测`}),$=r(()=>H.value?.lastCheckMessage||``);return i({refresh:W}),l(W),(e,r)=>{let i=f(`router-link`),s=x,l=y,S=v,C=b,W=_;return u(),t(`section`,w,[n(`div`,ee,[n(`h2`,T,[r[0]||=a(` DNS 情况 `,-1),n(`span`,{class:h([`flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium`,Y.value])},[n(`span`,{class:h([`h-1.5 w-1.5 rounded-full`,Z.value])},null,2),a(` `+c(J.value),1)],2)]),o(i,{to:`/admin/dns-setting`,class:`text-xs font-medium text-blue-600 hover:underline dark:text-blue-400`},{default:d(()=>[...r[1]||=[a(` 设置 → `,-1)]]),_:1})]),U.value&&!H.value?(u(),t(`div`,E,[(u(),t(g,null,m(4,e=>n(`div`,{key:`dns-skeleton-${e}`,class:`h-[5.5rem] animate-pulse rounded-xl border border-zinc-100 bg-zinc-100/80 dark:border-zinc-800 dark:bg-zinc-800/40`})),64))])):(u(),t(g,{key:1},[n(`div`,D,[n(`div`,O,[n(`div`,k,[o(s,{class:`h-3.5 w-3.5 text-zinc-400`}),r[2]||=a(` 模式 `,-1)]),n(`div`,A,c(G.value),1)]),n(`div`,j,[n(`div`,M,[o(l,{class:`h-3.5 w-3.5 text-zinc-400`}),r[3]||=a(` Server `,-1)]),n(`div`,{class:`mt-1.5 truncate text-sm font-semibold text-zinc-700 dark:text-zinc-200`,title:K.value},c(K.value),9,N)]),n(`div`,P,[n(`div`,F,[o(S,{class:`h-3.5 w-3.5 text-zinc-400`}),r[4]||=a(` 最近检测 `,-1)]),n(`div`,I,c(Q.value),1)]),n(`div`,L,[n(`div`,R,[o(C,{class:`h-3.5 w-3.5 text-zinc-400`}),r[5]||=a(` 检测状态 `,-1)]),n(`div`,z,[n(`span`,{class:h([`h-1.5 w-1.5 rounded-full`,Z.value])},null,2),n(`span`,{class:h([`text-sm font-semibold`,X.value])},c(J.value),3)]),$.value?(u(),t(`div`,{key:0,class:`mt-0.5 truncate text-[11px] text-zinc-400`,title:$.value},c($.value),9,B)):p(``,!0)])]),q.value?p(``,!0):(u(),t(`p`,V,[o(W,{class:`h-3.5 w-3.5 shrink-0`}),r[7]||=a(` 尚未进行 DNS 检测，可前往 `,-1),o(i,{to:`/admin/dns-setting`,class:`font-medium text-blue-600 hover:underline dark:text-blue-400`},{default:d(()=>[...r[6]||=[a(` DNS 设置 `,-1)]]),_:1}),r[8]||=a(` 手动检测 `,-1)]))],64))])}}}),U=e({default:()=>W}),W=H;export{U as n,W as t};