Files
pyMC_Repeater/repeater/web/html/assets/Neighbors-Bo65hv30.js
T
2026-06-23 16:35:02 +01:00

65 lines
86 KiB
JavaScript

import{r as e}from"./chunk-DECur_0Z.js";import{C as t,D as n,N as r,P as i,T as a,U as o,X as s,_t as c,c as l,f as u,gt as d,h as f,ht as p,i as m,j as h,l as g,m as _,o as v,p as y,r as b,s as x,u as S,w as C,y as w}from"./runtime-core.esm-bundler-CINEgm0a.js";import{a as T,l as E,o as D,s as O,t as k}from"./runtime-dom.esm-bundler-B3VeUO8l.js";import{t as A}from"./api-DSaJA91r.js";import{t as j}from"./system-BwYDm56e.js";import{n as M,r as N,t as ee}from"./dataService-5Ok9aIVh.js";import{t as te}from"./Spinner-CMJUE3iy.js";import{c as P,d as F,s as I}from"./index-Cijj_ZXo.js";import{t as L}from"./leaflet-src-rW8DhqPH.js";/* empty css */import{n as R,t as z}from"./CopyLabel-7zw0wWsl.js";import{a as B,i as V,l as H,o as U,r as ne,s as W,u as G}from"./formatters-CHyWlnnq.js";import{n as K,t as q}from"./SignalBars-CRFh_h3f.js";var re={class:`modal-card max-w-md`},ie={class:`bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4 mb-6`},ae={class:`flex items-center gap-3`},oe={class:`flex-1 min-w-0`},se={class:`text-content-primary dark:text-content-primary font-medium truncate`},ce={class:`text-content-secondary dark:text-content-muted text-sm font-mono`},le={key:0,class:`text-white/50 text-xs`},ue={key:1,class:`text-white/50 text-xs`},de=f({__name:`DeleteNeighborModal`,props:{show:{type:Boolean},neighbor:{}},emits:[`close`,`delete`],setup(e,{emit:t}){let n=e,r=t,i=()=>{n.neighbor&&(r(`delete`,n.neighbor.id),o())},o=()=>{r(`close`)};return(t,n)=>(a(),l(m,{to:`body`},[e.show&&e.neighbor?(a(),S(`div`,{key:0,onClick:n[0]||=E(e=>o(),[`self`]),class:`modal-backdrop-heavy`},[x(`div`,re,[x(`div`,{class:`flex items-center gap-3 mb-6`},[n[2]||=x(`svg`,{class:`w-6 h-6 text-accent-red`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z`})],-1),n[3]||=x(`div`,null,[x(`h3`,{class:`text-xl font-semibold text-content-primary dark:text-content-primary`},` Delete Neighbor `),x(`p`,{class:`text-content-secondary dark:text-content-muted text-sm mt-1`},` Are you sure you want to delete this neighbor? `)],-1),x(`button`,{onClick:o,class:`ml-auto text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors`},[...n[1]||=[x(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])]),x(`div`,ie,[x(`div`,ae,[x(`div`,oe,[x(`div`,se,c(e.neighbor?.node_name||e.neighbor?.long_name||e.neighbor?.short_name||`Unknown`),1),x(`div`,ce,` ID: `+c(e.neighbor?.node_num_hex||e.neighbor?.node_num||e.neighbor?.id||`N/A`),1),e.neighbor?.contact_type?(a(),S(`div`,le,c(e.neighbor.contact_type),1)):g(``,!0),e.neighbor?.hw_model?(a(),S(`div`,ue,c(e.neighbor.hw_model),1)):g(``,!0)])])]),n[4]||=x(`div`,{class:`bg-accent-red/10 border border-accent-red/30 rounded-lg p-4 mb-6`},[x(`div`,{class:`flex items-center gap-2 text-accent-red text-sm`},[x(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})]),x(`span`,null,`This action cannot be undone`)])],-1),x(`div`,{class:`flex gap-3`},[x(`button`,{onClick:o,class:`flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors`},` Cancel `),x(`button`,{onClick:i,class:`modal-btn-danger`},` Delete `)])])])):g(``,!0)]))}}),J={class:`bg-gradient-to-r from-primary/20 to-accent-cyan/20 border-b border-stroke-subtle dark:border-stroke/10 px-6 py-4`},fe={class:`flex items-center justify-between`},pe={class:`flex items-center gap-3`},me={key:0,class:`text-sm text-content-secondary dark:text-content-muted`},he={class:`p-6`},ge={key:0,class:`text-center py-8`},_e={key:1,class:`text-center py-8`},ve={class:`text-content-secondary dark:text-content-muted text-sm`},ye={key:2,class:`space-y-4`},be={class:`p-4`},xe={class:`flex items-center gap-2 mb-2`},Se={class:`flex items-baseline gap-2`},Ce={class:`text-3xl font-bold text-content-primary dark:text-content-primary`},we={class:`grid grid-cols-3 gap-3`},Te={class:`p-4`},Ee={class:`flex items-baseline gap-1`},De={class:`text-xl font-bold text-content-primary dark:text-content-primary`},Oe={class:`p-4`},ke={class:`flex items-baseline gap-1`},Ae={class:`text-xl font-bold text-content-primary dark:text-content-primary`},je={class:`p-4`},Me={class:`flex items-center gap-2`},Ne={key:0,class:`flex items-start gap-3 bg-amber-500/10 border border-amber-500/30 rounded-[12px] p-3`},Pe={class:`text-xs leading-relaxed`},Fe={class:`font-semibold text-amber-600 dark:text-amber-400 mb-0.5`},Ie={class:`p-4`},Le={class:`relative`},Re={class:`flex items-center gap-2 overflow-x-auto pb-2`},ze={key:0,class:`relative flex items-center`},Be={key:0,class:`absolute left-1/2 -translate-x-1/2 animate-pulse`},Ve={class:`text-content-muted dark:text-content-muted text-xs mt-2 flex items-center justify-between`},He={key:0,class:`text-cyan-500 dark:text-primary animate-pulse`},Ue={class:`flex items-center justify-between text-xs text-content-muted dark:text-content-muted pt-2`},We=F(f({__name:`PingResultModal`,props:{show:{type:Boolean},nodeName:{default:null},result:{default:null},error:{default:null},loading:{type:Boolean,default:!1}},emits:[`close`],setup(e,{emit:t}){let i=e,s=t,u=j(),{getSignalQuality:d}=K(),f=o(0),y=o(!1),C=v(()=>{let e=u.stats?.config?.radio?.spreading_factor??7,t=u.stats?.config?.radio?.bandwidth??125,n=u.stats?.config?.radio?.coding_rate??5;return 2**e/t*(8+4.25*(n-4)+20)}),w=v(()=>{if(!i.result)return{color:`text-gray-400`,label:`Unknown`};let e=i.result.rtt_ms,t=C.value,n=i.result.path.length,r=2*t*n+500*n;return e<r*2.5?{color:`text-green-600 dark:text-green-400`,label:`Fast`}:e<r*4?{color:`text-yellow-600 dark:text-yellow-400`,label:`Normal`}:e<r*7?{color:`text-orange-600 dark:text-orange-400`,label:`Slow`}:{color:`text-red-600 dark:text-red-400`,label:`Very Slow`}}),T=v(()=>{if(!i.result)return{bars:0,color:`text-gray-400 dark:text-gray-500`,quality:`None`};let e=d(i.result.rssi);return{bars:e.bars,color:e.color,quality:e.quality}}),D=v(()=>{if(!i.result)return 0;if(i.result.path_hash_mode!==void 0)return i.result.path_hash_mode;let e=i.result.path.reduce((e,t)=>{let n=t.replace(/^0x/i,``);return Math.max(e,n.length)},0);return e>4?2:e>2?1:0}),O=v(()=>D.value>0),A=v(()=>({0:`1-byte`,1:`2-byte`,2:`3-byte`})[D.value]??`1-byte`);h(()=>i.result,e=>{if(e&&!y.value){y.value=!0,f.value=0;let t=e.path.length,n=1500/(t*2),r=0,i=t*2-2,a=()=>{r<=i?(f.value=r/i,r++,setTimeout(a,n)):(y.value=!1,f.value=1)};setTimeout(a,100)}},{immediate:!0});let M=v(()=>{if(!i.result||!y.value)return-1;let e=i.result.path.length;if(e<=1)return-1;let t=f.value,n=.5;if(t<=n)return t/n*(e-1);{let r=(t-n)/n;return(e-1)*(1-r)}}),N=()=>{s(`close`)};return(t,i)=>(a(),l(m,{to:`body`},[_(k,{name:`modal`},{default:r(()=>[e.show?(a(),S(`div`,{key:0,class:`fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[300] p-4`,onClick:E(N,[`self`])},[x(`div`,{class:`modal-card-glass max-w-md overflow-hidden`,onClick:i[0]||=E(()=>{},[`stop`])},[x(`div`,J,[x(`div`,fe,[x(`div`,pe,[i[2]||=x(`div`,{class:`p-2 bg-cyan-400/20 dark:bg-primary/20 rounded-lg`},[x(`svg`,{class:`w-5 h-5 text-cyan-500 dark:text-primary`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.393c5.857-5.857 15.355-5.857 21.213 0`})])],-1),x(`div`,null,[i[1]||=x(`h2`,{class:`text-xl font-bold text-content-primary dark:text-content-primary`},` Ping Result `,-1),e.nodeName?(a(),S(`p`,me,c(e.nodeName),1)):g(``,!0)])]),x(`button`,{onClick:N,class:`p-2 hover:bg-stroke-subtle dark:hover:bg-white/10 rounded-lg transition-colors text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary`},[...i[3]||=[x(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])])]),x(`div`,he,[e.loading?(a(),S(`div`,ge,[_(te,{size:`lg`,class:`mx-auto mb-4`}),i[4]||=x(`p`,{class:`text-content-secondary dark:text-content-muted`},`Sending ping...`,-1),i[5]||=x(`p`,{class:`text-content-muted dark:text-content-muted text-sm mt-1`},` Waiting for response... `,-1)])):e.error?(a(),S(`div`,_e,[i[6]||=x(`div`,{class:`p-3 bg-accent-red/10 rounded-full w-16 h-16 mx-auto mb-4 flex items-center justify-center`},[x(`svg`,{class:`w-8 h-8 text-accent-red`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-1.964-1.333-2.732 0L3.268 16c-.77 1.333.192 3 1.732 3z`})])],-1),i[7]||=x(`h3`,{class:`text-accent-red font-semibold mb-2`},`Ping Failed`,-1),x(`p`,ve,c(e.error),1)])):e.result?(a(),S(`div`,ye,[x(`div`,be,[x(`div`,xe,[i[8]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-sm`},`Round-Trip Time`,-1),x(`span`,{class:p([`text-xs font-medium px-2 py-1 rounded-full`,w.value.color,`bg-current/10`])},c(w.value.label),3)]),x(`div`,Se,[x(`span`,Ce,c(e.result.rtt_ms.toFixed(2)),1),i[9]||=x(`span`,{class:`text-content-secondary dark:text-content-muted`},`ms`,-1)])]),x(`div`,we,[x(`div`,Te,[i[11]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-2`},`RSSI`,-1),x(`div`,Ee,[x(`span`,De,c(e.result.rssi),1),i[10]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-xs`},`dBm`,-1)])]),x(`div`,Oe,[i[13]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-2`},`SNR`,-1),x(`div`,ke,[x(`span`,Ae,c(e.result.snr_db),1),i[12]||=x(`span`,{class:`text-content-secondary dark:text-content-muted text-xs`},`dB`,-1)])]),x(`div`,je,[i[14]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-2`},`Signal`,-1),x(`div`,Me,[_(q,{bars:T.value.bars,color:T.value.color},null,8,[`bars`,`color`]),x(`span`,{class:p([`text-sm font-medium`,T.value.color])},c(T.value.quality),3)])])]),O.value?(a(),S(`div`,Ne,[i[16]||=x(`svg`,{class:`w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-1.964-1.333-2.732 0L3.268 16c-.77 1.333.192 3 1.732 3z`})],-1),x(`div`,Pe,[x(`p`,Fe,c(A.value)+` path hashes active `,1),i[15]||=x(`p`,{class:`text-content-secondary dark:text-content-muted`},` This result uses multi-byte path hashes. The repeater being traced must be running firmware that supports multi-byte path hashes. Repeaters on older firmware will not respond to or correctly route these trace packets. `,-1)])])):g(``,!0),x(`div`,Ie,[i[19]||=x(`div`,{class:`text-content-secondary dark:text-content-muted text-sm mb-3`},` Network Path `,-1),x(`div`,Le,[x(`div`,Re,[(a(!0),S(b,null,n(e.result.path,(t,n)=>(a(),S(`div`,{key:n,class:`flex items-center gap-2 flex-shrink-0 relative`},[x(`div`,{class:p([`bg-cyan-400/20 dark:bg-primary/20 text-cyan-600 dark:text-primary border border-cyan-400/40 dark:border-primary/30 px-3 py-1.5 rounded-lg text-sm font-mono transition-all duration-300`,y.value&&Math.floor(M.value)===n?`ring-2 ring-cyan-400/50 dark:ring-primary/50 scale-105`:``])},c(t),3),n<e.result.path.length-1?(a(),S(`div`,ze,[i[18]||=x(`svg`,{class:`w-4 h-4 text-white/40 flex-shrink-0`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 5l7 7-7 7`})],-1),_(k,{name:`packet`},{default:r(()=>[y.value&&M.value>=n&&M.value<n+1?(a(),S(`div`,Be,[...i[17]||=[x(`svg`,{class:`w-3 h-3 text-cyan-500 dark:text-primary drop-shadow-[0_0_6px_color-mix(in_srgb,var(--color-accent-cyan)_80%,transparent)] dark:drop-shadow-[0_0_6px_color-mix(in_srgb,var(--color-primary)_80%,transparent)]`,fill:`currentColor`,viewBox:`0 0 24 24`},[x(`circle`,{cx:`12`,cy:`12`,r:`8`})],-1)]])):g(``,!0)]),_:2},1024)])):g(``,!0)]))),128))])]),x(`div`,Ve,[x(`span`,null,c(e.result.path.length)+` hop`+c(e.result.path.length===1?``:`s`),1),y.value?(a(),S(`span`,He,`● Tracing route...`)):g(``,!0)])]),x(`div`,Ue,[x(`span`,null,`Target: `+c(e.result.target_id),1),x(`span`,null,`Tag: #`+c(e.result.tag),1)])])):g(``,!0)]),x(`div`,{class:`border-t border-stroke-subtle dark:border-stroke/10 px-6 py-4`},[x(`div`,{class:`modal-actions`},[x(`button`,{type:`button`,class:`modal-btn-primary`,onClick:N},`Close`)])])])])):g(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-5d1ed101`]]),Y=e(L(),1),Ge={class:`bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] shadow-2xl border border-stroke-subtle dark:border-white/10 flex flex-col h-full overflow-hidden`},Ke={class:`flex items-center justify-between p-8 pb-4 flex-shrink-0`},qe={class:`flex-1 min-w-0`},Je={class:`text-2xl font-bold text-content-primary dark:text-content-primary mb-1`},Ye={class:`text-content-secondary dark:text-content-muted text-sm font-mono break-all`},Xe={class:`flex items-center gap-2`},Ze={class:`flex-1 overflow-y-auto custom-scrollbar px-8`},Qe={class:`mb-6`},$e={class:`grid grid-cols-1 md:grid-cols-2 gap-4`},et={class:`glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]`},tt={class:`glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]`},nt={class:`text-content-primary dark:text-content-primary font-medium`},rt={class:`glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]`},it={class:`glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]`},at={class:`text-content-primary dark:text-content-primary font-medium`},ot={class:`mb-6`},st={class:`grid grid-cols-1 md:grid-cols-3 gap-4`},ct={class:`glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]`},lt={class:`text-content-primary dark:text-content-primary font-medium`},ut={class:`glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]`},dt={class:`text-content-primary dark:text-content-primary font-medium`},ft={key:0,class:`glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]`},pt={class:`flex items-center gap-2`},mt={class:`mb-6`},ht={class:`grid grid-cols-1 md:grid-cols-2 gap-4`},gt={class:`glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]`},_t={class:`text-content-primary dark:text-content-primary text-sm`},vt={class:`glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]`},yt={class:`text-content-primary dark:text-content-primary text-sm`},bt={key:0,class:`mb-6`},xt={class:`grid grid-cols-1 md:grid-cols-3 gap-4 mb-4`},St={class:`glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]`},Ct={class:`text-content-primary dark:text-content-primary font-mono text-sm`},wt={class:`glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]`},Tt={class:`text-content-primary dark:text-content-primary font-mono text-sm`},Et={class:`glass-card bg-background-mute dark:bg-black/20 p-4 rounded-[12px]`},Dt={class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},Ot={key:0,class:`text-content-primary dark:text-content-primary font-medium`},kt={class:`p-8 pt-4 border-t border-stroke-subtle dark:border-white/10 flex-shrink-0`},At=F(f({name:`NeighborDetailsModal`,__name:`NeighborDetailsModal`,props:{neighbor:{},isOpen:{type:Boolean},baseLatitude:{default:null},baseLongitude:{default:null}},emits:[`close`],setup(e,{emit:t}){let{getSignalQuality:n}=K(),{copy:i,copied:u}=R(),d=e,f=t,y=o(),b=null,C=e=>({Unknown:`Unknown`,"Chat Node":`Chat Node`,Repeater:`Repeater`,"Room Server":`Room Server`,"Hybrid Node":`Hybrid Node`})[e]||e,w=e=>({Unknown:`text-gray-600 dark:text-gray-400`,"Chat Node":`text-blue-600 dark:text-blue-400`,Repeater:`text-emerald-600 dark:text-emerald-400`,"Room Server":`text-purple-600 dark:text-purple-400`,"Hybrid Node":`text-amber-600 dark:text-amber-400`})[e]||`text-gray-600 dark:text-gray-400`,T=()=>{!d.neighbor?.latitude||!d.neighbor?.longitude||i(`${d.neighbor.latitude.toFixed(6)}, ${d.neighbor.longitude.toFixed(6)}`)},D=v(()=>{if(!d.neighbor?.latitude||!d.neighbor?.longitude||!d.baseLatitude||!d.baseLongitude)return null;let e=(d.neighbor.latitude-d.baseLatitude)*Math.PI/180,t=(d.neighbor.longitude-d.baseLongitude)*Math.PI/180,n=Math.sin(e/2)*Math.sin(e/2)+Math.cos(d.baseLatitude*Math.PI/180)*Math.cos(d.neighbor.latitude*Math.PI/180)*Math.sin(t/2)*Math.sin(t/2);return 6371*(2*Math.atan2(Math.sqrt(n),Math.sqrt(1-n)))}),O=v(()=>d.neighbor?.latitude!==null&&d.neighbor?.longitude!==null&&d.neighbor?.latitude!==0&&d.neighbor?.longitude!==0&&Math.abs(d.neighbor?.latitude??0)<=90&&Math.abs(d.neighbor?.longitude??0)<=180),A=()=>{if(!y.value||!d.neighbor||!O.value)return;b&&=(b.remove(),null);let e=document.documentElement.classList.contains(`dark`);b=Y.default.map(y.value,{center:[d.neighbor.latitude,d.neighbor.longitude],zoom:13,zoomControl:!0,attributionControl:!1});let t=e?`https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png`:`https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png`;Y.default.tileLayer(t,{maxZoom:19,attribution:`© OpenStreetMap © CARTO`}).addTo(b);let n=Y.default.divIcon({className:`custom-marker`,html:`<div class="w-8 h-8 rounded-full bg-blue-500 border-2 border-white shadow-lg flex items-center justify-center text-white font-bold text-xs">${d.neighbor.node_name?.charAt(0)||`?`}</div>`,iconSize:[32,32],iconAnchor:[16,16]});if(Y.default.marker([d.neighbor.latitude,d.neighbor.longitude],{icon:n}).addTo(b).bindPopup(`<b>${d.neighbor.node_name||`Unknown`}</b><br>${d.neighbor.pubkey.slice(0,8)}...`),d.baseLatitude!==null&&d.baseLongitude!==null&&d.baseLatitude!==0&&d.baseLongitude!==0&&Math.abs(d.baseLatitude)<=90&&Math.abs(d.baseLongitude)<=180){let e=window.getComputedStyle(document.documentElement).getPropertyValue(`--color-primary`).trim()||`deepskyblue`,t=Y.default.divIcon({className:`custom-marker`,html:`<div class="w-8 h-8 rounded-full bg-green-500 border-2 border-white shadow-lg flex items-center justify-center text-white font-bold text-xs">B</div>`,iconSize:[32,32],iconAnchor:[16,16]});Y.default.marker([d.baseLatitude,d.baseLongitude],{icon:t}).addTo(b).bindPopup(`<b>Base Station</b>`),Y.default.polyline([[d.baseLatitude,d.baseLongitude],[d.neighbor.latitude,d.neighbor.longitude]],{color:e,weight:2,opacity:.6,dashArray:`5, 10`}).addTo(b);let n=Y.default.latLngBounds([d.baseLatitude,d.baseLongitude],[d.neighbor.latitude,d.neighbor.longitude]);b.fitBounds(n,{padding:[50,50]})}},j=e=>{e.key===`Escape`&&f(`close`)},M=e=>{e.target===e.currentTarget&&f(`close`)};h(()=>d.isOpen,e=>{e?(document.body.style.overflow=`hidden`,setTimeout(()=>{O.value&&A()},100)):(document.body.style.overflow=``,b&&=(b.remove(),null))},{immediate:!0});let N=v(()=>d.neighbor?n(d.neighbor.rssi):null);return(t,n)=>(a(),l(m,{to:`body`},[_(k,{name:`modal`,appear:``},{default:r(()=>[e.isOpen&&e.neighbor?(a(),S(`div`,{key:0,class:`modal-backdrop overflow-hidden`,onClick:M,onKeydown:j,tabindex:`0`},[x(`div`,{class:`relative w-full max-w-4xl max-h-[90vh] flex flex-col`,onClick:n[2]||=E(()=>{},[`stop`])},[x(`div`,Ge,[x(`div`,Ke,[x(`div`,qe,[x(`h2`,Je,c(e.neighbor.node_name||`Unknown Node`),1),x(`p`,Ye,c(e.neighbor.pubkey),1)]),x(`div`,Xe,[x(`button`,{onClick:n[0]||=e=>f(`close`),class:`w-8 h-8 flex items-center justify-center rounded-full bg-background-mute dark:bg-white/10 hover:bg-stroke-subtle dark:hover:bg-white/20 transition-colors duration-200 text-content-secondary dark:text-content-primary`},[...n[3]||=[x(`svg`,{class:`w-5 h-5`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M6 18L18 6M6 6l12 12`})],-1)]])])]),x(`div`,Ze,[x(`div`,Qe,[n[8]||=x(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Basic Information `,-1),x(`div`,$e,[x(`div`,et,[n[4]||=x(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Contact Type `,-1),x(`div`,{class:p([`font-medium`,w(e.neighbor.contact_type)])},c(C(e.neighbor.contact_type)),3)]),x(`div`,tt,[n[5]||=x(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Route Type `,-1),x(`div`,nt,c(s(U)(e.neighbor.route_type)),1)]),x(`div`,rt,[n[6]||=x(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Zero Hop `,-1),x(`div`,{class:p([`font-medium`,e.neighbor.zero_hop?`text-green-600 dark:text-green-400`:`text-gray-600 dark:text-gray-400`])},c(e.neighbor.zero_hop?`Yes`:`No`),3)]),x(`div`,it,[n[7]||=x(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Advert Count `,-1),x(`div`,at,c(e.neighbor.advert_count.toLocaleString()),1)])])]),x(`div`,ot,[n[12]||=x(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Signal Quality `,-1),x(`div`,st,[x(`div`,ct,[n[9]||=x(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` RSSI `,-1),x(`div`,lt,c(s(B)(e.neighbor.rssi)),1)]),x(`div`,ut,[n[10]||=x(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` SNR `,-1),x(`div`,dt,c(s(W)(e.neighbor.snr)),1)]),N.value?(a(),S(`div`,ft,[n[11]||=x(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Signal Strength `,-1),x(`div`,pt,[_(q,{bars:N.value.bars,color:N.value.color},null,8,[`bars`,`color`]),x(`span`,{class:p([`text-sm font-medium`,N.value.color])},c(N.value.quality),3)])])):g(``,!0)])]),x(`div`,mt,[n[15]||=x(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Timeline `,-1),x(`div`,ht,[x(`div`,gt,[n[13]||=x(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` First Seen `,-1),x(`div`,_t,c(s(H)(e.neighbor.first_seen)),1)]),x(`div`,vt,[n[14]||=x(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Last Seen `,-1),x(`div`,yt,c(s(H)(e.neighbor.last_seen)),1)])])]),O.value?(a(),S(`div`,bt,[n[19]||=x(`h3`,{class:`text-lg font-semibold text-content-primary dark:text-content-primary mb-4`},` Location `,-1),x(`div`,xt,[x(`div`,St,[n[16]||=x(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Latitude `,-1),x(`div`,Ct,c(e.neighbor.latitude?.toFixed(6)),1)]),x(`div`,wt,[n[17]||=x(`div`,{class:`text-content-muted dark:text-content-muted text-xs uppercase tracking-wide mb-1`},` Longitude `,-1),x(`div`,Tt,c(e.neighbor.longitude?.toFixed(6)),1)]),x(`div`,Et,[x(`div`,Dt,c(D.value===null?`Coordinates`:`Distance`),1),D.value===null?(a(),S(`button`,{key:1,onClick:T,class:`w-full px-3 py-1.5 rounded-lg text-sm font-medium transition-colors flex items-center justify-center gap-1.5 bg-primary/20 hover:bg-primary/30 border border-primary/50 text-primary`},[n[18]||=x(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z`})],-1),_(z,{copied:s(u)},null,8,[`copied`])])):(a(),S(`div`,Ot,c(`${D.value.toFixed(2)} km`),1))])]),x(`div`,{ref_key:`mapContainer`,ref:y,class:`w-full h-96 rounded-[12px] overflow-hidden border border-stroke-subtle dark:border-white/10`},null,512)])):g(``,!0)]),x(`div`,kt,[x(`button`,{onClick:n[1]||=e=>f(`close`),class:`w-full px-4 py-2.5 rounded-lg font-medium transition-colors bg-primary/20 hover:bg-primary/30 border border-primary/50 text-primary`},` Close `)])])])],32)):g(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-3835f9a2`]]),jt=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Mt=1,X=8,Nt=class e{static from(t){if(!(t instanceof ArrayBuffer))throw Error(`Data must be an instance of ArrayBuffer.`);let[n,r]=new Uint8Array(t,0,2);if(n!==219)throw Error(`Data does not appear to be in a KDBush format.`);let i=r>>4;if(i!==Mt)throw Error(`Got v${i} data when expected v${Mt}.`);let a=jt[r&15];if(!a)throw Error(`Unrecognized array type.`);let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,o,a,t)}constructor(e,t=64,n=Float64Array,r){if(isNaN(e)||e<0)throw Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let i=jt.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-o%8)%8;if(i<0)throw Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,X,e),this.coords=new this.ArrayType(this.data,X+o+s,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(X+a+o+s),this.ids=new this.IndexArrayType(this.data,X,e),this.coords=new this.ArrayType(this.data,X+o+s,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Mt<<4)+i]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return Pt(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this,s=[0,i.length-1,0],c=[];for(;s.length;){let l=s.pop()||0,u=s.pop()||0,d=s.pop()||0;if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&(s.push(d),s.push(f-1),s.push(1-l)),(l===0?n>=p:r>=m)&&(s.push(f+1),s.push(u),s.push(1-l))}return c}within(e,t,n){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:r,coords:i,nodeSize:a}=this,o=[0,r.length-1,0],s=[],c=n*n;for(;o.length;){let l=o.pop()||0,u=o.pop()||0,d=o.pop()||0;if(u-d<=a){for(let n=d;n<=u;n++)Rt(i[2*n],i[2*n+1],e,t)<=c&&s.push(r[n]);continue}let f=d+u>>1,p=i[2*f],m=i[2*f+1];Rt(p,m,e,t)<=c&&s.push(r[f]),(l===0?e-n<=p:t-n<=m)&&(o.push(d),o.push(f-1),o.push(1-l)),(l===0?e+n>=p:t+n>=m)&&(o.push(f+1),o.push(u),o.push(1-l))}return s}};function Pt(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;Ft(e,t,o,r,i,a),Pt(e,t,n,r,o-1,1-a),Pt(e,t,n,o+1,i,1-a)}function Ft(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);Ft(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(It(e,t,r,n),t[2*i+a]>o&&It(e,t,r,i);s<c;){for(It(e,t,s,c),s++,c--;t[2*s+a]<o;)s++;for(;t[2*c+a]>o;)c--}t[2*r+a]===o?It(e,t,r,c):(c++,It(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function It(e,t,n,r){Lt(e,n,r),Lt(t,2*n,2*r),Lt(t,2*n+1,2*r+1)}function Lt(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Rt(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}var zt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},Bt=Math.fround||(e=>(t=>(e[0]=+t,e[0])))(new Float32Array(1)),Z=2,Q=3,Vt=4,$=5,Ht=6,Ut=class{constructor(e){this.options=Object.assign(Object.create(zt),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:t,minZoom:n,maxZoom:r}=this.options;t&&console.time(`total time`);let i=`prepare ${e.length} points`;t&&console.time(i),this.points=e;let a=[];for(let t=0;t<e.length;t++){let n=e[t];if(!n.geometry)continue;let[r,i]=n.geometry.coordinates,o=Bt(Kt(r)),s=Bt(qt(i));a.push(o,s,1/0,t,-1,1),this.options.reduce&&a.push(0)}let o=this.trees[r+1]=this._createTree(a);t&&console.timeEnd(i);for(let e=r;e>=n;e--){let n=+Date.now();o=this.trees[e]=this._createTree(this._cluster(o,e)),t&&console.log(`z%d: %d clusters in %dms`,e,o.numItems,+Date.now()-n)}return t&&console.timeEnd(`total time`),this}getClusters(e,t){let n=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),i=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,i=180;else if(n>i){let e=this.getClusters([n,r,180,a],t),o=this.getClusters([-180,r,i,a],t);return e.concat(o)}let o=this.trees[this._limitZoom(t)],s=o.range(Kt(n),qt(a),Kt(i),qt(r)),c=o.data,l=[];for(let e of s){let t=this.stride*e;l.push(c[t+$]>1?Wt(c,t,this.clusterProps):this.points[c[t+Q]])}return l}getChildren(e){let t=this._getOriginId(e),n=this._getOriginZoom(e),r=`No cluster with the specified id.`,i=this.trees[n];if(!i)throw Error(r);let a=i.data;if(t*this.stride>=a.length)throw Error(r);let o=this.options.radius/(this.options.extent*2**(n-1)),s=a[t*this.stride],c=a[t*this.stride+1],l=i.within(s,c,o),u=[];for(let t of l){let n=t*this.stride;a[n+Vt]===e&&u.push(a[n+$]>1?Wt(a,n,this.clusterProps):this.points[a[n+Q]])}if(u.length===0)throw Error(r);return u}getLeaves(e,t,n){t||=10,n||=0;let r=[];return this._appendLeaves(r,e,t,n,0),r}getTile(e,t,n){let r=this.trees[this._limitZoom(e)],i=2**e,{extent:a,radius:o}=this.options,s=o/a,c=(n-s)/i,l=(n+1+s)/i,u={features:[]};return this._addTileFeatures(r.range((t-s)/i,c,(t+1+s)/i,l),r.data,t,n,i,u),t===0&&this._addTileFeatures(r.range(1-s/i,c,1,l),r.data,i,n,i,u),t===i-1&&this._addTileFeatures(r.range(0,c,s/i,l),r.data,-1,n,i,u),u.features.length?u:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){let n=this.getChildren(e);if(t++,n.length!==1)break;e=n[0].properties.cluster_id}return t}_appendLeaves(e,t,n,r,i){let a=this.getChildren(t);for(let t of a){let a=t.properties;if(a&&a.cluster?i+a.point_count<=r?i+=a.point_count:i=this._appendLeaves(e,a.cluster_id,n,r,i):i<r?i++:e.push(t),e.length===n)break}return i}_createTree(e){let t=new Nt(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<e.length;n+=this.stride)t.add(e[n],e[n+1]);return t.finish(),t.data=e,t}_addTileFeatures(e,t,n,r,i,a){for(let o of e){let e=o*this.stride,s=t[e+$]>1,c,l,u;if(s)c=Gt(t,e,this.clusterProps),l=t[e],u=t[e+1];else{let n=this.points[t[e+Q]];c=n.properties;let[r,i]=n.geometry.coordinates;l=Kt(r),u=qt(i)}let d={type:1,geometry:[[Math.round(this.options.extent*(l*i-n)),Math.round(this.options.extent*(u*i-r))]],tags:c},f;f=s||this.options.generateId?t[e+Q]:this.points[t[e+Q]].id,f!==void 0&&(d.id=f),a.features.push(d)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){let{radius:n,extent:r,reduce:i,minPoints:a}=this.options,o=n/(r*2**t),s=e.data,c=[],l=this.stride;for(let n=0;n<s.length;n+=l){if(s[n+Z]<=t)continue;s[n+Z]=t;let r=s[n],u=s[n+1],d=e.within(s[n],s[n+1],o),f=s[n+$],p=f;for(let e of d){let n=e*l;s[n+Z]>t&&(p+=s[n+$])}if(p>f&&p>=a){let e=r*f,a=u*f,o,m=-1,h=((n/l|0)<<5)+(t+1)+this.points.length;for(let r of d){let c=r*l;if(s[c+Z]<=t)continue;s[c+Z]=t;let u=s[c+$];e+=s[c]*u,a+=s[c+1]*u,s[c+Vt]=h,i&&(o||(o=this._map(s,n,!0),m=this.clusterProps.length,this.clusterProps.push(o)),i(o,this._map(s,c)))}s[n+Vt]=h,c.push(e/p,a/p,1/0,h,-1,p),i&&c.push(m)}else{for(let e=0;e<l;e++)c.push(s[n+e]);if(p>1)for(let e of d){let n=e*l;if(!(s[n+Z]<=t)){s[n+Z]=t;for(let e=0;e<l;e++)c.push(s[n+e])}}}}return c}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,n){if(e[t+$]>1){let r=this.clusterProps[e[t+Ht]];return n?Object.assign({},r):r}let r=this.points[e[t+Q]].properties,i=this.options.map(r);return n&&i===r?Object.assign({},i):i}};function Wt(e,t,n){return{type:`Feature`,id:e[t+Q],properties:Gt(e,t,n),geometry:{type:`Point`,coordinates:[Jt(e[t]),Yt(e[t+1])]}}}function Gt(e,t,n){let r=e[t+$],i=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?`${Math.round(r/100)/10}k`:r,a=e[t+Ht],o=a===-1?{}:Object.assign({},n[a]);return Object.assign(o,{cluster:!0,cluster_id:e[t+Q],point_count:r,point_count_abbreviated:i})}function Kt(e){return e/360+.5}function qt(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function Jt(e){return(e-.5)*360}function Yt(e){let t=(180-e*360)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}var Xt={class:`map-container`},Zt={key:0,class:`flex items-center justify-center h-96 glass-card backdrop-blur border border-stroke-subtle rounded-xl shadow-sm dark:shadow-none`},Qt={key:0,class:`flex items-center gap-2 text-content-secondary dark:text-content-muted`},$t={key:1,class:`text-center text-content-primary dark:text-content-primary`},en={class:`hidden sm:inline`},tn={key:3,class:`map-legend z-200`},nn={class:`legend-footer`},rn={key:4,class:`map-attribution z-200`},an=F(f({__name:`NetworkMap`,props:{adverts:{},baseLatitude:{default:null},baseLongitude:{default:null},statsLoading:{type:Boolean,default:!1},showLegend:{type:Boolean,default:!0}},emits:[`update:showLegend`],setup(e,{expose:n,emit:r}){typeof window<`u`&&!window.chrome&&(window.chrome={runtime:{}});let i=e,s=r,l=()=>{s(`update:showLegend`,!i.showLegend)},d=o(),f=null,p=o(new Map),m=null,y=o(new Map),b=o([]),T=o(!0),E=o(60),D=o(14),O=o(document.documentElement.classList.contains(`dark`)),k={base:`var(--color-accent-red)`,unknown:`var(--color-text-muted)`,chatNode:`var(--color-primary)`,repeater:`var(--color-secondary)`,roomServer:`var(--color-secondary)`,hybrid:`var(--color-accent-cyan)`,directLine:`var(--color-primary)`,transportDirectLine:`var(--color-secondary)`,floodLine:`var(--color-accent-cyan)`,transportFloodLine:`var(--color-accent-red)`,cluster:`var(--color-primary)`,popupText:`var(--color-text-secondary)`,popupSubtle:`var(--color-text-muted)`,popupHeading:`var(--color-text-primary)`},A=new MutationObserver(()=>{let e=document.documentElement.classList.contains(`dark`);e!==O.value&&(O.value=e,f&&ee())}),j=v(()=>i.baseLatitude!==null&&i.baseLongitude!==null&&typeof i.baseLatitude==`number`&&typeof i.baseLongitude==`number`&&i.baseLatitude!==0&&i.baseLongitude!==0&&Math.abs(i.baseLatitude)<=90&&Math.abs(i.baseLongitude)<=180),M=(e,t,n,r)=>{let i=(n-e)*Math.PI/180,a=(r-t)*Math.PI/180,o=Math.sin(i/2)*Math.sin(i/2)+Math.cos(e*Math.PI/180)*Math.cos(n*Math.PI/180)*Math.sin(a/2)*Math.sin(a/2);return 6371*(2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o)))},N=()=>{f&&=(b.value.forEach(e=>{f&&e.remove()}),b.value.length=0,f.remove(),null),p.value.clear(),y.value.clear(),m=null},ee=async()=>{let e=f?.getZoom()||11,t=f?.getCenter()||(j.value?[i.baseLatitude,i.baseLongitude]:[0,0]);N(),await w(),await I(),f&&f.setView(t,e)},P=e=>{let t=new Map;return e.filter(e=>e.latitude!==null&&e.longitude!==null).map(e=>{let n=e.latitude,r=e.longitude,i=`${n.toFixed(6)}_${r.toFixed(6)}`,a=t.get(i)||0;if(t.set(i,a+1),a>0){let e=.001,t=a*60*(Math.PI/180);n+=Math.sin(t)*e*(a*.5),r+=Math.cos(t)*e*(a*.5)}return{type:`Feature`,properties:{advert:{...e,jittered_latitude:n,jittered_longitude:r}},geometry:{type:`Point`,coordinates:[r,n]}}})},F=e=>{m=new Ut({radius:E.value,maxZoom:D.value,minPoints:2}),m.load(e)},I=async()=>{if(!d.value||!j.value){console.warn(`Cannot initialize map: missing container or coordinates`);return}N(),await w();let e=i.baseLatitude,t=i.baseLongitude;f=Y.default.map(d.value,{center:[e,t],zoom:11,zoomControl:!0,attributionControl:!1,preferCanvas:!1});try{let e=O.value?`https://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}{r}.png`:`https://{s}.basemaps.cartocdn.com/light_nolabels/{z}/{x}/{y}{r}.png`,t=O.value?`https://{s}.basemaps.cartocdn.com/dark_only_labels/{z}/{x}/{y}{r}.png`:`https://{s}.basemaps.cartocdn.com/light_only_labels/{z}/{x}/{y}{r}.png`,n=Y.default.tileLayer(e,{maxZoom:19,attribution:`&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>`,errorTileUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==`}),r=Y.default.tileLayer(t,{maxZoom:19,attribution:``,errorTileUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==`});n.addTo(f),r.addTo(f)}catch(e){console.warn(`Error loading tiles:`,e)}try{let n=(e,t=!1)=>{let n=t?16:12;return Y.default.divIcon({className:`custom-div-icon`,html:`<div style="background-color: ${e}; width: ${n}px; height: ${n}px; border-radius: 50%; border: 2px solid var(--color-surface); box-shadow: 0 2px 4px color-mix(in srgb, var(--color-background) 35%, transparent);"></div>`,iconSize:[n+4,n+4],iconAnchor:[(n+4)/2,(n+4)/2]})},r=e=>{let t=e<10?30:e<100?40:50;return Y.default.divIcon({className:`custom-cluster-icon`,html:`
<div style="
width: ${t}px;
height: ${t}px;
background: color-mix(in srgb, var(--color-primary) 20%, transparent);
border: 2px solid var(--color-primary);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
backdrop-filter: blur(10px);
box-shadow: 0 4px 12px color-mix(in srgb, var(--color-primary) 35%, transparent);
color: var(--color-text-primary);
font-size: ${t<35?`11px`:`13px`};
font-weight: bold;
text-shadow: 0 1px 2px color-mix(in srgb, var(--color-background) 45%, transparent);
">
${e}
</div>
`,iconSize:[t,t],iconAnchor:[t/2,t/2]})},a=n(k.base,!0);Y.default.marker([e,t],{icon:a}).addTo(f).bindPopup(`
<div class="p-2">
<strong style="color: ${k.base};">Base Station</strong><br>
<span class="text-sm" style="color: ${k.popupText};">Base Station</span><br>
<span class="text-xs" style="color: ${k.popupSubtle};">${e.toFixed(6)}, ${t.toFixed(6)}</span>
</div>
`);let o={Unknown:k.unknown,"Chat Node":k.chatNode,Repeater:k.repeater,"Room Server":k.roomServer,"Hybrid Node":k.hybrid},s=(e,t,n,r,i=0)=>{if(!f||e.zero_hop!==!0)return;let a=e.jittered_latitude||e.latitude,o=e.jittered_longitude||e.longitude;if(a===null||o===null)return;let s=e.route_type||0,c=r,l=3,u=.7,d;s===2?(c=k.directLine,l=4,u=.9):s===1?(c=k.floodLine,d=`10, 5`,u=.8):s===3?(c=k.transportDirectLine,l=5,u=.95):s===0?(c=k.transportFloodLine,d=`12, 6`,u=.8):(c=k.unknown,d=`2, 5`,u=.6);let p=[t,n],m=[a,o],h=Y.default.polyline([p,m],{color:c,weight:l,opacity:0,dashArray:d,className:`connection-line`}).addTo(f),g=Y.default.polyline([p,p],{color:c,weight:l,opacity:0,dashArray:d,className:`connection-line animated-line`}).addTo(f);setTimeout(()=>{let i=0;g.setStyle({opacity:u+.2});let s=()=>{i++;let c=i/30,d=p[0]+(m[0]-p[0])*c,_=p[1]+(m[1]-p[1])*c;g.setLatLngs([p,[d,_]]),i<30?setTimeout(s,30):setTimeout(()=>{f&&g&&g.remove(),h.setStyle({opacity:u}),h.on(`mouseover`,()=>{h.setStyle({weight:l+2,opacity:Math.min(u+.3,1)})}),h.on(`mouseout`,()=>{h.setStyle({weight:l,opacity:u})});let i=M(t,n,a,o);h.bindPopup(`
<div class="p-2">
<strong style="color: ${r}">Connection to ${e.node_name||`Unknown Node`}</strong><br>
<span class="text-sm" style="color: ${k.popupText};">Distance: ${i.toFixed(2)} km</span><br>
<span class="text-sm" style="color: ${k.popupText};">Route: ${U(e.route_type)}</span><br>
<span class="text-sm" style="color: ${k.popupText};">Signal: ${B(e.rssi)} / ${W(e.snr)}</span>
</div>
`),b.value.push(h)},200)};s()},i)},c=()=>{if(!f||!m)return;let i=f.getBounds(),a=Math.floor(f.getZoom());y.value.forEach(e=>{f&&e.remove()}),y.value.clear(),b.value.forEach(e=>{f&&e.remove()}),b.value.length=0,m.getClusters([i.getWest(),i.getSouth(),i.getEast(),i.getNorth()],a).forEach(i=>{let[a,c]=i.geometry.coordinates,l=i.properties;if(l.cluster){let n=Y.default.marker([c,a],{icon:r(l.point_count||0)}).addTo(f);n.on(`click`,()=>{if(f&&m){let e=m.getClusterExpansionZoom(l.cluster_id);f.setView([c,a],e)}});let i=m.getLeaves(l.cluster_id,1/0).map(e=>`<div style="margin: 2px 0; color: ${o[e.properties.advert.contact_type]||o.Unknown};">
${e.properties.advert.node_name||`Unknown Node`} (${e.properties.advert.contact_type})
</div>`).join(``);n.bindPopup(`
<div class="p-2">
<strong style="color: ${k.cluster};">Cluster: ${l.point_count} nodes</strong><br>
<div style="max-height: 200px; overflow-y: auto; margin-top: 8px;">
${i}
</div>
<div style="margin-top: 8px; font-size: 11px; color: ${k.popupSubtle};">
Click to zoom in and separate nodes
</div>
</div>
`),y.value.set(`cluster-${l.cluster_id}`,n);let u=M(e,t,c,a),d=Math.min(Math.floor(u*5),200);s({node_name:`Cluster of ${l.point_count} nodes`,contact_type:`Cluster`,route_type:2,rssi:null,snr:null,jittered_latitude:c,jittered_longitude:a,latitude:c,longitude:a},e,t,k.cluster,d)}else{let r=l.advert,i=o[r.contact_type]||o.Unknown,u=n(i),d=c,m=a,h=M(e,t,d,m),g=Y.default.marker([d,m],{icon:u}).addTo(f).bindPopup(`
<div class="p-2">
<strong style="color: ${i}">${r.node_name||`Unknown Node`}</strong><br>
<span class="text-sm" style="color: ${k.popupText};">Type: ${r.contact_type}</span><br>
<span class="text-sm" style="color: ${k.popupText};">Distance: ${h.toFixed(2)} km</span><br>
<span class="text-sm" style="color: ${k.popupText};">Signal: ${B(r.rssi)} / ${W(r.snr)}</span><br>
<span class="text-sm" style="color: ${k.popupText};">Route: ${U(r.route_type)}</span><br>
<span class="text-sm" style="color: ${k.popupText};">Last Seen: ${H(r.last_seen)}</span>
${r.jittered_latitude?`<br><span class="text-xs" style="color: ${k.popupSubtle};">Position adjusted to separate overlapping nodes</span>`:``}
</div>
`);p.value.set(r.pubkey,g),y.value.set(`node-${r.pubkey}`,g);let _=Math.min(Math.floor(h*5),200);s({...r,jittered_latitude:d,jittered_longitude:m},e,t,i,_)}})},l=(e,t)=>{let r=0;P(i.adverts).forEach(i=>{let a=i.properties.advert;if(a.latitude!==null&&a.longitude!==null){let i=o[a.contact_type]||o.Unknown,c=n(i),l=a.jittered_latitude||a.latitude,u=a.jittered_longitude||a.longitude,d=Y.default.marker([l,u],{icon:c}).addTo(f).bindPopup(`
<div class="p-2">
<strong style="color: ${i}">${a.node_name||`Unknown Node`}</strong><br>
<span class="text-sm" style="color: ${k.popupText};">Type: ${a.contact_type}</span><br>
<span class="text-sm" style="color: ${k.popupText};">Distance: ${M(e,t,l,u).toFixed(2)} km</span><br>
<span class="text-sm" style="color: ${k.popupText};">Signal: ${B(a.rssi)} / ${W(a.snr)}</span><br>
<span class="text-sm" style="color: ${k.popupText};">Route: ${U(a.route_type)}</span><br>
<span class="text-sm" style="color: ${k.popupText};">Last Seen: ${H(a.last_seen)}</span>
${a.jittered_latitude?`<br><span class="text-xs" style="color: ${k.popupSubtle};">Position adjusted to separate overlapping nodes</span>`:``}
</div>
`);p.value.set(a.pubkey,d);let m=d.getElement();m&&(m.style.opacity=`0`,m.style.transition=`opacity 0.5s ease-out`),s(a,e,t,i,r),setTimeout(()=>{m&&(m.style.opacity=`1`)},r+1e3),r+=100}})};if(T.value&&i.adverts.length>0)try{F(P(i.adverts));let n=Math.min(14,f.getZoom());f.setZoom(n),setTimeout(()=>{try{c()}catch(n){console.warn(`Error updating clusters:`,n),l(e,t)}},100),f.on(`moveend`,()=>{try{c()}catch(e){console.warn(`Error updating clusters on move:`,e)}}),f.on(`zoomend`,()=>{try{c()}catch(e){console.warn(`Error updating clusters on zoom:`,e)}})}catch(n){console.warn(`Error initializing clustering:`,n),l(e,t)}else l(e,t);setTimeout(()=>{f&&f.invalidateSize()},1e3)}catch(e){console.error(`Error initializing map:`,e)}};return n({highlightNode:e=>{let t=p.value.get(e);if(t){let e=t.getElement();if(e){let t=e.querySelector(`div`);t&&t.classList.add(`marker-highlight`)}}},unhighlightNode:e=>{let t=p.value.get(e);if(t){let e=t.getElement();if(e){let t=e.querySelector(`div`);t&&t.classList.remove(`marker-highlight`)}}},initializeOpenStreetMap:I}),h(()=>i.adverts,()=>{f&&j.value&&setTimeout(()=>{I()},100)},{immediate:!1}),h(j,e=>{e&&i.adverts.length>0&&!f&&w(()=>I())}),t(()=>{A.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),j.value&&i.adverts.length>0&&setTimeout(()=>{I()},300)}),C(()=>{A.disconnect(),N()}),(t,n)=>(a(),S(`div`,Xt,[j.value?(a(),S(`div`,{key:1,ref_key:`mapContainer`,ref:d,class:`leaflet-map-container h-96 w-full glass-card backdrop-blur border border-stroke-subtle rounded-xl overflow-hidden shadow-sm dark:shadow-none`,style:{"min-height":`384px`,position:`relative`}},null,512)):(a(),S(`div`,Zt,[i.statsLoading?(a(),S(`div`,Qt,[_(te,{size:`xs`}),n[0]||=x(`p`,{class:`text-xs sm:text-sm`},`Fetching base station location…`,-1)])):(a(),S(`div`,$t,[...n[1]||=[x(`svg`,{class:`w-8 h-8 mx-auto mb-2 text-content-muted dark:text-content-muted`,fill:`currentColor`,viewBox:`0 0 20 20`},[x(`path`,{d:`M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z`})],-1),x(`p`,{class:`text-sm text-content-primary dark:text-content-primary`},` No valid coordinates available `,-1),x(`p`,{class:`text-xs text-content-secondary dark:text-content-muted`},` Configure base station location to view map `,-1)]]))])),j.value&&e.adverts.length>0?(a(),S(`button`,{key:2,onClick:l,class:`absolute bottom-3 right-3 z-200 flex items-center gap-2 px-3 py-2 bg-surface/80 border border-stroke-subtle rounded-lg text-content-secondary hover:bg-background-mute hover:text-content-primary transition-colors text-sm backdrop-blur-sm`},[n[2]||=x(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z`})],-1),x(`span`,en,c(e.showLegend?`Hide`:`Show`),1)])):g(``,!0),j.value&&e.adverts.length>0&&e.showLegend?(a(),S(`div`,tn,[n[3]||=u(`<div class="legend-section" data-v-0d8d71bb><div class="legend-subtitle" data-v-0d8d71bb>Node Types</div><div class="legend-items" data-v-0d8d71bb><div class="legend-item" data-v-0d8d71bb><div class="legend-icon" style="background-color:var(--color-accent-red);" data-v-0d8d71bb></div><span data-v-0d8d71bb>Base Station</span></div><div class="legend-item" data-v-0d8d71bb><div class="legend-icon" style="background-color:var(--color-primary);" data-v-0d8d71bb></div><span data-v-0d8d71bb>Chat Node</span></div><div class="legend-item" data-v-0d8d71bb><div class="legend-icon" style="background-color:var(--color-secondary);" data-v-0d8d71bb></div><span data-v-0d8d71bb>Repeater</span></div><div class="legend-item" data-v-0d8d71bb><div class="legend-icon" style="background-color:var(--color-secondary);" data-v-0d8d71bb></div><span data-v-0d8d71bb>Room Server</span></div><div class="legend-item" data-v-0d8d71bb><div class="legend-icon" style="background-color:var(--color-accent-cyan);" data-v-0d8d71bb></div><span data-v-0d8d71bb>Hybrid Node</span></div></div></div><div class="legend-section" data-v-0d8d71bb><div class="legend-subtitle" data-v-0d8d71bb>Route Types</div><div class="legend-items" data-v-0d8d71bb><div class="legend-item" data-v-0d8d71bb><div class="legend-line" style="background:var(--color-primary);height:3px;" data-v-0d8d71bb></div><span data-v-0d8d71bb>Direct</span></div><div class="legend-item" data-v-0d8d71bb><div class="legend-line" style="background:var(--color-secondary);height:4px;" data-v-0d8d71bb></div><span data-v-0d8d71bb>Transport Direct</span></div><div class="legend-item" data-v-0d8d71bb><div class="legend-line legend-line-dashed" style="color:var(--color-accent-cyan);" data-v-0d8d71bb></div><span data-v-0d8d71bb>Flood</span></div><div class="legend-item" data-v-0d8d71bb><div class="legend-line legend-line-dashed" style="color:var(--color-accent-red);" data-v-0d8d71bb></div><span data-v-0d8d71bb>Transport Flood</span></div></div></div>`,2),x(`div`,nn,c(e.adverts.length)+` node`+c(e.adverts.length===1?``:`s`)+` visible `,1)])):g(``,!0),j.value?(a(),S(`div`,rn,` © OpenStreetMap contributors © CARTO `)):g(``,!0)]))}}),[[`__scopeId`,`data-v-0d8d71bb`]]),on={class:`relative`,"data-menu-container":``},sn=f({__name:`NeighborMenu`,props:{neighbor:{},canPing:{type:Boolean}},emits:[`ping`,`delete`,`show-details`],setup(e,{emit:t}){let n=window.__neighborMenuManager||{activeMenu:null,setActiveMenu:e=>{if(n.activeMenu&&n.activeMenu!==e)try{n.activeMenu.closeMenu()}catch(e){console.warn(`Error closing previous menu:`,e)}n.activeMenu=e}};window.__neighborMenuManager=n;let r=e,i=t,s=o(!1),c=o(),u=o(),f=o({top:0,left:0}),h=()=>{s.value=!1,document.removeEventListener(`click`,T,!0),document.removeEventListener(`keydown`,E),n.activeMenu===_&&(n.activeMenu=null)},_={closeMenu:h},v=()=>{h(),i(`ping`,r.neighbor)},y=()=>{h(),i(`show-details`,r.neighbor)},b=()=>{h(),i(`delete`,r.neighbor)},T=e=>{e.target.closest(`[data-menu-container]`)||h()},E=e=>{e.key===`Escape`&&h()},D=async()=>{if(!s.value&&c.value){n.setActiveMenu(_);let e=c.value.getBoundingClientRect(),t=window.innerWidth,r=t<1024,i=e.left+144>t-16,a=e.left;if(r&&i&&(a=e.right-144),a=Math.max(8,a),f.value={top:e.bottom+4,left:a},s.value=!0,await w(),u.value){let t=u.value.offsetHeight;e.bottom+4+t>window.innerHeight-8&&(f.value={top:e.top-t-4,left:a})}document.addEventListener(`click`,T,!0),document.addEventListener(`keydown`,E)}else h()};return C(()=>{h()}),(e,t)=>(a(),S(`div`,on,[x(`button`,{ref_key:`buttonRef`,ref:c,onClick:D,class:p([`p-1 rounded hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary/80`,{"bg-background-mute dark:bg-stroke/10 text-content-primary dark:text-content-primary/80":s.value}]),"data-menu-container":``},[...t[0]||=[x(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z`})],-1)]],2),(a(),l(m,{to:`body`},[s.value?(a(),S(`div`,{key:0,ref_key:`menuRef`,ref:u,class:`fixed w-36 bg-white dark:bg-surface-elevated backdrop-blur-lg border border-stroke-subtle dark:border-white/20 rounded-[15px] shadow-2xl z-[450]`,style:d({top:f.value.top+`px`,left:f.value.left+`px`}),"data-menu-container":``},[x(`div`,{class:`py-2`},[x(`button`,{onClick:y,class:`flex items-center gap-3 w-full px-4 py-3 text-sm text-content-primary dark:text-content-primary hover:bg-primary/10 transition-colors border-b border-stroke-subtle dark:border-white/10`},[...t[1]||=[x(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`})],-1),x(`span`,{class:`font-medium`},`Details`,-1)]]),x(`button`,{onClick:v,class:`flex items-center gap-3 w-full px-4 py-3 text-sm text-content-primary dark:text-content-primary hover:bg-primary/10 transition-colors border-b border-stroke-subtle dark:border-white/10`},[...t[2]||=[x(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.393c5.857-5.857 15.355-5.857 21.213 0`})],-1),x(`span`,{class:`font-medium`},`Ping`,-1)]]),x(`button`,{onClick:b,class:`flex items-center gap-3 w-full px-4 py-3 text-sm text-accent-red hover:bg-accent-red/10 transition-colors`},[...t[3]||=[x(`svg`,{class:`w-4 h-4`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})],-1),x(`span`,{class:`font-medium`},`Delete`,-1)]])])],4)):g(``,!0)]))]))}}),cn={class:`glass-card/30 backdrop-blur border border-stroke-subtle rounded-xl p-6 shadow-sm dark:shadow-none`},ln={class:`flex items-center justify-between mb-4`},un={class:`flex items-center gap-3`},dn={class:`text-content-primary dark:text-content-primary text-lg font-semibold`},fn={class:`bg-background-mute text-content-secondary dark:text-content-primary text-xs px-2 py-1 rounded-full`},pn={key:0,class:`text-content-muted dark:text-content-muted`},mn={key:0,class:`hidden lg:flex bg-background-mute backdrop-blur rounded-lg border border-stroke-subtle p-1`},hn={class:`hidden lg:block overflow-x-auto`},gn={class:`w-full`},_n={class:`bg-background-mute dark:bg-transparent`},vn={class:`flex items-center gap-1`},yn={class:`flex items-center gap-1`},bn={class:`flex items-center gap-1`},xn={class:`flex items-center gap-1`},Sn={class:`flex items-center gap-1`},Cn={class:`flex items-center gap-1`},wn={class:`flex items-center gap-1`},Tn={class:`flex items-center gap-1`},En={class:`flex items-center gap-1`},Dn={class:`bg-surface/50 dark:bg-transparent`},On=[`onMouseenter`,`onMouseleave`,`onClick`],kn=[`onClick`,`title`],An={key:0,class:`ml-1 text-xs`},jn={key:0,class:`flex items-center gap-3`},Mn={class:`text-content-secondary dark:text-content-muted`},Nn={class:`flex gap-1`},Pn=[`onClick`],Fn=[`onClick`],In={key:1,class:`text-content-muted`},Ln={class:`flex items-center gap-2`},Rn={class:`flex items-center gap-2`},zn=[`title`],Bn=[`title`],Vn={class:`lg:hidden space-y-3`},Hn=[`onClick`],Un={class:`flex items-center justify-between mb-3`},Wn={class:`flex items-center gap-3`},Gn={class:`text-content-primary dark:text-content-primary font-medium text-base`},Kn={class:`flex items-center gap-2`},qn={class:`grid grid-cols-1 gap-3`},Jn={class:`grid grid-cols-2 gap-4`},Yn=[`onClick`,`title`],Xn={key:0,class:`ml-1 text-xs`},Zn={class:`flex items-center gap-2 justify-end`},Qn={class:`grid grid-cols-2 gap-4`},$n={class:`flex items-center gap-2`},er=[`title`],tr={class:`text-content-primary dark:text-content-primary text-sm block text-right`},nr={key:0,class:`border-t border-stroke-subtle pt-3`},rr={class:`flex items-center justify-between`},ir={class:`text-content-secondary dark:text-content-muted text-sm font-mono`},ar={class:`flex gap-2`},or=[`onClick`],sr=[`onClick`],cr={class:`grid grid-cols-3 gap-4 pt-3 border-t border-stroke-subtle`},lr={class:`text-center`},ur={class:`text-content-primary dark:text-content-primary text-sm font-medium`},dr={class:`text-center`},fr={class:`text-content-primary dark:text-content-primary text-sm font-medium`},pr={class:`text-center`},mr=[`title`],hr=f({__name:`NeighborTable`,props:{contactType:{},contactTypeKey:{},adverts:{},originalCount:{default:0},color:{},baseLatitude:{default:null},baseLongitude:{default:null},isCompactView:{type:Boolean,default:!1},isFirstTable:{type:Boolean,default:!1},showViewToggle:{type:Boolean,default:!1}},emits:[`highlight-node`,`unhighlight-node`,`menu-ping`,`menu-delete`,`show-details`,`toggle-view`],setup(e,{emit:t}){let r=o(null),{getSignalQuality:i}=K(),l=o(`advert_count`),u=o(`desc`),f=e,m=t,h=(e,t,n,r)=>{let i=(n-e)*Math.PI/180,a=(r-t)*Math.PI/180,o=Math.sin(i/2)*Math.sin(i/2)+Math.cos(e*Math.PI/180)*Math.cos(n*Math.PI/180)*Math.sin(a/2)*Math.sin(a/2);return 6371*(2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o)))},C=e=>f.baseLatitude===null||f.baseLongitude===null||e.latitude===null||e.longitude===null?`N/A`:ne(h(f.baseLatitude,f.baseLongitude,e.latitude,e.longitude)),w=async e=>{try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);return t.value=e,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),!0}},T=e=>{let t=Date.now()-e*1e3,n=Math.floor(t/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24);return n<60?`${n}s ago`:r<60?`${r}m ago`:i<24?`${i}h ago`:`${a}d ago`},D=e=>{let t=Date.now()-e*1e3,n=Math.floor(t/(1e3*60*60));return n<1?{color:`text-primary`}:n<26?{color:`text-secondary`}:{color:`text-accent-red`}},O=async(e,t)=>{await w(`${e.toFixed(6)}, ${t.toFixed(6)}`)},k=(e,t)=>{let n=`https://www.google.com/maps?q=${e},${t}`;window.open(n,`_blank`)},A=async e=>{await w(e),r.value=e,setTimeout(()=>{r.value=null},2e3)},j=e=>{let t=i(e);return{bars:t.bars,color:t.color}},M=()=>f.isCompactView?`py-2 px-2`:`py-4 px-3`,N=()=>{m(`toggle-view`)},ee=e=>{m(`highlight-node`,e)},te=e=>{m(`unhighlight-node`,e)},P=e=>{m(`menu-ping`,e)},F=e=>{m(`show-details`,e)},I=e=>{m(`menu-delete`,e)},L=e=>{l.value===e?u.value=u.value===`asc`?`desc`:`asc`:(l.value=e,u.value=typeof f.adverts[0]?.[e]==`number`?`desc`:`asc`)},R=v(()=>l.value?[...f.adverts].sort((e,t)=>{let n=e[l.value],r=t[l.value];if(n==null)return 1;if(r==null)return-1;let i=0;return typeof n==`string`&&typeof r==`string`?i=n.localeCompare(r):typeof n==`number`&&typeof r==`number`?i=n-r:typeof n==`boolean`&&typeof r==`boolean`&&(i=n===r?0:n?1:-1),u.value===`asc`?i:-i}):f.adverts);return(t,i)=>(a(),S(`div`,cn,[x(`div`,ln,[x(`div`,un,[x(`div`,{class:`w-3 h-3 rounded-full border border-stroke-subtle`,style:d({backgroundColor:e.color})},null,4),x(`h3`,dn,c(e.contactType),1),x(`span`,fn,[y(c(e.adverts.length)+` `,1),e.originalCount>0&&e.adverts.length<e.originalCount?(a(),S(`span`,pn,` / `+c(e.originalCount),1)):g(``,!0)])]),e.isFirstTable&&e.showViewToggle?(a(),S(`div`,mn,[x(`button`,{onClick:N,class:p([`p-2 rounded-md transition-colors`,e.isCompactView?`text-content-secondary dark:text-content-muted hover:text-primary hover:bg-primary/10`:`bg-primary/20 text-primary border border-primary/30`]),title:`Comfortable view`},[...i[10]||=[x(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[x(`rect`,{x:`3`,y:`3`,width:`18`,height:`6`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`}),x(`rect`,{x:`3`,y:`12`,width:`18`,height:`6`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],2),x(`button`,{onClick:N,class:p([`p-2 rounded-md transition-colors`,e.isCompactView?`bg-primary/20 text-primary border border-primary/30`:`text-content-secondary dark:text-content-muted hover:text-primary hover:bg-primary/10`]),title:`Compact view`},[...i[11]||=[x(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[x(`rect`,{x:`3`,y:`3`,width:`18`,height:`4`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`}),x(`rect`,{x:`3`,y:`10`,width:`18`,height:`4`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`}),x(`rect`,{x:`3`,y:`17`,width:`18`,height:`4`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],2)])):g(``,!0)]),x(`div`,hn,[x(`table`,gn,[x(`thead`,null,[x(`tr`,_n,[x(`th`,{class:p(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${M().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5`)},null,2),x(`th`,{onClick:i[0]||=e=>L(`node_name`),class:p(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${M().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[x(`div`,vn,[i[13]||=y(` Node Name `,-1),l.value===`node_name`?(a(),S(`svg`,{key:0,class:p([`w-3 h-3`,u.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[12]||=[x(`path`,{"fill-rule":`evenodd`,d:`M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z`,"clip-rule":`evenodd`},null,-1)]],2)):g(``,!0)])],2),x(`th`,{onClick:i[1]||=e=>L(`pubkey`),class:p(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${M().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[x(`div`,yn,[i[15]||=y(` Public Key `,-1),l.value===`pubkey`?(a(),S(`svg`,{key:0,class:p([`w-3 h-3`,u.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[14]||=[x(`path`,{"fill-rule":`evenodd`,d:`M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z`,"clip-rule":`evenodd`},null,-1)]],2)):g(``,!0)])],2),x(`th`,{class:p(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${M().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5`)},` Location `,2),x(`th`,{class:p(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${M().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5`)},` Distance `,2),x(`th`,{onClick:i[2]||=e=>L(`route_type`),class:p(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${M().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[x(`div`,bn,[i[17]||=y(` Route Type `,-1),l.value===`route_type`?(a(),S(`svg`,{key:0,class:p([`w-3 h-3`,u.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[16]||=[x(`path`,{"fill-rule":`evenodd`,d:`M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z`,"clip-rule":`evenodd`},null,-1)]],2)):g(``,!0)])],2),x(`th`,{onClick:i[3]||=e=>L(`zero_hop`),class:p(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${M().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[x(`div`,xn,[i[19]||=y(` Zero Hop `,-1),l.value===`zero_hop`?(a(),S(`svg`,{key:0,class:p([`w-3 h-3`,u.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[18]||=[x(`path`,{"fill-rule":`evenodd`,d:`M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z`,"clip-rule":`evenodd`},null,-1)]],2)):g(``,!0)])],2),x(`th`,{onClick:i[4]||=e=>L(`rssi`),class:p(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${M().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[x(`div`,Sn,[i[21]||=y(` RSSI `,-1),l.value===`rssi`?(a(),S(`svg`,{key:0,class:p([`w-3 h-3`,u.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[20]||=[x(`path`,{"fill-rule":`evenodd`,d:`M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z`,"clip-rule":`evenodd`},null,-1)]],2)):g(``,!0)])],2),x(`th`,{onClick:i[5]||=e=>L(`snr`),class:p(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${M().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[x(`div`,Cn,[i[23]||=y(` SNR `,-1),l.value===`snr`?(a(),S(`svg`,{key:0,class:p([`w-3 h-3`,u.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[22]||=[x(`path`,{"fill-rule":`evenodd`,d:`M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z`,"clip-rule":`evenodd`},null,-1)]],2)):g(``,!0)])],2),x(`th`,{onClick:i[6]||=e=>L(`last_seen`),class:p(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${M().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[x(`div`,wn,[i[25]||=y(` Last Seen `,-1),l.value===`last_seen`?(a(),S(`svg`,{key:0,class:p([`w-3 h-3`,u.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[24]||=[x(`path`,{"fill-rule":`evenodd`,d:`M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z`,"clip-rule":`evenodd`},null,-1)]],2)):g(``,!0)])],2),x(`th`,{onClick:i[7]||=e=>L(`first_seen`),class:p(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${M().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[x(`div`,Tn,[i[27]||=y(` First Seen `,-1),l.value===`first_seen`?(a(),S(`svg`,{key:0,class:p([`w-3 h-3`,u.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[26]||=[x(`path`,{"fill-rule":`evenodd`,d:`M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z`,"clip-rule":`evenodd`},null,-1)]],2)):g(``,!0)])],2),x(`th`,{onClick:i[8]||=e=>L(`advert_count`),class:p(`text-left text-content-secondary dark:text-content-muted text-xs font-medium py-3 ${M().split(` `)[1]} border-b border-stroke-subtle dark:border-white/5 cursor-pointer hover:text-primary transition-colors select-none`)},[x(`div`,En,[i[29]||=y(` Advert Count `,-1),l.value===`advert_count`?(a(),S(`svg`,{key:0,class:p([`w-3 h-3`,u.value===`asc`?``:`rotate-180`]),fill:`currentColor`,viewBox:`0 0 20 20`},[...i[28]||=[x(`path`,{"fill-rule":`evenodd`,d:`M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z`,"clip-rule":`evenodd`},null,-1)]],2)):g(``,!0)])],2)])]),x(`tbody`,Dn,[(a(!0),S(b,null,n(R.value,e=>(a(),S(`tr`,{key:e.id,class:`hover:bg-background-mute/50 dark:hover:bg-white/5 transition-colors cursor-pointer`,onMouseenter:t=>ee(e.pubkey),onMouseleave:t=>te(e.pubkey),onClick:t=>F(e)},[x(`td`,{class:p(M()),onClick:i[9]||=E(()=>{},[`stop`])},[_(sn,{neighbor:e,onPing:P,onShowDetails:F,onDelete:I},null,8,[`neighbor`])],2),x(`td`,{class:p(`${M()} text-content-primary dark:text-content-primary text-sm`)},c(e.node_name||`Unknown`),3),x(`td`,{class:p(`${M()} text-content-primary dark:text-content-primary text-sm font-mono`)},[x(`button`,{onClick:E(t=>A(e.pubkey),[`stop`]),class:p([`text-content-primary dark:text-content-primary hover:text-primary transition-colors cursor-pointer underline underline-offset-2 decoration-stroke-hover hover:decoration-primary/60`,r.value===e.pubkey?`text-primary decoration-primary/60`:``]),title:r.value===e.pubkey?`Copied!`:`Click to copy full public key`},[y(c(s(V)(e.pubkey))+` `,1),r.value===e.pubkey?(a(),S(`span`,An,``)):g(``,!0)],10,kn)],2),x(`td`,{class:p(`${M()} text-content-primary dark:text-content-primary text-sm`)},[e.latitude!==null&&e.longitude!==null?(a(),S(`div`,jn,[x(`span`,Mn,c(e.latitude.toFixed(4))+`, `+c(e.longitude.toFixed(4)),1),x(`div`,Nn,[x(`button`,{onClick:E(t=>O(e.latitude,e.longitude),[`stop`]),class:`text-content-muted dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors cursor-pointer`,title:`Copy coordinates to clipboard`},[...i[30]||=[x(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[x(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`,stroke:`currentColor`,"stroke-width":`2`}),x(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],8,Pn),x(`button`,{onClick:E(t=>k(e.latitude,e.longitude),[`stop`]),class:`text-content-muted hover:text-primary transition-colors cursor-pointer`,title:`Open in Google Maps`},[...i[31]||=[x(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[x(`path`,{d:`M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z`,stroke:`currentColor`,"stroke-width":`2`}),x(`circle`,{cx:`12`,cy:`10`,r:`3`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],8,Fn)])])):(a(),S(`span`,In,`Unknown`))],2),x(`td`,{class:p(`${M()} text-content-primary dark:text-content-primary text-sm`)},c(C(e)),3),x(`td`,{class:p(`${M()} text-content-primary dark:text-content-primary text-sm`)},[x(`span`,{class:p([`inline-block px-2 py-1 rounded-full text-xs border transition-colors`,s(G)(e.route_type).bgColor,s(G)(e.route_type).borderColor,s(G)(e.route_type).textColor])},c(s(G)(e.route_type).text),3)],2),x(`td`,{class:p(`${M()} text-content-primary dark:text-content-primary text-sm`)},[x(`span`,{class:p([`inline-block px-2 py-1 rounded-full text-xs border transition-colors`,e.zero_hop?`bg-primary/20 border-primary/50 text-primary`:`bg-secondary/20 border-secondary/50 text-secondary`])},c(e.zero_hop?`Zero Hop`:`Multi-Hop`),3)],2),x(`td`,{class:p(`${M()} text-content-primary dark:text-content-primary text-sm`)},[x(`div`,Ln,[_(q,{bars:j(e.rssi).bars,color:j(e.rssi).color},null,8,[`bars`,`color`]),x(`span`,{class:p(j(e.rssi).color)},c(s(B)(e.rssi)),3)])],2),x(`td`,{class:p(`${M()} text-content-primary dark:text-content-primary text-sm`)},c(s(W)(e.snr)),3),x(`td`,{class:p(`${M()} text-content-primary dark:text-content-primary text-sm`)},[x(`div`,Rn,[x(`div`,{class:p([`w-2 h-2 rounded-full`,D(e.last_seen).color===`text-primary`?`bg-primary`:``,D(e.last_seen).color===`text-secondary`?`bg-secondary`:``,D(e.last_seen).color===`text-accent-red`?`bg-accent-red`:``])},null,2),x(`span`,{class:p([D(e.last_seen).color,`cursor-help`]),title:s(H)(e.last_seen)},c(T(e.last_seen)),11,zn)])],2),x(`td`,{class:p(`${M()} text-content-primary dark:text-content-primary text-sm`)},[x(`span`,{title:s(H)(e.first_seen),class:`cursor-help`},c(T(e.first_seen)),9,Bn)],2),x(`td`,{class:p(`${M()} text-content-primary dark:text-content-primary text-sm text-center`)},c(e.advert_count),3)],40,On))),128))])])]),x(`div`,Vn,[(a(!0),S(b,null,n(R.value,e=>(a(),S(`div`,{key:e.id,class:`bg-surface/50 dark:bg-transparent border border-stroke-subtle rounded-lg p-4 hover:bg-background-mute/50 dark:hover:bg-stroke/10 transition-colors`,onClick:t=>ee(e.pubkey)},[x(`div`,Un,[x(`div`,Wn,[x(`h4`,Gn,c(e.node_name||`Unknown Node`),1),x(`div`,Kn,[x(`span`,{class:p([`inline-block px-2 py-1 rounded-full text-xs border`,s(G)(e.route_type).bgColor,s(G)(e.route_type).borderColor,s(G)(e.route_type).textColor])},c(s(G)(e.route_type).text),3),x(`span`,{class:p([`inline-block px-2 py-1 rounded-full text-xs border`,e.zero_hop?`bg-primary/20 border-primary/50 text-primary`:`bg-secondary/20 border-secondary/50 text-secondary`])},c(e.zero_hop?`Zero Hop`:`Multi-Hop`),3)])]),_(sn,{neighbor:e,onPing:P,onShowDetails:F,onDelete:I},null,8,[`neighbor`])]),x(`div`,qn,[x(`div`,Jn,[x(`div`,null,[i[32]||=x(`div`,{class:`text-content-muted text-xs mb-1`},`Public Key`,-1),x(`button`,{onClick:t=>A(e.pubkey),class:p([`text-content-primary dark:text-content-primary hover:text-primary transition-colors cursor-pointer font-mono text-sm underline underline-offset-2 decoration-stroke-hover hover:decoration-primary/60 break-all`,r.value===e.pubkey?`text-primary decoration-primary/60`:``]),title:r.value===e.pubkey?`Copied!`:`Click to copy full public key`},[y(c(s(V)(e.pubkey))+` `,1),r.value===e.pubkey?(a(),S(`span`,Xn,``)):g(``,!0)],10,Yn)]),x(`div`,null,[i[33]||=x(`div`,{class:`text-content-muted text-xs mb-1`},`Signal`,-1),x(`div`,Zn,[_(q,{bars:j(e.rssi).bars,color:j(e.rssi).color,size:`md`},null,8,[`bars`,`color`]),x(`span`,{class:p(`${j(e.rssi).color} text-sm font-medium`)},c(s(B)(e.rssi)),3)])])]),x(`div`,Qn,[x(`div`,null,[i[34]||=x(`div`,{class:`text-content-muted text-xs mb-1`},`Last Seen`,-1),x(`div`,$n,[x(`div`,{class:p([`w-2 h-2 rounded-full`,D(e.last_seen).color===`text-primary`?`bg-primary`:``,D(e.last_seen).color===`text-secondary`?`bg-secondary`:``,D(e.last_seen).color===`text-accent-red`?`bg-accent-red`:``])},null,2),x(`span`,{class:p(`${D(e.last_seen).color} text-sm`),title:s(H)(e.last_seen)},c(T(e.last_seen)),11,er)])]),x(`div`,null,[i[35]||=x(`div`,{class:`text-content-muted text-xs mb-1`},`Distance`,-1),x(`span`,tr,c(C(e)),1)])]),e.latitude!==null&&e.longitude!==null?(a(),S(`div`,nr,[i[38]||=x(`div`,{class:`text-content-muted text-xs mb-1`},`Location`,-1),x(`div`,rr,[x(`span`,ir,c(e.latitude.toFixed(4))+`, `+c(e.longitude.toFixed(4)),1),x(`div`,ar,[x(`button`,{onClick:t=>O(e.latitude,e.longitude),class:`text-content-muted dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors p-2 hover:bg-stroke-subtle dark:hover:bg-white/10 rounded-lg`,title:`Copy coordinates`},[...i[36]||=[x(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[x(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`,stroke:`currentColor`,"stroke-width":`2`}),x(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],8,or),x(`button`,{onClick:t=>k(e.latitude,e.longitude),class:`text-content-muted hover:text-primary transition-colors p-2 hover:bg-stroke/10 rounded-lg`,title:`Open in Maps`},[...i[37]||=[x(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[x(`path`,{d:`M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z`,stroke:`currentColor`,"stroke-width":`2`}),x(`circle`,{cx:`12`,cy:`10`,r:`3`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],8,sr)])])])):g(``,!0),x(`div`,cr,[x(`div`,lr,[i[39]||=x(`div`,{class:`text-content-muted text-xs mb-1`},`SNR`,-1),x(`span`,ur,c(s(W)(e.snr)),1)]),x(`div`,dr,[i[40]||=x(`div`,{class:`text-content-muted text-xs mb-1`},`Adverts`,-1),x(`span`,fr,c(e.advert_count),1)]),x(`div`,pr,[i[41]||=x(`div`,{class:`text-content-muted text-xs mb-1`},`First Seen`,-1),x(`span`,{class:`text-content-primary dark:text-content-primary text-sm`,title:s(H)(e.first_seen)},c(T(e.first_seen)),9,mr)])])])],8,Hn))),128))])]))}}),gr={class:`space-y-6`},_r={key:0,class:`flex items-center justify-center py-12`},vr={class:`text-center`},yr={key:1,class:`bg-red-50 dark:bg-accent-red/10 border border-red-300 dark:border-accent-red/20 rounded-[15px] p-6`},br={class:`flex items-center gap-3`},xr={class:`text-red-500 dark:text-accent-red/80 text-sm`},Sr={key:0,class:``},Cr={class:`flex items-center justify-between`},wr={class:`flex items-center gap-3`},Tr={class:`hidden lg:flex bg-background-mute dark:bg-surface-elevated/30 backdrop-blur rounded-lg border border-stroke-subtle dark:border-stroke/10 mb p-1`},Er={class:`flex items-center gap-2`},Dr=[`value`,`disabled`],Or=[`value`],kr={class:`flex items-center gap-2`},Ar={key:0,class:`ml-1 bg-accent-cyan/20 text-accent-cyan border border-accent-cyan/30 text-xs px-1.5 py-0.5 rounded-full font-medium`},jr={class:`bg-background dark:bg-background/30 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4 mt-4 space-y-4`},Mr={class:`grid grid-cols-1 md:grid-cols-3 gap-4`},Nr={key:1,class:`text-center py-12`},Pr={key:2,class:`text-center py-12`},Fr=f({name:`NeighborsView`,__name:`Neighbors`,setup(e){let r=j(),s=N(),l=ee(),d=M,f={0:`var(--color-text-muted)`,1:`var(--color-primary)`,2:`var(--color-accent-green)`,3:`var(--color-secondary)`,4:`var(--color-accent-cyan)`},m=v(()=>s.advertsByType),C=v(()=>s.isLoading),w=o(null),E=o(s.currentHours),k=[{label:`2 Days`,value:48},{label:`7 Days`,value:168},{label:`14 Days`,value:336},{label:`30 Days`,value:720}],F=async e=>{E.value=e,await s.fetchAll(e)},L=o(I(`neighbors_compactView`,!1)),R=o(I(`neighbors_showMapLegend`,typeof window<`u`?window.innerWidth>=1024:!0)),z=o(I(`neighbors_showAllMapContacts`,!1)),B=o(I(`neighbors_showFilters`,!1)),V=o(I(`neighbors_filters`,{zeroHop:`true`,routeType:`all`,searchText:``}));h(L,e=>P(`neighbors_compactView`,e)),h(R,e=>P(`neighbors_showMapLegend`,e)),h(z,e=>P(`neighbors_showAllMapContacts`,e)),h(B,e=>P(`neighbors_showFilters`,e)),h(V,e=>P(`neighbors_filters`,e),{deep:!0});let H=o(!1),U=o(!1),ne=o(!1),W=o(null),G=o(null),K=o(null),q=o(null),re=o(!1),ie=o(null),ae=v(()=>{if(!q.value)return null;let e=q.value;return{id:e.id,pubkey:e.pubkey,node_name:e.node_name,contact_type:e.contact_type,latitude:e.latitude,longitude:e.longitude,rssi:e.rssi,snr:e.snr,route_type:e.route_type,last_seen:e.last_seen,first_seen:e.first_seen,advert_count:e.advert_count,timestamp:e.timestamp,is_repeater:e.is_repeater,is_new_neighbor:e.is_new_neighbor,zero_hop:e.zero_hop}}),oe=v(()=>r.stats?.config?.repeater?.latitude),se=v(()=>r.stats?.config?.repeater?.longitude),ce=v(()=>r.stats===null&&r.isLoading),le=e=>e.filter(e=>{if(V.value.zeroHop!==`all`){let t=e.zero_hop;if(V.value.zeroHop===`true`&&!t||V.value.zeroHop===`false`&&t)return!1}if(V.value.routeType!==`all`){let t=e.route_type;if(V.value.routeType===`direct`&&t!==2||V.value.routeType===`transport_direct`&&t!==3||V.value.routeType===`flood`&&t!==1||V.value.routeType===`transport_flood`&&t!==0)return!1}if(V.value.searchText){let t=V.value.searchText.toLowerCase(),n=e.node_name?.toLowerCase()||``,r=e.pubkey.toLowerCase();if(!n.includes(t)&&!r.includes(t))return!1}return!0}),ue=()=>{V.value={zeroHop:`all`,routeType:`all`,searchText:``}},J=v(()=>V.value.zeroHop!==`all`||V.value.routeType!==`all`||V.value.searchText!==``),fe=v(()=>{let e={};for(let[t,n]of Object.entries(m.value))e[t]=le(n);return e}),pe=v(()=>Object.entries(d).filter(([e])=>fe.value[e]?.length>0).sort(([e],[t])=>parseInt(e)-parseInt(t))),me=v(()=>Object.values(m.value).flat().filter(e=>{let t=e.latitude,n=e.longitude;return t!=null&&t!==0&&n!=null&&n!==0&&typeof t==`number`&&typeof n==`number`&&!isNaN(t)&&!isNaN(n)&&(z.value||e.zero_hop===!0)})),he=()=>s.fetchAll(E.value),ge=o(),_e=e=>{ge.value?.highlightNode(e)},ve=e=>{ge.value?.unhighlightNode(e)},ye=async e=>{let t=e;W.value=null,G.value=null,ne.value=!0,K.value=t.node_name||`Unknown Node`,U.value=!0;try{let e=r.stats?.config?.mesh?.path_hash_mode??0,n=(e===2?3:e===1?2:1)*2,i=`0x${parseInt(t.pubkey.substring(0,n),16).toString(16).padStart(n,`0`)}`,a=await A.pingNeighbor(i,10);a.success&&a.data?W.value=a.data:(G.value=a.error||`Unknown error occurred`,console.error(`Failed to ping neighbor:`,a.error))}catch(e){console.error(`Error pinging neighbor:`,e),G.value=e instanceof Error?e.message:`Unknown error occurred`}finally{ne.value=!1}},be=()=>{U.value=!1,W.value=null,G.value=null,K.value=null},xe=e=>{q.value=e,H.value=!0},Se=e=>{ie.value=e,re.value=!0},Ce=()=>{re.value=!1,ie.value=null},we=()=>{H.value=!1,q.value=null},Te=async e=>{try{await A.deleteAdvert(e),await s.fetchAll(E.value),we()}catch(e){console.error(`Error deleting neighbor:`,e)}};return t(()=>{l.ensure(`neighbors`),l.ensure(`radioConfig`)}),(e,t)=>(a(),S(`div`,gr,[C.value?(a(),S(`div`,_r,[x(`div`,vr,[_(te,{size:`lg`,class:`mx-auto mb-4`}),t[9]||=x(`p`,{class:`text-content-secondary dark:text-content-muted`},`Loading neighbor data...`,-1)])])):w.value?(a(),S(`div`,yr,[x(`div`,br,[t[11]||=x(`svg`,{class:`w-5 h-5 text-red-600 dark:text-accent-red`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z`})],-1),x(`div`,null,[t[10]||=x(`h3`,{class:`text-red-600 dark:text-accent-red font-medium`},`Error Loading Neighbors`,-1),x(`p`,xr,c(w.value),1)])])])):(a(),S(b,{key:2},[_(an,{ref_key:`networkMapRef`,ref:ge,adverts:me.value,"base-latitude":oe.value,"base-longitude":se.value,"stats-loading":ce.value,"show-legend":R.value,"onUpdate:showLegend":t[0]||=e=>R.value=e},null,8,[`adverts`,`base-latitude`,`base-longitude`,`stats-loading`,`show-legend`]),Object.keys(m.value).length>0?(a(),S(`div`,Sr,[x(`div`,Cr,[t[16]||=x(`span`,{class:`text-content-primary dark:text-content-primary text-lg font-semibold`},null,-1),x(`div`,wr,[x(`div`,Tr,[x(`button`,{onClick:t[1]||=e=>L.value=!1,class:p([`p-2 rounded-md transition-colors`,L.value?`text-content-secondary dark:text-content-muted hover:text-primary hover:bg-primary/10`:`bg-primary/20 text-primary border border-primary/30`]),title:`Comfortable view`},[...t[12]||=[x(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[x(`rect`,{x:`3`,y:`3`,width:`18`,height:`6`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`}),x(`rect`,{x:`3`,y:`12`,width:`18`,height:`6`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],2),x(`button`,{onClick:t[2]||=e=>L.value=!0,class:p([`p-2 rounded-md transition-colors`,L.value?`bg-primary/20 text-primary border border-primary/30`:`text-content-secondary dark:text-content-muted hover:text-primary hover:bg-primary/10`]),title:`Compact view`},[...t[13]||=[x(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`},[x(`rect`,{x:`3`,y:`3`,width:`18`,height:`4`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`}),x(`rect`,{x:`3`,y:`10`,width:`18`,height:`4`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`}),x(`rect`,{x:`3`,y:`17`,width:`18`,height:`4`,rx:`2`,stroke:`currentColor`,"stroke-width":`2`})],-1)]],2)]),x(`div`,Er,[x(`select`,{value:E.value,onChange:t[3]||=e=>F(+e.target.value),disabled:C.value,class:`text-xs px-2 py-1.5 rounded-lg bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary border border-stroke-subtle dark:border-stroke/20 focus:outline-none focus:border-primary/50 disabled:opacity-50`},[(a(),S(b,null,n(k,e=>x(`option`,{key:e.value,value:e.value},c(e.label),9,Or)),64))],40,Dr)]),x(`div`,kr,[x(`button`,{onClick:t[4]||=e=>z.value=!z.value,class:p([`px-3 py-1.5 text-xs rounded-lg transition-colors border`,z.value?`bg-primary/20 text-primary border-primary/30`:`bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary border-stroke-subtle dark:border-stroke/20 hover:bg-stroke-subtle dark:hover:bg-white/20`])},` Map: `+c(z.value?`All Contacts`:`Zero Hop`),3),x(`button`,{onClick:t[5]||=e=>B.value=!B.value,class:p([`px-3 py-1.5 text-xs rounded-lg transition-colors border`,J.value?`bg-primary/20 text-primary border-primary/30`:`bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary border-stroke-subtle dark:border-stroke/20 hover:bg-stroke-subtle dark:hover:bg-white/20`])},[t[14]||=x(`svg`,{class:`w-4 h-4 inline mr-1`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[x(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707v6.586a1 1 0 01-1.447.894l-4-2A1 1 0 717 18.586V13.414a1 1 0 00-.293-.707L.293 6.293A1 1 0 010 5.586V3a1 1 0 011-1z`})],-1),t[15]||=y(` Filters `,-1),J.value?(a(),S(`span`,Ar,` Active `)):g(``,!0)],2),J.value?(a(),S(`button`,{key:0,onClick:ue,class:`px-3 py-1.5 text-xs rounded-lg bg-background-mute dark:bg-white/10 text-content-secondary dark:text-content-primary border border-stroke-subtle dark:border-stroke/20 hover:bg-stroke-subtle dark:hover:bg-white/20 transition-colors`},` Clear Filters `)):g(``,!0)])])]),i(x(`div`,jr,[x(`div`,Mr,[x(`div`,null,[t[18]||=x(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},`Zero Hop`,-1),i(x(`select`,{"onUpdate:modelValue":t[6]||=e=>V.value.zeroHop=e,class:`w-full bg-surface dark:bg-surface/50 border border-stroke-subtle dark:border-stroke/20 rounded-lg px-3 py-2 text-content-primary dark:text-content-primary text-sm focus:border-primary/50 focus:outline-none`},[...t[17]||=[x(`option`,{value:`all`},`All Nodes`,-1),x(`option`,{value:`true`},`Zero Hop Only`,-1),x(`option`,{value:`false`},`Multi-Hop Only`,-1)]],512),[[T,V.value.zeroHop]])]),x(`div`,null,[t[20]||=x(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},`Route Type`,-1),i(x(`select`,{"onUpdate:modelValue":t[7]||=e=>V.value.routeType=e,class:`w-full bg-surface dark:bg-surface/50 border border-stroke-subtle dark:border-stroke/20 rounded-lg px-3 py-2 text-content-primary dark:text-content-primary text-sm focus:border-primary/50 focus:outline-none`},[...t[19]||=[u(`<option value="all">All Types</option><option value="direct">Direct</option><option value="transport_direct">Transport Direct</option><option value="flood">Flood</option><option value="transport_flood">Transport Flood</option>`,5)]],512),[[T,V.value.routeType]])]),x(`div`,null,[t[21]||=x(`label`,{class:`block text-xs font-medium text-content-secondary dark:text-content-muted mb-1`},`Search`,-1),i(x(`input`,{"onUpdate:modelValue":t[8]||=e=>V.value.searchText=e,type:`text`,placeholder:`Node name or pubkey...`,class:`w-full bg-surface dark:bg-surface/50 border border-stroke-subtle dark:border-stroke/20 rounded-lg px-3 py-2 text-content-primary dark:text-content-primary text-sm focus:border-primary/50 focus:outline-none placeholder-gray-400 dark:placeholder-white/40`},null,512),[[D,V.value.searchText]])])])],512),[[O,B.value]])])):g(``,!0),(a(!0),S(b,null,n(pe.value,([e,t])=>(a(),S(`div`,{key:e,class:`space-y-6`},[_(hr,{"contact-type":t,"contact-type-key":e,adverts:fe.value[e],"original-count":m.value[e]?.length||0,color:f[parseInt(e)],"base-latitude":oe.value,"base-longitude":se.value,"is-compact-view":L.value,"is-first-table":!1,"show-view-toggle":!1,onHighlightNode:_e,onUnhighlightNode:ve,onMenuPing:ye,onMenuDelete:xe,onShowDetails:Se},null,8,[`contact-type`,`contact-type-key`,`adverts`,`original-count`,`color`,`base-latitude`,`base-longitude`,`is-compact-view`])]))),128)),pe.value.length===0&&Object.keys(m.value).length===0?(a(),S(`div`,Nr,[t[22]||=u(`<div class="text-content-secondary dark:text-content-muted mb-4"><svg class="w-16 h-16 mx-auto mb-4 opacity-50" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg></div><h3 class="text-content-primary dark:text-content-primary text-lg font-medium mb-2"> No Neighbors Found </h3><p class="text-content-secondary dark:text-content-muted"> No mesh neighbors have been discovered in your area yet. </p>`,3),x(`button`,{onClick:he,class:`mt-4 px-4 py-2 bg-primary/20 text-primary border border-primary/30 rounded-lg hover:bg-primary/30 transition-colors`},` Refresh `)])):pe.value.length===0&&J.value?(a(),S(`div`,Pr,[t[23]||=u(`<div class="text-content-secondary dark:text-content-muted mb-4"><svg class="w-16 h-16 mx-auto mb-4 opacity-50" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg></div><h3 class="text-content-primary dark:text-content-primary text-lg font-medium mb-2"> No neighbors match your filters </h3><p class="text-content-secondary dark:text-content-muted mb-4"> Try adjusting your filter criteria to see more results. </p>`,3),x(`button`,{onClick:ue,class:`px-4 py-2 bg-primary/20 text-primary border border-primary/30 rounded-lg hover:bg-primary/30 transition-colors`},` Clear Filters `)])):g(``,!0)],64)),_(de,{show:H.value,neighbor:ae.value,onClose:we,onDelete:Te},null,8,[`show`,`neighbor`]),_(We,{show:U.value,"node-name":K.value,result:W.value,error:G.value,loading:ne.value,onClose:be},null,8,[`show`,`node-name`,`result`,`error`,`loading`]),_(At,{"is-open":re.value,neighbor:ie.value,"base-latitude":oe.value,"base-longitude":se.value,onClose:Ce},null,8,[`is-open`,`neighbor`,`base-latitude`,`base-longitude`])]))}});export{Fr as default};