import{_ as h,c as o,a as t,b as n,h as r,m as g,y as b,I as y,w as c,k as u,g as f,W as x,f as l,e as v,F as m,i as _,s as k,n as T,t as i}from"./index-BCgxBvDt.js";import{O as A}from"./osmap-SRnOrxSF.js";import{L as w}from"./localeText-ZTaDi7ZY.js";import"./Vector-5IlHN0Py.js";const R={name:"traceroute",components:{LocaleText:w,OSMap:A},data(){return{tracing:!1,ipAddress:void 0,tracerouteResult:void 0}},setup(){return{store:x()}},methods:{execute(){this.ipAddress&&(this.tracing=!0,this.tracerouteResult=void 0,f("/api/traceroute/execute",{ipAddress:this.ipAddress},d=>{d.status?this.tracerouteResult=d.data:this.store.newMessage("Server",d.message,"danger"),this.tracing=!1}))}}},M={class:"mt-md-5 mt-3 text-body"},S={class:"container-md"},$={class:"mb-3 text-body"},L={class:"d-flex gap-2 mb-3 flex-column"},C={class:"flex-grow-1"},P={class:"mb-1 text-muted",for:"ipAddress"},I=["disabled"],O=["disabled"],V={key:0,class:"d-block"},B={key:1,class:"d-block"},N={class:"position-relative"},z={key:"pingPlaceholder"},D={key:1},E={key:"table",class:"w-100 mt-2"},F={class:"table table-sm rounded-3 w-100"},G={scope:"col"},H={scope:"col"},K={scope:"col"},W={scope:"col"},U={scope:"col"},j={scope:"col"},q={key:0},J={key:1};function Q(d,s,X,Y,Z,tt){const a=r("LocaleText"),p=r("OSMap");return l(),o("div",M,[t("div",S,[t("h3",$,[n(a,{t:"Traceroute"})]),t("div",L,[t("div",C,[t("label",P,[t("small",null,[n(a,{t:"Enter IP Address / Hostname"})])]),g(t("input",{disabled:this.tracing,id:"ipAddress",class:"form-control rounded-3","onUpdate:modelValue":s[0]||(s[0]=e=>this.ipAddress=e),onKeyup:s[1]||(s[1]=y(e=>this.execute(),["enter"])),type:"text"},null,40,I),[[b,this.ipAddress]])]),t("button",{class:"btn btn-primary rounded-3 position-relative flex-grow-1",disabled:this.tracing||!this.ipAddress,onClick:s[2]||(s[2]=e=>this.execute())},[n(u,{name:"slide"},{default:c(()=>[this.tracing?(l(),o("span",B,[...s[4]||(s[4]=[t("span",{class:"spinner-border spinner-border-sm","aria-hidden":"true"},null,-1),t("span",{class:"visually-hidden",role:"status"},"Loading...",-1)])])):(l(),o("span",V,[...s[3]||(s[3]=[t("i",{class:"bi bi-person-walking me-2"},null,-1),v("Trace! ",-1)])]))]),_:1})],8,O)]),t("div",N,[n(u,{name:"ping"},{default:c(()=>[this.tracerouteResult?(l(),o("div",D,[n(p,{d:this.tracerouteResult,type:"traceroute"},null,8,["d"]),t("div",E,[t("table",F,[t("thead",null,[t("tr",null,[t("th",G,[n(a,{t:"Hop"})]),t("th",H,[n(a,{t:"IP Address"})]),t("th",K,[n(a,{t:"Average RTT (ms)"})]),t("th",W,[n(a,{t:"Min RTT (ms)"})]),t("th",U,[n(a,{t:"Max RTT (ms)"})]),t("th",j,[n(a,{t:"Geolocation"})])])]),t("tbody",null,[(l(!0),o(m,null,_(this.tracerouteResult,(e,et)=>(l(),o("tr",null,[t("td",null,[t("small",null,i(e.hop),1)]),t("td",null,[t("small",null,[t("samp",null,i(e.ip),1)])]),t("td",null,[t("small",null,[t("samp",null,i(e.avg_rtt),1)])]),t("td",null,[t("small",null,[t("samp",null,i(e.min_rtt),1)])]),t("td",null,[t("small",null,[t("samp",null,i(e.max_rtt),1)])]),t("td",null,[e.geo&&e.geo.city&&e.geo.country?(l(),o("span",q,[t("small",null,i(e.geo.city)+", "+i(e.geo.country),1)])):(l(),o("span",J," - "))])]))),256))])])])])):(l(),o("div",z,[s[5]||(s[5]=t("div",{class:"pingPlaceholder bg-body-secondary rounded-3 mb-3",style:{height:"300px !important"}},null,-1)),(l(),o(m,null,_(5,e=>t("div",{class:T(["pingPlaceholder bg-body-secondary rounded-3 mb-3",{"animate__animated animate__flash animate__slower animate__infinite":this.tracing}]),style:k({"animation-delay":`${e*.05}s`})},null,6)),64))]))]),_:1})])])])}const at=h(R,[["render",Q],["__scopeId","data-v-125b538b"]]);export{at as default};
