import{c as e,a_ as a,a$ as t,b0 as r}from"./index-nE6cslhy.js";import{r as s,c as n,j as o}from"./vendor-react-Co0R0q1H.js";const c=e("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),i=e("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),l=e("signal-high",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}]]),d=e("signal-low",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}]]),p=e("signal-medium",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}]]),x=e("signal-zero",[["path",{d:"M2 20h.01",key:"4haj6o"}]]),h=e("signal",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]]),u={excellent:"color(display-p3 0.00 1.00 0.00)",good:"color(display-p3 0.55 0.90 0.15)",fair:"color(display-p3 1.00 0.85 0.00)",weak:"color(display-p3 1.00 0.55 0.15)",poor:"color(display-p3 1.00 0.20 0.20)"},g={excellent:"#4ADE80",good:"#A3E635",fair:"#FACC15",weak:"#FB923C",poor:"#EF4444"};function f(e){return e>=-90?"excellent":e>=-100?"good":e>=-110?"fair":e>=-120?"weak":"poor"}function y(e,a,t=!0){return a?t?{backgroundColor:g[e],"--p3-color":u[e]}:{backgroundColor:"rgba(255, 255, 255, 0.25)"}:{backgroundColor:"rgba(255, 255, 255, 0.1)"}}function m(e,a=!0){return e&&a?"signal-bar-active":""}function k({rssi:e,className:a="w-4 h-4"}){const t=f(e),r=function(e){switch(e){case"excellent":return"text-signal-excellent";case"good":return"text-signal-good";case"fair":return"text-signal-fair";case"weak":return"text-signal-poor";case"poor":return"text-signal-critical";default:return"text-fg-muted"}}(t),s=n(r,a);switch(t){case"excellent":return o.jsx(h,{className:s});case"good":return o.jsx(l,{className:s});case"fair":return o.jsx(p,{className:s});case"weak":return o.jsx(d,{className:s});default:return o.jsx(x,{className:s})}}const j=s.memo(function({rssi:e,snr:a,compact:t=!1,showValues:s=!0,radioConfig:c,nfPenalty:i=0,validated:l=!0}){const d=void 0!==a?function(e,a,t,s=0){const n=r(a,e,t,s);return n?function(e){switch(e){case"excellent":return"excellent";case"good":return"good";case"fair":return"fair";case"poor":return"weak";case"critical":return"poor"}}(n.finalGrade):f(e)}(e,a,c,i):f(e),p={excellent:4,good:3,fair:2,weak:1,poor:0}[d];return t?o.jsxs("div",{className:"flex items-center gap-1.5",children:[s&&o.jsx("span",{className:n("type-data-xs w-[32px] text-left",l?"text-fg-secondary":"text-fg-muted"),children:e}),o.jsx("div",{className:"flex items-center gap-[2px] h-3 w-[14px]",children:Array.from({length:4}).map((e,a)=>o.jsx("div",{className:n("w-[3px] h-full rounded-[1px] transition-colors",m(a<p,l)),style:y(d,a<p,l)},a))})]}):o.jsxs("div",{className:"flex items-center gap-2",children:[s&&o.jsxs("div",{className:"flex flex-col items-start w-[52px]",children:[o.jsxs("span",{className:n("type-data-xs leading-tight",l?"text-fg-secondary":"text-fg-muted"),children:[e," dBm"]}),void 0!==a&&o.jsxs("span",{className:"type-data-xs text-fg-muted leading-tight",children:[a.toFixed(1)," dB"]})]}),o.jsx("div",{className:"flex items-center gap-[2px] h-3.5 w-[14px]",children:Array.from({length:4}).map((e,a)=>o.jsx("div",{className:n("w-[3px] h-full rounded-[1px] transition-colors",m(a<p,l)),style:y(d,a<p,l)},a))})]})});function v(e){const a=f(e);return a.charAt(0).toUpperCase()+a.slice(1)}function w(e){return"tx_local"!==e.packet_origin&&"tx_forward"!==e.packet_origin&&(null!=e._isZeroHop?e._isZeroHop:function(e){const r=function(e){if(Array.isArray(e))return e;if("string"==typeof e&&e.startsWith("["))try{const a=JSON.parse(e);return Array.isArray(a)?a:[]}catch{return[]}return[]}(e.original_path),s=e.route??e.route_type;return a(s)?0===r.length:t(s)?r.length<=1:0===r.length}(e))}export{c as A,i as C,j as S,h as a,k as b,v as g,w as i};
