diff --git a/frontend/dist/VERSION b/frontend/dist/VERSION index 71c5d8c8..72a8bb4c 100644 --- a/frontend/dist/VERSION +++ b/frontend/dist/VERSION @@ -1 +1 @@ -0.9.301 +0.9.302 diff --git a/frontend/dist/assets/AnalyzerFilterPanel-DoQoJv94.js b/frontend/dist/assets/AnalyzerFilterPanel-BWsROE43.js similarity index 98% rename from frontend/dist/assets/AnalyzerFilterPanel-DoQoJv94.js rename to frontend/dist/assets/AnalyzerFilterPanel-BWsROE43.js index c4418070..903ff320 100644 --- a/frontend/dist/assets/AnalyzerFilterPanel-DoQoJv94.js +++ b/frontend/dist/assets/AnalyzerFilterPanel-BWsROE43.js @@ -1,4 +1,4 @@ -import{d as U,a6 as J,R as q,bY as G,r as d,j as n,bk as K,B as Y}from"./index-CeMilrX4.js";import{c as Q}from"./node-types-C09ZlzBQ.js";import{M as V}from"./monitor-smartphone-DxkmIgui.js";import{C as Z}from"./circle-question-mark-Bqc_DPUo.js";import{F as W}from"./funnel-D2SUJQ8o.js";import{S as ee}from"./search-Bph9xP9G.js";/** +import{d as U,a6 as J,R as q,bY as G,r as d,j as n,bk as K,B as Y}from"./index-BOwCLZTK.js";import{c as Q}from"./node-types-C6okL8rE.js";import{M as V}from"./monitor-smartphone-Dd11JEL9.js";import{C as Z}from"./circle-question-mark-XDnZ1ChV.js";import{F as W}from"./funnel-CWx99rlN.js";import{S as ee}from"./search-Ba9CRHru.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/BasemapLayer-CNBmoufo.js b/frontend/dist/assets/BasemapLayer-B-5TmAfZ.js similarity index 99% rename from frontend/dist/assets/BasemapLayer-CNBmoufo.js rename to frontend/dist/assets/BasemapLayer-B-5TmAfZ.js index 15b8bf0f..37ff0b9d 100644 --- a/frontend/dist/assets/BasemapLayer-CNBmoufo.js +++ b/frontend/dist/assets/BasemapLayer-B-5TmAfZ.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CeMilrX4.js","assets/index-CLjIU9sF.css"])))=>i.map(i=>d[i]); -import{r as i,_ as $,aK as B,e as K}from"./index-CeMilrX4.js";const H=i.createContext(null);function G(){var s;const e=(s=i.useContext(H))==null?void 0:s.maps,t=i.useContext(w);return i.useMemo(()=>({...e,current:t==null?void 0:t.map}),[e,t])}function Y(e,t){const n=Array.isArray(e)?e[0]:e?e.x:0,s=Array.isArray(e)?e[1]:e?e.y:0,o=Array.isArray(t)?t[0]:t?t.x:0,r=Array.isArray(t)?t[1]:t?t.y:0;return n===o&&s===r}function v(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n{let o=null;"interactive"in s&&(o=Object.assign({},s),delete o.interactive);const r=t[s.ref];if(r){o=o||Object.assign({},s),delete o.ref;for(const a of J)a in r&&(o[a]=r[a])}return o||s});return{...e,layers:n}}const A={version:8,sources:{},layers:[]},U={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},F={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},N={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},X=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],Q=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class b{constructor(t,n,s){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=o=>{const r=this.props[N[o.type]];r?r(o):o.type==="error"&&console.error(o.error)},this._onCameraEvent=o=>{if(this._internalUpdate)return;o.viewState=this._propsedCameraUpdate||P(this._map.transform);const r=this.props[F[o.type]];r&&r(o)},this._onCameraUpdate=o=>this._internalUpdate?o:(this._propsedCameraUpdate=P(o),z(o,this.props)),this._onPointerEvent=o=>{(o.type==="mousemove"||o.type==="mouseout")&&this._updateHover(o);const r=this.props[U[o.type]];r&&(this.props.interactiveLayerIds&&o.type!=="mouseover"&&o.type!=="mouseout"&&(o.features=this._hoveredFeatures||this._queryRenderedFeatures(o.point)),r(o),delete o.features)},this._MapClass=t,this.props=n,this._initialize(s)}get map(){return this._map}setProps(t){const n=this.props;this.props=t;const s=this._updateSettings(t,n),o=this._updateSize(t),r=this._updateViewState(t);this._updateStyle(t,n),this._updateStyleComponents(t),this._updateHandlers(t,n),(s||o||r&&!this._map.isMoving())&&this.redraw()}static reuse(t,n){const s=b.savedMaps.pop();if(!s)return null;const o=s.map,r=o.getContainer();for(n.className=r.className;r.childNodes.length>0;)n.appendChild(r.childNodes[0]);o._container=n;const a=o._resizeObserver;a&&(a.disconnect(),a.observe(n)),s.setProps({...t,styleDiffing:!1}),o.resize();const{initialViewState:c}=t;return c&&(c.bounds?o.fitBounds(c.bounds,{...c.fitBoundsOptions,duration:0}):s._updateViewState(c)),o.isStyleLoaded()?o.fire("load"):o.once("style.load",()=>o.fire("load")),o._update(),s}_initialize(t){const{props:n}=this,{mapStyle:s=A}=n,o={...n,...n.initialViewState,container:t,style:O(s)},r=o.initialViewState||o.viewState||o;if(Object.assign(o,{center:[r.longitude||0,r.latitude||0],zoom:r.zoom||0,pitch:r.pitch||0,bearing:r.bearing||0}),n.gl){const c=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=c,n.gl)}const a=new this._MapClass(o);r.padding&&a.setPadding(r.padding),n.cursor&&(a.getCanvas().style.cursor=n.cursor),a.transformCameraUpdate=this._onCameraUpdate,a.on("style.load",()=>{var c;this._styleComponents={light:a.getLight(),sky:a.getSky(),projection:(c=a.getProjection)==null?void 0:c.call(a),terrain:a.getTerrain()},this._updateStyleComponents(this.props)}),a.on("sourcedata",()=>{this._updateStyleComponents(this.props)});for(const c in U)a.on(c,this._onPointerEvent);for(const c in F)a.on(c,this._onCameraEvent);for(const c in N)a.on(c,this._onEvent);this._map=a}recycle(){const n=this.map.getContainer().querySelector("[mapboxgl-children]");n==null||n.remove(),b.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_updateSize(t){const{viewState:n}=t;if(n){const s=this._map;if(n.width!==s.transform.width||n.height!==s.transform.height)return s.resize(),!0}return!1}_updateViewState(t){const n=this._map,s=n.transform;if(!n.isMoving()){const r=z(s,t);if(Object.keys(r).length>0)return this._internalUpdate=!0,n.jumpTo(r),this._internalUpdate=!1,!0}return!1}_updateSettings(t,n){const s=this._map;let o=!1;for(const r of X)if(r in t&&!v(t[r],n[r])){o=!0;const a=s[`set${r[0].toUpperCase()}${r.slice(1)}`];a==null||a.call(s,t[r])}return o}_updateStyle(t,n){if(t.cursor!==n.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==n.mapStyle){const{mapStyle:s=A,styleDiffing:o=!0}=t,r={diff:o};"localIdeographFontFamily"in t&&(r.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(O(s),r)}}_updateStyleComponents({light:t,projection:n,sky:s,terrain:o}){var c,u;const r=this._map,a=this._styleComponents;r.style._loaded&&(t&&!v(t,a.light)&&(a.light=t,r.setLight(t)),n&&!v(n,a.projection)&&n!==((c=a.projection)==null?void 0:c.type)&&(a.projection=typeof n=="string"?{type:n}:n,(u=r.setProjection)==null||u.call(r,a.projection)),s&&!v(s,a.sky)&&(a.sky=s,r.setSky(s)),o!==void 0&&!v(o,a.terrain)&&(!o||r.getSource(o.source))&&(a.terrain=o,r.setTerrain(o)))}_updateHandlers(t,n){const s=this._map;for(const o of Q){const r=t[o]??!0,a=n[o]??!0;v(r,a)||(r?s[o].enable(r):s[o].disable())}}_queryRenderedFeatures(t){const n=this._map,{interactiveLayerIds:s=[]}=this.props;try{return n.queryRenderedFeatures(t,{layers:s.filter(n.getLayer.bind(n))})}catch{return[]}}_updateHover(t){var o;const{props:n}=this;if(n.interactiveLayerIds&&(n.onMouseMove||n.onMouseEnter||n.onMouseLeave)){const r=t.type,a=((o=this._hoveredFeatures)==null?void 0:o.length)>0,c=this._queryRenderedFeatures(t.point),u=c.length>0;!u&&a&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=c,u&&!a&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=r}else this._hoveredFeatures=null}}b.savedMaps=[];const ee=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function te(e){if(!e)return null;const t=e.map,n={getMap:()=>t};for(const s of ne(t))!(s in n)&&!ee.includes(s)&&(n[s]=t[s].bind(t));return n}function ne(e){const t=new Set;let n=e;for(;n;){for(const s of Object.getOwnPropertyNames(n))s[0]!=="_"&&typeof e[s]=="function"&&s!=="fire"&&s!=="setEventedParent"&&t.add(s);n=Object.getPrototypeOf(n)}return Array.from(t)}const oe=typeof document<"u"?i.useLayoutEffect:i.useEffect;function re(e,t){const{RTLTextPlugin:n,maxParallelImageRequests:s,workerCount:o,workerUrl:r}=t;if(n&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"){const{pluginUrl:a,lazy:c=!0}=typeof n=="string"?{pluginUrl:n}:n;e.setRTLTextPlugin(a,u=>{u&&console.error(u)},c)}s!==void 0&&e.setMaxParallelImageRequests(s),o!==void 0&&e.setWorkerCount(o),r!==void 0&&e.setWorkerUrl(r)}const w=i.createContext(null);function se(e,t){const n=i.useContext(H),[s,o]=i.useState(null),r=i.useRef(),{current:a}=i.useRef({mapLib:null,map:null});i.useEffect(()=>{const l=e.mapLib;let d=!0,f;return Promise.resolve(l||$(()=>import("./maplibre-gl-C4iRAMmw.js").then(m=>m.m),__vite__mapDeps([0,1]))).then(m=>{if(!d)return;if(!m)throw new Error("Invalid mapLib");const y="Map"in m?m:m.default;if(!y.Map)throw new Error("Invalid mapLib");re(y,e),e.reuseMaps&&(f=b.reuse(e,r.current)),f||(f=new b(y.Map,e,r.current)),a.map=te(f),a.mapLib=y,o(f),n==null||n.onMapMount(a.map,e.id)}).catch(m=>{const{onError:y}=e;y?y({type:"error",target:null,originalEvent:null,error:m}):console.error(m)}),()=>{d=!1,f&&(n==null||n.onMapUnmount(e.id),e.reuseMaps?f.recycle():f.destroy())}},[]),oe(()=>{s&&s.setProps(e)}),i.useImperativeHandle(t,()=>a.map,[s]);const c=i.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),u={height:"100%"};return i.createElement("div",{id:e.id,ref:r,style:c},s&&i.createElement(w.Provider,{value:a},i.createElement("div",{"mapboxgl-children":"",style:u},e.children)))}const Me=i.forwardRef(se),ae=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function L(e,t){if(!e||!t)return;const n=e.style;for(const s in t){const o=t[s];Number.isFinite(o)&&!ae.test(s)?n[s]=`${o}px`:n[s]=o}}function Z(e,t){if(e===t)return null;const n=D(e),s=D(t),o=[];for(const r of s)n.has(r)||o.push(r);for(const r of n)s.has(r)||o.push(r);return o.length===0?null:o}function D(e){return new Set(e?e.trim().split(/\s+/):[])}const be=i.memo(i.forwardRef((e,t)=>{const{map:n,mapLib:s}=i.useContext(w),o=i.useRef({props:e}),r=i.useMemo(()=>{let E=!1;i.Children.forEach(e.children,h=>{h&&(E=!0)});const k={...e,element:E?document.createElement("div"):void 0},p=new s.Marker(k);return p.setLngLat([e.longitude,e.latitude]),p.getElement().addEventListener("click",h=>{var g,_;(_=(g=o.current.props).onClick)==null||_.call(g,{type:"click",target:p,originalEvent:h})}),p.on("dragstart",h=>{var _,S;const g=h;g.lngLat=r.getLngLat(),(S=(_=o.current.props).onDragStart)==null||S.call(_,g)}),p.on("drag",h=>{var _,S;const g=h;g.lngLat=r.getLngLat(),(S=(_=o.current.props).onDrag)==null||S.call(_,g)}),p.on("dragend",h=>{var _,S;const g=h;g.lngLat=r.getLngLat(),(S=(_=o.current.props).onDragEnd)==null||S.call(_,g)}),p},[]);i.useEffect(()=>(r.addTo(n.getMap()),()=>{r.remove()}),[]);const{longitude:a,latitude:c,offset:u,style:l,draggable:d=!1,popup:f=null,rotation:m=0,rotationAlignment:y="auto",pitchAlignment:C="auto"}=e;i.useEffect(()=>{L(r.getElement(),l)},[l]),i.useImperativeHandle(t,()=>r,[]);const T=o.current.props;(r.getLngLat().lng!==a||r.getLngLat().lat!==c)&&r.setLngLat([a,c]),u&&!Y(r.getOffset(),u)&&r.setOffset(u),r.isDraggable()!==d&&r.setDraggable(d),r.getRotation()!==m&&r.setRotation(m),r.getRotationAlignment()!==y&&r.setRotationAlignment(y),r.getPitchAlignment()!==C&&r.setPitchAlignment(C),r.getPopup()!==f&&r.setPopup(f);const x=Z(T.className,e.className);if(x)for(const E of x)r.toggleClassName(E);return o.current.props=e,B.createPortal(e.children,r.getElement())})),xe=i.memo(i.forwardRef((e,t)=>{const{map:n,mapLib:s}=i.useContext(w),o=i.useMemo(()=>document.createElement("div"),[]),r=i.useRef({props:e}),a=i.useMemo(()=>{const c={...e},u=new s.Popup(c);return u.setLngLat([e.longitude,e.latitude]),u.once("open",l=>{var d,f;(f=(d=r.current.props).onOpen)==null||f.call(d,l)}),u},[]);if(i.useEffect(()=>{const c=u=>{var l,d;(d=(l=r.current.props).onClose)==null||d.call(l,u)};return a.on("close",c),a.setDOMContent(o).addTo(n.getMap()),()=>{a.off("close",c),a.isOpen()&&a.remove()}},[]),i.useEffect(()=>{L(a.getElement(),e.style)},[e.style]),i.useImperativeHandle(t,()=>a,[]),a.isOpen()){const c=r.current.props;(a.getLngLat().lng!==e.longitude||a.getLngLat().lat!==e.latitude)&&a.setLngLat([e.longitude,e.latitude]),e.offset&&!v(c.offset,e.offset)&&a.setOffset(e.offset),(c.anchor!==e.anchor||c.maxWidth!==e.maxWidth)&&(a.options.anchor=e.anchor,a.setMaxWidth(e.maxWidth));const u=Z(c.className,e.className);if(u)for(const l of u)a.toggleClassName(l);r.current.props=e}return B.createPortal(e.children,o)}));function M(e,t,n,s){const o=i.useContext(w),r=i.useMemo(()=>e(o),[]);return i.useEffect(()=>{const a=t,c=null,u=typeof t=="function"?t:null,{map:l}=o;return l.hasControl(r)||(l.addControl(r,a==null?void 0:a.position),c&&c(o)),()=>{u&&u(o),l.hasControl(r)&&l.removeControl(r)}},[]),r}function ie(e){const t=M(({mapLib:n})=>new n.AttributionControl(e),{position:e.position});return i.useEffect(()=>{L(t._container,e.style)},[e.style]),null}i.memo(ie);function ce(e){const t=M(({mapLib:n})=>new n.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return i.useEffect(()=>{L(t._controlContainer,e.style)},[e.style]),null}i.memo(ce);function le(e,t){const n=i.useRef({props:e}),s=M(({mapLib:o})=>{const r=new o.GeolocateControl(e),a=r._setupUI;return r._setupUI=()=>{r._container.hasChildNodes()||a()},r.on("geolocate",c=>{var u,l;(l=(u=n.current.props).onGeolocate)==null||l.call(u,c)}),r.on("error",c=>{var u,l;(l=(u=n.current.props).onError)==null||l.call(u,c)}),r.on("outofmaxbounds",c=>{var u,l;(l=(u=n.current.props).onOutOfMaxBounds)==null||l.call(u,c)}),r.on("trackuserlocationstart",c=>{var u,l;(l=(u=n.current.props).onTrackUserLocationStart)==null||l.call(u,c)}),r.on("trackuserlocationend",c=>{var u,l;(l=(u=n.current.props).onTrackUserLocationEnd)==null||l.call(u,c)}),r},{position:e.position});return n.current.props=e,i.useImperativeHandle(t,()=>s,[]),i.useEffect(()=>{L(s._container,e.style)},[e.style]),null}i.memo(i.forwardRef(le));function ue(e){const t=M(({mapLib:n})=>new n.NavigationControl(e),{position:e.position});return i.useEffect(()=>{L(t._container,e.style)},[e.style]),null}i.memo(ue);function fe(e){const t=M(({mapLib:r})=>new r.ScaleControl(e),{position:e.position}),n=i.useRef(e),s=n.current;n.current=e;const{style:o}=e;return e.maxWidth!==void 0&&e.maxWidth!==s.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==s.unit&&t.setUnit(e.unit),i.useEffect(()=>{L(t._container,o)},[o]),null}const ke=i.memo(fe);function de(e){const t=M(({mapLib:n})=>new n.TerrainControl(e),{position:e.position});return i.useEffect(()=>{L(t._container,e.style)},[e.style]),null}i.memo(de);function me(e){const t=M(({mapLib:n})=>new n.LogoControl(e),{position:e.position});return i.useEffect(()=>{L(t._container,e.style)},[e.style]),null}i.memo(me);function R(e,t){if(!e)throw new Error(t)}let ye=0;function ge(e,t,n){if(e.style&&e.style._loaded){const s={...n};return delete s.id,delete s.children,e.addSource(t,s),e.getSource(t)}return null}function he(e,t,n){var a,c,u;R(t.id===n.id,"source id changed"),R(t.type===n.type,"source type changed");let s="",o=0;for(const l in t)l!=="children"&&l!=="id"&&!v(n[l],t[l])&&(s=l,o++);if(!o)return;const r=t.type;if(r==="geojson")e.setData(t.data);else if(r==="image")e.updateImage({url:t.url,coordinates:t.coordinates});else switch(s){case"coordinates":(a=e.setCoordinates)==null||a.call(e,t.coordinates);break;case"url":(c=e.setUrl)==null||c.call(e,t.url);break;case"tiles":(u=e.setTiles)==null||u.call(e,t.tiles);break;default:console.warn(`Unable to update prop: ${s}`)}}function Re(e){const t=i.useContext(w).map.getMap(),n=i.useRef(e),[,s]=i.useState(0),o=i.useMemo(()=>e.id||`jsx-source-${ye++}`,[]);i.useEffect(()=>{if(t){const a=()=>setTimeout(()=>s(c=>c+1),0);return t.on("styledata",a),a(),()=>{var c;if(t.off("styledata",a),t.style&&t.style._loaded&&t.getSource(o)){const u=(c=t.getStyle())==null?void 0:c.layers;if(u)for(const l of u)l.source===o&&t.removeLayer(l.id);t.removeSource(o)}}}},[t]);let r=t&&t.style&&t.getSource(o);return r?he(r,e,n.current):r=ge(t,o,e),n.current=e,r&&i.Children.map(e.children,a=>a&&i.cloneElement(a,{source:o}))||null}function pe(e,t,n,s){if(R(n.id===s.id,"layer id changed"),R(n.type===s.type,"layer type changed"),n.type==="custom"||s.type==="custom")return;const{layout:o={},paint:r={},filter:a,minzoom:c,maxzoom:u,beforeId:l}=n;if(l!==s.beforeId&&e.moveLayer(t,l),o!==s.layout){const d=s.layout||{};for(const f in o)v(o[f],d[f])||e.setLayoutProperty(t,f,o[f]);for(const f in d)o.hasOwnProperty(f)||e.setLayoutProperty(t,f,void 0)}if(r!==s.paint){const d=s.paint||{};for(const f in r)v(r[f],d[f])||e.setPaintProperty(t,f,r[f]);for(const f in d)r.hasOwnProperty(f)||e.setPaintProperty(t,f,void 0)}v(a,s.filter)||e.setFilter(t,a),(c!==s.minzoom||u!==s.maxzoom)&&e.setLayerZoomRange(t,c,u)}function ve(e,t,n){if(e.style&&e.style._loaded&&(!("source"in n)||e.getSource(n.source))){const s={...n,id:t};delete s.beforeId,e.addLayer(s,n.beforeId)}}let _e=0;function Ie(e){const t=i.useContext(w).map.getMap(),n=i.useRef(e),[,s]=i.useState(0),o=i.useMemo(()=>e.id||`jsx-layer-${_e++}`,[]);if(i.useEffect(()=>{if(t){const a=()=>s(c=>c+1);return t.on("styledata",a),a(),()=>{t.off("styledata",a),t.style&&t.style._loaded&&t.getLayer(o)&&t.removeLayer(o)}}},[t]),t&&t.style&&t.getLayer(o))try{pe(t,o,e,n.current)}catch(a){console.warn(a)}else ve(t,o,e);return n.current=e,null}const V="pymc-basemap-mode",j="dark";function Le(){if(typeof window>"u")return j;try{const e=localStorage.getItem(V);if(e==="light"||e==="dark")return e}catch{}return j}function W(e){if(!(typeof window>"u"))try{localStorage.setItem(V,e)}catch{}}const q=K(e=>({mode:Le(),toggle:()=>e(t=>{const n=t.mode==="light"?"dark":"light";return W(n),{mode:n}}),setMode:t=>{W(t),e({mode:t})}})),Te=()=>q(e=>e.mode),Pe=()=>q(e=>e.toggle),Ce={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},Se={light:"basemap-light-",dark:"basemap-dark-"},I={};async function Ee(e){if(I[e])return I[e];const n=await(await fetch(Ce[e])).json();return I[e]=n,n}function ze({mode:e}){const{current:t}=G(),[n,s]=i.useState(null),o=i.useRef({light:!1,dark:!1}),r=i.useRef({light:[],dark:[]});i.useEffect(()=>{const l=()=>{var y;const m=(y=t==null?void 0:t.getMap)==null?void 0:y.call(t);m&&!n&&s(m)};l();const d=setInterval(l,50),f=setTimeout(()=>clearInterval(d),5e3);return()=>{clearInterval(d),clearTimeout(f)}},[t,n]);const a=i.useCallback(async(l,d,f)=>{var E,k;if(o.current[d])return;const m=Se[d],y=await Ee(d),C=[];for(const[p,h]of Object.entries(y.sources||{})){const g=m+p;l.getSource(g)||l.addSource(g,h)}const x=(k=(((E=l.getStyle())==null?void 0:E.layers)||[]).find(p=>!p.id.startsWith("basemap-light-")&&!p.id.startsWith("basemap-dark-")))==null?void 0:k.id;for(const p of y.layers||[]){const h=m+p.id;if(C.push(h),l.getLayer(h))continue;const g={...p,id:h};"source"in g&&typeof g.source=="string"&&(g.source=m+g.source),g.layout||(g.layout={}),g.layout.visibility=f?"visible":"none";try{l.addLayer(g,x)}catch(_){console.warn(`[BasemapLayer] Failed to add layer ${h}:`,_)}}r.current[d]=C,o.current[d]=!0},[]),c=i.useCallback((l,d,f)=>{const m=r.current[d],y=f?"visible":"none";for(const C of m)if(l.getLayer(C))try{l.setLayoutProperty(C,"visibility",y)}catch{}},[]),u=i.useCallback(l=>{var m;const f=(((m=l.getStyle())==null?void 0:m.layers)||[]).filter(y=>!y.id.startsWith("basemap-light-")&&!y.id.startsWith("basemap-dark-"));for(const y of f)try{l.moveLayer(y.id)}catch{}},[]);return i.useEffect(()=>{if(!n)return;const l=d=>{n.hasImage(d.id)||n.addImage(d.id,{width:1,height:1,data:new Uint8Array([0,0,0,0])})};return n.on("styleimagemissing",l),()=>{n.off("styleimagemissing",l)}},[n]),i.useEffect(()=>{if(!n)return;let l=!1;const d=async()=>{if(!l)try{await Promise.all([a(n,"light",e==="light"),a(n,"dark",e==="dark")]),l||u(n)}catch(m){console.error("[BasemapLayer] Setup error:",m)}};n.isStyleLoaded()?d():(n.once("style.load",d),n.once("load",()=>{!l&&!o.current.light&&d()}));const f=()=>{l||setTimeout(()=>{!l&&o.current.light&&o.current.dark&&u(n)},100)};return n.on("styledata",f),()=>{l=!0,n.off("styledata",f)}},[n,a,u,e]),i.useEffect(()=>{n&&(!o.current.light||!o.current.dark||(c(n,"light",e==="light"),c(n,"dark",e==="dark")))},[n,e,c]),null}export{ze as B,Ie as L,Me as M,xe as P,Re as S,be as a,G as b,Pe as c,ke as d,Te as u}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BOwCLZTK.js","assets/index-DH0lUVGm.css"])))=>i.map(i=>d[i]); +import{r as i,_ as $,aK as B,e as K}from"./index-BOwCLZTK.js";const H=i.createContext(null);function G(){var s;const e=(s=i.useContext(H))==null?void 0:s.maps,t=i.useContext(w);return i.useMemo(()=>({...e,current:t==null?void 0:t.map}),[e,t])}function Y(e,t){const n=Array.isArray(e)?e[0]:e?e.x:0,s=Array.isArray(e)?e[1]:e?e.y:0,o=Array.isArray(t)?t[0]:t?t.x:0,r=Array.isArray(t)?t[1]:t?t.y:0;return n===o&&s===r}function v(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n{let o=null;"interactive"in s&&(o=Object.assign({},s),delete o.interactive);const r=t[s.ref];if(r){o=o||Object.assign({},s),delete o.ref;for(const a of J)a in r&&(o[a]=r[a])}return o||s});return{...e,layers:n}}const A={version:8,sources:{},layers:[]},U={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},F={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},N={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},X=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],Q=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class b{constructor(t,n,s){this._map=null,this._internalUpdate=!1,this._hoveredFeatures=null,this._propsedCameraUpdate=null,this._styleComponents={},this._onEvent=o=>{const r=this.props[N[o.type]];r?r(o):o.type==="error"&&console.error(o.error)},this._onCameraEvent=o=>{if(this._internalUpdate)return;o.viewState=this._propsedCameraUpdate||P(this._map.transform);const r=this.props[F[o.type]];r&&r(o)},this._onCameraUpdate=o=>this._internalUpdate?o:(this._propsedCameraUpdate=P(o),z(o,this.props)),this._onPointerEvent=o=>{(o.type==="mousemove"||o.type==="mouseout")&&this._updateHover(o);const r=this.props[U[o.type]];r&&(this.props.interactiveLayerIds&&o.type!=="mouseover"&&o.type!=="mouseout"&&(o.features=this._hoveredFeatures||this._queryRenderedFeatures(o.point)),r(o),delete o.features)},this._MapClass=t,this.props=n,this._initialize(s)}get map(){return this._map}setProps(t){const n=this.props;this.props=t;const s=this._updateSettings(t,n),o=this._updateSize(t),r=this._updateViewState(t);this._updateStyle(t,n),this._updateStyleComponents(t),this._updateHandlers(t,n),(s||o||r&&!this._map.isMoving())&&this.redraw()}static reuse(t,n){const s=b.savedMaps.pop();if(!s)return null;const o=s.map,r=o.getContainer();for(n.className=r.className;r.childNodes.length>0;)n.appendChild(r.childNodes[0]);o._container=n;const a=o._resizeObserver;a&&(a.disconnect(),a.observe(n)),s.setProps({...t,styleDiffing:!1}),o.resize();const{initialViewState:c}=t;return c&&(c.bounds?o.fitBounds(c.bounds,{...c.fitBoundsOptions,duration:0}):s._updateViewState(c)),o.isStyleLoaded()?o.fire("load"):o.once("style.load",()=>o.fire("load")),o._update(),s}_initialize(t){const{props:n}=this,{mapStyle:s=A}=n,o={...n,...n.initialViewState,container:t,style:O(s)},r=o.initialViewState||o.viewState||o;if(Object.assign(o,{center:[r.longitude||0,r.latitude||0],zoom:r.zoom||0,pitch:r.pitch||0,bearing:r.bearing||0}),n.gl){const c=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=c,n.gl)}const a=new this._MapClass(o);r.padding&&a.setPadding(r.padding),n.cursor&&(a.getCanvas().style.cursor=n.cursor),a.transformCameraUpdate=this._onCameraUpdate,a.on("style.load",()=>{var c;this._styleComponents={light:a.getLight(),sky:a.getSky(),projection:(c=a.getProjection)==null?void 0:c.call(a),terrain:a.getTerrain()},this._updateStyleComponents(this.props)}),a.on("sourcedata",()=>{this._updateStyleComponents(this.props)});for(const c in U)a.on(c,this._onPointerEvent);for(const c in F)a.on(c,this._onCameraEvent);for(const c in N)a.on(c,this._onEvent);this._map=a}recycle(){const n=this.map.getContainer().querySelector("[mapboxgl-children]");n==null||n.remove(),b.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_updateSize(t){const{viewState:n}=t;if(n){const s=this._map;if(n.width!==s.transform.width||n.height!==s.transform.height)return s.resize(),!0}return!1}_updateViewState(t){const n=this._map,s=n.transform;if(!n.isMoving()){const r=z(s,t);if(Object.keys(r).length>0)return this._internalUpdate=!0,n.jumpTo(r),this._internalUpdate=!1,!0}return!1}_updateSettings(t,n){const s=this._map;let o=!1;for(const r of X)if(r in t&&!v(t[r],n[r])){o=!0;const a=s[`set${r[0].toUpperCase()}${r.slice(1)}`];a==null||a.call(s,t[r])}return o}_updateStyle(t,n){if(t.cursor!==n.cursor&&(this._map.getCanvas().style.cursor=t.cursor||""),t.mapStyle!==n.mapStyle){const{mapStyle:s=A,styleDiffing:o=!0}=t,r={diff:o};"localIdeographFontFamily"in t&&(r.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(O(s),r)}}_updateStyleComponents({light:t,projection:n,sky:s,terrain:o}){var c,u;const r=this._map,a=this._styleComponents;r.style._loaded&&(t&&!v(t,a.light)&&(a.light=t,r.setLight(t)),n&&!v(n,a.projection)&&n!==((c=a.projection)==null?void 0:c.type)&&(a.projection=typeof n=="string"?{type:n}:n,(u=r.setProjection)==null||u.call(r,a.projection)),s&&!v(s,a.sky)&&(a.sky=s,r.setSky(s)),o!==void 0&&!v(o,a.terrain)&&(!o||r.getSource(o.source))&&(a.terrain=o,r.setTerrain(o)))}_updateHandlers(t,n){const s=this._map;for(const o of Q){const r=t[o]??!0,a=n[o]??!0;v(r,a)||(r?s[o].enable(r):s[o].disable())}}_queryRenderedFeatures(t){const n=this._map,{interactiveLayerIds:s=[]}=this.props;try{return n.queryRenderedFeatures(t,{layers:s.filter(n.getLayer.bind(n))})}catch{return[]}}_updateHover(t){var o;const{props:n}=this;if(n.interactiveLayerIds&&(n.onMouseMove||n.onMouseEnter||n.onMouseLeave)){const r=t.type,a=((o=this._hoveredFeatures)==null?void 0:o.length)>0,c=this._queryRenderedFeatures(t.point),u=c.length>0;!u&&a&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=c,u&&!a&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=r}else this._hoveredFeatures=null}}b.savedMaps=[];const ee=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function te(e){if(!e)return null;const t=e.map,n={getMap:()=>t};for(const s of ne(t))!(s in n)&&!ee.includes(s)&&(n[s]=t[s].bind(t));return n}function ne(e){const t=new Set;let n=e;for(;n;){for(const s of Object.getOwnPropertyNames(n))s[0]!=="_"&&typeof e[s]=="function"&&s!=="fire"&&s!=="setEventedParent"&&t.add(s);n=Object.getPrototypeOf(n)}return Array.from(t)}const oe=typeof document<"u"?i.useLayoutEffect:i.useEffect;function re(e,t){const{RTLTextPlugin:n,maxParallelImageRequests:s,workerCount:o,workerUrl:r}=t;if(n&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"){const{pluginUrl:a,lazy:c=!0}=typeof n=="string"?{pluginUrl:n}:n;e.setRTLTextPlugin(a,u=>{u&&console.error(u)},c)}s!==void 0&&e.setMaxParallelImageRequests(s),o!==void 0&&e.setWorkerCount(o),r!==void 0&&e.setWorkerUrl(r)}const w=i.createContext(null);function se(e,t){const n=i.useContext(H),[s,o]=i.useState(null),r=i.useRef(),{current:a}=i.useRef({mapLib:null,map:null});i.useEffect(()=>{const l=e.mapLib;let d=!0,f;return Promise.resolve(l||$(()=>import("./maplibre-gl-C4v-QlFl.js").then(m=>m.m),__vite__mapDeps([0,1]))).then(m=>{if(!d)return;if(!m)throw new Error("Invalid mapLib");const y="Map"in m?m:m.default;if(!y.Map)throw new Error("Invalid mapLib");re(y,e),e.reuseMaps&&(f=b.reuse(e,r.current)),f||(f=new b(y.Map,e,r.current)),a.map=te(f),a.mapLib=y,o(f),n==null||n.onMapMount(a.map,e.id)}).catch(m=>{const{onError:y}=e;y?y({type:"error",target:null,originalEvent:null,error:m}):console.error(m)}),()=>{d=!1,f&&(n==null||n.onMapUnmount(e.id),e.reuseMaps?f.recycle():f.destroy())}},[]),oe(()=>{s&&s.setProps(e)}),i.useImperativeHandle(t,()=>a.map,[s]);const c=i.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),u={height:"100%"};return i.createElement("div",{id:e.id,ref:r,style:c},s&&i.createElement(w.Provider,{value:a},i.createElement("div",{"mapboxgl-children":"",style:u},e.children)))}const Me=i.forwardRef(se),ae=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function L(e,t){if(!e||!t)return;const n=e.style;for(const s in t){const o=t[s];Number.isFinite(o)&&!ae.test(s)?n[s]=`${o}px`:n[s]=o}}function Z(e,t){if(e===t)return null;const n=D(e),s=D(t),o=[];for(const r of s)n.has(r)||o.push(r);for(const r of n)s.has(r)||o.push(r);return o.length===0?null:o}function D(e){return new Set(e?e.trim().split(/\s+/):[])}const be=i.memo(i.forwardRef((e,t)=>{const{map:n,mapLib:s}=i.useContext(w),o=i.useRef({props:e}),r=i.useMemo(()=>{let E=!1;i.Children.forEach(e.children,h=>{h&&(E=!0)});const k={...e,element:E?document.createElement("div"):void 0},p=new s.Marker(k);return p.setLngLat([e.longitude,e.latitude]),p.getElement().addEventListener("click",h=>{var g,_;(_=(g=o.current.props).onClick)==null||_.call(g,{type:"click",target:p,originalEvent:h})}),p.on("dragstart",h=>{var _,S;const g=h;g.lngLat=r.getLngLat(),(S=(_=o.current.props).onDragStart)==null||S.call(_,g)}),p.on("drag",h=>{var _,S;const g=h;g.lngLat=r.getLngLat(),(S=(_=o.current.props).onDrag)==null||S.call(_,g)}),p.on("dragend",h=>{var _,S;const g=h;g.lngLat=r.getLngLat(),(S=(_=o.current.props).onDragEnd)==null||S.call(_,g)}),p},[]);i.useEffect(()=>(r.addTo(n.getMap()),()=>{r.remove()}),[]);const{longitude:a,latitude:c,offset:u,style:l,draggable:d=!1,popup:f=null,rotation:m=0,rotationAlignment:y="auto",pitchAlignment:C="auto"}=e;i.useEffect(()=>{L(r.getElement(),l)},[l]),i.useImperativeHandle(t,()=>r,[]);const T=o.current.props;(r.getLngLat().lng!==a||r.getLngLat().lat!==c)&&r.setLngLat([a,c]),u&&!Y(r.getOffset(),u)&&r.setOffset(u),r.isDraggable()!==d&&r.setDraggable(d),r.getRotation()!==m&&r.setRotation(m),r.getRotationAlignment()!==y&&r.setRotationAlignment(y),r.getPitchAlignment()!==C&&r.setPitchAlignment(C),r.getPopup()!==f&&r.setPopup(f);const x=Z(T.className,e.className);if(x)for(const E of x)r.toggleClassName(E);return o.current.props=e,B.createPortal(e.children,r.getElement())})),xe=i.memo(i.forwardRef((e,t)=>{const{map:n,mapLib:s}=i.useContext(w),o=i.useMemo(()=>document.createElement("div"),[]),r=i.useRef({props:e}),a=i.useMemo(()=>{const c={...e},u=new s.Popup(c);return u.setLngLat([e.longitude,e.latitude]),u.once("open",l=>{var d,f;(f=(d=r.current.props).onOpen)==null||f.call(d,l)}),u},[]);if(i.useEffect(()=>{const c=u=>{var l,d;(d=(l=r.current.props).onClose)==null||d.call(l,u)};return a.on("close",c),a.setDOMContent(o).addTo(n.getMap()),()=>{a.off("close",c),a.isOpen()&&a.remove()}},[]),i.useEffect(()=>{L(a.getElement(),e.style)},[e.style]),i.useImperativeHandle(t,()=>a,[]),a.isOpen()){const c=r.current.props;(a.getLngLat().lng!==e.longitude||a.getLngLat().lat!==e.latitude)&&a.setLngLat([e.longitude,e.latitude]),e.offset&&!v(c.offset,e.offset)&&a.setOffset(e.offset),(c.anchor!==e.anchor||c.maxWidth!==e.maxWidth)&&(a.options.anchor=e.anchor,a.setMaxWidth(e.maxWidth));const u=Z(c.className,e.className);if(u)for(const l of u)a.toggleClassName(l);r.current.props=e}return B.createPortal(e.children,o)}));function M(e,t,n,s){const o=i.useContext(w),r=i.useMemo(()=>e(o),[]);return i.useEffect(()=>{const a=t,c=null,u=typeof t=="function"?t:null,{map:l}=o;return l.hasControl(r)||(l.addControl(r,a==null?void 0:a.position),c&&c(o)),()=>{u&&u(o),l.hasControl(r)&&l.removeControl(r)}},[]),r}function ie(e){const t=M(({mapLib:n})=>new n.AttributionControl(e),{position:e.position});return i.useEffect(()=>{L(t._container,e.style)},[e.style]),null}i.memo(ie);function ce(e){const t=M(({mapLib:n})=>new n.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return i.useEffect(()=>{L(t._controlContainer,e.style)},[e.style]),null}i.memo(ce);function le(e,t){const n=i.useRef({props:e}),s=M(({mapLib:o})=>{const r=new o.GeolocateControl(e),a=r._setupUI;return r._setupUI=()=>{r._container.hasChildNodes()||a()},r.on("geolocate",c=>{var u,l;(l=(u=n.current.props).onGeolocate)==null||l.call(u,c)}),r.on("error",c=>{var u,l;(l=(u=n.current.props).onError)==null||l.call(u,c)}),r.on("outofmaxbounds",c=>{var u,l;(l=(u=n.current.props).onOutOfMaxBounds)==null||l.call(u,c)}),r.on("trackuserlocationstart",c=>{var u,l;(l=(u=n.current.props).onTrackUserLocationStart)==null||l.call(u,c)}),r.on("trackuserlocationend",c=>{var u,l;(l=(u=n.current.props).onTrackUserLocationEnd)==null||l.call(u,c)}),r},{position:e.position});return n.current.props=e,i.useImperativeHandle(t,()=>s,[]),i.useEffect(()=>{L(s._container,e.style)},[e.style]),null}i.memo(i.forwardRef(le));function ue(e){const t=M(({mapLib:n})=>new n.NavigationControl(e),{position:e.position});return i.useEffect(()=>{L(t._container,e.style)},[e.style]),null}i.memo(ue);function fe(e){const t=M(({mapLib:r})=>new r.ScaleControl(e),{position:e.position}),n=i.useRef(e),s=n.current;n.current=e;const{style:o}=e;return e.maxWidth!==void 0&&e.maxWidth!==s.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==s.unit&&t.setUnit(e.unit),i.useEffect(()=>{L(t._container,o)},[o]),null}const ke=i.memo(fe);function de(e){const t=M(({mapLib:n})=>new n.TerrainControl(e),{position:e.position});return i.useEffect(()=>{L(t._container,e.style)},[e.style]),null}i.memo(de);function me(e){const t=M(({mapLib:n})=>new n.LogoControl(e),{position:e.position});return i.useEffect(()=>{L(t._container,e.style)},[e.style]),null}i.memo(me);function R(e,t){if(!e)throw new Error(t)}let ye=0;function ge(e,t,n){if(e.style&&e.style._loaded){const s={...n};return delete s.id,delete s.children,e.addSource(t,s),e.getSource(t)}return null}function he(e,t,n){var a,c,u;R(t.id===n.id,"source id changed"),R(t.type===n.type,"source type changed");let s="",o=0;for(const l in t)l!=="children"&&l!=="id"&&!v(n[l],t[l])&&(s=l,o++);if(!o)return;const r=t.type;if(r==="geojson")e.setData(t.data);else if(r==="image")e.updateImage({url:t.url,coordinates:t.coordinates});else switch(s){case"coordinates":(a=e.setCoordinates)==null||a.call(e,t.coordinates);break;case"url":(c=e.setUrl)==null||c.call(e,t.url);break;case"tiles":(u=e.setTiles)==null||u.call(e,t.tiles);break;default:console.warn(`Unable to update prop: ${s}`)}}function Re(e){const t=i.useContext(w).map.getMap(),n=i.useRef(e),[,s]=i.useState(0),o=i.useMemo(()=>e.id||`jsx-source-${ye++}`,[]);i.useEffect(()=>{if(t){const a=()=>setTimeout(()=>s(c=>c+1),0);return t.on("styledata",a),a(),()=>{var c;if(t.off("styledata",a),t.style&&t.style._loaded&&t.getSource(o)){const u=(c=t.getStyle())==null?void 0:c.layers;if(u)for(const l of u)l.source===o&&t.removeLayer(l.id);t.removeSource(o)}}}},[t]);let r=t&&t.style&&t.getSource(o);return r?he(r,e,n.current):r=ge(t,o,e),n.current=e,r&&i.Children.map(e.children,a=>a&&i.cloneElement(a,{source:o}))||null}function pe(e,t,n,s){if(R(n.id===s.id,"layer id changed"),R(n.type===s.type,"layer type changed"),n.type==="custom"||s.type==="custom")return;const{layout:o={},paint:r={},filter:a,minzoom:c,maxzoom:u,beforeId:l}=n;if(l!==s.beforeId&&e.moveLayer(t,l),o!==s.layout){const d=s.layout||{};for(const f in o)v(o[f],d[f])||e.setLayoutProperty(t,f,o[f]);for(const f in d)o.hasOwnProperty(f)||e.setLayoutProperty(t,f,void 0)}if(r!==s.paint){const d=s.paint||{};for(const f in r)v(r[f],d[f])||e.setPaintProperty(t,f,r[f]);for(const f in d)r.hasOwnProperty(f)||e.setPaintProperty(t,f,void 0)}v(a,s.filter)||e.setFilter(t,a),(c!==s.minzoom||u!==s.maxzoom)&&e.setLayerZoomRange(t,c,u)}function ve(e,t,n){if(e.style&&e.style._loaded&&(!("source"in n)||e.getSource(n.source))){const s={...n,id:t};delete s.beforeId,e.addLayer(s,n.beforeId)}}let _e=0;function Ie(e){const t=i.useContext(w).map.getMap(),n=i.useRef(e),[,s]=i.useState(0),o=i.useMemo(()=>e.id||`jsx-layer-${_e++}`,[]);if(i.useEffect(()=>{if(t){const a=()=>s(c=>c+1);return t.on("styledata",a),a(),()=>{t.off("styledata",a),t.style&&t.style._loaded&&t.getLayer(o)&&t.removeLayer(o)}}},[t]),t&&t.style&&t.getLayer(o))try{pe(t,o,e,n.current)}catch(a){console.warn(a)}else ve(t,o,e);return n.current=e,null}const V="pymc-basemap-mode",j="dark";function Le(){if(typeof window>"u")return j;try{const e=localStorage.getItem(V);if(e==="light"||e==="dark")return e}catch{}return j}function W(e){if(!(typeof window>"u"))try{localStorage.setItem(V,e)}catch{}}const q=K(e=>({mode:Le(),toggle:()=>e(t=>{const n=t.mode==="light"?"dark":"light";return W(n),{mode:n}}),setMode:t=>{W(t),e({mode:t})}})),Te=()=>q(e=>e.mode),Pe=()=>q(e=>e.toggle),Ce={light:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",dark:"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"},Se={light:"basemap-light-",dark:"basemap-dark-"},I={};async function Ee(e){if(I[e])return I[e];const n=await(await fetch(Ce[e])).json();return I[e]=n,n}function ze({mode:e}){const{current:t}=G(),[n,s]=i.useState(null),o=i.useRef({light:!1,dark:!1}),r=i.useRef({light:[],dark:[]});i.useEffect(()=>{const l=()=>{var y;const m=(y=t==null?void 0:t.getMap)==null?void 0:y.call(t);m&&!n&&s(m)};l();const d=setInterval(l,50),f=setTimeout(()=>clearInterval(d),5e3);return()=>{clearInterval(d),clearTimeout(f)}},[t,n]);const a=i.useCallback(async(l,d,f)=>{var E,k;if(o.current[d])return;const m=Se[d],y=await Ee(d),C=[];for(const[p,h]of Object.entries(y.sources||{})){const g=m+p;l.getSource(g)||l.addSource(g,h)}const x=(k=(((E=l.getStyle())==null?void 0:E.layers)||[]).find(p=>!p.id.startsWith("basemap-light-")&&!p.id.startsWith("basemap-dark-")))==null?void 0:k.id;for(const p of y.layers||[]){const h=m+p.id;if(C.push(h),l.getLayer(h))continue;const g={...p,id:h};"source"in g&&typeof g.source=="string"&&(g.source=m+g.source),g.layout||(g.layout={}),g.layout.visibility=f?"visible":"none";try{l.addLayer(g,x)}catch(_){console.warn(`[BasemapLayer] Failed to add layer ${h}:`,_)}}r.current[d]=C,o.current[d]=!0},[]),c=i.useCallback((l,d,f)=>{const m=r.current[d],y=f?"visible":"none";for(const C of m)if(l.getLayer(C))try{l.setLayoutProperty(C,"visibility",y)}catch{}},[]),u=i.useCallback(l=>{var m;const f=(((m=l.getStyle())==null?void 0:m.layers)||[]).filter(y=>!y.id.startsWith("basemap-light-")&&!y.id.startsWith("basemap-dark-"));for(const y of f)try{l.moveLayer(y.id)}catch{}},[]);return i.useEffect(()=>{if(!n)return;const l=d=>{n.hasImage(d.id)||n.addImage(d.id,{width:1,height:1,data:new Uint8Array([0,0,0,0])})};return n.on("styleimagemissing",l),()=>{n.off("styleimagemissing",l)}},[n]),i.useEffect(()=>{if(!n)return;let l=!1;const d=async()=>{if(!l)try{await Promise.all([a(n,"light",e==="light"),a(n,"dark",e==="dark")]),l||u(n)}catch(m){console.error("[BasemapLayer] Setup error:",m)}};n.isStyleLoaded()?d():(n.once("style.load",d),n.once("load",()=>{!l&&!o.current.light&&d()}));const f=()=>{l||setTimeout(()=>{!l&&o.current.light&&o.current.dark&&u(n)},100)};return n.on("styledata",f),()=>{l=!0,n.off("styledata",f)}},[n,a,u,e]),i.useEffect(()=>{n&&(!o.current.light||!o.current.dark||(c(n,"light",e==="light"),c(n,"dark",e==="dark")))},[n,e,c]),null}export{ze as B,Ie as L,Me as M,xe as P,Re as S,be as a,G as b,Pe as c,ke as d,Te as u}; diff --git a/frontend/dist/assets/ChatBubble-D4uyE1Zh.js b/frontend/dist/assets/ChatBubble-CCVYaLOe.js similarity index 93% rename from frontend/dist/assets/ChatBubble-D4uyE1Zh.js rename to frontend/dist/assets/ChatBubble-CCVYaLOe.js index 1a49145e..26f0e293 100644 --- a/frontend/dist/assets/ChatBubble-D4uyE1Zh.js +++ b/frontend/dist/assets/ChatBubble-CCVYaLOe.js @@ -1,4 +1,4 @@ -import{d as h,r as u,j as e,c as t}from"./index-CeMilrX4.js";import{e as f,g as p,a as g,b as j,f as b}from"./chat-utils-BJwCtjDV.js";/** +import{d as h,r as u,j as e,c as t}from"./index-BOwCLZTK.js";import{e as f,g as p,a as g,b as j,f as b}from"./chat-utils-D21OFED5.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/CollisionExplorerModal-Cvw_f8a6.js b/frontend/dist/assets/CollisionExplorerModal-Cudk5ace.js similarity index 97% rename from frontend/dist/assets/CollisionExplorerModal-Cvw_f8a6.js rename to frontend/dist/assets/CollisionExplorerModal-Cudk5ace.js index e6c506d9..f242292c 100644 --- a/frontend/dist/assets/CollisionExplorerModal-Cvw_f8a6.js +++ b/frontend/dist/assets/CollisionExplorerModal-Cudk5ace.js @@ -1,4 +1,4 @@ -import{d as k,r as c,K as L,bO as S,P as H,j as e,ak as R,al as B,bz as E,c as N,x as w,F as T,D as _,E as D,bY as P}from"./index-CeMilrX4.js";import{u as z,M as I,B as W,S as q,L as F,a as U}from"./BasemapLayer-CNBmoufo.js";import{T as Y}from"./triangle-alert-DiFold9L.js";import{M as A}from"./map-pin-D6_BkIVb.js";import{M as $}from"./monitor-smartphone-DxkmIgui.js";/** +import{d as k,r as c,K as L,bO as S,P as H,j as e,ak as R,al as B,bz as E,c as N,x as w,F as T,D as _,E as D,bY as P}from"./index-BOwCLZTK.js";import{u as z,M as I,B as W,S as q,L as F,a as U}from"./BasemapLayer-B-5TmAfZ.js";import{T as Y}from"./triangle-alert-SO3tIa8w.js";import{M as A}from"./map-pin-C2z_C0J3.js";import{M as $}from"./monitor-smartphone-Dd11JEL9.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/Configuration-DyP_2E9Y.js b/frontend/dist/assets/Configuration-CdhAM59e.js similarity index 94% rename from frontend/dist/assets/Configuration-DyP_2E9Y.js rename to frontend/dist/assets/Configuration-CdhAM59e.js index 451b844e..9fe8cf85 100644 --- a/frontend/dist/assets/Configuration-DyP_2E9Y.js +++ b/frontend/dist/assets/Configuration-CdhAM59e.js @@ -1,5 +1,5 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/latin-400-BcR6IdUc.css","assets/latin-500-DCnAHIrw.css","assets/latin-600-CnkPk-vb.css","assets/latin-700-UC1i-VSI.css"])))=>i.map(i=>d[i]); -import{d as ue,r as t,j as e,c as l,L as $,D as B,bk as J,am as Ts,dR as Re,dS as ss,dT as Ze,_ as Te,T as ie,M as et,S as st,dU as tt,N as X,cn as Qe,b_ as at,dV as nt,z as lt,dW as _s,dX as rt,dY as it,dZ as ot,R as ct,B as F,d_ as qe,I as dt,E as ut,F as mt}from"./index-CeMilrX4.js";import{g as xt,a as ft,c as ht,r as pt,s as yt,b as gt,u as bt,d as jt}from"./system-D5lXsOVm.js";import{C as vt}from"./ConfirmModal-BF449Kzb.js";import{N as Nt}from"./NodeInformationCard-DGC6n0fh.js";import{i as kt,g as wt,s as Ct,a as St,k as Tt}from"./keycap-sfx-ByZp-njj.js";import{C as Y,P as _t,a as Ft,B as Et}from"./PageLayout-Cw_MXmcE.js";import{T as Is}from"./trash-2-Bu7BoH4P.js";import{R as te,C as _e}from"./Grid-BuDgMX1I.js";import{A as Rt}from"./antenna-DhdWQ_ro.js";import{P as Fs}from"./plus-D-z0bUE_.js";import{K as Ge}from"./key-round-Dkqq4aT0.js";import{C as Pt}from"./circle-check-CY6Nl8LU.js";import{T as Be}from"./triangle-alert-DiFold9L.js";import{R as Dt}from"./refresh-cw-DqhcBXAw.js";import{C as It}from"./chevron-right-D3QL4sfa.js";import"./DataBox-Da-5DbUW.js";/** +import{d as ue,r as t,j as e,c as l,L as H,D as B,bk as J,am as Ts,dS as Re,dT as ss,dU as Ze,_ as Te,T as ie,M as et,S as st,dV as tt,N as X,cn as Qe,b_ as at,dW as nt,z as lt,dX as _s,dY as rt,dZ as it,d_ as ot,R as ct,B as F,d$ as qe,I as dt,E as ut,F as mt}from"./index-BOwCLZTK.js";import{g as xt,a as ft,c as ht,r as pt,s as yt,b as gt,u as bt,d as jt}from"./system-BNWIl4nC.js";import{C as vt}from"./ConfirmModal-DpSKXZ01.js";import{N as Nt}from"./NodeInformationCard-PgTi9luy.js";import{i as kt,g as wt,s as Ct,a as St,k as Tt}from"./keycap-sfx-ByZp-njj.js";import{C as Y,P as _t,a as Ft,B as Et}from"./PageLayout-QKntxcnp.js";import{T as Is}from"./trash-2-qMD09ppP.js";import{R as te,C as _e}from"./Grid-eFMUBxsw.js";import{A as Rt}from"./antenna-rYsqNluv.js";import{P as Fs}from"./plus-ClrHVFhr.js";import{K as Ge}from"./key-round-Cv6ASKpS.js";import{C as Pt}from"./circle-check-CmQaOkab.js";import{T as Be}from"./triangle-alert-SO3tIa8w.js";import{R as Dt}from"./refresh-cw-C9txhqc9.js";import{C as It}from"./chevron-right-DJVm4pVP.js";import"./DataBox-BVnEv6Au.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -24,9 +24,9 @@ import{d as ue,r as t,j as e,c as l,L as $,D as B,bk as J,am as Ts,dR as Re,dS a * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ht=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],es=ue("pencil",Ht);/** + */const $t=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],es=ue("pencil",$t);/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $t=[["path",{d:"M10.17 4.193a2 2 0 0 1 3.666.013",key:"pltmmw"}],["path",{d:"M14 21h2",key:"v4qezv"}],["path",{d:"m15.874 7.743 1 1.732",key:"10m0iw"}],["path",{d:"m18.849 12.952 1 1.732",key:"zadnam"}],["path",{d:"M21.824 18.18a2 2 0 0 1-1.835 2.824",key:"fvwuk4"}],["path",{d:"M4.024 21a2 2 0 0 1-1.839-2.839",key:"1e1kah"}],["path",{d:"m5.136 12.952-1 1.732",key:"1u4ldi"}],["path",{d:"M8 21h2",key:"i9zjee"}],["path",{d:"m8.102 7.743-1 1.732",key:"1zzo4u"}]],qt=ue("triangle-dashed",$t),Ee=1500,oe={stacked:"h-[38px]",inline:"h-[32px]"},ce={stacked:"px-3",inline:"px-2.5"},de="rounded-lg";function H({label:a,value:c,editValue:r,onSave:f,type:o="text",suffix:d,placeholder:N,readOnly:u=!1,layout:g="stacked",min:i,max:n,step:h,maxLength:T,description:p,className:D}){const[w,k]=t.useState(!1),[y,E]=t.useState(""),[b,z]=t.useState("idle"),O=t.useRef(null),v=t.useRef(!0),_=t.useRef(null),P=!u&&!!f;t.useEffect(()=>(v.current=!0,()=>{v.current=!1,_.current&&clearTimeout(_.current)}),[]);const A=t.useCallback(()=>{P&&(E(r??c),k(!0),z("idle"),requestAnimationFrame(()=>{var C;return(C=O.current)==null?void 0:C.select()}))},[P,r,c]),S=t.useCallback(()=>{k(!1),E(""),z("idle")},[]),m=t.useCallback(async()=>{if(!f||b==="loading")return;if(y===(r??c)){S();return}_.current&&clearTimeout(_.current),z("loading");try{if(await f(y),!v.current)return;z("success"),k(!1),_.current=setTimeout(()=>{v.current&&z("idle")},Ee)}catch{if(!v.current)return;z("error"),_.current=setTimeout(()=>{v.current&&z("idle")},Ee)}},[f,y,r,c,S,b]),K=t.useCallback(C=>{C.key==="Enter"?(C.preventDefault(),m()):C.key==="Escape"&&(C.preventDefault(),S())},[m,S]);return g==="inline"?e.jsxs("div",{className:l("group flex items-center justify-between gap-3",D),children:[e.jsx("label",{className:"type-label text-fg-muted truncate",children:a}),w?e.jsxs("div",{className:l(oe.inline,de,ce.inline,"flex items-center transition-all","bg-transparent border border-sys-blue/50 ring-1 ring-sys-blue/20","min-w-[100px]"),children:[e.jsx("input",{ref:O,type:o,value:y,onChange:C=>E(C.target.value),onKeyDown:K,placeholder:N,min:i,max:n,step:h,maxLength:T,disabled:b==="loading",className:l("bg-transparent text-fg-primary focus:outline-none type-data flex-1 min-w-0",d?"w-12 text-right":"w-full")}),d&&e.jsx("span",{className:"text-fg-muted type-data ml-1 shrink-0",children:d}),e.jsx("div",{className:"flex items-center gap-0.5 ml-2 shrink-0",children:b==="loading"?e.jsx($,{className:"w-3.5 h-3.5 text-fg-muted animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:m,className:"p-0.5 rounded hover:bg-sys-green/15 text-sys-green transition-colors",title:"Save (Enter)",children:e.jsx(B,{className:"w-3 h-3"})}),e.jsx("button",{onClick:S,className:"p-0.5 rounded hover:bg-sys-red/15 text-fg-muted hover:text-sys-red transition-colors",title:"Cancel (Esc)",children:e.jsx(J,{className:"w-3 h-3"})})]})})]}):e.jsxs("div",{className:l(oe.inline,de,ce.inline,"flex items-center justify-end transition-all min-w-[80px]","bg-input-bg border border-input-border",P&&"cursor-pointer hover:border-edge-strong"),onClick:P?A:void 0,children:[e.jsx("span",{className:"type-data text-fg-primary",children:c}),b==="success"&&e.jsx(B,{className:"w-3 h-3 text-sys-green ml-1.5 shrink-0"}),b==="error"&&e.jsx(J,{className:"w-3 h-3 text-sys-red ml-1.5 shrink-0"}),b==="idle"&&P&&e.jsx(es,{className:"w-3 h-3 text-fg-muted ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]})]}):e.jsxs("div",{className:l("group",D),children:[e.jsx("label",{className:"type-label text-fg-muted block mb-1",children:a}),w?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:l(oe.stacked,de,ce.stacked,"flex items-center transition-all","bg-transparent border border-sys-blue/50 ring-1 ring-sys-blue/20"),children:[e.jsx("input",{ref:O,type:o,value:y,onChange:C=>E(C.target.value),onKeyDown:K,placeholder:N,min:i,max:n,step:h,maxLength:T,disabled:b==="loading",className:"w-full bg-transparent text-fg-primary focus:outline-none type-data flex-1 min-w-0"}),d&&e.jsx("span",{className:"text-fg-muted type-data ml-1 shrink-0",children:d}),e.jsx("div",{className:"flex items-center gap-0.5 ml-2 shrink-0",children:b==="loading"?e.jsx($,{className:"w-3.5 h-3.5 text-fg-muted animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:m,className:"p-1 rounded hover:bg-sys-green/15 text-sys-green transition-colors",title:"Save (Enter)",children:e.jsx(B,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:S,className:"p-1 rounded hover:bg-sys-red/15 text-fg-muted hover:text-sys-red transition-colors",title:"Cancel (Esc)",children:e.jsx(J,{className:"w-3.5 h-3.5"})})]})})]}),p&&e.jsx("p",{className:"type-data-xs text-fg-muted mt-1 ml-3",children:p})]}):e.jsxs("div",{className:l(oe.stacked,de,ce.stacked,"flex items-center transition-all","bg-input-bg border border-input-border",P&&"cursor-pointer hover:border-edge-strong"),onClick:P?A:void 0,children:[e.jsx("span",{className:"type-data text-fg-primary flex-1 whitespace-nowrap",children:c}),b==="success"&&e.jsx(B,{className:"w-3.5 h-3.5 text-sys-green shrink-0"}),b==="error"&&e.jsx(J,{className:"w-3.5 h-3.5 text-sys-red shrink-0"}),b==="idle"&&P&&e.jsx(es,{className:"w-3.5 h-3.5 text-fg-muted opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]})]})}function Ue({label:a,value:c,editValue:r,options:f,onSave:o,readOnly:d=!1,layout:N="stacked",className:u}){const[g,i]=t.useState(!1),[n,h]=t.useState(""),[T,p]=t.useState("idle"),D=t.useRef(null),w=t.useRef(!0),k=t.useRef(null),y=!d&&!!o;t.useEffect(()=>(w.current=!0,()=>{w.current=!1,k.current&&clearTimeout(k.current)}),[]);const E=t.useCallback(()=>{y&&(h(String(r)),i(!0),p("idle"),requestAnimationFrame(()=>{var m;return(m=D.current)==null?void 0:m.focus()}))},[y,r]),b=t.useCallback(()=>{i(!1),h(""),p("idle")},[]),z=t.useCallback(async()=>{if(!(!o||T==="loading")){if(n===String(r)){b();return}k.current&&clearTimeout(k.current),p("loading");try{if(await o(n),!w.current)return;p("success"),i(!1),k.current=setTimeout(()=>{w.current&&p("idle")},Ee)}catch{if(!w.current)return;p("error"),k.current=setTimeout(()=>{w.current&&p("idle")},Ee)}}},[o,n,r,b,T]),O=t.useCallback(m=>{m.key==="Escape"&&(m.preventDefault(),b())},[b]),v=N==="inline",_=v?oe.inline:oe.stacked,P=v?ce.inline:ce.stacked,A=e.jsxs("div",{className:l(_,de,P,"flex items-center transition-all relative","bg-transparent border border-sys-blue/50 ring-1 ring-sys-blue/20",v&&"min-w-[100px]"),children:[e.jsx("select",{ref:D,value:n,onChange:m=>h(m.target.value),onKeyDown:O,disabled:T==="loading",className:l("bg-transparent text-fg-primary focus:outline-none appearance-none cursor-pointer type-data flex-1 min-w-0","pr-6"),children:f.map(m=>e.jsx("option",{value:m.value,children:m.label},String(m.value)))}),e.jsx(Ts,{className:"absolute right-auto w-3.5 h-3.5 text-fg-muted pointer-events-none",style:{right:T==="loading"?"2rem":"3.5rem"}}),e.jsx("div",{className:"flex items-center gap-0.5 ml-1 shrink-0",children:T==="loading"?e.jsx($,{className:l("text-fg-muted animate-spin",v?"w-3 h-3":"w-3.5 h-3.5")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:z,className:l("rounded hover:bg-sys-green/15 text-sys-green transition-colors",v?"p-0.5":"p-1"),title:"Save",children:e.jsx(B,{className:v?"w-3 h-3":"w-3.5 h-3.5"})}),e.jsx("button",{onClick:b,className:l("rounded hover:bg-sys-red/15 text-fg-muted hover:text-sys-red transition-colors",v?"p-0.5":"p-1"),title:"Cancel (Esc)",children:e.jsx(J,{className:v?"w-3 h-3":"w-3.5 h-3.5"})})]})})]}),S=e.jsxs("div",{className:l(_,de,P,"flex items-center transition-all","bg-input-bg border border-input-border",y&&"cursor-pointer hover:border-edge-strong",v?"justify-end min-w-[80px]":""),onClick:y?E:void 0,children:[e.jsx("span",{className:l("type-data text-fg-primary",!v&&"flex-1"),children:c}),T==="success"&&e.jsx(B,{className:l("text-sys-green shrink-0",v?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")}),T==="error"&&e.jsx(J,{className:l("text-sys-red shrink-0",v?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")}),T==="idle"&&y&&e.jsx(Ts,{className:l("text-fg-muted opacity-0 group-hover:opacity-100 transition-opacity shrink-0",v?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")})]});return v?e.jsxs("div",{className:l("group flex items-center justify-between",u),children:[e.jsx("label",{className:"type-label text-fg-muted shrink-0",children:a}),g?A:S]}):e.jsxs("div",{className:l("group",u),children:[e.jsx("label",{className:"type-label text-fg-muted block mb-1",children:a}),g?A:S]})}async function Gt(){try{return await Re("/api/auth/tokens")}catch{return{tokens:[]}}}async function Bt(a){return Re("/api/auth/tokens",{method:"POST",body:JSON.stringify({name:a})})}async function Ut(a){return Re(`/api/auth/tokens/${a}`,{method:"DELETE"})}async function Rs(a){return Re("/api/update_web_config",{method:"POST",body:JSON.stringify(a)})}t.memo(function(){const{theme:c}=ss(),{themeId:r}=c,f=Ze.find(o=>o.meta.id===r)??Ze[0];return e.jsx("div",{className:"h-10 flex items-center justify-center",children:e.jsx("span",{className:"font-medium transition-all duration-300 leading-none text-center text-fg-secondary",style:{fontFamily:"Inter, system-ui, sans-serif",fontSize:"clamp(0.75rem, 0.6rem + 1.5vw, 1.1rem)",letterSpacing:"-0.02em"},children:f.meta.name})})});const We=t.memo(function({compact:c=!1}){const{theme:r,setTheme:f}=ss(),{themeId:o}=r;return e.jsx("div",{className:l("grid grid-cols-2 gap-2",c?"w-full min-w-0 self-stretch":"w-full"),children:[...Ze].reverse().map(d=>{const N=o===d.meta.id,u=d.meta.isDark;return e.jsxs("button",{type:"button",title:d.meta.name,className:l("flex flex-row items-stretch radius-inner transition-all duration-200 ease-out overflow-hidden cursor-pointer",c&&"h-6",N?"ring-2 ring-sys-blue scale-[1.02]":"opacity-70 hover:opacity-100"),onClick:()=>f(d.meta.id),children:[e.jsx("div",{className:l("flex-1 h-full",u?"bg-[#18181b]":"bg-[#EFF0F1]")}),e.jsx("div",{className:"flex flex-col h-full",children:d.display.palette.map((g,i)=>e.jsx("div",{className:"flex flex-1",children:g.map((n,h)=>e.jsx("div",{className:"w-2 h-full",style:{backgroundColor:n}},h))},i))})]},d.meta.id)})})});let Ps=!1,Fe=null;async function Wt(){if(!Ps)return Fe||(Fe=(async()=>{try{await Promise.all([Te(()=>Promise.resolve({}),__vite__mapDeps([0])),Te(()=>Promise.resolve({}),__vite__mapDeps([1])),Te(()=>Promise.resolve({}),__vite__mapDeps([2])),Te(()=>Promise.resolve({}),__vite__mapDeps([3]))]),Ps=!0}catch(a){console.warn("Failed to load theme fonts:",a)}})(),Fe)}const Xe=t.memo(function(){const{theme:c,setTheme:r}=ss(),{themeId:f}=c,o=f==="breeze dark",d=t.useCallback(N=>{r(N?"breeze dark":"breeze light")},[r]);return e.jsx(ie,{enabled:o,onChange:d,label:e.jsxs(e.Fragment,{children:["Dark Mode: ",o?e.jsx(et,{className:"w-3.5 h-3.5 text-sys-blue inline"}):e.jsx(st,{className:"w-3.5 h-3.5 text-[#e8a517] inline"})]}),tooltip:"Switch between dark and light mode",size:"md"})}),Xt=t.memo(function({layout:c="horizontal"}){return t.useEffect(()=>{Wt()},[]),c==="toggle-only"?e.jsx(Xe,{}):c==="thumbnails-only"?e.jsx(We,{}):c==="vertical"?e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx(Xe,{}),e.jsx(We,{})]}):e.jsxs("div",{className:"flex items-stretch gap-4",children:[e.jsx("div",{className:"flex-shrink-0 flex items-start",children:e.jsx(Xe,{})}),e.jsx(We,{compact:!0})]})}),Yt=1e4,Ye=2e3;function Je(a,c,r){const[f,o]=t.useState("idle"),[d,N]=t.useState(null),u=t.useRef(!0),g=t.useRef(null),i=t.useRef(null),n=t.useRef(!1),h=t.useRef("idle"),T=t.useRef(a),p=t.useRef(c),D=t.useRef(r);h.current=f,T.current=a,p.current=c,D.current=r,t.useEffect(()=>(u.current=!0,()=>{u.current=!1,g.current&&clearTimeout(g.current),i.current&&clearTimeout(i.current)}),[]);const w=t.useCallback(async y=>{if(h.current==="loading")return;const E=T.current;g.current&&clearTimeout(g.current),i.current&&clearTimeout(i.current),n.current=!1,N(y),o("loading"),g.current=setTimeout(()=>{n.current||!u.current||(N(E),o("error"),i.current=setTimeout(()=>{u.current&&(o("idle"),N(null))},Ye))},Yt);try{if(await p.current(y),n.current=!0,g.current&&clearTimeout(g.current),!u.current)return;o("success"),i.current=setTimeout(()=>{var b;u.current&&(o("idle"),N(null),(b=D.current)==null||b.call(D))},Ye)}catch{if(n.current=!0,g.current&&clearTimeout(g.current),!u.current)return;N(E),o("error"),i.current=setTimeout(()=>{u.current&&(o("idle"),N(null))},Ye)}},[]);return{enabled:d!==null?d:a,status:f,toggle:w}}function Jt(){const{latitude:a,longitude:c,enabled:r,setLocation:f,enable:o,disable:d,clear:N}=tt(),[u,g]=t.useState(!1),[i,n]=t.useState(""),[h,T]=t.useState(""),[p,D]=t.useState("idle"),[w,k]=t.useState(null),y=t.useRef(null),E=t.useRef(null),b=t.useRef(!0);t.useEffect(()=>(b.current=!0,()=>{b.current=!1,E.current&&clearTimeout(E.current)}),[]);const z=()=>{n((a==null?void 0:a.toFixed(6))??""),T((c==null?void 0:c.toFixed(6))??""),k(null),g(!0)},O=()=>{g(!1),k(null)};t.useEffect(()=>{if(!u)return;const m=K=>{p!=="loading"&&y.current&&!y.current.contains(K.target)&&O()};return document.addEventListener("mouseup",m),()=>document.removeEventListener("mouseup",m)},[u,p]);const v=(m,K)=>{const C=parseFloat(m),G=parseFloat(K);return isNaN(C)||isNaN(G)?"Please enter valid numbers":C<-90||C>90?"Latitude must be between -90 and 90":G<-180||G>180?"Longitude must be between -180 and 180":C===0&&G===0?"Coordinates (0, 0) are invalid":null},_=()=>{if(p==="loading")return;E.current&&clearTimeout(E.current);const m=v(i,h);if(m){k(m);return}D("loading"),k(null);const K=parseFloat(i),C=parseFloat(h);f(K,C),r||o(),D("success"),E.current=setTimeout(()=>{b.current&&(D("idle"),g(!1))},1e3)},P=()=>{r?d():o()},A=()=>{N(),g(!1)},S=a!==null&&c!==null;return e.jsx(Y,{children:e.jsxs("div",{ref:y,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx(X,{icon:e.jsx(qt,{}),title:"Stealth"}),e.jsxs("div",{className:"flex items-center gap-1",children:[S&&!u&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:P,className:l("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2 mr-2",r?"bg-toggle-on border-toggle-on":"bg-toggle-off border-edge-subtle"),title:r?"Disable stealth location":"Enable stealth location",children:e.jsx("span",{className:l("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",r?"translate-x-5":"translate-x-0.5")})}),e.jsx("button",{onClick:A,className:"p-2 rounded-lg transition-colors text-fg-muted hover:text-sys-red hover:bg-sys-red/10",title:"Clear stealth location",children:e.jsx(Is,{className:"w-4 h-4"})})]}),u?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:O,disabled:p==="loading",className:l("p-2 rounded-lg transition-colors",p==="loading"?"text-fg-muted cursor-not-allowed":"text-fg-muted hover:text-sys-red hover:bg-sys-red/10"),title:"Cancel",children:e.jsx(J,{className:"w-4 h-4"})}),e.jsx("button",{onClick:_,disabled:p==="loading",className:l("p-2 rounded-lg transition-colors",p==="loading"?"text-sys-blue cursor-wait":p==="success"?"text-sys-green":p==="error"?"text-sys-red":"text-sys-green hover:bg-sys-green/10"),title:"Save",children:p==="loading"?e.jsx($,{className:"w-4 h-4 animate-spin"}):p==="success"?e.jsx(B,{className:"w-4 h-4"}):p==="error"?e.jsx(J,{className:"w-4 h-4"}):e.jsx(B,{className:"w-4 h-4"})})]}):e.jsx("button",{onClick:z,className:"p-2 rounded-lg transition-colors text-fg-muted hover:text-fg-primary hover:bg-subtle",title:S?"Edit stealth location":"Set stealth location",children:e.jsx(es,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"bg-sys-cyan/5 rounded-xl p-3 mb-4",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{className:"w-4 h-4 text-sys-cyan flex-shrink-0 mt-0.5"}),e.jsxs("p",{className:"type-body-sm text-fg-muted",children:[e.jsx("span",{className:"text-fg-secondary",children:"Stealth mode"})," allows you to appear on the map and in topology analysis without broadcasting your location. Coordinates are stored locally in your browser only — ",e.jsx("span",{className:"text-sys-cyan",children:"never sent to config.yaml or the mesh"}),"."]})]})}),w&&e.jsx("div",{className:"text-xs mb-3 px-2 py-1.5 rounded-md text-sys-red bg-sys-red/10",children:w}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-1",children:u?"Latitude (°)":"Latitude"}),e.jsx("div",{className:l("h-[38px] rounded-full px-4 flex items-center transition-colors","bg-subtle-fill"),children:u?e.jsx("input",{type:"number",value:i,onChange:m=>n(m.target.value),step:"0.000001",min:"-90",max:"90",placeholder:"e.g. 34.052234",className:"w-full bg-transparent text-fg-primary focus:outline-none type-data placeholder:text-fg-muted/50"}):e.jsx("span",{className:l("type-data",S&&r?"text-fg-primary":"text-fg-muted"),children:S?a.toFixed(6):"Not set"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-1",children:u?"Longitude (°)":"Longitude"}),e.jsx("div",{className:l("h-[38px] rounded-full px-4 flex items-center transition-colors","bg-subtle-fill"),children:u?e.jsx("input",{type:"number",value:h,onChange:m=>T(m.target.value),step:"0.000001",min:"-180",max:"180",placeholder:"e.g. -118.243685",className:"w-full bg-transparent text-fg-primary focus:outline-none type-data placeholder:text-fg-muted/50"}):e.jsx("span",{className:l("type-data",S&&r?"text-fg-primary":"text-fg-muted"),children:S?c.toFixed(6):"Not set"})})]})]}),S&&!u&&e.jsx("div",{className:"mt-3 pt-3 border-t border-edge-subtle",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:l("w-2 h-2 rounded-full",r?"bg-sys-green":"bg-fg-muted")}),e.jsx("span",{className:"type-body-sm text-fg-muted",children:r?"Stealth location active — you appear on maps with these coordinates":"Stealth location disabled — coordinates saved but not in use"})]})})]})})}const Zt=[{value:7.8,label:"7.8 kHz"},{value:10.4,label:"10.4 kHz"},{value:15.6,label:"15.6 kHz"},{value:20.8,label:"20.8 kHz"},{value:31.25,label:"31.25 kHz"},{value:41.7,label:"41.7 kHz"},{value:62.5,label:"62.5 kHz"},{value:125,label:"125 kHz"},{value:250,label:"250 kHz"},{value:500,label:"500 kHz"}],Qt=[5,6,7,8,9,10,11,12],ea=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}],Ds={RADIO_CONFIG:"radioConfig"};function sa(a){if(!a)return"Never";const r=Date.now()-a*1e3,f=Math.floor(r/6e4),o=Math.floor(r/36e5),d=Math.floor(r/864e5);return f<1?"Just now":f<60?`${f}m ago`:o<24?`${o}h ago`:d<365?`${d}d ago`:`${Math.floor(d/365)}y ago`}function Ms({node:a,level:c,expandedKeys:r,selectedKeyId:f,globalFloodPolicy:o,onSelect:d,onToggle:N}){const u=r.has(a.id),g=f===a.id,i=a.children&&a.children.length>0,n=o==="allow";return e.jsxs("div",{children:[e.jsxs("div",{className:l("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",g?"bg-sys-blue/15":"hover:bg-subtle-fill",n&&"opacity-50 cursor-not-allowed"),style:{marginLeft:`${c*16}px`},onClick:()=>!n&&d(a.id),children:[i?e.jsx("button",{onClick:h=>{h.stopPropagation(),N(a.id)},className:"p-1 hover:bg-subtle-fill-hover rounded-full transition-colors",children:e.jsx(It,{className:l("w-3.5 h-3.5 text-fg-muted transition-transform",u&&"rotate-90")})}):e.jsx("span",{className:"w-5"}),e.jsx(Lt,{className:"w-4 h-4 text-sys-blue flex-shrink-0"}),e.jsx("span",{className:"type-data text-fg-primary flex-1 truncate",children:a.name}),e.jsx("span",{className:"type-data-xs text-fg-muted hidden sm:inline",title:a.last_used?new Date(a.last_used*1e3).toLocaleString():void 0,children:sa(a.last_used)}),e.jsx("span",{className:l("type-data-xs px-2 py-0.5 rounded-full",a.floodPolicy==="allow"?"bg-sys-green/15 text-sys-green":"bg-sys-red/15 text-sys-red"),children:a.floodPolicy==="allow"?"Allow":"Deny"})]}),i&&u&&e.jsx("div",{children:a.children.map(h=>e.jsx(Ms,{node:h,level:c+1,expandedKeys:r,selectedKeyId:f,globalFloodPolicy:o,onSelect:d,onToggle:N},h.id))})]})}function ta(){const[a,c]=t.useState(kt),[r,f]=t.useState(wt),[o,d]=t.useState(!1),N=t.useCallback(i=>{c(i),Ct(i)},[]),u=t.useCallback(i=>{const n=parseFloat(i.target.value);f(n),St(n)},[]),g=t.useCallback(async()=>{o||(d(!0),await Tt(),d(!1))},[o]);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(ie,{enabled:a,onChange:N,label:e.jsxs(e.Fragment,{children:["Sound: ",e.jsx("span",{className:a?"text-sys-green":"text-sys-red",children:a?"On":"Off"})]}),tooltip:"Enable or disable UI sound effects and haptic audio feedback",size:"md"}),e.jsx(F,{color:"primary",outline:!0,onClick:g,disabled:!a||o,className:"w-16 justify-center",children:o?"…":"Test"})]}),e.jsxs("div",{className:l("flex items-center gap-3",!a&&"opacity-40 pointer-events-none"),children:[e.jsx("span",{className:"type-label text-fg-muted w-14 shrink-0",children:"Volume"}),e.jsx("input",{type:"range",min:0,max:1,step:.05,value:r,onChange:u,className:"flex-1 accent-sys-blue h-1.5 cursor-pointer"}),e.jsxs("span",{className:"data-box w-16 justify-center",children:[Math.round(r*100),"%"]})]})]})}function ba(){var vs,Ns,ks,ws,Cs,Ss;const{stats:a,setMode:c,clearModeMutation:r,setDutyCycleConfig:f,clearDutyCycleMutation:o,fetchStats:d,startMutation:N,clearMutation:u}=at(),g=nt(),i=(vs=a==null?void 0:a.config)==null?void 0:vs.radio,n=(Ns=a==null?void 0:a.config)==null?void 0:Ns.repeater,h=(ks=a==null?void 0:a.config)==null?void 0:ks.duty_cycle,T=(a==null?void 0:a.node_name)||((ws=a==null?void 0:a.config)==null?void 0:ws.node_name)||"Unknown Node",p=(n==null?void 0:n.mode)??"forward",D=(h==null?void 0:h.enforcement_enabled)??!1,w=(Cs=a==null?void 0:a.config)==null?void 0:Cs.delays,k=t.useRef(!0);t.useEffect(()=>(k.current=!0,()=>{k.current=!1}),[]);const y=(Ss=a==null?void 0:a.config)==null?void 0:Ss.web,[E,b]=t.useState([]),[z,O]=t.useState(!1),[v,_]=t.useState(null),[P,A]=t.useState(!1),[S,m]=t.useState(""),[K,C]=t.useState(null),[G,ge]=t.useState(!1),[ae,Pe]=t.useState(null),[De,ts]=t.useState(!1),[as,ns]=t.useState(!1),[ls,rs]=t.useState(!1),[U,As]=t.useState([]),[Ks,is]=t.useState(!1),[os,I]=t.useState(null),[Z,Ls]=t.useState(()=>localStorage.getItem("pymc:globalFloodPolicy")==="allow"?"allow":"deny"),cs=t.useCallback(s=>{Ls(s),localStorage.setItem("pymc:globalFloodPolicy",s)},[]),[ds,us]=t.useState(!1),[L,Ie]=t.useState(null),[zs,Os]=t.useState(new Set),[be,me]=t.useState(!1),[je,ne]=t.useState(!1),[ve,le]=t.useState(!1),[M,W]=t.useState(null),[Q,xe]=t.useState(null),[Ne,ke]=t.useState(""),[Me,fe]=t.useState("allow"),[q,re]=t.useState(!1),[we,ms]=t.useState(!0),[he,Ae]=t.useState(!1),[Vs,xs]=t.useState(!0),[pe,ee]=t.useState("idle"),[Hs,Ke]=t.useState(!1),[Le,$s]=t.useState(!1),fs=t.useCallback(()=>{const s=w==null?void 0:w.tx_delay_factor;return s&&typeof s=="object"&&"parsedValue"in s?s.parsedValue??1:typeof s=="number"?s:1},[w]),hs=t.useCallback(()=>{const s=w==null?void 0:w.direct_tx_delay_factor;return typeof s=="number"?s:.5},[w]),ze=t.useCallback(()=>{const s=h==null?void 0:h.max_airtime_percent;return typeof s=="number"?s:s&&typeof s=="object"&&"parsedValue"in s?s.parsedValue??6:6},[h]),Oe=Je(p==="forward",async s=>{await c(s?"forward":"monitor")},r),Ve=Je(D,async s=>{await f({max_airtime_percent:ze(),enforcement_enabled:s})},o),He=Je((y==null?void 0:y.cors_enabled)??!1,async s=>{var j;const x=await Rs({web:{cors_enabled:s}});if(!x.success&&!((j=x.data)!=null&&j.persisted))throw new Error("CORS update failed");await d()}),V=t.useCallback(async s=>{N(Ds.RADIO_CONFIG);try{const x=await lt(s);if(!x.success)throw new Error(x.error||"Failed to save");await d({force:!0}).catch(()=>{})}finally{u(Ds.RADIO_CONFIG)}},[N,u,d]);t.useEffect(()=>{(async()=>{xs(!0);try{const x=await ht();x.success&&x.data?Ae(x.data.exists):Ae(!1);const j=y==null?void 0:y.web_path;ms(!j||j==="")}catch{Ae(!1)}finally{xs(!1)}})()},[y==null?void 0:y.web_path]);const ps=async s=>{var x;if(pe!=="loading"){ee("loading");try{const j=await Rs({web:{web_path:s?null:"/opt/pymc_console/web/html"}});if(!k.current)return;j.success||(x=j.data)!=null&&x.persisted?(ms(s),ee("success"),Ke(!0),setTimeout(()=>{k.current&&ee("idle")},2e3)):(ee("error"),setTimeout(()=>{k.current&&ee("idle")},2e3))}catch{if(!k.current)return;ee("error"),setTimeout(()=>{k.current&&ee("idle")},2e3)}}},qs=async()=>{if(!Le){$s(!0);try{await pt(),Ke(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{Ke(!1),setTimeout(()=>{window.location.reload()},3e3)}}},Ce=t.useCallback(async()=>{O(!0),_(null);try{const s=await Gt();b(s.tokens||[])}catch(s){_(s instanceof Error?s.message:"Failed to fetch tokens")}finally{O(!1)}},[]);t.useEffect(()=>{Ce()},[Ce]);const ys=async()=>{if(!S.trim()){_("Token name is required");return}ts(!0),_(null);try{const s=await Bt(S.trim());C(s.token||null),A(!1),ge(!0),m(""),await Ce()}catch(s){_(s instanceof Error?s.message:"Failed to create token")}finally{ts(!1)}},Gs=async()=>{if(ae){ns(!0),_(null);try{await Ut(ae.id),await Ce(),Pe(null)}catch(s){_(s instanceof Error?s.message:"Failed to revoke token")}finally{ns(!1)}}},Bs=async()=>{K&&(await mt(K),rs(!0),setTimeout(()=>rs(!1),2e3))},gs=s=>s?new Date(s*1e3).toLocaleString():"Never",bs=t.useCallback(s=>{const x=new Map,j=[];return s.forEach(R=>{const Se={id:R.id,name:R.name,floodPolicy:R.flood_policy,transport_key:R.transport_key,last_used:R.last_used,parent_id:R.parent_id,children:[]};x.set(R.id,Se)}),x.forEach(R=>{R.parent_id&&x.has(R.parent_id)?x.get(R.parent_id).children.push(R):j.push(R)}),j},[]),ye=t.useCallback(async()=>{is(!0),I(null);try{const s=await xt();if(s.success&&s.data){const x=bs(s.data);As(x),Ie(j=>{if(j===null)return null;const R=Se=>{for(const $e of Se)if($e.id===j||$e.children&&R($e.children))return!0;return!1};return R(x)?j:null})}else I(s.error||"Failed to load transport keys")}catch(s){I(s instanceof Error?s.message:"Unknown error occurred")}finally{is(!1)}},[bs]);t.useEffect(()=>{ye(),ft().then(s=>{s.success&&s.data&&cs(s.data.global_flood_allow?"allow":"deny")}).catch(()=>{})},[ye]);const se=t.useCallback((s,x)=>{for(const j of s){if(j.id===x)return j;if(j.children){const R=se(j.children,x);if(R)return R}}return null},[]),Us=t.useCallback(()=>{if(!L)return;const s=se(U,L);return s==null?void 0:s.name},[L,U,se]),Ws=t.useCallback(s=>{Os(x=>{const j=new Set(x);return j.has(s)?j.delete(s):j.add(s),j})},[]),Xs=async s=>{us(!0),I(null);try{const x=await yt(s==="allow");x.success?cs(s):I(x.error||"Failed to update global flood policy")}catch(x){I(x instanceof Error?x.message:"Failed to update global flood policy")}finally{us(!1)}},js=async()=>{if(!Ne.trim()){I("Key name is required");return}re(!0),I(null);try{const s=await gt({name:Ne.trim(),flood_policy:Me,parent_id:L??void 0});s.success?(await ye(),me(!1),ke(""),fe("allow")):I(s.error||"Failed to add transport key")}catch(s){I(s instanceof Error?s.message:"Failed to add transport key")}finally{re(!1)}},Ys=async()=>{if(M){re(!0),I(null);try{const s=await bt(M.id,{name:M.name,flood_policy:M.floodPolicy});s.success?(await ye(),ne(!1),W(null)):I(s.error||"Failed to update transport key")}catch(s){I(s instanceof Error?s.message:"Failed to update transport key")}finally{re(!1)}}},Js=async()=>{if(Q){re(!0),I(null);try{const s=await jt(Q.id);s.success?(await ye(),le(!1),xe(null),Ie(null)):I(s.error||"Failed to delete transport key")}catch(s){I(s instanceof Error?s.message:"Failed to delete transport key")}finally{re(!1)}}},Zs=t.useCallback(()=>{if(!L)return;const s=se(U,L);s&&(W({...s}),ne(!0))},[L,U,se]);t.useEffect(()=>{const s=j=>{j.key==="Escape"&&(be&&(me(!1),ke(""),fe("allow")),je&&(ne(!1),W(null)),ve&&(le(!1),xe(null)),P&&(A(!1),m("")),G&&(ge(!1),C(null)))};if(be||je||ve||P||G)return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[be,je,ve,P,G]);const Qs=t.useCallback(()=>{if(!L)return;const s=se(U,L);s&&(xe(s),le(!0))},[L,U,se]);return e.jsxs(_t,{children:[e.jsx(Ft,{title:"Configuration",icon:e.jsx(_s,{})}),e.jsxs(Et,{ready:g,children:[e.jsxs(te,{template:"standard",children:[e.jsx(_e,{span:12,md:6,children:e.jsxs(Y,{neomorphic:!0,children:[e.jsx(X,{icon:e.jsx(rt,{}),title:"Repeater Settings"}),n?e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx("div",{className:"col-span-2",children:e.jsx(H,{label:"Node Name",value:T,onSave:async s=>V({node_name:s}),placeholder:"Enter node name",maxLength:50})}),e.jsx(H,{label:"Latitude",value:n.latitude!==0?n.latitude.toFixed(6):"Not set",editValue:String(n.latitude),type:"number",suffix:"°",step:1e-6,min:-90,max:90,onSave:async s=>V({latitude:parseFloat(s)})}),e.jsx(H,{label:"Longitude",value:n.longitude!==0?n.longitude.toFixed(6):"Not set",editValue:String(n.longitude),type:"number",suffix:"°",step:1e-6,min:-180,max:180,onSave:async s=>V({longitude:parseFloat(s)})}),e.jsx(H,{label:"Advert Interval",value:n.send_advert_interval_hours>0?`${n.send_advert_interval_hours}h`:"Disabled",editValue:String(n.send_advert_interval_hours),type:"number",suffix:"hours",min:0,max:48,description:"0 = disabled, 3-48 hours",onSave:async s=>V({flood_advert_interval_hours:parseInt(s,10)})}),e.jsx(H,{label:"Score-based TX",value:n.use_score_for_tx?"Enabled":"Disabled",readOnly:!0})]}):e.jsx("p",{className:"text-fg-muted",children:"Loading repeater settings..."})]})}),e.jsx(_e,{span:12,md:6,children:e.jsxs(Y,{neomorphic:!0,children:[e.jsx(X,{icon:e.jsx(Rt,{}),title:"Radio Configuration"}),i?e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(H,{label:"Frequency",value:it(i.frequency),editValue:(i.frequency/1e6).toFixed(3),type:"number",suffix:"MHz",step:.001,min:400,max:930,onSave:async s=>V({frequency_mhz:parseFloat(s)})}),e.jsx(H,{label:"TX Power",value:`${i.tx_power} dBm`,editValue:String(i.tx_power),type:"number",suffix:"dBm",min:2,max:30,onSave:async s=>V({tx_power:parseInt(s,10)})}),e.jsx(Ue,{label:"Bandwidth",value:ot(i.bandwidth),editValue:i.bandwidth/1e3,options:Zt,onSave:async s=>V({bandwidth_khz:parseFloat(s)})}),e.jsx(Ue,{label:"Spreading Factor",value:`SF${i.spreading_factor}`,editValue:i.spreading_factor,options:Qt.map(s=>({value:s,label:`SF${s}`})),onSave:async s=>V({spreading_factor:parseInt(s,10)})}),e.jsx(Ue,{label:"Coding Rate",value:`4/${i.coding_rate}`,editValue:i.coding_rate,options:ea,onSave:async s=>V({coding_rate:parseInt(s,10)})}),e.jsx(H,{label:"Preamble",value:`${i.preamble_length} symbols`,readOnly:!0})]}):e.jsx("p",{className:"text-fg-muted",children:"Loading radio configuration..."})]})})]}),e.jsxs(te,{template:"standard",children:[e.jsx(_e,{span:12,md:6,children:e.jsxs(Y,{neomorphic:!0,children:[e.jsx(X,{icon:e.jsx(ct,{}),title:"Operating Mode"}),e.jsx("p",{className:"type-label text-fg-muted mb-3",children:"Control how the repeater handles packets"}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsx(ie,{enabled:Oe.enabled,onChange:Oe.toggle,label:"Repeat",tooltip:"Toggles repeater or monitor mode. In monitor mode, the repeater will not repeat packets from the mesh.",status:Oe.status,size:"md"}),e.jsx(ie,{enabled:Ve.enabled,onChange:Ve.toggle,label:"Duty Cycle",tooltip:"Limit transmission time to comply with airtime utilization regulations",status:Ve.status,size:"md"}),e.jsx(H,{label:"Max Airtime",layout:"inline",value:`${ze().toFixed(1)}%`,editValue:String(ze()),type:"number",suffix:"%",step:.5,min:.1,max:100,onSave:async s=>{await f({max_airtime_percent:parseFloat(s),enforcement_enabled:D}),o()}})]}),e.jsx("div",{className:"hidden lg:block w-px bg-border-subtle"}),e.jsxs("div",{className:"flex-1 pt-4 lg:pt-0 border-t lg:border-t-0 border-edge-subtle",children:[e.jsx("label",{className:"type-label text-fg-muted block mb-3",children:"TX Delays"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(H,{label:"Flood",layout:"inline",value:`${fs().toFixed(2)}x`,editValue:String(fs()),type:"number",suffix:"x",step:.1,min:0,max:5,onSave:async s=>V({tx_delay_factor:parseFloat(s)})}),e.jsx(H,{label:"Direct",layout:"inline",value:`${hs().toFixed(2)}s`,editValue:String(hs()),type:"number",suffix:"s",step:.1,min:0,max:5,onSave:async s=>V({direct_tx_delay_factor:parseFloat(s)})})]})]})]})]})}),e.jsx(_e,{span:12,md:6,children:e.jsxs(Y,{neomorphic:!0,children:[e.jsx(X,{icon:e.jsx(_s,{}),title:"App Settings"}),e.jsx("p",{className:"type-body-sm text-fg-muted mb-4",children:"Appearance and web server options."}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(ie,{enabled:He.enabled,onChange:He.toggle,label:"Enable CORS",tooltip:"Allow cross-origin API access",status:He.status,size:"md"}),e.jsx("div",{children:e.jsx(Xt,{})}),e.jsx(ta,{})]})]})})]}),e.jsx(te,{template:"auto",children:e.jsxs(Y,{neomorphic:!0,children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[e.jsx(X,{icon:e.jsx(Es,{}),title:"Regions Transport Keys",subtitle:"Manage regional key hierarchy for flood control"}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(F,{color:"primary",outline:!0,onClick:()=>me(!0),disabled:Z==="allow",children:[e.jsx(Fs,{"data-slot":"icon"}),"Add"]}),e.jsx(F,{color:"primary",outline:!0,onClick:Zs,disabled:!L||Z==="allow",children:"Edit"}),e.jsx(F,{color:"danger",outline:!0,onClick:Qs,disabled:!L||Z==="allow",children:"Delete"})]})]}),e.jsx("div",{className:"bg-subtle-fill radius-inner p-4 mb-4",children:e.jsx(ie,{enabled:Z==="deny",onChange:s=>Xs(s?"deny":"allow"),label:e.jsxs(e.Fragment,{children:["Require Transport Keys: ",e.jsx("span",{className:Z==="deny"?"text-sys-green":"text-sys-red",children:Z==="deny"?"On":"Off"})]}),tooltip:"When enabled, only packets with matching transport keys are forwarded. When disabled, all packets flood freely.",status:ds?"loading":"idle",disabled:ds,dangerOff:!0,size:"md",className:"flex-row-reverse justify-between w-full"})}),os&&e.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-sys-red bg-sys-red/10",children:os}),e.jsx("div",{className:"bg-subtle-fill radius-inner p-4 min-h-[120px]",children:Ks?e.jsxs("div",{className:"flex items-center justify-center py-6",children:[e.jsx($,{className:"w-5 h-5 animate-spin text-sys-blue mr-2"}),e.jsx("span",{className:"type-body-sm text-fg-muted",children:"Loading transport keys..."})]}):U.length===0?e.jsxs("div",{className:"text-center py-6",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-subtle-fill mx-auto mb-3 flex items-center justify-center",children:e.jsx(Es,{className:"w-6 h-6 text-fg-muted/50"})}),e.jsx("p",{className:"type-body text-fg-muted",children:"No transport keys found"}),e.jsx("p",{className:"type-body-sm text-fg-muted/70 mt-1",children:"Add your first transport key to get started"})]}):e.jsx("div",{className:"space-y-1",children:U.map(s=>e.jsx(Ms,{node:s,level:0,expandedKeys:zs,selectedKeyId:L,globalFloodPolicy:Z,onSelect:Ie,onToggle:Ws},s.id))})})]})}),e.jsx(te,{template:"auto",children:e.jsxs(Y,{neomorphic:!0,children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[e.jsx(X,{icon:e.jsx(Ge,{}),title:"API Tokens",subtitle:"Manage API tokens for machine-to-machine authentication"}),e.jsxs(F,{color:"primary",outline:!0,onClick:()=>A(!0),children:[e.jsx(Fs,{"data-slot":"icon"}),"Create Token"]})]}),e.jsx("div",{className:"bg-sys-blue/5 radius-inner p-4 mb-4",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-sys-blue/20 flex items-center justify-center flex-shrink-0",children:e.jsx(Qe,{className:"w-4 h-4 text-sys-blue"})}),e.jsxs("div",{className:"type-body-sm text-fg-muted",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-secondary",children:"API tokens"})," are used for machine-to-machine authentication. Include the token in the ",e.jsx("code",{className:"type-code bg-sys-blue/20 px-1.5 py-0.5 rounded-full text-sys-blue",children:"X-API-Key"})," header when making API requests."]}),e.jsx("p",{className:"mt-1 text-fg-muted/70",children:"Tokens are only shown once at creation. Store them securely."})]})]})}),v&&e.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-sys-red bg-sys-red/10",children:v}),z&&E.length===0?e.jsxs("div",{className:"flex items-center justify-center py-6",children:[e.jsx($,{className:"w-5 h-5 animate-spin text-sys-blue mr-2"}),e.jsx("span",{className:"type-body-sm text-fg-muted",children:"Loading tokens..."})]}):E.length>0?e.jsx("div",{className:"space-y-2",children:E.map(s=>e.jsx("div",{className:"bg-subtle-fill hover:bg-subtle-fill-strong radius-inner p-4 transition-base",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-sys-blue/10 flex items-center justify-center flex-shrink-0",children:e.jsx(Ge,{className:"w-5 h-5 text-sys-blue"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"type-body text-fg-primary font-medium truncate",children:s.name}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-0.5",children:[e.jsxs("span",{className:"type-data-sm text-fg-muted truncate",children:["Created: ",gs(s.created_at)]}),e.jsxs("span",{className:"type-data-sm text-fg-muted truncate",children:["Last used: ",gs(s.last_used)]})]})]})]}),e.jsxs(F,{color:"danger",outline:!0,onClick:()=>Pe({id:s.id,name:s.name}),disabled:as,children:[e.jsx(Is,{"data-slot":"icon"}),"Revoke"]})]})},s.id))}):e.jsxs("div",{className:"bg-subtle-fill radius-inner p-6 text-center",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:e.jsx(Ge,{className:"w-7 h-7 text-fg-muted/50"})}),e.jsx("h3",{className:"type-body text-fg-primary font-medium mb-1",children:"No API Tokens"}),e.jsx("p",{className:"type-body-sm text-fg-muted mb-4",children:"Create a token to enable API access"}),e.jsx(F,{color:"primary",outline:!0,onClick:()=>A(!0),children:"Create Your First Token"})]})]})}),e.jsx(te,{template:"auto",children:e.jsxs(Y,{neomorphic:!0,children:[e.jsx(X,{icon:e.jsx(Vt,{}),title:"Web Frontend",subtitle:"Choose which web interface to use",className:"mb-4"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:l("flex items-start gap-3 p-4 bg-subtle-fill radius-card border-2 cursor-pointer transition-base",we?"border-sys-blue bg-sys-blue/5":"border-transparent hover:border-sys-blue/30",pe==="loading"&&"opacity-50 pointer-events-none"),children:[e.jsx("input",{type:"radio",name:"frontend",checked:we,onChange:()=>ps(!0),disabled:pe==="loading",className:"mt-1 h-4 w-4 text-sys-blue focus:ring-sys-blue focus:ring-offset-bg-elevated"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"type-body text-fg-primary font-medium",children:"Default Frontend"}),e.jsx("a",{href:"https://github.com/rightup/pyMC_Repeater",target:"_blank",rel:"noopener noreferrer",onClick:s=>s.stopPropagation(),className:"type-data-xs bg-sys-cyan/15 text-sys-cyan px-2.5 py-0.5 rounded-full font-medium hover:bg-sys-cyan/25 transition-colors",children:"@RightUp"})]}),e.jsx("div",{className:"type-body-sm text-fg-muted mt-1",children:"Built-in pyMC Repeater web interface"}),e.jsx("div",{className:"type-data-xs text-fg-muted/60 mt-1",children:"/opt/pymc_repeater/repeater/web/html"})]})]}),e.jsxs("label",{className:l("flex items-start gap-3 p-4 bg-subtle-fill radius-card border-2 cursor-pointer transition-base",we?"border-transparent hover:border-sys-blue/30":"border-sys-blue bg-sys-blue/5",pe==="loading"&&"opacity-50 pointer-events-none"),children:[e.jsx("input",{type:"radio",name:"frontend",checked:!we,onChange:()=>ps(!1),disabled:pe==="loading",className:"mt-1 h-4 w-4 text-sys-blue focus:ring-sys-blue focus:ring-offset-bg-elevated"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"type-body text-fg-primary font-medium",children:"PyMC Console"}),e.jsx("span",{className:"type-data-xs bg-sys-indigo/15 text-sys-indigo px-2.5 py-0.5 rounded-full font-medium",children:"@Treehouse ⚡"})]}),e.jsx("div",{className:"type-body-sm text-fg-muted mt-1",children:"Alternative web interface for pyMC Repeater"}),e.jsx("div",{className:"type-data-xs text-fg-muted/60 mt-1",children:"/opt/pymc_console/web/html"})]})]})]}),!Vs&&e.jsx("div",{className:l("bg-subtle-fill radius-card p-4",he?"border border-sys-green/20":"border border-sys-cyan/20"),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:l("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",he?"bg-sys-green/20":"bg-sys-cyan/20"),children:he?e.jsx(Pt,{className:"w-4 h-4 text-sys-green"}):e.jsx(Qe,{className:"w-4 h-4 text-sys-cyan"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"type-body text-fg-primary font-medium",children:he?"PyMC Console has been detected":"PyMC Console Not Installed"}),he?e.jsxs("p",{className:"type-body-sm text-fg-muted mt-1",children:["PyMC Console is installed at ",e.jsx("code",{className:"type-code bg-sys-green/10 px-1.5 py-0.5 rounded-full text-sys-green",children:"/opt/pymc_console/web/html"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"type-body-sm text-fg-muted mt-1 mb-3",children:["PyMC Console must be installed at ",e.jsx("code",{className:"type-code bg-sys-cyan/10 px-1.5 py-0.5 rounded-full text-sys-cyan",children:"/opt/pymc_console/web/html"})," before selecting this option."]}),e.jsxs(F,{color:"primary",outline:!0,href:"https://github.com/dmduran12/pymc_console-dist",children:[e.jsx(At,{"data-slot":"icon"}),"PyMC Console Install Instructions"]})]})]})]})}),Hs&&e.jsx("div",{className:"bg-subtle-fill radius-card p-4 border border-sys-indigo/30",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-sys-indigo/20 flex items-center justify-center flex-shrink-0",children:e.jsx(Be,{className:"w-4 h-4 text-sys-indigo"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"type-body text-fg-primary font-medium",children:"Service restart required"}),e.jsx("p",{className:"type-body-sm text-fg-muted mt-1",children:"Web frontend changes will take effect after restarting the pymc-repeater service."})]})]}),e.jsx(F,{color:"warning",outline:!0,onClick:qs,disabled:Le,children:Le?e.jsxs(e.Fragment,{children:[e.jsx($,{"data-slot":"icon",className:"animate-spin"}),"Restarting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Dt,{"data-slot":"icon"}),"Restart Now"]})})]})})]})]})}),a&&e.jsx(te,{template:"auto",children:e.jsx(Nt,{nodeName:T,repeaterVersion:a.version,coreVersion:a.core_version,localHash:a.local_hash,publicKey:a.public_key})}),a&&((n==null?void 0:n.latitude)===0||!(n!=null&&n.latitude))&&((n==null?void 0:n.longitude)===0||!(n!=null&&n.longitude))&&e.jsx(te,{template:"auto",children:e.jsx(Jt,{})})]}),P&&e.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:s=>s.target===s.currentTarget&&A(!1),role:"dialog","aria-modal":"true","aria-labelledby":"create-token-modal-title",children:e.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[e.jsx("h3",{id:"create-token-modal-title",className:"type-micro mb-4",children:"Create API Token"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(qe,{label:"Token Name",type:"text",value:S,onChange:s=>m(s.target.value),placeholder:"e.g., Production Server, CI/CD Pipeline",description:"Give your token a descriptive name to identify its purpose",onKeyDown:s=>s.key==="Enter"&&ys(),autoFocus:!0}),e.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[e.jsx(F,{color:"muted",outline:!0,onClick:()=>{A(!1),m(""),_(null)},disabled:De,children:"Cancel"}),e.jsx(F,{color:"primary",onClick:ys,disabled:De||!S.trim(),children:De?e.jsxs(e.Fragment,{children:[e.jsx($,{"data-slot":"icon",className:"animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),G&&K&&e.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:s=>s.target===s.currentTarget&&ge(!1),role:"dialog","aria-modal":"true","aria-labelledby":"show-token-modal-title",children:e.jsxs("div",{className:"surface-modal radius-card p-6 max-w-lg w-full",children:[e.jsx("h3",{id:"show-token-modal-title",className:"type-micro mb-4",children:"Token Created Successfully"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-sys-indigo/10 border border-sys-indigo/30 radius-inner p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Be,{className:"w-4 h-4 text-sys-indigo flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-fg-secondary",children:[e.jsx("strong",{children:"Save this token now!"})," For security reasons, it will not be shown again."]})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-primary block mb-1.5",children:"Your API Token"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(dt,{value:K,readOnly:!0,className:"flex-1 font-mono"}),e.jsxs(F,{color:"primary",outline:!0,onClick:Bs,children:[ls?e.jsx(B,{"data-slot":"icon",className:"text-sys-green"}):e.jsx(ut,{"data-slot":"icon"}),ls?"Copied!":"Copy"]})]})]}),e.jsxs("div",{className:"bg-sys-cyan/10 border border-sys-cyan/30 radius-inner p-3",children:[e.jsx("p",{className:"text-sm text-fg-secondary mb-2",children:e.jsx("strong",{children:"Usage Example:"})}),e.jsxs("code",{className:"block bg-sys-cyan/20 px-3 py-2 rounded type-code text-sys-cyan overflow-x-auto",children:['curl -H "X-API-Key: ',K.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),e.jsx("div",{className:"flex justify-end mt-6",children:e.jsx(F,{color:"primary",onClick:()=>{ge(!1),C(null)},children:"Done"})})]})]})}),e.jsx(vt,{isOpen:!!ae,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${ae==null?void 0:ae.name}'? This action cannot be undone.`,confirmLabel:as?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:Gs,onCancel:()=>Pe(null)}),be&&e.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:s=>s.target===s.currentTarget&&me(!1),role:"dialog","aria-modal":"true","aria-labelledby":"add-key-modal-title",children:e.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[e.jsx("h3",{id:"add-key-modal-title",className:"type-micro mb-4",children:"Add Transport Key"}),e.jsxs("div",{className:"space-y-4",children:[L&&e.jsxs("div",{className:"bg-sys-cyan/10 border border-sys-cyan/30 radius-inner p-3 text-sm text-fg-secondary",children:["Adding as child of: ",e.jsx("strong",{className:"text-fg-primary",children:Us()})]}),e.jsx(qe,{label:"Key Name",type:"text",value:Ne,onChange:s=>ke(s.target.value),placeholder:"e.g., Region Name, Group Key",onKeyDown:s=>s.key==="Enter"&&js(),autoFocus:!0}),e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Flood Policy"}),e.jsxs("div",{className:"toggle-group w-full",children:[e.jsx("button",{onClick:()=>fe("deny"),className:l("toggle-group-item flex-1",Me==="deny"&&"active !text-sys-red"),children:"Deny"}),e.jsx("button",{onClick:()=>fe("allow"),className:l("toggle-group-item flex-1",Me==="allow"&&"active !text-sys-green"),children:"Allow"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[e.jsx(F,{color:"muted",outline:!0,onClick:()=>{me(!1),ke(""),fe("allow")},disabled:q,children:"Cancel"}),e.jsx(F,{color:"primary",onClick:js,disabled:q||!Ne.trim(),children:q?e.jsxs(e.Fragment,{children:[e.jsx($,{"data-slot":"icon",className:"animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),je&&M&&e.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:s=>s.target===s.currentTarget&&ne(!1),role:"dialog","aria-modal":"true","aria-labelledby":"edit-key-modal-title",children:e.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[e.jsx("h3",{id:"edit-key-modal-title",className:"type-micro mb-4",children:"Edit Transport Key"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(qe,{label:"Key Name",type:"text",value:M.name,onChange:s=>W({...M,name:s.target.value}),autoFocus:!0}),e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Flood Policy"}),e.jsxs("div",{className:"toggle-group w-full",children:[e.jsx("button",{onClick:()=>W({...M,floodPolicy:"deny"}),className:l("toggle-group-item flex-1",M.floodPolicy==="deny"&&"active !text-sys-red"),children:"Deny"}),e.jsx("button",{onClick:()=>W({...M,floodPolicy:"allow"}),className:l("toggle-group-item flex-1",M.floodPolicy==="allow"&&"active !text-sys-green"),children:"Allow"})]})]}),M.transport_key&&e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Transport Key"}),e.jsx("code",{className:"block bg-input-bg px-3 py-2 radius-inner border border-input-border type-code text-fg-muted overflow-x-auto",children:M.transport_key})]}),e.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[e.jsx(F,{color:"danger",outline:!0,onClick:()=>{ne(!1),xe(M),le(!0),W(null)},disabled:q,children:"Delete"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(F,{color:"muted",outline:!0,onClick:()=>{ne(!1),W(null)},disabled:q,children:"Cancel"}),e.jsx(F,{color:"primary",onClick:Ys,disabled:q||!M.name.trim(),children:q?e.jsxs(e.Fragment,{children:[e.jsx($,{"data-slot":"icon",className:"animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),ve&&Q&&e.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:s=>s.target===s.currentTarget&&le(!1),role:"dialog","aria-modal":"true","aria-labelledby":"delete-key-modal-title",children:e.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[e.jsx("h3",{id:"delete-key-modal-title",className:"type-micro mb-4",children:"Delete Transport Key"}),e.jsxs("p",{className:"text-fg-secondary mb-4",children:["Are you sure you want to delete ",e.jsxs("strong",{className:"text-fg-primary",children:["'",Q.name,"'"]}),"?"]}),Q.children&&Q.children.length>0&&e.jsx("div",{className:"bg-sys-indigo/10 border border-sys-indigo/30 radius-inner p-3 mb-4",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Be,{className:"w-4 h-4 text-sys-indigo flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-fg-secondary",children:["This key has ",Q.children.length," child key(s). Deleting will also remove all children."]})]})}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(F,{color:"muted",outline:!0,onClick:()=>{le(!1),xe(null)},disabled:q,children:"Cancel"}),e.jsx(F,{color:"danger",onClick:Js,disabled:q,children:q?e.jsxs(e.Fragment,{children:[e.jsx($,{"data-slot":"icon",className:"animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{ba as default}; + */const Ht=[["path",{d:"M10.17 4.193a2 2 0 0 1 3.666.013",key:"pltmmw"}],["path",{d:"M14 21h2",key:"v4qezv"}],["path",{d:"m15.874 7.743 1 1.732",key:"10m0iw"}],["path",{d:"m18.849 12.952 1 1.732",key:"zadnam"}],["path",{d:"M21.824 18.18a2 2 0 0 1-1.835 2.824",key:"fvwuk4"}],["path",{d:"M4.024 21a2 2 0 0 1-1.839-2.839",key:"1e1kah"}],["path",{d:"m5.136 12.952-1 1.732",key:"1u4ldi"}],["path",{d:"M8 21h2",key:"i9zjee"}],["path",{d:"m8.102 7.743-1 1.732",key:"1zzo4u"}]],qt=ue("triangle-dashed",Ht),Ee=1500,oe={stacked:"h-[38px]",inline:"h-[32px]"},ce={stacked:"px-3",inline:"px-2.5"},de="rounded-lg";function $({label:a,value:c,editValue:r,onSave:f,type:o="text",suffix:d,placeholder:N,readOnly:u=!1,layout:g="stacked",min:i,max:n,step:h,maxLength:T,description:p,className:D}){const[w,k]=t.useState(!1),[y,E]=t.useState(""),[b,z]=t.useState("idle"),O=t.useRef(null),v=t.useRef(!0),_=t.useRef(null),P=!u&&!!f;t.useEffect(()=>(v.current=!0,()=>{v.current=!1,_.current&&clearTimeout(_.current)}),[]);const A=t.useCallback(()=>{P&&(E(r??c),k(!0),z("idle"),requestAnimationFrame(()=>{var C;return(C=O.current)==null?void 0:C.select()}))},[P,r,c]),S=t.useCallback(()=>{k(!1),E(""),z("idle")},[]),m=t.useCallback(async()=>{if(!f||b==="loading")return;if(y===(r??c)){S();return}_.current&&clearTimeout(_.current),z("loading");try{if(await f(y),!v.current)return;z("success"),k(!1),_.current=setTimeout(()=>{v.current&&z("idle")},Ee)}catch{if(!v.current)return;z("error"),_.current=setTimeout(()=>{v.current&&z("idle")},Ee)}},[f,y,r,c,S,b]),K=t.useCallback(C=>{C.key==="Enter"?(C.preventDefault(),m()):C.key==="Escape"&&(C.preventDefault(),S())},[m,S]);return g==="inline"?e.jsxs("div",{className:l("group flex items-center justify-between gap-3",D),children:[e.jsx("label",{className:"type-label text-fg-muted truncate",children:a}),w?e.jsxs("div",{className:l(oe.inline,de,ce.inline,"flex items-center transition-all","bg-transparent border border-sys-blue/50 ring-1 ring-sys-blue/20","min-w-[100px]"),children:[e.jsx("input",{ref:O,type:o,value:y,onChange:C=>E(C.target.value),onKeyDown:K,placeholder:N,min:i,max:n,step:h,maxLength:T,disabled:b==="loading",className:l("bg-transparent text-fg-primary focus:outline-none type-data flex-1 min-w-0",d?"w-12 text-right":"w-full")}),d&&e.jsx("span",{className:"text-fg-muted type-data ml-1 shrink-0",children:d}),e.jsx("div",{className:"flex items-center gap-0.5 ml-2 shrink-0",children:b==="loading"?e.jsx(H,{className:"w-3.5 h-3.5 text-fg-muted animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:m,className:"p-0.5 rounded hover:bg-sys-green/15 text-sys-green transition-colors",title:"Save (Enter)",children:e.jsx(B,{className:"w-3 h-3"})}),e.jsx("button",{onClick:S,className:"p-0.5 rounded hover:bg-sys-red/15 text-fg-muted hover:text-sys-red transition-colors",title:"Cancel (Esc)",children:e.jsx(J,{className:"w-3 h-3"})})]})})]}):e.jsxs("div",{className:l(oe.inline,de,ce.inline,"flex items-center justify-end transition-all min-w-[80px]","bg-input-bg border border-input-border",P&&"cursor-pointer hover:border-edge-strong"),onClick:P?A:void 0,children:[e.jsx("span",{className:"type-data text-fg-primary",children:c}),b==="success"&&e.jsx(B,{className:"w-3 h-3 text-sys-green ml-1.5 shrink-0"}),b==="error"&&e.jsx(J,{className:"w-3 h-3 text-sys-red ml-1.5 shrink-0"}),b==="idle"&&P&&e.jsx(es,{className:"w-3 h-3 text-fg-muted ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]})]}):e.jsxs("div",{className:l("group",D),children:[e.jsx("label",{className:"type-label text-fg-muted block mb-1",children:a}),w?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:l(oe.stacked,de,ce.stacked,"flex items-center transition-all","bg-transparent border border-sys-blue/50 ring-1 ring-sys-blue/20"),children:[e.jsx("input",{ref:O,type:o,value:y,onChange:C=>E(C.target.value),onKeyDown:K,placeholder:N,min:i,max:n,step:h,maxLength:T,disabled:b==="loading",className:"w-full bg-transparent text-fg-primary focus:outline-none type-data flex-1 min-w-0"}),d&&e.jsx("span",{className:"text-fg-muted type-data ml-1 shrink-0",children:d}),e.jsx("div",{className:"flex items-center gap-0.5 ml-2 shrink-0",children:b==="loading"?e.jsx(H,{className:"w-3.5 h-3.5 text-fg-muted animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:m,className:"p-1 rounded hover:bg-sys-green/15 text-sys-green transition-colors",title:"Save (Enter)",children:e.jsx(B,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:S,className:"p-1 rounded hover:bg-sys-red/15 text-fg-muted hover:text-sys-red transition-colors",title:"Cancel (Esc)",children:e.jsx(J,{className:"w-3.5 h-3.5"})})]})})]}),p&&e.jsx("p",{className:"type-data-xs text-fg-muted mt-1 ml-3",children:p})]}):e.jsxs("div",{className:l(oe.stacked,de,ce.stacked,"flex items-center transition-all","bg-input-bg border border-input-border",P&&"cursor-pointer hover:border-edge-strong"),onClick:P?A:void 0,children:[e.jsx("span",{className:"type-data text-fg-primary flex-1 whitespace-nowrap",children:c}),b==="success"&&e.jsx(B,{className:"w-3.5 h-3.5 text-sys-green shrink-0"}),b==="error"&&e.jsx(J,{className:"w-3.5 h-3.5 text-sys-red shrink-0"}),b==="idle"&&P&&e.jsx(es,{className:"w-3.5 h-3.5 text-fg-muted opacity-0 group-hover:opacity-100 transition-opacity shrink-0"})]})]})}function Ue({label:a,value:c,editValue:r,options:f,onSave:o,readOnly:d=!1,layout:N="stacked",className:u}){const[g,i]=t.useState(!1),[n,h]=t.useState(""),[T,p]=t.useState("idle"),D=t.useRef(null),w=t.useRef(!0),k=t.useRef(null),y=!d&&!!o;t.useEffect(()=>(w.current=!0,()=>{w.current=!1,k.current&&clearTimeout(k.current)}),[]);const E=t.useCallback(()=>{y&&(h(String(r)),i(!0),p("idle"),requestAnimationFrame(()=>{var m;return(m=D.current)==null?void 0:m.focus()}))},[y,r]),b=t.useCallback(()=>{i(!1),h(""),p("idle")},[]),z=t.useCallback(async()=>{if(!(!o||T==="loading")){if(n===String(r)){b();return}k.current&&clearTimeout(k.current),p("loading");try{if(await o(n),!w.current)return;p("success"),i(!1),k.current=setTimeout(()=>{w.current&&p("idle")},Ee)}catch{if(!w.current)return;p("error"),k.current=setTimeout(()=>{w.current&&p("idle")},Ee)}}},[o,n,r,b,T]),O=t.useCallback(m=>{m.key==="Escape"&&(m.preventDefault(),b())},[b]),v=N==="inline",_=v?oe.inline:oe.stacked,P=v?ce.inline:ce.stacked,A=e.jsxs("div",{className:l(_,de,P,"flex items-center transition-all relative","bg-transparent border border-sys-blue/50 ring-1 ring-sys-blue/20",v&&"min-w-[100px]"),children:[e.jsx("select",{ref:D,value:n,onChange:m=>h(m.target.value),onKeyDown:O,disabled:T==="loading",className:l("bg-transparent text-fg-primary focus:outline-none appearance-none cursor-pointer type-data flex-1 min-w-0","pr-6"),children:f.map(m=>e.jsx("option",{value:m.value,children:m.label},String(m.value)))}),e.jsx(Ts,{className:"absolute right-auto w-3.5 h-3.5 text-fg-muted pointer-events-none",style:{right:T==="loading"?"2rem":"3.5rem"}}),e.jsx("div",{className:"flex items-center gap-0.5 ml-1 shrink-0",children:T==="loading"?e.jsx(H,{className:l("text-fg-muted animate-spin",v?"w-3 h-3":"w-3.5 h-3.5")}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:z,className:l("rounded hover:bg-sys-green/15 text-sys-green transition-colors",v?"p-0.5":"p-1"),title:"Save",children:e.jsx(B,{className:v?"w-3 h-3":"w-3.5 h-3.5"})}),e.jsx("button",{onClick:b,className:l("rounded hover:bg-sys-red/15 text-fg-muted hover:text-sys-red transition-colors",v?"p-0.5":"p-1"),title:"Cancel (Esc)",children:e.jsx(J,{className:v?"w-3 h-3":"w-3.5 h-3.5"})})]})})]}),S=e.jsxs("div",{className:l(_,de,P,"flex items-center transition-all","bg-input-bg border border-input-border",y&&"cursor-pointer hover:border-edge-strong",v?"justify-end min-w-[80px]":""),onClick:y?E:void 0,children:[e.jsx("span",{className:l("type-data text-fg-primary",!v&&"flex-1"),children:c}),T==="success"&&e.jsx(B,{className:l("text-sys-green shrink-0",v?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")}),T==="error"&&e.jsx(J,{className:l("text-sys-red shrink-0",v?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")}),T==="idle"&&y&&e.jsx(Ts,{className:l("text-fg-muted opacity-0 group-hover:opacity-100 transition-opacity shrink-0",v?"w-3 h-3 ml-1.5":"w-3.5 h-3.5")})]});return v?e.jsxs("div",{className:l("group flex items-center justify-between",u),children:[e.jsx("label",{className:"type-label text-fg-muted shrink-0",children:a}),g?A:S]}):e.jsxs("div",{className:l("group",u),children:[e.jsx("label",{className:"type-label text-fg-muted block mb-1",children:a}),g?A:S]})}async function Gt(){try{return await Re("/api/auth/tokens")}catch{return{tokens:[]}}}async function Bt(a){return Re("/api/auth/tokens",{method:"POST",body:JSON.stringify({name:a})})}async function Ut(a){return Re(`/api/auth/tokens/${a}`,{method:"DELETE"})}async function Rs(a){return Re("/api/update_web_config",{method:"POST",body:JSON.stringify(a)})}t.memo(function(){const{theme:c}=ss(),{themeId:r}=c,f=Ze.find(o=>o.meta.id===r)??Ze[0];return e.jsx("div",{className:"h-10 flex items-center justify-center",children:e.jsx("span",{className:"font-medium transition-all duration-300 leading-none text-center text-fg-secondary",style:{fontFamily:"Inter, system-ui, sans-serif",fontSize:"clamp(0.75rem, 0.6rem + 1.5vw, 1.1rem)",letterSpacing:"-0.02em"},children:f.meta.name})})});const We=t.memo(function({compact:c=!1}){const{theme:r,setTheme:f}=ss(),{themeId:o}=r;return e.jsx("div",{className:l("grid grid-cols-2 gap-2",c?"w-full min-w-0 self-stretch":"w-full"),children:[...Ze].reverse().map(d=>{const N=o===d.meta.id,u=d.meta.isDark;return e.jsxs("button",{type:"button",title:d.meta.name,className:l("flex flex-row items-stretch radius-inner transition-all duration-200 ease-out overflow-hidden cursor-pointer",c&&"h-6",N?"ring-2 ring-sys-blue scale-[1.02]":"opacity-70 hover:opacity-100"),onClick:()=>f(d.meta.id),children:[e.jsx("div",{className:l("flex-1 h-full",u?"bg-[#18181b]":"bg-[#EFF0F1]")}),e.jsx("div",{className:"flex flex-col h-full",children:d.display.palette.map((g,i)=>e.jsx("div",{className:"flex flex-1",children:g.map((n,h)=>e.jsx("div",{className:"w-2 h-full",style:{backgroundColor:n}},h))},i))})]},d.meta.id)})})});let Ps=!1,Fe=null;async function Wt(){if(!Ps)return Fe||(Fe=(async()=>{try{await Promise.all([Te(()=>Promise.resolve({}),__vite__mapDeps([0])),Te(()=>Promise.resolve({}),__vite__mapDeps([1])),Te(()=>Promise.resolve({}),__vite__mapDeps([2])),Te(()=>Promise.resolve({}),__vite__mapDeps([3]))]),Ps=!0}catch(a){console.warn("Failed to load theme fonts:",a)}})(),Fe)}const Xe=t.memo(function(){const{theme:c,setTheme:r}=ss(),{themeId:f}=c,o=f==="breeze dark",d=t.useCallback(N=>{r(N?"breeze dark":"breeze light")},[r]);return e.jsx(ie,{enabled:o,onChange:d,label:e.jsxs(e.Fragment,{children:["Dark Mode: ",o?e.jsx(et,{className:"w-3.5 h-3.5 text-sys-blue inline"}):e.jsx(st,{className:"w-3.5 h-3.5 text-[#e8a517] inline"})]}),tooltip:"Switch between dark and light mode",size:"md"})}),Xt=t.memo(function({layout:c="horizontal"}){return t.useEffect(()=>{Wt()},[]),c==="toggle-only"?e.jsx(Xe,{}):c==="thumbnails-only"?e.jsx(We,{}):c==="vertical"?e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx(Xe,{}),e.jsx(We,{})]}):e.jsxs("div",{className:"flex items-stretch gap-4",children:[e.jsx("div",{className:"flex-shrink-0 flex items-start",children:e.jsx(Xe,{})}),e.jsx(We,{compact:!0})]})}),Yt=1e4,Ye=2e3;function Je(a,c,r){const[f,o]=t.useState("idle"),[d,N]=t.useState(null),u=t.useRef(!0),g=t.useRef(null),i=t.useRef(null),n=t.useRef(!1),h=t.useRef("idle"),T=t.useRef(a),p=t.useRef(c),D=t.useRef(r);h.current=f,T.current=a,p.current=c,D.current=r,t.useEffect(()=>(u.current=!0,()=>{u.current=!1,g.current&&clearTimeout(g.current),i.current&&clearTimeout(i.current)}),[]);const w=t.useCallback(async y=>{if(h.current==="loading")return;const E=T.current;g.current&&clearTimeout(g.current),i.current&&clearTimeout(i.current),n.current=!1,N(y),o("loading"),g.current=setTimeout(()=>{n.current||!u.current||(N(E),o("error"),i.current=setTimeout(()=>{u.current&&(o("idle"),N(null))},Ye))},Yt);try{if(await p.current(y),n.current=!0,g.current&&clearTimeout(g.current),!u.current)return;o("success"),i.current=setTimeout(()=>{var b;u.current&&(o("idle"),N(null),(b=D.current)==null||b.call(D))},Ye)}catch{if(n.current=!0,g.current&&clearTimeout(g.current),!u.current)return;N(E),o("error"),i.current=setTimeout(()=>{u.current&&(o("idle"),N(null))},Ye)}},[]);return{enabled:d!==null?d:a,status:f,toggle:w}}function Jt(){const{latitude:a,longitude:c,enabled:r,setLocation:f,enable:o,disable:d,clear:N}=tt(),[u,g]=t.useState(!1),[i,n]=t.useState(""),[h,T]=t.useState(""),[p,D]=t.useState("idle"),[w,k]=t.useState(null),y=t.useRef(null),E=t.useRef(null),b=t.useRef(!0);t.useEffect(()=>(b.current=!0,()=>{b.current=!1,E.current&&clearTimeout(E.current)}),[]);const z=()=>{n((a==null?void 0:a.toFixed(6))??""),T((c==null?void 0:c.toFixed(6))??""),k(null),g(!0)},O=()=>{g(!1),k(null)};t.useEffect(()=>{if(!u)return;const m=K=>{p!=="loading"&&y.current&&!y.current.contains(K.target)&&O()};return document.addEventListener("mouseup",m),()=>document.removeEventListener("mouseup",m)},[u,p]);const v=(m,K)=>{const C=parseFloat(m),G=parseFloat(K);return isNaN(C)||isNaN(G)?"Please enter valid numbers":C<-90||C>90?"Latitude must be between -90 and 90":G<-180||G>180?"Longitude must be between -180 and 180":C===0&&G===0?"Coordinates (0, 0) are invalid":null},_=()=>{if(p==="loading")return;E.current&&clearTimeout(E.current);const m=v(i,h);if(m){k(m);return}D("loading"),k(null);const K=parseFloat(i),C=parseFloat(h);f(K,C),r||o(),D("success"),E.current=setTimeout(()=>{b.current&&(D("idle"),g(!1))},1e3)},P=()=>{r?d():o()},A=()=>{N(),g(!1)},S=a!==null&&c!==null;return e.jsx(Y,{children:e.jsxs("div",{ref:y,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx(X,{icon:e.jsx(qt,{}),title:"Stealth"}),e.jsxs("div",{className:"flex items-center gap-1",children:[S&&!u&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:P,className:l("relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2 mr-2",r?"bg-toggle-on border-toggle-on":"bg-toggle-off border-edge-subtle"),title:r?"Disable stealth location":"Enable stealth location",children:e.jsx("span",{className:l("inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",r?"translate-x-5":"translate-x-0.5")})}),e.jsx("button",{onClick:A,className:"p-2 rounded-lg transition-colors text-fg-muted hover:text-sys-red hover:bg-sys-red/10",title:"Clear stealth location",children:e.jsx(Is,{className:"w-4 h-4"})})]}),u?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:O,disabled:p==="loading",className:l("p-2 rounded-lg transition-colors",p==="loading"?"text-fg-muted cursor-not-allowed":"text-fg-muted hover:text-sys-red hover:bg-sys-red/10"),title:"Cancel",children:e.jsx(J,{className:"w-4 h-4"})}),e.jsx("button",{onClick:_,disabled:p==="loading",className:l("p-2 rounded-lg transition-colors",p==="loading"?"text-sys-blue cursor-wait":p==="success"?"text-sys-green":p==="error"?"text-sys-red":"text-sys-green hover:bg-sys-green/10"),title:"Save",children:p==="loading"?e.jsx(H,{className:"w-4 h-4 animate-spin"}):p==="success"?e.jsx(B,{className:"w-4 h-4"}):p==="error"?e.jsx(J,{className:"w-4 h-4"}):e.jsx(B,{className:"w-4 h-4"})})]}):e.jsx("button",{onClick:z,className:"p-2 rounded-lg transition-colors text-fg-muted hover:text-fg-primary hover:bg-subtle",title:S?"Edit stealth location":"Set stealth location",children:e.jsx(es,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"bg-sys-cyan/5 rounded-xl p-3 mb-4",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Qe,{className:"w-4 h-4 text-sys-cyan flex-shrink-0 mt-0.5"}),e.jsxs("p",{className:"type-body-sm text-fg-muted",children:[e.jsx("span",{className:"text-fg-secondary",children:"Stealth mode"})," allows you to appear on the map and in topology analysis without broadcasting your location. Coordinates are stored locally in your browser only — ",e.jsx("span",{className:"text-sys-cyan",children:"never sent to config.yaml or the mesh"}),"."]})]})}),w&&e.jsx("div",{className:"text-xs mb-3 px-2 py-1.5 rounded-md text-sys-red bg-sys-red/10",children:w}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-1",children:u?"Latitude (°)":"Latitude"}),e.jsx("div",{className:l("h-[38px] rounded-full px-4 flex items-center transition-colors","bg-subtle-fill"),children:u?e.jsx("input",{type:"number",value:i,onChange:m=>n(m.target.value),step:"0.000001",min:"-90",max:"90",placeholder:"e.g. 34.052234",className:"w-full bg-transparent text-fg-primary focus:outline-none type-data placeholder:text-fg-muted/50"}):e.jsx("span",{className:l("type-data",S&&r?"text-fg-primary":"text-fg-muted"),children:S?a.toFixed(6):"Not set"})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-1",children:u?"Longitude (°)":"Longitude"}),e.jsx("div",{className:l("h-[38px] rounded-full px-4 flex items-center transition-colors","bg-subtle-fill"),children:u?e.jsx("input",{type:"number",value:h,onChange:m=>T(m.target.value),step:"0.000001",min:"-180",max:"180",placeholder:"e.g. -118.243685",className:"w-full bg-transparent text-fg-primary focus:outline-none type-data placeholder:text-fg-muted/50"}):e.jsx("span",{className:l("type-data",S&&r?"text-fg-primary":"text-fg-muted"),children:S?c.toFixed(6):"Not set"})})]})]}),S&&!u&&e.jsx("div",{className:"mt-3 pt-3 border-t border-edge-subtle",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:l("w-2 h-2 rounded-full",r?"bg-sys-green":"bg-fg-muted")}),e.jsx("span",{className:"type-body-sm text-fg-muted",children:r?"Stealth location active — you appear on maps with these coordinates":"Stealth location disabled — coordinates saved but not in use"})]})})]})})}const Zt=[{value:7.8,label:"7.8 kHz"},{value:10.4,label:"10.4 kHz"},{value:15.6,label:"15.6 kHz"},{value:20.8,label:"20.8 kHz"},{value:31.25,label:"31.25 kHz"},{value:41.7,label:"41.7 kHz"},{value:62.5,label:"62.5 kHz"},{value:125,label:"125 kHz"},{value:250,label:"250 kHz"},{value:500,label:"500 kHz"}],Qt=[5,6,7,8,9,10,11,12],ea=[{value:5,label:"4/5"},{value:6,label:"4/6"},{value:7,label:"4/7"},{value:8,label:"4/8"}],Ds={RADIO_CONFIG:"radioConfig"};function sa(a){if(!a)return"Never";const r=Date.now()-a*1e3,f=Math.floor(r/6e4),o=Math.floor(r/36e5),d=Math.floor(r/864e5);return f<1?"Just now":f<60?`${f}m ago`:o<24?`${o}h ago`:d<365?`${d}d ago`:`${Math.floor(d/365)}y ago`}function Ms({node:a,level:c,expandedKeys:r,selectedKeyId:f,globalFloodPolicy:o,onSelect:d,onToggle:N}){const u=r.has(a.id),g=f===a.id,i=a.children&&a.children.length>0,n=o==="allow";return e.jsxs("div",{children:[e.jsxs("div",{className:l("flex items-center gap-2 h-[36px] px-3 rounded-full cursor-pointer transition-colors",g?"bg-sys-blue/15":"hover:bg-subtle-fill",n&&"opacity-50 cursor-not-allowed"),style:{marginLeft:`${c*16}px`},onClick:()=>!n&&d(a.id),children:[i?e.jsx("button",{onClick:h=>{h.stopPropagation(),N(a.id)},className:"p-1 hover:bg-subtle-fill-hover rounded-full transition-colors",children:e.jsx(It,{className:l("w-3.5 h-3.5 text-fg-muted transition-transform",u&&"rotate-90")})}):e.jsx("span",{className:"w-5"}),e.jsx(Lt,{className:"w-4 h-4 text-sys-blue flex-shrink-0"}),e.jsx("span",{className:"type-data text-fg-primary flex-1 truncate",children:a.name}),e.jsx("span",{className:"type-data-xs text-fg-muted hidden sm:inline",title:a.last_used?new Date(a.last_used*1e3).toLocaleString():void 0,children:sa(a.last_used)}),e.jsx("span",{className:l("type-data-xs px-2 py-0.5 rounded-full",a.floodPolicy==="allow"?"bg-sys-green/15 text-sys-green":"bg-sys-red/15 text-sys-red"),children:a.floodPolicy==="allow"?"Allow":"Deny"})]}),i&&u&&e.jsx("div",{children:a.children.map(h=>e.jsx(Ms,{node:h,level:c+1,expandedKeys:r,selectedKeyId:f,globalFloodPolicy:o,onSelect:d,onToggle:N},h.id))})]})}function ta(){const[a,c]=t.useState(kt),[r,f]=t.useState(wt),[o,d]=t.useState(!1),N=t.useCallback(i=>{c(i),Ct(i)},[]),u=t.useCallback(i=>{const n=parseFloat(i.target.value);f(n),St(n)},[]),g=t.useCallback(async()=>{o||(d(!0),await Tt(),d(!1))},[o]);return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(ie,{enabled:a,onChange:N,label:e.jsxs(e.Fragment,{children:["Sound: ",e.jsx("span",{className:a?"text-sys-green":"text-sys-red",children:a?"On":"Off"})]}),tooltip:"Enable or disable UI sound effects and haptic audio feedback",size:"md"}),e.jsx(F,{color:"primary",outline:!0,onClick:g,disabled:!a||o,className:"w-16 justify-center",children:o?"…":"Test"})]}),e.jsxs("div",{className:l("flex items-center gap-3",!a&&"opacity-40 pointer-events-none"),children:[e.jsx("span",{className:"type-label text-fg-muted w-14 shrink-0",children:"Volume"}),e.jsx("input",{type:"range",min:0,max:1,step:.05,value:r,onChange:u,className:"flex-1 accent-sys-blue h-1.5 cursor-pointer"}),e.jsxs("span",{className:"data-box w-16 justify-center",children:[Math.round(r*100),"%"]})]})]})}function ba(){var vs,Ns,ks,ws,Cs,Ss;const{stats:a,setMode:c,clearModeMutation:r,setDutyCycleConfig:f,clearDutyCycleMutation:o,fetchStats:d,startMutation:N,clearMutation:u}=at(),g=nt(),i=(vs=a==null?void 0:a.config)==null?void 0:vs.radio,n=(Ns=a==null?void 0:a.config)==null?void 0:Ns.repeater,h=(ks=a==null?void 0:a.config)==null?void 0:ks.duty_cycle,T=(a==null?void 0:a.node_name)||((ws=a==null?void 0:a.config)==null?void 0:ws.node_name)||"Unknown Node",p=(n==null?void 0:n.mode)??"forward",D=(h==null?void 0:h.enforcement_enabled)??!1,w=(Cs=a==null?void 0:a.config)==null?void 0:Cs.delays,k=t.useRef(!0);t.useEffect(()=>(k.current=!0,()=>{k.current=!1}),[]);const y=(Ss=a==null?void 0:a.config)==null?void 0:Ss.web,[E,b]=t.useState([]),[z,O]=t.useState(!1),[v,_]=t.useState(null),[P,A]=t.useState(!1),[S,m]=t.useState(""),[K,C]=t.useState(null),[G,ge]=t.useState(!1),[ae,Pe]=t.useState(null),[De,ts]=t.useState(!1),[as,ns]=t.useState(!1),[ls,rs]=t.useState(!1),[U,As]=t.useState([]),[Ks,is]=t.useState(!1),[os,I]=t.useState(null),[Z,Ls]=t.useState(()=>localStorage.getItem("pymc:globalFloodPolicy")==="allow"?"allow":"deny"),cs=t.useCallback(s=>{Ls(s),localStorage.setItem("pymc:globalFloodPolicy",s)},[]),[ds,us]=t.useState(!1),[L,Ie]=t.useState(null),[zs,Os]=t.useState(new Set),[be,me]=t.useState(!1),[je,ne]=t.useState(!1),[ve,le]=t.useState(!1),[M,W]=t.useState(null),[Q,xe]=t.useState(null),[Ne,ke]=t.useState(""),[Me,fe]=t.useState("allow"),[q,re]=t.useState(!1),[we,ms]=t.useState(!0),[he,Ae]=t.useState(!1),[Vs,xs]=t.useState(!0),[pe,ee]=t.useState("idle"),[$s,Ke]=t.useState(!1),[Le,Hs]=t.useState(!1),fs=t.useCallback(()=>{const s=w==null?void 0:w.tx_delay_factor;return s&&typeof s=="object"&&"parsedValue"in s?s.parsedValue??1:typeof s=="number"?s:1},[w]),hs=t.useCallback(()=>{const s=w==null?void 0:w.direct_tx_delay_factor;return typeof s=="number"?s:.5},[w]),ze=t.useCallback(()=>{const s=h==null?void 0:h.max_airtime_percent;return typeof s=="number"?s:s&&typeof s=="object"&&"parsedValue"in s?s.parsedValue??6:6},[h]),Oe=Je(p==="forward",async s=>{await c(s?"forward":"monitor")},r),Ve=Je(D,async s=>{await f({max_airtime_percent:ze(),enforcement_enabled:s})},o),$e=Je((y==null?void 0:y.cors_enabled)??!1,async s=>{var j;const x=await Rs({web:{cors_enabled:s}});if(!x.success&&!((j=x.data)!=null&&j.persisted))throw new Error("CORS update failed");await d()}),V=t.useCallback(async s=>{N(Ds.RADIO_CONFIG);try{const x=await lt(s);if(!x.success)throw new Error(x.error||"Failed to save");await d({force:!0}).catch(()=>{})}finally{u(Ds.RADIO_CONFIG)}},[N,u,d]);t.useEffect(()=>{(async()=>{xs(!0);try{const x=await ht();x.success&&x.data?Ae(x.data.exists):Ae(!1);const j=y==null?void 0:y.web_path;ms(!j||j==="")}catch{Ae(!1)}finally{xs(!1)}})()},[y==null?void 0:y.web_path]);const ps=async s=>{var x;if(pe!=="loading"){ee("loading");try{const j=await Rs({web:{web_path:s?null:"/opt/pymc_console/web/html"}});if(!k.current)return;j.success||(x=j.data)!=null&&x.persisted?(ms(s),ee("success"),Ke(!0),setTimeout(()=>{k.current&&ee("idle")},2e3)):(ee("error"),setTimeout(()=>{k.current&&ee("idle")},2e3))}catch{if(!k.current)return;ee("error"),setTimeout(()=>{k.current&&ee("idle")},2e3)}}},qs=async()=>{if(!Le){Hs(!0);try{await pt(),Ke(!1),setTimeout(()=>{window.location.reload()},2e3)}catch{Ke(!1),setTimeout(()=>{window.location.reload()},3e3)}}},Ce=t.useCallback(async()=>{O(!0),_(null);try{const s=await Gt();b(s.tokens||[])}catch(s){_(s instanceof Error?s.message:"Failed to fetch tokens")}finally{O(!1)}},[]);t.useEffect(()=>{Ce()},[Ce]);const ys=async()=>{if(!S.trim()){_("Token name is required");return}ts(!0),_(null);try{const s=await Bt(S.trim());C(s.token||null),A(!1),ge(!0),m(""),await Ce()}catch(s){_(s instanceof Error?s.message:"Failed to create token")}finally{ts(!1)}},Gs=async()=>{if(ae){ns(!0),_(null);try{await Ut(ae.id),await Ce(),Pe(null)}catch(s){_(s instanceof Error?s.message:"Failed to revoke token")}finally{ns(!1)}}},Bs=async()=>{K&&(await mt(K),rs(!0),setTimeout(()=>rs(!1),2e3))},gs=s=>s?new Date(s*1e3).toLocaleString():"Never",bs=t.useCallback(s=>{const x=new Map,j=[];return s.forEach(R=>{const Se={id:R.id,name:R.name,floodPolicy:R.flood_policy,transport_key:R.transport_key,last_used:R.last_used,parent_id:R.parent_id,children:[]};x.set(R.id,Se)}),x.forEach(R=>{R.parent_id&&x.has(R.parent_id)?x.get(R.parent_id).children.push(R):j.push(R)}),j},[]),ye=t.useCallback(async()=>{is(!0),I(null);try{const s=await xt();if(s.success&&s.data){const x=bs(s.data);As(x),Ie(j=>{if(j===null)return null;const R=Se=>{for(const He of Se)if(He.id===j||He.children&&R(He.children))return!0;return!1};return R(x)?j:null})}else I(s.error||"Failed to load transport keys")}catch(s){I(s instanceof Error?s.message:"Unknown error occurred")}finally{is(!1)}},[bs]);t.useEffect(()=>{ye(),ft().then(s=>{s.success&&s.data&&cs(s.data.global_flood_allow?"allow":"deny")}).catch(()=>{})},[ye]);const se=t.useCallback((s,x)=>{for(const j of s){if(j.id===x)return j;if(j.children){const R=se(j.children,x);if(R)return R}}return null},[]),Us=t.useCallback(()=>{if(!L)return;const s=se(U,L);return s==null?void 0:s.name},[L,U,se]),Ws=t.useCallback(s=>{Os(x=>{const j=new Set(x);return j.has(s)?j.delete(s):j.add(s),j})},[]),Xs=async s=>{us(!0),I(null);try{const x=await yt(s==="allow");x.success?cs(s):I(x.error||"Failed to update global flood policy")}catch(x){I(x instanceof Error?x.message:"Failed to update global flood policy")}finally{us(!1)}},js=async()=>{if(!Ne.trim()){I("Key name is required");return}re(!0),I(null);try{const s=await gt({name:Ne.trim(),flood_policy:Me,parent_id:L??void 0});s.success?(await ye(),me(!1),ke(""),fe("allow")):I(s.error||"Failed to add transport key")}catch(s){I(s instanceof Error?s.message:"Failed to add transport key")}finally{re(!1)}},Ys=async()=>{if(M){re(!0),I(null);try{const s=await bt(M.id,{name:M.name,flood_policy:M.floodPolicy});s.success?(await ye(),ne(!1),W(null)):I(s.error||"Failed to update transport key")}catch(s){I(s instanceof Error?s.message:"Failed to update transport key")}finally{re(!1)}}},Js=async()=>{if(Q){re(!0),I(null);try{const s=await jt(Q.id);s.success?(await ye(),le(!1),xe(null),Ie(null)):I(s.error||"Failed to delete transport key")}catch(s){I(s instanceof Error?s.message:"Failed to delete transport key")}finally{re(!1)}}},Zs=t.useCallback(()=>{if(!L)return;const s=se(U,L);s&&(W({...s}),ne(!0))},[L,U,se]);t.useEffect(()=>{const s=j=>{j.key==="Escape"&&(be&&(me(!1),ke(""),fe("allow")),je&&(ne(!1),W(null)),ve&&(le(!1),xe(null)),P&&(A(!1),m("")),G&&(ge(!1),C(null)))};if(be||je||ve||P||G)return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[be,je,ve,P,G]);const Qs=t.useCallback(()=>{if(!L)return;const s=se(U,L);s&&(xe(s),le(!0))},[L,U,se]);return e.jsxs(_t,{children:[e.jsx(Ft,{title:"Configuration",icon:e.jsx(_s,{})}),e.jsxs(Et,{ready:g,children:[e.jsxs(te,{template:"standard",children:[e.jsx(_e,{span:12,md:6,children:e.jsxs(Y,{neomorphic:!0,children:[e.jsx(X,{icon:e.jsx(rt,{}),title:"Repeater Settings"}),n?e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx("div",{className:"col-span-2",children:e.jsx($,{label:"Node Name",value:T,onSave:async s=>V({node_name:s}),placeholder:"Enter node name",maxLength:50})}),e.jsx($,{label:"Latitude",value:n.latitude!==0?n.latitude.toFixed(6):"Not set",editValue:String(n.latitude),type:"number",suffix:"°",step:1e-6,min:-90,max:90,onSave:async s=>V({latitude:parseFloat(s)})}),e.jsx($,{label:"Longitude",value:n.longitude!==0?n.longitude.toFixed(6):"Not set",editValue:String(n.longitude),type:"number",suffix:"°",step:1e-6,min:-180,max:180,onSave:async s=>V({longitude:parseFloat(s)})}),e.jsx($,{label:"Advert Interval",value:n.send_advert_interval_hours>0?`${n.send_advert_interval_hours}h`:"Disabled",editValue:String(n.send_advert_interval_hours),type:"number",suffix:"hours",min:0,max:48,description:"0 = disabled, 3-48 hours",onSave:async s=>V({flood_advert_interval_hours:parseInt(s,10)})}),e.jsx($,{label:"Score-based TX",value:n.use_score_for_tx?"Enabled":"Disabled",readOnly:!0})]}):e.jsx("p",{className:"text-fg-muted",children:"Loading repeater settings..."})]})}),e.jsx(_e,{span:12,md:6,children:e.jsxs(Y,{neomorphic:!0,children:[e.jsx(X,{icon:e.jsx(Rt,{}),title:"Radio Configuration"}),i?e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx($,{label:"Frequency",value:it(i.frequency),editValue:(i.frequency/1e6).toFixed(3),type:"number",suffix:"MHz",step:.001,min:400,max:930,onSave:async s=>V({frequency_mhz:parseFloat(s)})}),e.jsx($,{label:"TX Power",value:`${i.tx_power} dBm`,editValue:String(i.tx_power),type:"number",suffix:"dBm",min:2,max:30,onSave:async s=>V({tx_power:parseInt(s,10)})}),e.jsx(Ue,{label:"Bandwidth",value:ot(i.bandwidth),editValue:i.bandwidth/1e3,options:Zt,onSave:async s=>V({bandwidth_khz:parseFloat(s)})}),e.jsx(Ue,{label:"Spreading Factor",value:`SF${i.spreading_factor}`,editValue:i.spreading_factor,options:Qt.map(s=>({value:s,label:`SF${s}`})),onSave:async s=>V({spreading_factor:parseInt(s,10)})}),e.jsx(Ue,{label:"Coding Rate",value:`4/${i.coding_rate}`,editValue:i.coding_rate,options:ea,onSave:async s=>V({coding_rate:parseInt(s,10)})}),e.jsx($,{label:"Preamble",value:`${i.preamble_length} symbols`,readOnly:!0})]}):e.jsx("p",{className:"text-fg-muted",children:"Loading radio configuration..."})]})})]}),e.jsxs(te,{template:"standard",children:[e.jsx(_e,{span:12,md:6,children:e.jsxs(Y,{neomorphic:!0,children:[e.jsx(X,{icon:e.jsx(ct,{}),title:"Operating Mode"}),e.jsx("p",{className:"type-label text-fg-muted mb-3",children:"Control how the repeater handles packets"}),e.jsxs("div",{className:"flex flex-col lg:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1 space-y-4",children:[e.jsx(ie,{enabled:Oe.enabled,onChange:Oe.toggle,label:"Repeat",tooltip:"Toggles repeater or monitor mode. In monitor mode, the repeater will not repeat packets from the mesh.",status:Oe.status,size:"md"}),e.jsx(ie,{enabled:Ve.enabled,onChange:Ve.toggle,label:"Duty Cycle",tooltip:"Limit transmission time to comply with airtime utilization regulations",status:Ve.status,size:"md"}),e.jsx($,{label:"Max Airtime",layout:"inline",value:`${ze().toFixed(1)}%`,editValue:String(ze()),type:"number",suffix:"%",step:.5,min:.1,max:100,onSave:async s=>{await f({max_airtime_percent:parseFloat(s),enforcement_enabled:D}),o()}})]}),e.jsx("div",{className:"hidden lg:block w-px bg-border-subtle"}),e.jsxs("div",{className:"flex-1 pt-4 lg:pt-0 border-t lg:border-t-0 border-edge-subtle",children:[e.jsx("label",{className:"type-label text-fg-muted block mb-3",children:"TX Delays"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx($,{label:"Flood",layout:"inline",value:`${fs().toFixed(2)}x`,editValue:String(fs()),type:"number",suffix:"x",step:.1,min:0,max:5,onSave:async s=>V({tx_delay_factor:parseFloat(s)})}),e.jsx($,{label:"Direct",layout:"inline",value:`${hs().toFixed(2)}s`,editValue:String(hs()),type:"number",suffix:"s",step:.1,min:0,max:5,onSave:async s=>V({direct_tx_delay_factor:parseFloat(s)})})]})]})]})]})}),e.jsx(_e,{span:12,md:6,children:e.jsxs(Y,{neomorphic:!0,children:[e.jsx(X,{icon:e.jsx(_s,{}),title:"App Settings"}),e.jsx("p",{className:"type-body-sm text-fg-muted mb-4",children:"Appearance and web server options."}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(ie,{enabled:$e.enabled,onChange:$e.toggle,label:"Enable CORS",tooltip:"Allow cross-origin API access",status:$e.status,size:"md"}),e.jsx("div",{children:e.jsx(Xt,{})}),e.jsx(ta,{})]})]})})]}),e.jsx(te,{template:"auto",children:e.jsxs(Y,{neomorphic:!0,children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[e.jsx(X,{icon:e.jsx(Es,{}),title:"Regions Transport Keys",subtitle:"Manage regional key hierarchy for flood control"}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(F,{color:"primary",outline:!0,onClick:()=>me(!0),disabled:Z==="allow",children:[e.jsx(Fs,{"data-slot":"icon"}),"Add"]}),e.jsx(F,{color:"primary",outline:!0,onClick:Zs,disabled:!L||Z==="allow",children:"Edit"}),e.jsx(F,{color:"danger",outline:!0,onClick:Qs,disabled:!L||Z==="allow",children:"Delete"})]})]}),e.jsx("div",{className:"bg-subtle-fill radius-inner p-4 mb-4",children:e.jsx(ie,{enabled:Z==="deny",onChange:s=>Xs(s?"deny":"allow"),label:e.jsxs(e.Fragment,{children:["Require Transport Keys: ",e.jsx("span",{className:Z==="deny"?"text-sys-green":"text-sys-red",children:Z==="deny"?"On":"Off"})]}),tooltip:"When enabled, only packets with matching transport keys are forwarded. When disabled, all packets flood freely.",status:ds?"loading":"idle",disabled:ds,dangerOff:!0,size:"md",className:"flex-row-reverse justify-between w-full"})}),os&&e.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-sys-red bg-sys-red/10",children:os}),e.jsx("div",{className:"bg-subtle-fill radius-inner p-4 min-h-[120px]",children:Ks?e.jsxs("div",{className:"flex items-center justify-center py-6",children:[e.jsx(H,{className:"w-5 h-5 animate-spin text-sys-blue mr-2"}),e.jsx("span",{className:"type-body-sm text-fg-muted",children:"Loading transport keys..."})]}):U.length===0?e.jsxs("div",{className:"text-center py-6",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-subtle-fill mx-auto mb-3 flex items-center justify-center",children:e.jsx(Es,{className:"w-6 h-6 text-fg-muted/50"})}),e.jsx("p",{className:"type-body text-fg-muted",children:"No transport keys found"}),e.jsx("p",{className:"type-body-sm text-fg-muted/70 mt-1",children:"Add your first transport key to get started"})]}):e.jsx("div",{className:"space-y-1",children:U.map(s=>e.jsx(Ms,{node:s,level:0,expandedKeys:zs,selectedKeyId:L,globalFloodPolicy:Z,onSelect:Ie,onToggle:Ws},s.id))})})]})}),e.jsx(te,{template:"auto",children:e.jsxs(Y,{neomorphic:!0,children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 mb-4",children:[e.jsx(X,{icon:e.jsx(Ge,{}),title:"API Tokens",subtitle:"Manage API tokens for machine-to-machine authentication"}),e.jsxs(F,{color:"primary",outline:!0,onClick:()=>A(!0),children:[e.jsx(Fs,{"data-slot":"icon"}),"Create Token"]})]}),e.jsx("div",{className:"bg-sys-blue/5 radius-inner p-4 mb-4",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-sys-blue/20 flex items-center justify-center flex-shrink-0",children:e.jsx(Qe,{className:"w-4 h-4 text-sys-blue"})}),e.jsxs("div",{className:"type-body-sm text-fg-muted",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-fg-secondary",children:"API tokens"})," are used for machine-to-machine authentication. Include the token in the ",e.jsx("code",{className:"type-code bg-sys-blue/20 px-1.5 py-0.5 rounded-full text-sys-blue",children:"X-API-Key"})," header when making API requests."]}),e.jsx("p",{className:"mt-1 text-fg-muted/70",children:"Tokens are only shown once at creation. Store them securely."})]})]})}),v&&e.jsx("div",{className:"type-body-sm mb-3 px-3 py-2 rounded-full text-sys-red bg-sys-red/10",children:v}),z&&E.length===0?e.jsxs("div",{className:"flex items-center justify-center py-6",children:[e.jsx(H,{className:"w-5 h-5 animate-spin text-sys-blue mr-2"}),e.jsx("span",{className:"type-body-sm text-fg-muted",children:"Loading tokens..."})]}):E.length>0?e.jsx("div",{className:"space-y-2",children:E.map(s=>e.jsx("div",{className:"bg-subtle-fill hover:bg-subtle-fill-strong radius-inner p-4 transition-base",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-sys-blue/10 flex items-center justify-center flex-shrink-0",children:e.jsx(Ge,{className:"w-5 h-5 text-sys-blue"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"type-body text-fg-primary font-medium truncate",children:s.name}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-0.5",children:[e.jsxs("span",{className:"type-data-sm text-fg-muted truncate",children:["Created: ",gs(s.created_at)]}),e.jsxs("span",{className:"type-data-sm text-fg-muted truncate",children:["Last used: ",gs(s.last_used)]})]})]})]}),e.jsxs(F,{color:"danger",outline:!0,onClick:()=>Pe({id:s.id,name:s.name}),disabled:as,children:[e.jsx(Is,{"data-slot":"icon"}),"Revoke"]})]})},s.id))}):e.jsxs("div",{className:"bg-subtle-fill radius-inner p-6 text-center",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:e.jsx(Ge,{className:"w-7 h-7 text-fg-muted/50"})}),e.jsx("h3",{className:"type-body text-fg-primary font-medium mb-1",children:"No API Tokens"}),e.jsx("p",{className:"type-body-sm text-fg-muted mb-4",children:"Create a token to enable API access"}),e.jsx(F,{color:"primary",outline:!0,onClick:()=>A(!0),children:"Create Your First Token"})]})]})}),e.jsx(te,{template:"auto",children:e.jsxs(Y,{neomorphic:!0,children:[e.jsx(X,{icon:e.jsx(Vt,{}),title:"Web Frontend",subtitle:"Choose which web interface to use",className:"mb-4"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:l("flex items-start gap-3 p-4 bg-subtle-fill radius-card border-2 cursor-pointer transition-base",we?"border-sys-blue bg-sys-blue/5":"border-transparent hover:border-sys-blue/30",pe==="loading"&&"opacity-50 pointer-events-none"),children:[e.jsx("input",{type:"radio",name:"frontend",checked:we,onChange:()=>ps(!0),disabled:pe==="loading",className:"mt-1 h-4 w-4 text-sys-blue focus:ring-sys-blue focus:ring-offset-bg-elevated"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"type-body text-fg-primary font-medium",children:"Default Frontend"}),e.jsx("a",{href:"https://github.com/rightup/pyMC_Repeater",target:"_blank",rel:"noopener noreferrer",onClick:s=>s.stopPropagation(),className:"type-data-xs bg-sys-cyan/15 text-sys-cyan px-2.5 py-0.5 rounded-full font-medium hover:bg-sys-cyan/25 transition-colors",children:"@RightUp"})]}),e.jsx("div",{className:"type-body-sm text-fg-muted mt-1",children:"Built-in pyMC Repeater web interface"}),e.jsx("div",{className:"type-data-xs text-fg-muted/60 mt-1",children:"/opt/pymc_repeater/repeater/web/html"})]})]}),e.jsxs("label",{className:l("flex items-start gap-3 p-4 bg-subtle-fill radius-card border-2 cursor-pointer transition-base",we?"border-transparent hover:border-sys-blue/30":"border-sys-blue bg-sys-blue/5",pe==="loading"&&"opacity-50 pointer-events-none"),children:[e.jsx("input",{type:"radio",name:"frontend",checked:!we,onChange:()=>ps(!1),disabled:pe==="loading",className:"mt-1 h-4 w-4 text-sys-blue focus:ring-sys-blue focus:ring-offset-bg-elevated"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"type-body text-fg-primary font-medium",children:"PyMC Console"}),e.jsx("span",{className:"type-data-xs bg-sys-indigo/15 text-sys-indigo px-2.5 py-0.5 rounded-full font-medium",children:"@Treehouse ⚡"})]}),e.jsx("div",{className:"type-body-sm text-fg-muted mt-1",children:"Alternative web interface for pyMC Repeater"}),e.jsx("div",{className:"type-data-xs text-fg-muted/60 mt-1",children:"/opt/pymc_console/web/html"})]})]})]}),!Vs&&e.jsx("div",{className:l("bg-subtle-fill radius-card p-4",he?"border border-sys-green/20":"border border-sys-cyan/20"),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:l("w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",he?"bg-sys-green/20":"bg-sys-cyan/20"),children:he?e.jsx(Pt,{className:"w-4 h-4 text-sys-green"}):e.jsx(Qe,{className:"w-4 h-4 text-sys-cyan"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"type-body text-fg-primary font-medium",children:he?"PyMC Console has been detected":"PyMC Console Not Installed"}),he?e.jsxs("p",{className:"type-body-sm text-fg-muted mt-1",children:["PyMC Console is installed at ",e.jsx("code",{className:"type-code bg-sys-green/10 px-1.5 py-0.5 rounded-full text-sys-green",children:"/opt/pymc_console/web/html"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"type-body-sm text-fg-muted mt-1 mb-3",children:["PyMC Console must be installed at ",e.jsx("code",{className:"type-code bg-sys-cyan/10 px-1.5 py-0.5 rounded-full text-sys-cyan",children:"/opt/pymc_console/web/html"})," before selecting this option."]}),e.jsxs(F,{color:"primary",outline:!0,href:"https://github.com/dmduran12/pymc_console-dist",children:[e.jsx(At,{"data-slot":"icon"}),"PyMC Console Install Instructions"]})]})]})]})}),$s&&e.jsx("div",{className:"bg-subtle-fill radius-card p-4 border border-sys-indigo/30",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-sys-indigo/20 flex items-center justify-center flex-shrink-0",children:e.jsx(Be,{className:"w-4 h-4 text-sys-indigo"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"type-body text-fg-primary font-medium",children:"Service restart required"}),e.jsx("p",{className:"type-body-sm text-fg-muted mt-1",children:"Web frontend changes will take effect after restarting the pymc-repeater service."})]})]}),e.jsx(F,{color:"warning",outline:!0,onClick:qs,disabled:Le,children:Le?e.jsxs(e.Fragment,{children:[e.jsx(H,{"data-slot":"icon",className:"animate-spin"}),"Restarting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Dt,{"data-slot":"icon"}),"Restart Now"]})})]})})]})]})}),a&&e.jsx(te,{template:"auto",children:e.jsx(Nt,{nodeName:T,repeaterVersion:a.version,coreVersion:a.core_version,localHash:a.local_hash,publicKey:a.public_key})}),a&&((n==null?void 0:n.latitude)===0||!(n!=null&&n.latitude))&&((n==null?void 0:n.longitude)===0||!(n!=null&&n.longitude))&&e.jsx(te,{template:"auto",children:e.jsx(Jt,{})})]}),P&&e.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:s=>s.target===s.currentTarget&&A(!1),role:"dialog","aria-modal":"true","aria-labelledby":"create-token-modal-title",children:e.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[e.jsx("h3",{id:"create-token-modal-title",className:"type-micro mb-4",children:"Create API Token"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(qe,{label:"Token Name",type:"text",value:S,onChange:s=>m(s.target.value),placeholder:"e.g., Production Server, CI/CD Pipeline",description:"Give your token a descriptive name to identify its purpose",onKeyDown:s=>s.key==="Enter"&&ys(),autoFocus:!0}),e.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[e.jsx(F,{color:"muted",outline:!0,onClick:()=>{A(!1),m(""),_(null)},disabled:De,children:"Cancel"}),e.jsx(F,{color:"primary",onClick:ys,disabled:De||!S.trim(),children:De?e.jsxs(e.Fragment,{children:[e.jsx(H,{"data-slot":"icon",className:"animate-spin"}),"Creating..."]}):"Create Token"})]})]})]})}),G&&K&&e.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:s=>s.target===s.currentTarget&&ge(!1),role:"dialog","aria-modal":"true","aria-labelledby":"show-token-modal-title",children:e.jsxs("div",{className:"surface-modal radius-card p-6 max-w-lg w-full",children:[e.jsx("h3",{id:"show-token-modal-title",className:"type-micro mb-4",children:"Token Created Successfully"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-sys-indigo/10 border border-sys-indigo/30 radius-inner p-3",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Be,{className:"w-4 h-4 text-sys-indigo flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-fg-secondary",children:[e.jsx("strong",{children:"Save this token now!"})," For security reasons, it will not be shown again."]})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-primary block mb-1.5",children:"Your API Token"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(dt,{value:K,readOnly:!0,className:"flex-1 font-mono"}),e.jsxs(F,{color:"primary",outline:!0,onClick:Bs,children:[ls?e.jsx(B,{"data-slot":"icon",className:"text-sys-green"}):e.jsx(ut,{"data-slot":"icon"}),ls?"Copied!":"Copy"]})]})]}),e.jsxs("div",{className:"bg-sys-cyan/10 border border-sys-cyan/30 radius-inner p-3",children:[e.jsx("p",{className:"text-sm text-fg-secondary mb-2",children:e.jsx("strong",{children:"Usage Example:"})}),e.jsxs("code",{className:"block bg-sys-cyan/20 px-3 py-2 rounded type-code text-sys-cyan overflow-x-auto",children:['curl -H "X-API-Key: ',K.slice(0,12),'..." ',window.location.origin,"/api/stats"]})]}),e.jsx("div",{className:"flex justify-end mt-6",children:e.jsx(F,{color:"primary",onClick:()=>{ge(!1),C(null)},children:"Done"})})]})]})}),e.jsx(vt,{isOpen:!!ae,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${ae==null?void 0:ae.name}'? This action cannot be undone.`,confirmLabel:as?"Revoking...":"Revoke",cancelLabel:"Cancel",variant:"danger",onConfirm:Gs,onCancel:()=>Pe(null)}),be&&e.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:s=>s.target===s.currentTarget&&me(!1),role:"dialog","aria-modal":"true","aria-labelledby":"add-key-modal-title",children:e.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[e.jsx("h3",{id:"add-key-modal-title",className:"type-micro mb-4",children:"Add Transport Key"}),e.jsxs("div",{className:"space-y-4",children:[L&&e.jsxs("div",{className:"bg-sys-cyan/10 border border-sys-cyan/30 radius-inner p-3 text-sm text-fg-secondary",children:["Adding as child of: ",e.jsx("strong",{className:"text-fg-primary",children:Us()})]}),e.jsx(qe,{label:"Key Name",type:"text",value:Ne,onChange:s=>ke(s.target.value),placeholder:"e.g., Region Name, Group Key",onKeyDown:s=>s.key==="Enter"&&js(),autoFocus:!0}),e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Flood Policy"}),e.jsxs("div",{className:"toggle-group w-full",children:[e.jsx("button",{onClick:()=>fe("deny"),className:l("toggle-group-item flex-1",Me==="deny"&&"active !text-sys-red"),children:"Deny"}),e.jsx("button",{onClick:()=>fe("allow"),className:l("toggle-group-item flex-1",Me==="allow"&&"active !text-sys-green"),children:"Allow"})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[e.jsx(F,{color:"muted",outline:!0,onClick:()=>{me(!1),ke(""),fe("allow")},disabled:q,children:"Cancel"}),e.jsx(F,{color:"primary",onClick:js,disabled:q||!Ne.trim(),children:q?e.jsxs(e.Fragment,{children:[e.jsx(H,{"data-slot":"icon",className:"animate-spin"}),"Adding..."]}):"Add Key"})]})]})]})}),je&&M&&e.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:s=>s.target===s.currentTarget&&ne(!1),role:"dialog","aria-modal":"true","aria-labelledby":"edit-key-modal-title",children:e.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[e.jsx("h3",{id:"edit-key-modal-title",className:"type-micro mb-4",children:"Edit Transport Key"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(qe,{label:"Key Name",type:"text",value:M.name,onChange:s=>W({...M,name:s.target.value}),autoFocus:!0}),e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Flood Policy"}),e.jsxs("div",{className:"toggle-group w-full",children:[e.jsx("button",{onClick:()=>W({...M,floodPolicy:"deny"}),className:l("toggle-group-item flex-1",M.floodPolicy==="deny"&&"active !text-sys-red"),children:"Deny"}),e.jsx("button",{onClick:()=>W({...M,floodPolicy:"allow"}),className:l("toggle-group-item flex-1",M.floodPolicy==="allow"&&"active !text-sys-green"),children:"Allow"})]})]}),M.transport_key&&e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Transport Key"}),e.jsx("code",{className:"block bg-input-bg px-3 py-2 radius-inner border border-input-border type-code text-fg-muted overflow-x-auto",children:M.transport_key})]}),e.jsxs("div",{className:"flex justify-between gap-3 mt-6",children:[e.jsx(F,{color:"danger",outline:!0,onClick:()=>{ne(!1),xe(M),le(!0),W(null)},disabled:q,children:"Delete"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(F,{color:"muted",outline:!0,onClick:()=>{ne(!1),W(null)},disabled:q,children:"Cancel"}),e.jsx(F,{color:"primary",onClick:Ys,disabled:q||!M.name.trim(),children:q?e.jsxs(e.Fragment,{children:[e.jsx(H,{"data-slot":"icon",className:"animate-spin"}),"Saving..."]}):"Save"})]})]})]})]})}),ve&&Q&&e.jsx("div",{className:"fixed inset-0 z-[10010] flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:s=>s.target===s.currentTarget&&le(!1),role:"dialog","aria-modal":"true","aria-labelledby":"delete-key-modal-title",children:e.jsxs("div",{className:"surface-modal radius-card p-6 max-w-md w-full",children:[e.jsx("h3",{id:"delete-key-modal-title",className:"type-micro mb-4",children:"Delete Transport Key"}),e.jsxs("p",{className:"text-fg-secondary mb-4",children:["Are you sure you want to delete ",e.jsxs("strong",{className:"text-fg-primary",children:["'",Q.name,"'"]}),"?"]}),Q.children&&Q.children.length>0&&e.jsx("div",{className:"bg-sys-indigo/10 border border-sys-indigo/30 radius-inner p-3 mb-4",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Be,{className:"w-4 h-4 text-sys-indigo flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"text-sm text-fg-secondary",children:["This key has ",Q.children.length," child key(s). Deleting will also remove all children."]})]})}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(F,{color:"muted",outline:!0,onClick:()=>{le(!1),xe(null)},disabled:q,children:"Cancel"}),e.jsx(F,{color:"danger",onClick:Js,disabled:q,children:q?e.jsxs(e.Fragment,{children:[e.jsx(H,{"data-slot":"icon",className:"animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})}export{ba as default}; diff --git a/frontend/dist/assets/ConfirmModal-BF449Kzb.js b/frontend/dist/assets/ConfirmModal-DpSKXZ01.js similarity index 76% rename from frontend/dist/assets/ConfirmModal-BF449Kzb.js rename to frontend/dist/assets/ConfirmModal-DpSKXZ01.js index 0a8b1b92..791e1c4b 100644 --- a/frontend/dist/assets/ConfirmModal-BF449Kzb.js +++ b/frontend/dist/assets/ConfirmModal-DpSKXZ01.js @@ -1 +1 @@ -import{r as d,j as s,ak as m,dI as x,c as f,al as g,e0 as C,B as a}from"./index-CeMilrX4.js";import{T as j}from"./triangle-alert-DiFold9L.js";const p={danger:"text-sys-red",warning:"text-sys-indigo",default:"text-sys-blue"},u={danger:"danger",warning:"warning",default:"primary"};function N({isOpen:n,title:r="Confirm",message:l,confirmLabel:t="Confirm",cancelLabel:i="Cancel",variant:o="default",onConfirm:c,onCancel:e}){return s.jsxs(m,{open:n,onClose:e,size:"sm",children:[s.jsx(x,{icon:s.jsx(j,{className:f("w-5 h-5",p[o])}),title:r,onClose:e}),s.jsx(g,{children:s.jsx("p",{className:"text-sm text-fg-secondary",children:l})}),s.jsxs(C,{children:[s.jsx(a,{color:"muted",onClick:e,className:"flex-1",children:i}),s.jsx(a,{color:u[o],onClick:c,className:"flex-1",children:t})]})]})}const A=d.memo(N);export{A as C}; +import{r as d,j as s,ak as m,dJ as x,c as f,al as g,e1 as C,B as a}from"./index-BOwCLZTK.js";import{T as j}from"./triangle-alert-SO3tIa8w.js";const p={danger:"text-sys-red",warning:"text-sys-indigo",default:"text-sys-blue"},u={danger:"danger",warning:"warning",default:"primary"};function N({isOpen:n,title:r="Confirm",message:l,confirmLabel:t="Confirm",cancelLabel:i="Cancel",variant:o="default",onConfirm:c,onCancel:e}){return s.jsxs(m,{open:n,onClose:e,size:"sm",children:[s.jsx(x,{icon:s.jsx(j,{className:f("w-5 h-5",p[o])}),title:r,onClose:e}),s.jsx(g,{children:s.jsx("p",{className:"text-sm text-fg-secondary",children:l})}),s.jsxs(C,{children:[s.jsx(a,{color:"muted",onClick:e,className:"flex-1",children:i}),s.jsx(a,{color:u[o],onClick:c,className:"flex-1",children:t})]})]})}const A=d.memo(N);export{A as C}; diff --git a/frontend/dist/assets/Contacts-DVoMEmqg.js b/frontend/dist/assets/Contacts-nDnNtpiy.js similarity index 92% rename from frontend/dist/assets/Contacts-DVoMEmqg.js rename to frontend/dist/assets/Contacts-nDnNtpiy.js index dda7f552..af45e032 100644 --- a/frontend/dist/assets/Contacts-DVoMEmqg.js +++ b/frontend/dist/assets/Contacts-nDnNtpiy.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-DAxQZgO0.js","assets/index-CeMilrX4.js","assets/BasemapLayer-CNBmoufo.js","assets/consumer-registry-Hkh6Dv_i.js","assets/link-scoring-FRwcQ0ss.js","assets/ConfirmModal-BF449Kzb.js","assets/triangle-alert-DiFold9L.js","assets/max-0cG3bA4z.js","assets/download-ByVPtD5I.js","assets/database-D2sIhibw.js","assets/useMapViewStore-DgL-E_Uc.js","assets/index-BK59_Mkt.js","assets/refresh-cw-DqhcBXAw.js","assets/target-q6HPYno6.js","assets/funnel-D2SUJQ8o.js","assets/plus-D-z0bUE_.js","assets/easing-CFZ7-xae.js","assets/zap-09srAnh-.js","assets/trash-2-Bu7BoH4P.js","assets/wifi-off-Y-Y9dpWj.js","assets/wifi-DjxkOZ88.js","assets/badge-colors-DnsnMXHA.js","assets/chevron-right-D3QL4sfa.js","assets/node-types-C09ZlzBQ.js","assets/LightSparkline-D652BQd5.js","assets/map-pin-D6_BkIVb.js","assets/usePipelineStore-B80TA53S.js","assets/ping-DgsEwYAS.js","assets/PageLayout-Cw_MXmcE.js","assets/listbox-CGIGCOya.js","assets/element-movement-zLH7y51p.js","assets/MqttModeBadge-C_MEMmDd.js","assets/chat-utils-BJwCtjDV.js","assets/SignalIndicator-CpBGKD5A.js","assets/CollisionExplorerModal-Cvw_f8a6.js","assets/monitor-smartphone-DxkmIgui.js","assets/DataBox-Da-5DbUW.js","assets/circle-question-mark-Bqc_DPUo.js","assets/network-c_XxfhAX.js","assets/activity-BZFnO4kb.js","assets/search-Bph9xP9G.js","assets/index-CLjIU9sF.css","assets/BasemapLayer-B1CfjdFi.css","assets/ContactsMapMapLibre-BwWOEply.css"])))=>i.map(i=>d[i]); -import{d as P,a9 as ss,j as e,r as a,_ as ts,bV as Ee,bW as Fe,a6 as oe,D as ke,ah as Pe,bX as ns,bY as he,R as pe,x as k,bZ as as,L as Oe,b_ as rs,Q as os,b$ as cs,c0 as is,c1 as ls,P as ds,c2 as ms,c3 as xs,V as us,ai as ps,W as Ne,c4 as hs,c5 as fs,bf as re,v as gs,I as js,bk as bs,c as we}from"./index-CeMilrX4.js";import{useDiscoveredNodes as ys}from"./usePipelineStore-B80TA53S.js";import{p as Ns}from"./ping-DgsEwYAS.js";import{c as Ce}from"./node-types-C09ZlzBQ.js";import{P as vs,a as ws,B as ks}from"./PageLayout-Cw_MXmcE.js";import{L as Cs,a as ue}from"./listbox-CGIGCOya.js";import{T as Te,M as Ms}from"./MqttModeBadge-C_MEMmDd.js";import{u as Ss,e as _s,f as Rs,r as Ps}from"./consumer-registry-Hkh6Dv_i.js";import{e as Ts,g as Ls,a as $s}from"./chat-utils-BJwCtjDV.js";import{A as Es,b as Fs}from"./SignalIndicator-CpBGKD5A.js";import{C as Os,S as zs}from"./CollisionExplorerModal-Cvw_f8a6.js";import{E as Ds,T as Hs}from"./target-q6HPYno6.js";import{D as As}from"./DataBox-Da-5DbUW.js";import{a as X,C as Is}from"./badge-colors-DnsnMXHA.js";import{C as ze}from"./circle-question-mark-Bqc_DPUo.js";import{N as Bs}from"./network-c_XxfhAX.js";import{A as De}from"./activity-BZFnO4kb.js";import{T as Vs}from"./trash-2-Bu7BoH4P.js";import{C as qs}from"./ConfirmModal-BF449Kzb.js";import{M as Le}from"./monitor-smartphone-DxkmIgui.js";import{M as Us}from"./map-pin-D6_BkIVb.js";import{S as Ws}from"./search-Bph9xP9G.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ContactsMapMapLibre-NYBNCx0J.js","assets/index-BOwCLZTK.js","assets/BasemapLayer-B-5TmAfZ.js","assets/consumer-registry-CTjikLma.js","assets/link-scoring-CgjOR3NF.js","assets/ConfirmModal-DpSKXZ01.js","assets/triangle-alert-SO3tIa8w.js","assets/max-vSbldOSt.js","assets/download-B9g5-0oH.js","assets/database-C6oOGn9y.js","assets/useMapViewStore-DpXuD1iT.js","assets/index-2RIoVPos.js","assets/refresh-cw-C9txhqc9.js","assets/target-vmW1ltA0.js","assets/funnel-CWx99rlN.js","assets/plus-ClrHVFhr.js","assets/easing-CsgXD0uy.js","assets/zap-Bd-kARJ1.js","assets/trash-2-qMD09ppP.js","assets/wifi-off-DC4jBRps.js","assets/wifi-CI57D5A3.js","assets/badge-colors-DCbxcv7o.js","assets/chevron-right-DJVm4pVP.js","assets/node-types-C6okL8rE.js","assets/LightSparkline-C68RXWon.js","assets/map-pin-C2z_C0J3.js","assets/usePipelineStore-Cw6U5jyB.js","assets/ping-LiBbR-Oy.js","assets/PageLayout-QKntxcnp.js","assets/listbox-C1tUi7YC.js","assets/element-movement-BLnr83nT.js","assets/MqttModeBadge-CSj5wNzF.js","assets/chat-utils-D21OFED5.js","assets/SignalIndicator-Calk-LyB.js","assets/CollisionExplorerModal-Cudk5ace.js","assets/monitor-smartphone-Dd11JEL9.js","assets/DataBox-BVnEv6Au.js","assets/circle-question-mark-XDnZ1ChV.js","assets/network-D0Fgg1y-.js","assets/activity-D5uH2SFx.js","assets/search-Ba9CRHru.js","assets/index-DH0lUVGm.css","assets/BasemapLayer-B1CfjdFi.css","assets/ContactsMapMapLibre-BwWOEply.css"])))=>i.map(i=>d[i]); +import{d as P,a9 as ss,j as e,r as a,_ as ts,bV as Ee,bW as Fe,a6 as oe,D as ke,ah as Pe,bX as ns,bY as he,R as pe,x as k,bZ as as,L as Oe,b_ as rs,Q as os,b$ as cs,c0 as is,c1 as ls,P as ds,c2 as ms,c3 as xs,V as us,ai as ps,W as Ne,c4 as hs,c5 as fs,bf as re,v as gs,I as js,bk as bs,c as we}from"./index-BOwCLZTK.js";import{useDiscoveredNodes as ys}from"./usePipelineStore-Cw6U5jyB.js";import{p as Ns}from"./ping-LiBbR-Oy.js";import{c as Ce}from"./node-types-C6okL8rE.js";import{P as vs,a as ws,B as ks}from"./PageLayout-QKntxcnp.js";import{L as Cs,a as ue}from"./listbox-C1tUi7YC.js";import{T as Te,M as Ms}from"./MqttModeBadge-CSj5wNzF.js";import{u as Ss,e as _s,f as Rs,r as Ps}from"./consumer-registry-CTjikLma.js";import{e as Ts,g as Ls,a as $s}from"./chat-utils-D21OFED5.js";import{A as Es,b as Fs}from"./SignalIndicator-Calk-LyB.js";import{C as Os,S as zs}from"./CollisionExplorerModal-Cudk5ace.js";import{E as Ds,T as Hs}from"./target-vmW1ltA0.js";import{D as As}from"./DataBox-BVnEv6Au.js";import{a as X,C as Is}from"./badge-colors-DCbxcv7o.js";import{C as ze}from"./circle-question-mark-XDnZ1ChV.js";import{N as Bs}from"./network-D0Fgg1y-.js";import{A as De}from"./activity-D5uH2SFx.js";import{T as Vs}from"./trash-2-qMD09ppP.js";import{C as qs}from"./ConfirmModal-DpSKXZ01.js";import{M as Le}from"./monitor-smartphone-Dd11JEL9.js";import{M as Us}from"./map-pin-C2z_C0J3.js";import{S as Ws}from"./search-Ba9CRHru.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -49,4 +49,4 @@ import{d as P,a9 as ss,j as e,r as a,_ as ts,bV as Ee,bW as Fe,a6 as oe,D as ke, * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dt=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],mt=P("trending-down",dt);class xt extends a.Component{constructor(c){super(c),this.state={hasError:!1}}static getDerivedStateFromError(c){return{hasError:!0,error:c}}render(){var c;return this.state.hasError?e.jsx("div",{className:"map-container-16-9 flex items-center justify-center rounded-2xl surface-base",role:"alert","aria-live":"assertive",children:e.jsxs("div",{className:"text-center text-fg-muted p-4",children:[e.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),e.jsx("p",{className:"text-sm text-fg-muted",children:((c=this.state.error)==null?void 0:c.message)||"Unknown error"}),e.jsx("p",{className:"text-xs text-fg-muted mt-2",children:"Try refreshing the page or check your browser's WebGL support."})]})}):this.props.children}}const ut=a.lazy(()=>ts(()=>import("./ContactsMapMapLibre-DAxQZgO0.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43]))),$e=()=>e.jsx("div",{className:"map-container-16-9 flex items-center justify-center rounded-2xl surface-base",role:"status","aria-live":"polite","aria-label":"Loading map",children:e.jsxs("div",{className:"text-fg-muted flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-sys-blue border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading map..."})]})});function pt({neighbors:o,localNode:c,localHash:f,onRemoveNode:x,selectedNodeHash:g,onNodeSelected:v,highlightedEdgeKey:p,highlightedGhost:d}){return ss()===!1?e.jsx($e,{}):e.jsx(xt,{children:e.jsx(a.Suspense,{fallback:e.jsx($e,{}),children:e.jsx(ut,{neighbors:o,localNode:c,localHash:f,onRemoveNode:x,selectedNodeHash:g,onNodeSelected:v,highlightedEdgeKey:p,highlightedGhost:d})})})}function ht({hash:o,className:c="",size:f="sm",collisionInfo:x,isViterbiResolved:g}){const v=Ee(),p=Fe(),[d,T]=a.useState(!1),S=a.useMemo(()=>oe(o),[o]),L=a.useMemo(()=>x!==void 0?x:S?v.find(j=>j.prefix===S)??null:null,[S,v,x]),$=g??(p.totalPaths>0&&p.avgPathConfidence>=.7),O=a.useCallback(j=>{j.preventDefault(),j.stopPropagation(),T(!0)},[]),B=a.useCallback(()=>{T(!1)},[]);if(!L)return null;const w=f==="sm"?"w-3.5 h-3.5":"w-4 h-4",H=$?"text-sys-cyan hover:text-sys-cyan hover:bg-sys-cyan/10 focus:ring-sys-cyan/50":"text-signal-fair hover:text-sys-indigo hover:bg-signal-fair/10 focus:ring-signal-fair/50",_=$?`Prefix conflict resolved by Viterbi HMM (${(p.avgPathConfidence*100).toFixed(0)}% confidence)`:`Prefix conflict: ${L.candidateCount} nodes share prefix "${S}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:O,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${H} ${c}`,title:_,"aria-label":`View prefix conflict for ${S}${$?" (Viterbi resolved)":""}`,children:$?e.jsxs("span",{className:"relative",children:[e.jsx(Ds,{className:w}),e.jsx(ke,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-sys-green"})]}):e.jsx(et,{className:w})}),e.jsx(Os,{isOpen:d,prefix:L.prefix,candidateHashes:L.candidateHashes,onClose:B})]})}const ft=a.memo(ht),Ae=[{target:"Contacts",fn:"name",minStage:1,when:_s},{target:"Contacts",fn:"traceLinks.directed",minStage:2,when:Rs}];Ps(Ae);function gt(o){return o<1e3?`${Math.round(o)}m`:`${(o/1e3).toFixed(1)}km`}function jt({hash:o,contact:c,isHub:f,isNeighbor:x,distance:g,centrality:v,sparklineData:p,neighborSignal:d,collisionInfo:T,isViterbiResolved:S,isPinging:L,isPingingThis:$,pingResult:O,pingError:B,gatewayInfo:w,lastForwarderPrefix:H,isMobile:_,pathStability:j,onRowClick:E,onPing:fe,onRemove:V}){Ss(Ae);const Z=c.latitude&&c.longitude&&c.latitude!==0&&c.longitude!==0,h=c.node_name||c.name||"Unknown",q=x&&d,z=Ce(c),{isRepeater:U,isCompanion:y,isRoomServer:W,isClient:J,label:ee}=z,ge=x?`${ee} — Direct RF contact (zero-hop neighbor)`:`${ee} — Flood routing (multi-hop via mesh)`,G=c.first_seen?Pe(c.first_seen).replace(/ ago$/i," old"):null;return e.jsxs("div",{className:`contacts-grid-row ${f?"bg-sys-amber/5 border-l-2 border-l-sys-amber":""} ${Z?"cursor-pointer hover:bg-subtle-fill":""}`,onClick:()=>E(o),children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[q&&(d==null?void 0:d.avgSnr)!==null?e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 self-center ${ns(d.avgSnr)}`}):e.jsx("div",{className:"w-2 flex-shrink-0"}),e.jsx("div",{className:"w-6 h-6 flex items-center justify-center flex-shrink-0",title:ge,children:(()=>{if(W&&U)return e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(he,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(zs,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]});if(W)return e.jsx(he,{className:"w-5 h-5 text-sys-pink"});if(U)return e.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(pe,{className:"w-3.5 h-3.5 text-sys-blue"})});if((y||J)&&h!=="Unknown"){const{emoji:b,cleanName:D}=Ts(h);return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center",style:{backgroundColor:Ls(D)},children:b?e.jsx("span",{className:"text-sm leading-none",children:b}):e.jsx("span",{className:"text-white text-[9px] font-bold tracking-tighter",children:$s(h)})})}return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-zinc-500/20",children:e.jsx(ze,{className:"w-3.5 h-3.5 text-sys-amber"})})})()}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[e.jsx("span",{className:"roster-title truncate",title:h,children:h}),x&&e.jsx(k,{color:X.neighbor,compact:!0,className:"flex-shrink-0",children:"NBR"}),f&&e.jsxs(k,{color:X.hub,compact:!0,className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(Bs,{className:"w-3 h-3"}),"HUB"]}),U&&e.jsx(k,{color:X.repeater,compact:!0,className:"flex-shrink-0",children:"RPT"}),W&&e.jsx(k,{color:X.room,compact:!0,className:"flex-shrink-0",children:"ROOM"}),y&&e.jsx(k,{color:X.companion,compact:!0,className:"flex-shrink-0",children:"COMP"}),J&&e.jsx(k,{color:X.client,compact:!0,className:"flex-shrink-0",children:"CLIENT"}),_&&e.jsxs(k,{color:"cyan",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",children:[e.jsx(ot,{className:"w-2.5 h-2.5"}),"MOBILE"]}),!Z&&e.jsx("span",{className:"flex items-center gap-0.5 flex-shrink-0 text-fg-muted/50",title:"No GPS location provided",children:e.jsx(at,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(As,{copy:!0,size:"compact",truncate:[8,6],children:o}),e.jsx(ft,{hash:o,collisionInfo:T,isViterbiResolved:S}),!x&&w&&e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`Via ${w.name||w.prefix} (${w.hopCount} hop${w.hopCount!==1?"s":""})`,children:[e.jsx(Es,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:w.prefix}),w.hopCount>1&&e.jsxs("span",{className:"opacity-60",children:["+",w.hopCount-1]})]}),H&&!x&&e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`Last forwarded by ${H}`,children:[e.jsx(Qs,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:H})]}),j!=null&&j!==0&&e.jsx(k,{color:j>0?"green":"amber",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:j>0?"Path stability improving":"Path stability declining",children:j>0?e.jsx(as,{className:"w-2.5 h-2.5"}):e.jsx(mt,{className:"w-2.5 h-2.5"})}),p.length>0&&(()=>{const b=p.reduce((je,se)=>je+se.count,0);if(b===0)return null;const D=b/24;return e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`${b} packets in last 24h (~${D.toFixed(1)}/hr)`,children:[e.jsx(it,{className:"w-2.5 h-2.5"}),e.jsxs("span",{children:[D<1?"<1":D.toFixed(0),"/hr"]})]})})(),G&&e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0 opacity-70",title:`First discovered ${G}`,children:[e.jsx(Zs,{className:"w-2.5 h-2.5"}),e.jsx("span",{children:G})]})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[q&&(d==null?void 0:d.avgRssi)!==null&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Fs,{rssi:d.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs text-fg-muted",children:Math.round(d.avgRssi)})]}),q&&(d==null?void 0:d.avgSnr)!==null&&e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[d.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-fg-muted",children:g!=null&&e.jsxs(e.Fragment,{children:[e.jsx(He,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs",children:gt(g)})]})}),e.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:v>0&&e.jsxs(e.Fragment,{children:[e.jsx(De,{className:"w-3 h-3 text-sys-indigo"}),e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[(v*100).toFixed(0),"%"]})]})}),e.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:e.jsx("span",{className:"type-data-xs text-fg-primary whitespace-nowrap",children:c.last_seen?Pe(c.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[x&&e.jsx(e.Fragment,{children:O?e.jsxs("div",{className:"flex items-center gap-1 text-sys-green",title:`RTT: ${O.rtt_ms.toFixed(0)}ms`,children:[e.jsx(ke,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"type-data-xs hidden sm:inline",children:[O.snr_db.toFixed(1),"dB"]})]}):B?e.jsx("span",{className:"text-sys-red text-xs",title:B,children:"✗"}):e.jsx("button",{onClick:b=>fe(o,b),disabled:L,className:"p-1 sm:p-1.5 radius-inner text-fg-muted/50 hover:text-sys-blue hover:bg-sys-blue/10 transition-base disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:$?e.jsx(Oe,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(Hs,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:b=>{b.stopPropagation(),V(o,h)},className:"p-1 sm:p-1.5 radius-inner text-fg-muted/50 hover:text-sys-red hover:bg-sys-red/10 transition-base",title:"Remove contact",children:e.jsx(Vs,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]})}const bt=a.memo(jt),yt=6371e3,Nt=[],vt=[{field:"lastHeard",icon:Is,label:"Recent"},{field:"distance",icon:He,label:"Distance"},{field:"centrality",icon:De,label:"Centrality"}];function wt(o){switch(o){case"room_server":return"room";case"repeater":return"repeater";case"companion":return"companion";case"unknown":return"companion"}}function kt(o){const c=Ce(o);return wt(c.type)}function ve(o,c){const{color:f="primary",border:x=!1}=c??{};return we("flex items-center gap-1.5 px-2 py-1.5 text-sm radius-inner transition-base",o?f==="success"?"bg-sys-green/20 text-sys-green":"bg-sys-blue/20 text-sys-blue":"text-fg-muted hover:text-fg-secondary hover-bg",x&&(o?f==="success"?"border border-sys-green/30":"border border-sys-blue/30":"border border-transparent"))}function Ct(o,c,f,x){const g=(f-o)*Math.PI/180,v=(x-c)*Math.PI/180,p=Math.sin(g/2)*Math.sin(g/2)+Math.cos(o*Math.PI/180)*Math.cos(f*Math.PI/180)*Math.sin(v/2)*Math.sin(v/2),d=2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p));return yt*d}function Mt(){const{stats:o}=rs(),c=os(),f=cs(),x=is(),g=ls(),v=ds(),p=ms(),d=xs(),T=us(),S=ps(),L=Ne[T],$=Ee(),O=Fe(),B=hs(),w=O.totalPaths>0&&O.avgPathConfidence>=.7,H=a.useMemo(()=>{const s=new Map;for(const t of $)s.set(t.prefix,t);return s},[$]),[_,j]=a.useState(null),[E,fe]=a.useState("lastHeard"),[V,Z]=a.useState("desc"),[h,q]=a.useState(""),[z,U]=a.useState(!1),[y,W]=a.useState(new Set),[J,ee]=a.useState(!1),[ge,G]=a.useState(null),[b,D]=a.useState(null),[je,se]=a.useState(new Map),[Ie,te]=a.useState(new Map),[C,Be]=a.useState(25),[Q,ce]=a.useState(25),be=a.useRef(null),ne=a.useMemo(()=>(o==null?void 0:o.neighbors)??{},[o==null?void 0:o.neighbors]),ye=ys(),ie=a.useMemo(()=>{if(ye.size===0)return ne;const s=new Set;for(const n of Object.keys(ne))s.add((n.startsWith("0x")?n.slice(2):n).toLowerCase());let t=null;for(const[n,r]of ye){const i=(n.startsWith("0x")?n.slice(2):n).toLowerCase();s.has(i)||(t||(t={...ne}),t[n]={last_seen:r.lastSeen,name:r.name??void 0,node_name:r.name??void 0,latitude:r.latitude,longitude:r.longitude,is_repeater:r.nodeType==="repeater",contact_type:r.nodeType==="repeater"?"Repeater":r.nodeType==="companion"?"Companion":r.nodeType==="room_server"?"Room Server":void 0})}return t??ne},[ne,ye]),A=a.useMemo(()=>{const t=Date.now()/1e3-L.minutes*60;return Object.fromEntries(Object.entries(ie).filter(([n,r])=>c.has(n)?!1:(r.last_seen??0)>=t))},[ie,c,L.minutes]),R=fs(),Y=o==null?void 0:o.local_hash,Ve=a.useMemo(()=>{const s=new Map;if(!Y||p.size===0)return s;for(const[t,n]of p)if(t.endsWith(`→${Y}`)&&n.hops.length>1){const r=t.split("→")[0],i=n.hops[n.hops.length-1];s.set(r,i)}return s},[p,Y]),le=a.useMemo(()=>{const s=new Map;if(!(R!=null&&R.latitude)||!(R!=null&&R.longitude))return s;for(const[t,n]of Object.entries(A))n.latitude&&n.longitude&&n.latitude!==0&&n.longitude!==0?s.set(t,Ct(R.latitude,R.longitude,n.latitude,n.longitude)):s.set(t,null);return s},[A,R]),{neighborHashSet:de,neighborSignalMap:qe}=a.useMemo(()=>{const s=new Set,t=new Map;for(const n of v)s.add(n.hash),t.set(n.hash,{avgRssi:n.avgRssi,avgSnr:n.avgSnr});return{neighborHashSet:s,neighborSignalMap:t}},[v]),Me=a.useMemo(()=>{const s=h.toLowerCase().trim(),t=s==="neighbor"||s==="neighbors",n=z||t,r=y.size>0;return Object.fromEntries(Object.entries(A).filter(([i,l])=>{if(r){const M=kt(l);if(!y.has(M))return!1}if(n&&!de.has(i))return!1;if(t||!s)return!0;const I=(l.node_name||l.name||"").toLowerCase(),N=oe(i).toLowerCase();return I.includes(s)||N.includes(s)||i.toLowerCase().includes(s)}))},[A,h,z,de,y]),u=a.useMemo(()=>{const s=Object.entries(Me),t=h.toLowerCase().trim(),n=t.length===2&&/^[0-9a-f]{2}$/i.test(t);return s.sort(([r,i],[l,I])=>{if(n){const M=oe(r).toLowerCase(),F=oe(l).toLowerCase(),ae=M===t,me=F===t;if(ae&&!me)return-1;if(me&&!ae)return 1}let N=0;switch(E){case"lastHeard":N=(i.last_seen||0)-(I.last_seen||0);break;case"distance":{const M=le.get(r)??null,F=le.get(l)??null;M===null&&F===null?N=0:M===null?N=1:F===null?N=-1:N=M-F;break}case"centrality":{const M=g.get(r)||0,F=g.get(l)||0;N=M-F;break}}return V==="desc"?-N:N})},[Me,E,V,le,g,h]),m=a.useMemo(()=>{let s=0,t=0,n=0,r=0,i=0;for(const[,l]of u){const I=Ce(l),N=l.latitude&&l.longitude&&l.latitude!==0&&l.longitude!==0;switch(I.type){case"room_server":n++;break;case"repeater":t++;break;case"companion":s++;break;case"unknown":i++;break}N&&r++}return{companions:s,repeaters:t,roomServers:n,total:u.length,withLocation:r,unknown:i}},[u]),Ue=a.useMemo(()=>new Set(x),[x]),Se=a.useMemo(()=>C===0?u:u.slice(0,Q),[u,Q,C]);a.useEffect(()=>{ce(C||u.length)},[E,V,h,z,y,C,u.length]),a.useEffect(()=>{const s=t=>{t.target.closest("[data-dropdown]")||ee(!1)};return document.addEventListener("click",s),()=>document.removeEventListener("click",s)},[]),a.useEffect(()=>{if(C===0)return;const s=new IntersectionObserver(t=>{t[0].isIntersecting&&QMath.min(n+C,u.length))},{threshold:.1,rootMargin:"100px"});return be.current&&s.observe(be.current),()=>s.disconnect()},[C,Q,u.length]);const We=a.useCallback(s=>{Be(s),ce(s||u.length)},[u.length]),Ge=a.useCallback(s=>{E===s?Z(t=>t==="desc"?"asc":"desc"):(fe(s),Z("desc"))},[E]),Qe=a.useCallback(s=>{const t=A[s];t!=null&&t.latitude&&(t!=null&&t.longitude)&&t.latitude!==0&&t.longitude!==0&&G(s)},[A]),Ye=a.useCallback(()=>{G(null)},[]),Ke=a.useCallback((s,t)=>{j({hash:s,name:t})},[]),Xe=a.useCallback(async(s,t)=>{if(t.stopPropagation(),!b){D(s),se(n=>{const r=new Map(n);return r.delete(s),r}),te(n=>{const r=new Map(n);return r.delete(s),r});try{const n=s.startsWith("0x")?s.slice(0,4):`0x${s.slice(0,2)}`,r=await Ns(n,30);r.success&&r.data?(se(i=>new Map(i).set(s,r.data)),setTimeout(()=>{se(i=>{const l=new Map(i);return l.delete(s),l})},1e4)):(te(i=>new Map(i).set(s,r.error||"Ping failed")),setTimeout(()=>{te(i=>{const l=new Map(i);return l.delete(s),l})},5e3))}catch(n){const r=n instanceof Error?n.message:"Ping failed";te(i=>new Map(i).set(s,r)),setTimeout(()=>{te(i=>{const l=new Map(i);return l.delete(s),l})},5e3)}finally{D(null)}}},[b]);return e.jsxs(vs,{children:[e.jsx(ws,{title:"Contacts",icon:e.jsx(re,{}),subtitle:e.jsx(Ms,{}),controls:e.jsxs("div",{className:"flex items-center gap-3 sm:gap-5",children:[e.jsxs("div",{className:"hidden sm:flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Total:"}),e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${m.total} discovered node${m.total!==1?"s":""} on the mesh network`,children:[e.jsx(re,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:m.total})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Types:"}),m.repeaters>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Repeaters",children:[e.jsx(pe,{className:"w-3.5 h-3.5 text-sys-blue"}),e.jsx("span",{children:m.repeaters})]}),m.companions>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Companions",children:[e.jsx(Le,{className:"w-3.5 h-3.5 text-fg-muted"}),e.jsx("span",{children:m.companions})]}),m.roomServers>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Room Servers",children:[e.jsx(he,{className:"w-3.5 h-3.5 text-sys-pink"}),e.jsx("span",{children:m.roomServers})]}),m.withLocation>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"With GPS location",children:[e.jsx(Us,{className:"w-3.5 h-3.5 text-sys-green"}),e.jsx("span",{children:m.withLocation})]}),m.unknown>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Unknown type",children:[e.jsx(ze,{className:"w-3.5 h-3.5 text-sys-amber"}),e.jsx("span",{children:m.unknown})]})]})]}),e.jsxs("div",{className:"flex sm:hidden items-center gap-1.5",children:[e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(re,{className:"w-3 h-3 text-fg-secondary"}),e.jsx("span",{children:m.total})]}),m.repeaters>0&&e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(pe,{className:"w-3 h-3 text-sys-blue"}),e.jsx("span",{children:m.repeaters})]}),m.companions>0&&e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(Le,{className:"w-3 h-3 text-fg-muted"}),e.jsx("span",{children:m.companions})]}),m.roomServers>0&&e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(he,{className:"w-3 h-3 text-sys-pink"}),e.jsx("span",{children:m.roomServers})]}),e.jsx(Te,{ranges:Ne,selectedIndex:T,onSelect:S,size:"sm"})]}),e.jsx("div",{className:"hidden sm:block",children:e.jsx(Te,{ranges:Ne,selectedIndex:T,onSelect:S})})]})}),e.jsxs(ks,{children:[e.jsx(pt,{neighbors:A,localNode:R??void 0,localHash:Y,onRemoveNode:f,selectedNodeHash:ge,onNodeSelected:Ye}),e.jsxs(gs,{noPadding:!0,children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 px-3 sm:px-4 py-2.5 border-b border-edge-subtle",children:[e.jsx("span",{className:"icon-md flex items-center justify-center text-icon-card-title flex-shrink-0",children:e.jsx(re,{})}),e.jsx("span",{className:"type-micro flex-shrink-0 mr-auto hidden sm:block",children:"Discovered Contacts"}),e.jsx(js,{type:"search",size:"sm",value:h,onChange:s=>q(s.target.value),placeholder:"Search...",leadingIcon:e.jsx(Ws,{className:"w-3.5 h-3.5"}),trailingIcon:h?e.jsx("button",{onClick:()=>{q(""),(h.toLowerCase().trim()==="neighbor"||h.toLowerCase().trim()==="neighbors")&&U(!1)},className:"text-fg-muted hover:text-fg-secondary",children:e.jsx(bs,{className:"w-3 h-3"})}):void 0,className:"w-24 sm:w-32 xl:w-44","aria-label":"Search contacts"}),e.jsx("div",{className:"h-4 w-px bg-border-subtle flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsxs("div",{className:"relative","data-dropdown":!0,children:[e.jsxs("button",{onClick:()=>ee(!J),className:ve(y.size>0,{border:!0}),title:"Filter by contact type",children:[e.jsx(tt,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:"Filter"}),y.size>0&&e.jsx("span",{className:"tabular-nums text-xs bg-sys-blue/30 px-1 rounded",children:y.size})]}),J&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 surface-elevated radius-inner py-1 min-w-[140px]",children:[[{key:"repeater",label:"Repeaters"},{key:"companion",label:"Companions"},{key:"room",label:"Rooms"}].map(({key:s,label:t})=>e.jsxs("button",{onClick:()=>{W(n=>{const r=new Set(n);return r.has(s)?r.delete(s):r.add(s),r})},className:"w-full px-3 py-1.5 text-sm text-left hover-bg transition-base flex items-center gap-2",children:[e.jsx("span",{className:we("w-4 h-4 flex items-center justify-center radius-badge border",y.has(s)?"bg-sys-blue border-sys-blue text-white":"border-edge-subtle"),children:y.has(s)&&e.jsx(ke,{className:"w-3 h-3"})}),e.jsx("span",{className:y.has(s)?"text-fg-primary":"text-fg-secondary",children:t})]},s)),y.size>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-edge-subtle my-1"}),e.jsx("button",{onClick:()=>W(new Set),className:"w-full px-3 py-1.5 text-sm text-left text-fg-muted hover:text-fg-secondary hover-bg transition-base",children:"Clear filters"})]})]})]}),de.size>0&&e.jsxs("button",{onClick:()=>U(!z),className:ve(z,{color:"success",border:!0}),title:z?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(pe,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:"Neighbors"})]})]}),e.jsx("div",{className:"h-4 w-px bg-border-subtle flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[vt.map(({field:s,icon:t,label:n})=>e.jsxs("button",{onClick:()=>Ge(s),className:ve(E===s),title:`Sort by ${n.toLowerCase()}`,children:[e.jsx(t,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:n}),E===s&&e.jsx(Ks,{className:we("w-3 h-3",V==="asc"&&"rotate-180")})]},s)),e.jsx("div",{className:"h-4 w-px bg-border-subtle"}),e.jsxs(Cs,{value:C,onChange:We,className:"w-auto min-w-[50px] [&_button]:py-1 [&_button]:px-2 [&_button]:text-xs [&_button]:min-h-0","aria-label":"Items per page",children:[e.jsx(ue,{value:25,children:"25"}),e.jsx(ue,{value:50,children:"50"}),e.jsx(ue,{value:100,children:"100"}),e.jsx(ue,{value:0,children:"All"})]})]})]}),u.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden sm:grid contacts-grid-header border-b border-edge-subtle/50 px-3 py-2 type-micro text-fg-muted",children:[e.jsx("div",{className:"contacts-col-node",children:"Node"}),e.jsx("div",{className:"contacts-col-signal text-right",children:"Signal"}),e.jsx("div",{className:"contacts-col-distance text-right",children:"Distance"}),e.jsx("div",{className:"contacts-col-centrality text-right",children:"Centrality"}),e.jsx("div",{className:"contacts-col-seen text-right",children:"Last Seen"}),e.jsx("div",{className:"contacts-col-actions"})]}),e.jsx("div",{className:"divide-y divide-edge-subtle/30",children:Se.map(([s,t])=>{const n=oe(s),r=Ue.has(s),i=de.has(s),l=le.get(s)??null,I=g.get(s)||0,N=i?qe.get(s):void 0,M=n?H.get(n)??null:null,F=B.get(s)??Nt;let ae=null;if(!i&&Y&&p.size>0){const Je=`${s}→${Y}`,xe=p.get(Je);if(xe&&xe.hops.length>0){const _e=xe.hops[0],Re=Object.keys(ie).find(es=>es.toUpperCase().startsWith(_e.toUpperCase())),K=Re?ie[Re]:null;ae={prefix:_e,name:(K==null?void 0:K.node_name)??(K==null?void 0:K.name)??null,hopCount:xe.hopCount}}}const me=d.has(s),Ze=Ve.get(s)??null;return e.jsx(bt,{hash:s,contact:t,isHub:r,isNeighbor:i,distance:l,centrality:I,sparklineData:F,neighborSignal:N,collisionInfo:M,isViterbiResolved:w,isPinging:b!==null,isPingingThis:b===s,pingResult:je.get(s),pingError:Ie.get(s),gatewayInfo:ae,lastForwarderPrefix:Ze,isMobile:me,onRowClick:Qe,onPing:Xe,onRemove:Ke},s)})}),C>0&&Q0&&Qce(s=>Math.min(s+C,u.length)),className:"text-sys-blue hover:text-sys-blue/80 transition-base",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(re,{className:"roster-empty-icon"}),e.jsx("div",{className:"type-label text-fg-secondary",children:"No Contacts Discovered"}),e.jsx("div",{className:"type-data-xs text-fg-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]})]}),e.jsx(qs,{isOpen:!!_,title:"Remove Contact",message:`Are you sure you would like to remove ${(_==null?void 0:_.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{_&&f(_.hash),j(null)},onCancel:()=>j(null)})]})}const Yt=Object.freeze(Object.defineProperty({__proto__:null,default:Mt},Symbol.toStringTag,{value:"Module"}));export{Yt as C,ft as P,He as R,mt as T}; + */const dt=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],mt=P("trending-down",dt);class xt extends a.Component{constructor(c){super(c),this.state={hasError:!1}}static getDerivedStateFromError(c){return{hasError:!0,error:c}}render(){var c;return this.state.hasError?e.jsx("div",{className:"map-container-16-9 flex items-center justify-center rounded-2xl surface-base",role:"alert","aria-live":"assertive",children:e.jsxs("div",{className:"text-center text-fg-muted p-4",children:[e.jsx("p",{className:"text-lg mb-2",children:"Map failed to load"}),e.jsx("p",{className:"text-sm text-fg-muted",children:((c=this.state.error)==null?void 0:c.message)||"Unknown error"}),e.jsx("p",{className:"text-xs text-fg-muted mt-2",children:"Try refreshing the page or check your browser's WebGL support."})]})}):this.props.children}}const ut=a.lazy(()=>ts(()=>import("./ContactsMapMapLibre-NYBNCx0J.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43]))),$e=()=>e.jsx("div",{className:"map-container-16-9 flex items-center justify-center rounded-2xl surface-base",role:"status","aria-live":"polite","aria-label":"Loading map",children:e.jsxs("div",{className:"text-fg-muted flex items-center gap-3",children:[e.jsx("div",{className:"w-5 h-5 border-2 border-sys-blue border-t-transparent rounded-full animate-spin","aria-hidden":"true"}),e.jsx("span",{children:"Loading map..."})]})});function pt({neighbors:o,localNode:c,localHash:f,onRemoveNode:x,selectedNodeHash:g,onNodeSelected:v,highlightedEdgeKey:p,highlightedGhost:d}){return ss()===!1?e.jsx($e,{}):e.jsx(xt,{children:e.jsx(a.Suspense,{fallback:e.jsx($e,{}),children:e.jsx(ut,{neighbors:o,localNode:c,localHash:f,onRemoveNode:x,selectedNodeHash:g,onNodeSelected:v,highlightedEdgeKey:p,highlightedGhost:d})})})}function ht({hash:o,className:c="",size:f="sm",collisionInfo:x,isViterbiResolved:g}){const v=Ee(),p=Fe(),[d,T]=a.useState(!1),S=a.useMemo(()=>oe(o),[o]),L=a.useMemo(()=>x!==void 0?x:S?v.find(j=>j.prefix===S)??null:null,[S,v,x]),$=g??(p.totalPaths>0&&p.avgPathConfidence>=.7),O=a.useCallback(j=>{j.preventDefault(),j.stopPropagation(),T(!0)},[]),B=a.useCallback(()=>{T(!1)},[]);if(!L)return null;const w=f==="sm"?"w-3.5 h-3.5":"w-4 h-4",H=$?"text-sys-cyan hover:text-sys-cyan hover:bg-sys-cyan/10 focus:ring-sys-cyan/50":"text-signal-fair hover:text-sys-indigo hover:bg-signal-fair/10 focus:ring-signal-fair/50",_=$?`Prefix conflict resolved by Viterbi HMM (${(p.avgPathConfidence*100).toFixed(0)}% confidence)`:`Prefix conflict: ${L.candidateCount} nodes share prefix "${S}"`;return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:O,className:`inline-flex items-center justify-center p-0.5 rounded focus:outline-none focus:ring-2 transition-colors cursor-pointer touch-manipulation ${H} ${c}`,title:_,"aria-label":`View prefix conflict for ${S}${$?" (Viterbi resolved)":""}`,children:$?e.jsxs("span",{className:"relative",children:[e.jsx(Ds,{className:w}),e.jsx(ke,{className:"absolute -bottom-0.5 -right-0.5 w-2 h-2 text-sys-green"})]}):e.jsx(et,{className:w})}),e.jsx(Os,{isOpen:d,prefix:L.prefix,candidateHashes:L.candidateHashes,onClose:B})]})}const ft=a.memo(ht),Ae=[{target:"Contacts",fn:"name",minStage:1,when:_s},{target:"Contacts",fn:"traceLinks.directed",minStage:2,when:Rs}];Ps(Ae);function gt(o){return o<1e3?`${Math.round(o)}m`:`${(o/1e3).toFixed(1)}km`}function jt({hash:o,contact:c,isHub:f,isNeighbor:x,distance:g,centrality:v,sparklineData:p,neighborSignal:d,collisionInfo:T,isViterbiResolved:S,isPinging:L,isPingingThis:$,pingResult:O,pingError:B,gatewayInfo:w,lastForwarderPrefix:H,isMobile:_,pathStability:j,onRowClick:E,onPing:fe,onRemove:V}){Ss(Ae);const Z=c.latitude&&c.longitude&&c.latitude!==0&&c.longitude!==0,h=c.node_name||c.name||"Unknown",q=x&&d,z=Ce(c),{isRepeater:U,isCompanion:y,isRoomServer:W,isClient:J,label:ee}=z,ge=x?`${ee} — Direct RF contact (zero-hop neighbor)`:`${ee} — Flood routing (multi-hop via mesh)`,G=c.first_seen?Pe(c.first_seen).replace(/ ago$/i," old"):null;return e.jsxs("div",{className:`contacts-grid-row ${f?"bg-sys-amber/5 border-l-2 border-l-sys-amber":""} ${Z?"cursor-pointer hover:bg-subtle-fill":""}`,onClick:()=>E(o),children:[e.jsxs("div",{className:"contacts-col-node flex items-center gap-2 min-w-0",children:[q&&(d==null?void 0:d.avgSnr)!==null?e.jsx("div",{className:`w-2 h-2 rounded-full flex-shrink-0 self-center ${ns(d.avgSnr)}`}):e.jsx("div",{className:"w-2 flex-shrink-0"}),e.jsx("div",{className:"w-6 h-6 flex items-center justify-center flex-shrink-0",title:ge,children:(()=>{if(W&&U)return e.jsxs("div",{className:"relative w-5 h-5",children:[e.jsx(he,{className:"w-5 h-5 absolute inset-0 text-sys-pink"}),e.jsx(zs,{className:"w-2.5 h-2.5 absolute -bottom-0.5 -right-0.5 text-sys-teal"})]});if(W)return e.jsx(he,{className:"w-5 h-5 text-sys-pink"});if(U)return e.jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(pe,{className:"w-3.5 h-3.5 text-sys-blue"})});if((y||J)&&h!=="Unknown"){const{emoji:b,cleanName:D}=Ts(h);return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center",style:{backgroundColor:Ls(D)},children:b?e.jsx("span",{className:"text-sm leading-none",children:b}):e.jsx("span",{className:"text-white text-[9px] font-bold tracking-tighter",children:$s(h)})})}return e.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center bg-zinc-500/20",children:e.jsx(ze,{className:"w-3.5 h-3.5 text-sys-amber"})})})()}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5 overflow-hidden",children:[e.jsx("span",{className:"roster-title truncate",title:h,children:h}),x&&e.jsx(k,{color:X.neighbor,compact:!0,className:"flex-shrink-0",children:"NBR"}),f&&e.jsxs(k,{color:X.hub,compact:!0,className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(Bs,{className:"w-3 h-3"}),"HUB"]}),U&&e.jsx(k,{color:X.repeater,compact:!0,className:"flex-shrink-0",children:"RPT"}),W&&e.jsx(k,{color:X.room,compact:!0,className:"flex-shrink-0",children:"ROOM"}),y&&e.jsx(k,{color:X.companion,compact:!0,className:"flex-shrink-0",children:"COMP"}),J&&e.jsx(k,{color:X.client,compact:!0,className:"flex-shrink-0",children:"CLIENT"}),_&&e.jsxs(k,{color:"cyan",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",children:[e.jsx(ot,{className:"w-2.5 h-2.5"}),"MOBILE"]}),!Z&&e.jsx("span",{className:"flex items-center gap-0.5 flex-shrink-0 text-fg-muted/50",title:"No GPS location provided",children:e.jsx(at,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx(As,{copy:!0,size:"compact",truncate:[8,6],children:o}),e.jsx(ft,{hash:o,collisionInfo:T,isViterbiResolved:S}),!x&&w&&e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`Via ${w.name||w.prefix} (${w.hopCount} hop${w.hopCount!==1?"s":""})`,children:[e.jsx(Es,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:w.prefix}),w.hopCount>1&&e.jsxs("span",{className:"opacity-60",children:["+",w.hopCount-1]})]}),H&&!x&&e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`Last forwarded by ${H}`,children:[e.jsx(Qs,{className:"w-2.5 h-2.5"}),e.jsx("span",{className:"font-mono",children:H})]}),j!=null&&j!==0&&e.jsx(k,{color:j>0?"green":"amber",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:j>0?"Path stability improving":"Path stability declining",children:j>0?e.jsx(as,{className:"w-2.5 h-2.5"}):e.jsx(mt,{className:"w-2.5 h-2.5"})}),p.length>0&&(()=>{const b=p.reduce((je,se)=>je+se.count,0);if(b===0)return null;const D=b/24;return e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0",title:`${b} packets in last 24h (~${D.toFixed(1)}/hr)`,children:[e.jsx(it,{className:"w-2.5 h-2.5"}),e.jsxs("span",{children:[D<1?"<1":D.toFixed(0),"/hr"]})]})})(),G&&e.jsxs(k,{color:"zinc",compact:!0,className:"flex items-center gap-0.5 flex-shrink-0 opacity-70",title:`First discovered ${G}`,children:[e.jsx(Zs,{className:"w-2.5 h-2.5"}),e.jsx("span",{children:G})]})]})]})]}),e.jsxs("div",{className:"contacts-col-signal flex items-center justify-end gap-2",children:[q&&(d==null?void 0:d.avgRssi)!==null&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Fs,{rssi:d.avgRssi,className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs text-fg-muted",children:Math.round(d.avgRssi)})]}),q&&(d==null?void 0:d.avgSnr)!==null&&e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[d.avgSnr.toFixed(1)," dB"]})]}),e.jsx("div",{className:"contacts-col-distance flex items-center justify-end gap-1 text-fg-muted",children:g!=null&&e.jsxs(e.Fragment,{children:[e.jsx(He,{className:"w-3 h-3"}),e.jsx("span",{className:"type-data-xs",children:gt(g)})]})}),e.jsx("div",{className:"contacts-col-centrality flex items-center justify-end gap-1",children:v>0&&e.jsxs(e.Fragment,{children:[e.jsx(De,{className:"w-3 h-3 text-sys-indigo"}),e.jsxs("span",{className:"type-data-xs text-fg-muted",children:[(v*100).toFixed(0),"%"]})]})}),e.jsx("div",{className:"contacts-col-seen flex items-center justify-end",children:e.jsx("span",{className:"type-data-xs text-fg-primary whitespace-nowrap",children:c.last_seen?Pe(c.last_seen):"—"})}),e.jsxs("div",{className:"contacts-col-actions flex items-center justify-end gap-1",children:[x&&e.jsx(e.Fragment,{children:O?e.jsxs("div",{className:"flex items-center gap-1 text-sys-green",title:`RTT: ${O.rtt_ms.toFixed(0)}ms`,children:[e.jsx(ke,{className:"w-3.5 h-3.5"}),e.jsxs("span",{className:"type-data-xs hidden sm:inline",children:[O.snr_db.toFixed(1),"dB"]})]}):B?e.jsx("span",{className:"text-sys-red text-xs",title:B,children:"✗"}):e.jsx("button",{onClick:b=>fe(o,b),disabled:L,className:"p-1 sm:p-1.5 radius-inner text-fg-muted/50 hover:text-sys-blue hover:bg-sys-blue/10 transition-base disabled:opacity-50 disabled:cursor-not-allowed",title:"Ping neighbor for updated signal info",children:$?e.jsx(Oe,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4 animate-spin"}):e.jsx(Hs,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})}),e.jsx("button",{onClick:b=>{b.stopPropagation(),V(o,h)},className:"p-1 sm:p-1.5 radius-inner text-fg-muted/50 hover:text-sys-red hover:bg-sys-red/10 transition-base",title:"Remove contact",children:e.jsx(Vs,{className:"w-3.5 h-3.5 sm:w-4 sm:h-4"})})]})]})}const bt=a.memo(jt),yt=6371e3,Nt=[],vt=[{field:"lastHeard",icon:Is,label:"Recent"},{field:"distance",icon:He,label:"Distance"},{field:"centrality",icon:De,label:"Centrality"}];function wt(o){switch(o){case"room_server":return"room";case"repeater":return"repeater";case"companion":return"companion";case"unknown":return"companion"}}function kt(o){const c=Ce(o);return wt(c.type)}function ve(o,c){const{color:f="primary",border:x=!1}=c??{};return we("flex items-center gap-1.5 px-2 py-1.5 text-sm radius-inner transition-base",o?f==="success"?"bg-sys-green/20 text-sys-green":"bg-sys-blue/20 text-sys-blue":"text-fg-muted hover:text-fg-secondary hover-bg",x&&(o?f==="success"?"border border-sys-green/30":"border border-sys-blue/30":"border border-transparent"))}function Ct(o,c,f,x){const g=(f-o)*Math.PI/180,v=(x-c)*Math.PI/180,p=Math.sin(g/2)*Math.sin(g/2)+Math.cos(o*Math.PI/180)*Math.cos(f*Math.PI/180)*Math.sin(v/2)*Math.sin(v/2),d=2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p));return yt*d}function Mt(){const{stats:o}=rs(),c=os(),f=cs(),x=is(),g=ls(),v=ds(),p=ms(),d=xs(),T=us(),S=ps(),L=Ne[T],$=Ee(),O=Fe(),B=hs(),w=O.totalPaths>0&&O.avgPathConfidence>=.7,H=a.useMemo(()=>{const s=new Map;for(const t of $)s.set(t.prefix,t);return s},[$]),[_,j]=a.useState(null),[E,fe]=a.useState("lastHeard"),[V,Z]=a.useState("desc"),[h,q]=a.useState(""),[z,U]=a.useState(!1),[y,W]=a.useState(new Set),[J,ee]=a.useState(!1),[ge,G]=a.useState(null),[b,D]=a.useState(null),[je,se]=a.useState(new Map),[Ie,te]=a.useState(new Map),[C,Be]=a.useState(25),[Q,ce]=a.useState(25),be=a.useRef(null),ne=a.useMemo(()=>(o==null?void 0:o.neighbors)??{},[o==null?void 0:o.neighbors]),ye=ys(),ie=a.useMemo(()=>{if(ye.size===0)return ne;const s=new Set;for(const n of Object.keys(ne))s.add((n.startsWith("0x")?n.slice(2):n).toLowerCase());let t=null;for(const[n,r]of ye){const i=(n.startsWith("0x")?n.slice(2):n).toLowerCase();s.has(i)||(t||(t={...ne}),t[n]={last_seen:r.lastSeen,name:r.name??void 0,node_name:r.name??void 0,latitude:r.latitude,longitude:r.longitude,is_repeater:r.nodeType==="repeater",contact_type:r.nodeType==="repeater"?"Repeater":r.nodeType==="companion"?"Companion":r.nodeType==="room_server"?"Room Server":void 0})}return t??ne},[ne,ye]),A=a.useMemo(()=>{const t=Date.now()/1e3-L.minutes*60;return Object.fromEntries(Object.entries(ie).filter(([n,r])=>c.has(n)?!1:(r.last_seen??0)>=t))},[ie,c,L.minutes]),R=fs(),Y=o==null?void 0:o.local_hash,Ve=a.useMemo(()=>{const s=new Map;if(!Y||p.size===0)return s;for(const[t,n]of p)if(t.endsWith(`→${Y}`)&&n.hops.length>1){const r=t.split("→")[0],i=n.hops[n.hops.length-1];s.set(r,i)}return s},[p,Y]),le=a.useMemo(()=>{const s=new Map;if(!(R!=null&&R.latitude)||!(R!=null&&R.longitude))return s;for(const[t,n]of Object.entries(A))n.latitude&&n.longitude&&n.latitude!==0&&n.longitude!==0?s.set(t,Ct(R.latitude,R.longitude,n.latitude,n.longitude)):s.set(t,null);return s},[A,R]),{neighborHashSet:de,neighborSignalMap:qe}=a.useMemo(()=>{const s=new Set,t=new Map;for(const n of v)s.add(n.hash),t.set(n.hash,{avgRssi:n.avgRssi,avgSnr:n.avgSnr});return{neighborHashSet:s,neighborSignalMap:t}},[v]),Me=a.useMemo(()=>{const s=h.toLowerCase().trim(),t=s==="neighbor"||s==="neighbors",n=z||t,r=y.size>0;return Object.fromEntries(Object.entries(A).filter(([i,l])=>{if(r){const M=kt(l);if(!y.has(M))return!1}if(n&&!de.has(i))return!1;if(t||!s)return!0;const I=(l.node_name||l.name||"").toLowerCase(),N=oe(i).toLowerCase();return I.includes(s)||N.includes(s)||i.toLowerCase().includes(s)}))},[A,h,z,de,y]),u=a.useMemo(()=>{const s=Object.entries(Me),t=h.toLowerCase().trim(),n=t.length===2&&/^[0-9a-f]{2}$/i.test(t);return s.sort(([r,i],[l,I])=>{if(n){const M=oe(r).toLowerCase(),F=oe(l).toLowerCase(),ae=M===t,me=F===t;if(ae&&!me)return-1;if(me&&!ae)return 1}let N=0;switch(E){case"lastHeard":N=(i.last_seen||0)-(I.last_seen||0);break;case"distance":{const M=le.get(r)??null,F=le.get(l)??null;M===null&&F===null?N=0:M===null?N=1:F===null?N=-1:N=M-F;break}case"centrality":{const M=g.get(r)||0,F=g.get(l)||0;N=M-F;break}}return V==="desc"?-N:N})},[Me,E,V,le,g,h]),m=a.useMemo(()=>{let s=0,t=0,n=0,r=0,i=0;for(const[,l]of u){const I=Ce(l),N=l.latitude&&l.longitude&&l.latitude!==0&&l.longitude!==0;switch(I.type){case"room_server":n++;break;case"repeater":t++;break;case"companion":s++;break;case"unknown":i++;break}N&&r++}return{companions:s,repeaters:t,roomServers:n,total:u.length,withLocation:r,unknown:i}},[u]),Ue=a.useMemo(()=>new Set(x),[x]),Se=a.useMemo(()=>C===0?u:u.slice(0,Q),[u,Q,C]);a.useEffect(()=>{ce(C||u.length)},[E,V,h,z,y,C,u.length]),a.useEffect(()=>{const s=t=>{t.target.closest("[data-dropdown]")||ee(!1)};return document.addEventListener("click",s),()=>document.removeEventListener("click",s)},[]),a.useEffect(()=>{if(C===0)return;const s=new IntersectionObserver(t=>{t[0].isIntersecting&&QMath.min(n+C,u.length))},{threshold:.1,rootMargin:"100px"});return be.current&&s.observe(be.current),()=>s.disconnect()},[C,Q,u.length]);const We=a.useCallback(s=>{Be(s),ce(s||u.length)},[u.length]),Ge=a.useCallback(s=>{E===s?Z(t=>t==="desc"?"asc":"desc"):(fe(s),Z("desc"))},[E]),Qe=a.useCallback(s=>{const t=A[s];t!=null&&t.latitude&&(t!=null&&t.longitude)&&t.latitude!==0&&t.longitude!==0&&G(s)},[A]),Ye=a.useCallback(()=>{G(null)},[]),Ke=a.useCallback((s,t)=>{j({hash:s,name:t})},[]),Xe=a.useCallback(async(s,t)=>{if(t.stopPropagation(),!b){D(s),se(n=>{const r=new Map(n);return r.delete(s),r}),te(n=>{const r=new Map(n);return r.delete(s),r});try{const n=s.startsWith("0x")?s.slice(0,4):`0x${s.slice(0,2)}`,r=await Ns(n,30);r.success&&r.data?(se(i=>new Map(i).set(s,r.data)),setTimeout(()=>{se(i=>{const l=new Map(i);return l.delete(s),l})},1e4)):(te(i=>new Map(i).set(s,r.error||"Ping failed")),setTimeout(()=>{te(i=>{const l=new Map(i);return l.delete(s),l})},5e3))}catch(n){const r=n instanceof Error?n.message:"Ping failed";te(i=>new Map(i).set(s,r)),setTimeout(()=>{te(i=>{const l=new Map(i);return l.delete(s),l})},5e3)}finally{D(null)}}},[b]);return e.jsxs(vs,{children:[e.jsx(ws,{title:"Contacts",icon:e.jsx(re,{}),subtitle:e.jsx(Ms,{}),controls:e.jsxs("div",{className:"flex items-center gap-3 sm:gap-5",children:[e.jsxs("div",{className:"hidden sm:flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Total:"}),e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${m.total} discovered node${m.total!==1?"s":""} on the mesh network`,children:[e.jsx(re,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:m.total})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-xs text-fg-muted",children:"Types:"}),m.repeaters>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Repeaters",children:[e.jsx(pe,{className:"w-3.5 h-3.5 text-sys-blue"}),e.jsx("span",{children:m.repeaters})]}),m.companions>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Companions",children:[e.jsx(Le,{className:"w-3.5 h-3.5 text-fg-muted"}),e.jsx("span",{children:m.companions})]}),m.roomServers>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Room Servers",children:[e.jsx(he,{className:"w-3.5 h-3.5 text-sys-pink"}),e.jsx("span",{children:m.roomServers})]}),m.withLocation>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"With GPS location",children:[e.jsx(Us,{className:"w-3.5 h-3.5 text-sys-green"}),e.jsx("span",{children:m.withLocation})]}),m.unknown>0&&e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:"Unknown type",children:[e.jsx(ze,{className:"w-3.5 h-3.5 text-sys-amber"}),e.jsx("span",{children:m.unknown})]})]})]}),e.jsxs("div",{className:"flex sm:hidden items-center gap-1.5",children:[e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(re,{className:"w-3 h-3 text-fg-secondary"}),e.jsx("span",{children:m.total})]}),m.repeaters>0&&e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(pe,{className:"w-3 h-3 text-sys-blue"}),e.jsx("span",{children:m.repeaters})]}),m.companions>0&&e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(Le,{className:"w-3 h-3 text-fg-muted"}),e.jsx("span",{children:m.companions})]}),m.roomServers>0&&e.jsxs("span",{className:"data-box !px-1.5 !py-0.5 !text-[10px] flex items-center gap-1",children:[e.jsx(he,{className:"w-3 h-3 text-sys-pink"}),e.jsx("span",{children:m.roomServers})]}),e.jsx(Te,{ranges:Ne,selectedIndex:T,onSelect:S,size:"sm"})]}),e.jsx("div",{className:"hidden sm:block",children:e.jsx(Te,{ranges:Ne,selectedIndex:T,onSelect:S})})]})}),e.jsxs(ks,{children:[e.jsx(pt,{neighbors:A,localNode:R??void 0,localHash:Y,onRemoveNode:f,selectedNodeHash:ge,onNodeSelected:Ye}),e.jsxs(gs,{noPadding:!0,children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 px-3 sm:px-4 py-2.5 border-b border-edge-subtle",children:[e.jsx("span",{className:"icon-md flex items-center justify-center text-icon-card-title flex-shrink-0",children:e.jsx(re,{})}),e.jsx("span",{className:"type-micro flex-shrink-0 mr-auto hidden sm:block",children:"Discovered Contacts"}),e.jsx(js,{type:"search",size:"sm",value:h,onChange:s=>q(s.target.value),placeholder:"Search...",leadingIcon:e.jsx(Ws,{className:"w-3.5 h-3.5"}),trailingIcon:h?e.jsx("button",{onClick:()=>{q(""),(h.toLowerCase().trim()==="neighbor"||h.toLowerCase().trim()==="neighbors")&&U(!1)},className:"text-fg-muted hover:text-fg-secondary",children:e.jsx(bs,{className:"w-3 h-3"})}):void 0,className:"w-24 sm:w-32 xl:w-44","aria-label":"Search contacts"}),e.jsx("div",{className:"h-4 w-px bg-border-subtle flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsxs("div",{className:"relative","data-dropdown":!0,children:[e.jsxs("button",{onClick:()=>ee(!J),className:ve(y.size>0,{border:!0}),title:"Filter by contact type",children:[e.jsx(tt,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:"Filter"}),y.size>0&&e.jsx("span",{className:"tabular-nums text-xs bg-sys-blue/30 px-1 rounded",children:y.size})]}),J&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 surface-elevated radius-inner py-1 min-w-[140px]",children:[[{key:"repeater",label:"Repeaters"},{key:"companion",label:"Companions"},{key:"room",label:"Rooms"}].map(({key:s,label:t})=>e.jsxs("button",{onClick:()=>{W(n=>{const r=new Set(n);return r.has(s)?r.delete(s):r.add(s),r})},className:"w-full px-3 py-1.5 text-sm text-left hover-bg transition-base flex items-center gap-2",children:[e.jsx("span",{className:we("w-4 h-4 flex items-center justify-center radius-badge border",y.has(s)?"bg-sys-blue border-sys-blue text-white":"border-edge-subtle"),children:y.has(s)&&e.jsx(ke,{className:"w-3 h-3"})}),e.jsx("span",{className:y.has(s)?"text-fg-primary":"text-fg-secondary",children:t})]},s)),y.size>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-edge-subtle my-1"}),e.jsx("button",{onClick:()=>W(new Set),className:"w-full px-3 py-1.5 text-sm text-left text-fg-muted hover:text-fg-secondary hover-bg transition-base",children:"Clear filters"})]})]})]}),de.size>0&&e.jsxs("button",{onClick:()=>U(!z),className:ve(z,{color:"success",border:!0}),title:z?"Show all contacts":"Show only MeshCore neighbors (direct RF contact)",children:[e.jsx(pe,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:"Neighbors"})]})]}),e.jsx("div",{className:"h-4 w-px bg-border-subtle flex-shrink-0"}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[vt.map(({field:s,icon:t,label:n})=>e.jsxs("button",{onClick:()=>Ge(s),className:ve(E===s),title:`Sort by ${n.toLowerCase()}`,children:[e.jsx(t,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"hidden xl:inline",children:n}),E===s&&e.jsx(Ks,{className:we("w-3 h-3",V==="asc"&&"rotate-180")})]},s)),e.jsx("div",{className:"h-4 w-px bg-border-subtle"}),e.jsxs(Cs,{value:C,onChange:We,className:"w-auto min-w-[50px] [&_button]:py-1 [&_button]:px-2 [&_button]:text-xs [&_button]:min-h-0","aria-label":"Items per page",children:[e.jsx(ue,{value:25,children:"25"}),e.jsx(ue,{value:50,children:"50"}),e.jsx(ue,{value:100,children:"100"}),e.jsx(ue,{value:0,children:"All"})]})]})]}),u.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden sm:grid contacts-grid-header border-b border-edge-subtle/50 px-3 py-2 type-micro text-fg-muted",children:[e.jsx("div",{className:"contacts-col-node",children:"Node"}),e.jsx("div",{className:"contacts-col-signal text-right",children:"Signal"}),e.jsx("div",{className:"contacts-col-distance text-right",children:"Distance"}),e.jsx("div",{className:"contacts-col-centrality text-right",children:"Centrality"}),e.jsx("div",{className:"contacts-col-seen text-right",children:"Last Seen"}),e.jsx("div",{className:"contacts-col-actions"})]}),e.jsx("div",{className:"divide-y divide-edge-subtle/30",children:Se.map(([s,t])=>{const n=oe(s),r=Ue.has(s),i=de.has(s),l=le.get(s)??null,I=g.get(s)||0,N=i?qe.get(s):void 0,M=n?H.get(n)??null:null,F=B.get(s)??Nt;let ae=null;if(!i&&Y&&p.size>0){const Je=`${s}→${Y}`,xe=p.get(Je);if(xe&&xe.hops.length>0){const _e=xe.hops[0],Re=Object.keys(ie).find(es=>es.toUpperCase().startsWith(_e.toUpperCase())),K=Re?ie[Re]:null;ae={prefix:_e,name:(K==null?void 0:K.node_name)??(K==null?void 0:K.name)??null,hopCount:xe.hopCount}}}const me=d.has(s),Ze=Ve.get(s)??null;return e.jsx(bt,{hash:s,contact:t,isHub:r,isNeighbor:i,distance:l,centrality:I,sparklineData:F,neighborSignal:N,collisionInfo:M,isViterbiResolved:w,isPinging:b!==null,isPingingThis:b===s,pingResult:je.get(s),pingError:Ie.get(s),gatewayInfo:ae,lastForwarderPrefix:Ze,isMobile:me,onRowClick:Qe,onPing:Xe,onRemove:Ke},s)})}),C>0&&Q0&&Qce(s=>Math.min(s+C,u.length)),className:"text-sys-blue hover:text-sys-blue/80 transition-base",children:"Load more"})]})]}):e.jsxs("div",{className:"roster-empty",children:[e.jsx(re,{className:"roster-empty-icon"}),e.jsx("div",{className:"type-label text-fg-secondary",children:"No Contacts Discovered"}),e.jsx("div",{className:"type-data-xs text-fg-muted mt-1",children:"Contacts will appear here as they advertise on the mesh network."})]})]})]}),e.jsx(qs,{isOpen:!!_,title:"Remove Contact",message:`Are you sure you would like to remove ${(_==null?void 0:_.name)||"this contact"}?`,confirmLabel:"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:()=>{_&&f(_.hash),j(null)},onCancel:()=>j(null)})]})}const Yt=Object.freeze(Object.defineProperty({__proto__:null,default:Mt},Symbol.toStringTag,{value:"Module"}));export{Yt as C,ft as P,He as R,mt as T}; diff --git a/frontend/dist/assets/ContactsMapMapLibre-DAxQZgO0.js b/frontend/dist/assets/ContactsMapMapLibre-NYBNCx0J.js similarity index 99% rename from frontend/dist/assets/ContactsMapMapLibre-DAxQZgO0.js rename to frontend/dist/assets/ContactsMapMapLibre-NYBNCx0J.js index bcd9b21d..afc2f2fd 100644 --- a/frontend/dist/assets/ContactsMapMapLibre-DAxQZgO0.js +++ b/frontend/dist/assets/ContactsMapMapLibre-NYBNCx0J.js @@ -1,4 +1,4 @@ -import{d as X0,a5 as aa,r as j,eY as ua,b_ as ca,cS as fa,cT as da,j as g,ak as xo,cU as ha,al as wo,m as s0,D as hn,c as n0,L as Yn,d6 as e0,Z as I0,eZ as Os,e_ as vo,e$ as ma,bQ as ga,bW as pa,bY as ya,a7 as bo,am as ko,A as R0,b as Ur,B as Ot,d7 as xa,bS as us,M as zs,S as Hs,cZ as Co,e as Eo,R as So,bk as mn,bf as yi,f0 as Mo,G as wa,K as va,d5 as ba,f1 as ka,ah as Bo,bs as xi,bu as Ca,E as Gs,F as Us,bU as Ea,aK as Sa,ek as Do,f2 as Ma,bZ as Ba,f3 as Da,f4 as _o,a6 as dn,c7 as _a,f5 as To,f6 as Ta,f7 as ja,ap as jo,x as x0,f8 as Ro,bI as Ra,eW as Ia,bL as La,cX as Io,c_ as Na,P as Fa,f9 as Pa,ew as Qa,fa as cs}from"./index-CeMilrX4.js";import{u as Lo,b as Ar,S as J0,L as t0,P as Oa,c as za,M as Ha,d as Ga,B as Ua}from"./BasemapLayer-CNBmoufo.js";import{u as No,r as Fo,e as wi,f as vi,g as Va}from"./consumer-registry-Hkh6Dv_i.js";import{L as Hn,c as Wa}from"./link-scoring-FRwcQ0ss.js";import{C as Ya}from"./ConfirmModal-BF449Kzb.js";import{b as Ka,e as Za,a as Po,m as bi,s as $a,G as Cs,c as Qo,g as qa,M as Ja,E as Xa,u as Au,d as eu,i as tu,j as ru,k as nu}from"./max-0cG3bA4z.js";import{D as Oo}from"./download-ByVPtD5I.js";import{D as su}from"./database-D2sIhibw.js";import{H as iu,A as un,D as ki,p as ou,c as lu,u as ur}from"./useMapViewStore-DgL-E_Uc.js";import{R as zo}from"./refresh-cw-DqhcBXAw.js";import{E as Ho}from"./target-q6HPYno6.js";import{F as au}from"./funnel-D2SUJQ8o.js";import{P as uu}from"./plus-D-z0bUE_.js";import{C as cu,a as Go,b as Es,c as fu}from"./easing-CFZ7-xae.js";import{Z as du}from"./zap-09srAnh-.js";import{T as Vs}from"./trash-2-Bu7BoH4P.js";import{W as hu}from"./wifi-off-Y-Y9dpWj.js";import{W as mu}from"./wifi-DjxkOZ88.js";import{C as Uo,H as Ci,a as Lr,N as gu,b as pu}from"./badge-colors-DnsnMXHA.js";import{C as yu}from"./chevron-right-D3QL4sfa.js";import{T as xu,P as wu,R as vu}from"./Contacts-DVoMEmqg.js";import{c as bu}from"./node-types-C09ZlzBQ.js";import{L as ku}from"./LightSparkline-D652BQd5.js";import{M as Cu}from"./map-pin-D6_BkIVb.js";import"./triangle-alert-DiFold9L.js";import"./index-BK59_Mkt.js";import"./usePipelineStore-B80TA53S.js";import"./ping-DgsEwYAS.js";import"./PageLayout-Cw_MXmcE.js";import"./listbox-CGIGCOya.js";import"./element-movement-zLH7y51p.js";import"./MqttModeBadge-C_MEMmDd.js";import"./chat-utils-BJwCtjDV.js";import"./SignalIndicator-CpBGKD5A.js";import"./CollisionExplorerModal-Cvw_f8a6.js";import"./monitor-smartphone-DxkmIgui.js";import"./DataBox-Da-5DbUW.js";import"./circle-question-mark-Bqc_DPUo.js";import"./network-c_XxfhAX.js";import"./activity-BZFnO4kb.js";import"./search-Bph9xP9G.js";/** +import{d as X0,a5 as aa,r as j,eZ as ua,b_ as ca,cT as fa,cU as da,j as g,ak as xo,cV as ha,al as wo,m as s0,D as hn,c as n0,L as Yn,d7 as e0,Z as I0,e_ as Os,e$ as vo,f0 as ma,bQ as ga,bW as pa,bY as ya,a7 as bo,am as ko,A as R0,b as Ur,B as Ot,d8 as xa,bS as us,M as zs,S as Hs,c_ as Co,e as Eo,R as So,bk as mn,bf as yi,f1 as Mo,G as wa,K as va,d6 as ba,f2 as ka,ah as Bo,bs as xi,bu as Ca,E as Gs,F as Us,bU as Ea,aK as Sa,el as Do,f3 as Ma,bZ as Ba,f4 as Da,f5 as _o,a6 as dn,c7 as _a,f6 as To,f7 as Ta,f8 as ja,ap as jo,x as x0,f9 as Ro,bI as Ra,eX as Ia,bL as La,cY as Io,c$ as Na,P as Fa,fa as Pa,ex as Qa,fb as cs}from"./index-BOwCLZTK.js";import{u as Lo,b as Ar,S as J0,L as t0,P as Oa,c as za,M as Ha,d as Ga,B as Ua}from"./BasemapLayer-B-5TmAfZ.js";import{u as No,r as Fo,e as wi,f as vi,g as Va}from"./consumer-registry-CTjikLma.js";import{L as Hn,c as Wa}from"./link-scoring-CgjOR3NF.js";import{C as Ya}from"./ConfirmModal-DpSKXZ01.js";import{b as Ka,e as Za,a as Po,m as bi,s as $a,G as Cs,c as Qo,g as qa,M as Ja,E as Xa,u as Au,d as eu,i as tu,j as ru,k as nu}from"./max-vSbldOSt.js";import{D as Oo}from"./download-B9g5-0oH.js";import{D as su}from"./database-C6oOGn9y.js";import{H as iu,A as un,D as ki,p as ou,c as lu,u as ur}from"./useMapViewStore-DpXuD1iT.js";import{R as zo}from"./refresh-cw-C9txhqc9.js";import{E as Ho}from"./target-vmW1ltA0.js";import{F as au}from"./funnel-CWx99rlN.js";import{P as uu}from"./plus-ClrHVFhr.js";import{C as cu,a as Go,b as Es,c as fu}from"./easing-CsgXD0uy.js";import{Z as du}from"./zap-Bd-kARJ1.js";import{T as Vs}from"./trash-2-qMD09ppP.js";import{W as hu}from"./wifi-off-DC4jBRps.js";import{W as mu}from"./wifi-CI57D5A3.js";import{C as Uo,H as Ci,a as Lr,N as gu,b as pu}from"./badge-colors-DCbxcv7o.js";import{C as yu}from"./chevron-right-DJVm4pVP.js";import{T as xu,P as wu,R as vu}from"./Contacts-nDnNtpiy.js";import{c as bu}from"./node-types-C6okL8rE.js";import{L as ku}from"./LightSparkline-C68RXWon.js";import{M as Cu}from"./map-pin-C2z_C0J3.js";import"./triangle-alert-SO3tIa8w.js";import"./index-2RIoVPos.js";import"./usePipelineStore-Cw6U5jyB.js";import"./ping-LiBbR-Oy.js";import"./PageLayout-QKntxcnp.js";import"./listbox-C1tUi7YC.js";import"./element-movement-BLnr83nT.js";import"./MqttModeBadge-CSj5wNzF.js";import"./chat-utils-D21OFED5.js";import"./SignalIndicator-Calk-LyB.js";import"./CollisionExplorerModal-Cudk5ace.js";import"./monitor-smartphone-Dd11JEL9.js";import"./DataBox-BVnEv6Au.js";import"./circle-question-mark-XDnZ1ChV.js";import"./network-D0Fgg1y-.js";import"./activity-D5uH2SFx.js";import"./search-Ba9CRHru.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/Dashboard-D8wufrUF.js b/frontend/dist/assets/Dashboard-DeWxytuz.js similarity index 97% rename from frontend/dist/assets/Dashboard-D8wufrUF.js rename to frontend/dist/assets/Dashboard-DeWxytuz.js index f69ad012..f56f8a90 100644 --- a/frontend/dist/assets/Dashboard-D8wufrUF.js +++ b/frontend/dist/assets/Dashboard-DeWxytuz.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CeMilrX4.js","assets/index-CLjIU9sF.css"])))=>i.map(i=>d[i]); -import{d as E,e as lt,_ as je,f as Ne,h as Pe,k as ct,r as h,j as e,A as Fe,m as Q,S as dt,M as mt,U as ut,n as xt,o as ft,p as ht,q as pt,t as gt,v as H,w as fe,x as U,y as yt,z as bt,D as ve,E as jt,L as ee,F as Nt,G as te,H as vt,J as wt,K as se,N as Le,T as kt,O as Ct,B as we,R as Ae,P as Ee,Q as Tt,V as G,W as L,X as Mt,Y as _t,$ as Bt,a0 as St,a1 as Dt,a2 as Rt,a3 as oe,u as he,a4 as Pt,a5 as Ft,a6 as ke,a7 as ie,a8 as Y,a9 as He,aa as Lt,ab as K,ac as At,ad as Et,ae as Ht,af as Ce,ag as $t,c as F,ah as It,ai as $e,aj as Te,ak as Ot,al as zt,am as qt,an as Wt,ao as Ut,ap as Vt}from"./index-CeMilrX4.js";import{C as Me,P as Gt,a as Xt,B as Yt}from"./PageLayout-Cw_MXmcE.js";import{u as I,r as O,h as Kt,a as Jt,b as Zt,i as Qt}from"./consumer-registry-Hkh6Dv_i.js";import{A as V,D as A,E as es}from"./DataValue-BDllMDjE.js";import{c as ts}from"./node-types-C09ZlzBQ.js";import{b as Ie,c as W,a as ss,d as ns,F as J}from"./meshcore-tx-constants-DgpFTAmf.js";import{S as as,u as ue,P as os,T as is,C as Oe}from"./PacketList-BviFr-nL.js";import{useGetDecodedContent as rs,useResolveSource as ls}from"./usePipelineStore-B80TA53S.js";import{A as _e}from"./SignalIndicator-CpBGKD5A.js";import{T as ze,M as cs}from"./MqttModeBadge-C_MEMmDd.js";import{L as qe}from"./LightSparkline-D652BQd5.js";import{c as ds}from"./link-scoring-FRwcQ0ss.js";import{Z as ms}from"./zap-09srAnh-.js";import{N as us}from"./NodeInformationCard-DGC6n0fh.js";import{g as xs,e as re,a as fs,f as hs}from"./chat-utils-BJwCtjDV.js";import{M as We,C as ps}from"./ChatBubble-D4uyE1Zh.js";import{C as Be}from"./chevron-right-D3QL4sfa.js";import{H as gs}from"./hash-CBEVBQJR.js";import{M as ys}from"./message-square-VqJiaYsP.js";import{H as bs}from"./useMapViewStore-DgL-E_Uc.js";import{R as le,C as ce}from"./Grid-BuDgMX1I.js";import{C as js}from"./circle-x-B6UCLWHM.js";import"./index-BK59_Mkt.js";import"./primitives-Dgc86_cp.js";import"./badge-colors-DnsnMXHA.js";import"./arrow-up-C471XgXc.js";import"./map-pin-D6_BkIVb.js";import"./circle-question-mark-Bqc_DPUo.js";import"./triangle-alert-DiFold9L.js";import"./DataBox-Da-5DbUW.js";import"./layers-DVUHhJuY.js";import"./activity-BZFnO4kb.js";import"./circle-check-CY6Nl8LU.js";import"./database-D2sIhibw.js";import"./shield-D-fYOAoy.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BOwCLZTK.js","assets/index-DH0lUVGm.css"])))=>i.map(i=>d[i]); +import{d as E,e as lt,_ as je,f as Ne,h as Pe,k as ct,r as h,j as e,A as Fe,m as Q,S as dt,M as mt,U as ut,n as xt,o as ft,p as ht,q as pt,t as gt,v as H,w as fe,x as U,y as yt,z as bt,D as ve,E as jt,L as ee,F as Nt,G as te,H as vt,J as wt,K as se,N as Le,T as kt,O as Ct,B as we,R as Ae,P as Ee,Q as Tt,V as G,W as L,X as Mt,Y as _t,$ as Bt,a0 as St,a1 as Dt,a2 as Rt,a3 as oe,u as he,a4 as Pt,a5 as Ft,a6 as ke,a7 as ie,a8 as Y,a9 as He,aa as Lt,ab as K,ac as At,ad as Et,ae as Ht,af as Ce,ag as $t,c as F,ah as It,ai as $e,aj as Te,ak as Ot,al as zt,am as qt,an as Wt,ao as Ut,ap as Vt}from"./index-BOwCLZTK.js";import{C as Me,P as Gt,a as Xt,B as Yt}from"./PageLayout-QKntxcnp.js";import{u as I,r as O,h as Kt,a as Jt,b as Zt,i as Qt}from"./consumer-registry-CTjikLma.js";import{A as V,D as A,E as es}from"./DataValue-x_TMPgMk.js";import{c as ts}from"./node-types-C6okL8rE.js";import{b as Ie,c as W,a as ss,d as ns,F as J}from"./meshcore-tx-constants-DgpFTAmf.js";import{S as as,u as ue,P as os,T as is,C as Oe}from"./PacketList-DquMVCqT.js";import{useGetDecodedContent as rs,useResolveSource as ls}from"./usePipelineStore-Cw6U5jyB.js";import{A as _e}from"./SignalIndicator-Calk-LyB.js";import{T as ze,M as cs}from"./MqttModeBadge-CSj5wNzF.js";import{L as qe}from"./LightSparkline-C68RXWon.js";import{c as ds}from"./link-scoring-CgjOR3NF.js";import{Z as ms}from"./zap-Bd-kARJ1.js";import{N as us}from"./NodeInformationCard-PgTi9luy.js";import{g as xs,e as re,a as fs,f as hs}from"./chat-utils-D21OFED5.js";import{M as We,C as ps}from"./ChatBubble-CCVYaLOe.js";import{C as Be}from"./chevron-right-DJVm4pVP.js";import{H as gs}from"./hash-Dwn2PbMF.js";import{M as ys}from"./message-square-BcKhgYbO.js";import{H as bs}from"./useMapViewStore-DpXuD1iT.js";import{R as le,C as ce}from"./Grid-eFMUBxsw.js";import{C as js}from"./circle-x-BJVhIbR2.js";import"./index-2RIoVPos.js";import"./primitives-DEqdAn1G.js";import"./badge-colors-DCbxcv7o.js";import"./arrow-up-BqsZCBBC.js";import"./map-pin-C2z_C0J3.js";import"./circle-question-mark-XDnZ1ChV.js";import"./triangle-alert-SO3tIa8w.js";import"./DataBox-BVnEv6Au.js";import"./layers-Dg2mpSl7.js";import"./activity-D5uH2SFx.js";import"./circle-check-CmQaOkab.js";import"./database-C6oOGn9y.js";import"./shield-DYw72pvS.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -44,7 +44,7 @@ import{d as E,e as lt,_ as je,f as Ne,h as Pe,k as ct,r as h,j as e,A as Fe,m as * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Es=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Hs=E("timer",Es),$=lt(()=>({result:null,isComputing:!1})),$s=500,Is=300;let z=null,Z=null;function Os(t){var a;const n=(a=t==null?void 0:t.config)==null?void 0:a.radio;return`${(n==null?void 0:n.spreading_factor)??7}:${(n==null?void 0:n.bandwidth)??125e3}:${(n==null?void 0:n.coding_rate)??5}:${(n==null?void 0:n.preamble_length)??8}`}function zs(){if(z)return z;if(typeof window>"u")return null;try{z=new Worker(new URL("/assets/dashboard-bucketing.worker-RVncOvX0.js",import.meta.url),{type:"module"}),z.onmessage=t=>{if(t.data.type==="error"){console.error("[DashboardBucketing] Worker error:",t.data.error),$.setState({isComputing:!1});return}$.setState({result:t.data.payload,isComputing:!1})},z.onerror=t=>{console.error("[DashboardBucketing] Worker error:",t),$.setState({isComputing:!1})}}catch(t){console.error("[DashboardBucketing] Failed to init worker:",t)}return z}function qs(t,n,a,s){const o=zs();if(!o)return;const i=t.length,d=new Float64Array(i),r=new Float64Array(i),c=new Uint16Array(i),u=new Uint8Array(i),m=new Uint8Array(i),x=new Uint8Array(i),l=new Uint8Array(i),j=new Float32Array(i),b=new Float32Array(i),g=new Uint32Array(i),v=new Map;let w=0;for(let y=0;yparseInt(n,10)).filter(n=>t[n]>0).sort((n,a)=>t[a]-t[n])}function Ws(t,n,a){const s={...t,received:[...t.received],unique_received:[...t.unique_received],transmitted:[...t.transmitted],forwarded:[...t.forwarded],dropped:[...t.dropped],receivedBytesBuckets:t.receivedBytesBuckets.map(m=>({...m,bytesByType:{...m.bytesByType}})),forwardedBytesBuckets:t.forwardedBytesBuckets.map(m=>({...m,bytesByType:{...m.bytesByType}})),droppedBytesBuckets:t.droppedBytesBuckets.map(m=>({...m,bytesByType:{...m.bytesByType}})),receivedTotalByType:{...t.receivedTotalByType},forwardedTotalByType:{...t.forwardedTotalByType},droppedTotalByType:{...t.droppedTotalByType}},{start_time:o,end_time:i,bucket_duration_seconds:d,bucket_count:r}=t,c=new Set;for(const m of n){const x=m.timestamp??0;if(xi)continue;const l=Math.floor((x-o)/d);if(l<0||l>=r)continue;c.has(l)||(c.add(l),s.received[l]={...s.received[l]},s.unique_received[l]={...s.unique_received[l]},s.transmitted[l]={...s.transmitted[l]},s.forwarded[l]={...s.forwarded[l]},s.dropped[l]={...s.dropped[l]});const j=Pe(m,a),b=m.length??m.payload_length??0,g=m.type??m.payload_type??0,v=m.packet_origin;v==="tx_local"?(s.transmitted[l].count++,s.transmitted[l].airtime_ms+=j):v==="tx_forward"||m.transmitted?(s.forwarded[l].count++,s.forwarded[l].airtime_ms+=j,s.forwardedBytesBuckets[l].bytesByType[g]=(s.forwardedBytesBuckets[l].bytesByType[g]??0)+b,s.forwardedBytesBuckets[l].totalBytes+=b,s.forwardedTotalByType[g]=(s.forwardedTotalByType[g]??0)+b,s.totalForwardedCount++):m.drop_reason&&(s.dropped[l].count++,s.dropped[l].airtime_ms+=j,s.droppedBytesBuckets[l].bytesByType[g]=(s.droppedBytesBuckets[l].bytesByType[g]??0)+b,s.droppedBytesBuckets[l].totalBytes+=b,s.droppedTotalByType[g]=(s.droppedTotalByType[g]??0)+b,s.totalDroppedCount++),v!=="tx_local"&&(s.received[l].count++,s.received[l].airtime_ms+=j,s.unique_received[l].count++,s.unique_received[l].airtime_ms+=j,s.receivedBytesBuckets[l].bytesByType[g]=(s.receivedBytesBuckets[l].bytesByType[g]??0)+b,s.receivedBytesBuckets[l].totalBytes+=b,s.receivedTotalByType[g]=(s.receivedTotalByType[g]??0)+b,s.totalReceivedBytes+=b)}const u=s.time_range_minutes/60;return s.kbPerHour=u>0?Math.round(s.totalReceivedBytes/1024/u):0,s.forwardedRatePerHour=u>0?Math.round(s.totalForwardedCount/u):0,s.droppedRatePerHour=u>0?Math.round(s.totalDroppedCount/u):0,s.receivedActiveTypes=de(s.receivedTotalByType),s.forwardedActiveTypes=de(s.forwardedTotalByType),s.droppedActiveTypes=de(s.droppedTotalByType),s}typeof window<"u"&&Promise.all([je(()=>import("./index-CeMilrX4.js").then(t=>t.fH),__vite__mapDeps([0,1])),je(()=>import("./index-CeMilrX4.js").then(t=>t.fG),__vite__mapDeps([0,1]))]).then(([t,n])=>{const{DASHBOARD_TIME_RANGES:a}=n;let s=0,o=-1,i="";t.useStore.subscribe(d=>{const r=d.packets.length,c=d.globalTimeRangeIndex,u=Os(d.stats);if(r===s&&c===o&&u===i)return;const m=s,x=o,l=i;if(s=r,o=c,i=u,r===0)return;const j=a[c]??a[4],b=j.minutes,g=j.buckets,v=d.stats,w=Ne(v),C=r-m,y=c!==x,N=u!==l,k=$.getState().result;if(!y&&!N&&C>0&&C<$s&&k!==null&&k.time_range_minutes===b&&k.bucket_count===g){const f=d.packets.slice(r-C),T=Ws(k,f,w);$.setState({result:T})}else Z&&clearTimeout(Z),Z=setTimeout(()=>{Z=null;const f=t.useStore.getState();if(f.packets.length===0||!f.stats)return;const T=a[f.globalTimeRangeIndex]??a[4],_=Ne(f.stats);qs(f.packets,T.minutes,T.buckets,_)},Is)})});const Us=()=>$(t=>t.result),Ue=[{target:"ReceivedChart",fn:"type",minStage:1},{target:"ReceivedChart",fn:"airtime",minStage:1,when:Kt}];O(Ue);function Vs(t){const a=new Date(t*1e3).getHours();return a>=6&&a<18}function Gs(t){return new Date(t*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}function Xs({buckets:t,activeTypes:n,totalByType:a}){I(Ue);const s=ct(),[o,i]=h.useState(null),[d,r]=h.useState(null),[c,u]=h.useState(null),m=h.useCallback((v,w,C)=>{i(w),r(C)},[]),x=t.length>0&&n.length>0,l=o?Vs(o.start):null,j=o?Gs(o.start):"",b=c!==null&&l!==null&&c!==l;l!==c&&u(l);const g=48;return e.jsxs("div",{className:"flex flex-col h-full relative",children:[e.jsx("div",{className:"h-5 relative mb-1 shrink-0",children:o&&d!==null&&e.jsxs("div",{className:"absolute flex items-center gap-1.5 type-data-sm -translate-x-1/2",style:{left:`calc(${g}px + ${d*100}% * (1 - ${g}px / 100%))`},children:[e.jsx(Fe,{mode:"wait",children:e.jsx(Q.span,{initial:b?{opacity:0,scale:.5,rotate:-90}:!1,animate:{opacity:1,scale:1,rotate:0},exit:{opacity:0,scale:.5,rotate:90},transition:{duration:.25,ease:"easeOut"},children:l?e.jsx(dt,{className:"w-4 h-4 text-sys-amber"}):e.jsx(mt,{className:"w-4 h-4 text-sys-blue"})},l?"sun":"moon")}),e.jsx("span",{className:"text-fg-secondary",children:j})]})}),e.jsx("div",{className:"flex-1 min-h-0",children:x&&e.jsx(ut,{buckets:t,activeTypes:n,gridColor:s.grid,axisTickColor:s.axisTick,onHover:m})}),e.jsx("div",{className:"pt-2 px-1 pb-2 shrink-0",children:x&&e.jsx(xt,{activeTypes:n,totalByType:a})})]})}function Ys(t,n,a){var i,d;if(t.length<=a)return t;const s=t.length/a,o=[];for(let r=0;r0&&(x.bytesByType[j]=(x.bytesByType[j]??0)+b)}}o.push(x)}return o}function Ks(t,n,a,s,o,i,d){if(n.length===0)return;const r=Ys(n,a,pt.statsCard),c=r.length,u=i/c,m=r.map(l=>l.totalBytes),x=Math.max(...m);if(x!==0){for(let l=0;l{const d=t.map(c=>c.start),r=t.map(()=>1);return[d,r]},[t]);return h.useEffect(()=>{if(!a.current||t.length===0)return;const d=a.current;let r=null,c=null;const u=ft(()=>{const m=d.getBoundingClientRect(),x=Math.floor(m.width)||200,l=Math.floor(m.height)||60,j={width:x,height:l,padding:[0,0,0,0],cursor:{show:!1},scales:{x:{time:!1},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],legend:{show:!1},hooks:{draw:[b=>{const g=b.ctx,{left:v,top:w,width:C,height:y}=b.bbox;Ks(g,s.current,o.current,v,w,C,y)}]}};r=new ht(j,i,d),c=new ResizeObserver(()=>{const b=d.getBoundingClientRect();b.width>0&&b.height>0&&(r==null||r.setSize({width:Math.floor(b.width),height:Math.floor(b.height)}))}),c.observe(d)});return()=>{u(),c==null||c.disconnect(),r==null||r.destroy()}},[i,t.length]),t.length===0?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsx("div",{className:"w-full h-0.5 rounded-full bg-fg-muted/15"})}):e.jsx("div",{ref:a,className:"w-full h-full"})}const Ve=h.memo(Js),Ge=[{target:"ForwardedCard",fn:"type",minStage:1}];O(Ge);function Zs({value:t,receivedCount:n,buckets:a,activeTypes:s,ratePerHour:o,timeRangeLabel:i,icon:d,isLoaded:r=!0}){I(Ge);const c=n>0?(t/n*100).toFixed(1):null;return r?e.jsxs(H,{children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[d&&e.jsx("span",{className:"icon-sm text-icon-card-title",children:d}),e.jsx("span",{className:"type-micro",children:"FORWARDED"}),i&&e.jsx(U,{color:"zinc",className:"hidden sm:inline-flex",children:i})]}),e.jsx("div",{className:"type-data-xl text-fg-primary",children:e.jsx(V,{value:t,className:"font-mono tabular-nums",priority:"high"})}),e.jsx("div",{className:"flex-1 mt-1 overflow-hidden min-h-[40px] sm:min-h-[60px]",children:s.length>0?e.jsx(Ve,{buckets:a,activeTypes:s}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"w-full h-0.5 rounded-full bg-fg-muted/15"})})}),e.jsx("div",{className:"pt-1.5 sm:pt-2 mt-1",children:e.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Rate"}),e.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[o,"/hr"]})]}),c!==null&&e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Ratio"}),e.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[c,"%"]})]})]})})]}):e.jsx(H,{children:e.jsx(fe,{})})}const Xe=[{target:"DroppedCard",fn:"type",minStage:1}];O(Xe);function Qs({value:t,receivedCount:n,buckets:a,activeTypes:s,ratePerHour:o,timeRangeLabel:i,icon:d,isLoaded:r=!0}){I(Xe);const c=n>0?(t/n*100).toFixed(1):null;return r?e.jsxs(H,{children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[d&&e.jsx("span",{className:"icon-sm text-icon-card-title",children:d}),e.jsx("span",{className:"type-micro",children:"DROPPED"}),i&&e.jsx(U,{color:"zinc",className:"hidden sm:inline-flex",children:i})]}),e.jsx("div",{className:"type-data-xl text-fg-primary",children:e.jsx(V,{value:t,className:"font-mono tabular-nums",priority:"high"})}),e.jsx("div",{className:"flex-1 mt-1 overflow-hidden min-h-[40px] sm:min-h-[60px]",children:s.length>0?e.jsx(Ve,{buckets:a,activeTypes:s}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"w-full h-0.5 rounded-full bg-fg-muted/15"})})}),e.jsx("div",{className:"pt-1.5 sm:pt-2 mt-1",children:e.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Rate"}),e.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[o,"/hr"]})]}),c!==null&&e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Drop %"}),e.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[c,"%"]})]})]})})]}):e.jsx(H,{children:e.jsx(fe,{})})}const en=2,tn=1;function sn(t,n,a){const s=c=>(c==null?void 0:c.reduce((u,m)=>u+m.count,0))??0,o=s(n),i=s(a),d=o||(t==null?void 0:t.rx_count)||1,r=i||(t==null?void 0:t.dropped_count)||0;return d>0?r/(d+r)*100:0}function nn(t,n,a){const s=o=>(o==null?void 0:o.reduce((i,d)=>i+d.count,0))??0;if(n!=null&&n.length&&a){const i=s(n)*100,d=n.length*a*1e3;return i/d*100}if(t){const o=(t.uptime_seconds||1)*1e3;return(t.total_airtime_ms||t.airtime_used_ms||0)/o*100}return 0}function Se(t,n,a){return ss(Math.max(n,Math.min(a,t)))}function an(t,n,a,s,o){let i=Ie(t);n>20?i+=J*2:n>12&&(i+=J),a>8&&(i+=J);const d=Se(i,0,en);let r=ns(t);a>8&&(r+=J);const c=Se(r,0,tn),u=W(d),m=W(c),x=s!==null?W(s):null;let l="stable";return x!==null&&(u>x?l="increase":u{if(u!=="applying"){m("applying");try{const ae=await bt({tx_delay_factor:P,direct_tx_delay_factor:rt});ae!=null&&ae.success?(m("success"),setTimeout(()=>m("idle"),2e3)):(m("error"),setTimeout(()=>m("idle"),2500))}catch{m("error"),setTimeout(()=>m("idle"),2500)}}},[u]);if(!d)return e.jsx(H,{children:e.jsx(fe,{})});const j=10080*60,g=Math.floor(Date.now()/1e3)-j,v=Object.values((t==null?void 0:t.neighbors)??{}).filter(P=>P.zero_hop&&P.last_seen>=g&&ts(P).isRepeater).length,w=x.filter(P=>P.status==="active"||P.lastSeen>=g).length,C=Math.max(v,w),y=sn(t,n,a),N=nn(t,s,o),k=((ge=(pe=t==null?void 0:t.config)==null?void 0:pe.delays)==null?void 0:ge.tx_delay_factor)??null,D=((be=(ye=t==null?void 0:t.config)==null?void 0:ye.delays)==null?void 0:be.direct_tx_delay_factor)??null,f=an(C,y,N,k),T=C!==1,_=Ie(C),B=[`${C} repeater${T?"s":""} heard in the last 7 days (base ×${_.toFixed(1)}).`];f.floodFactor===_&&y<=12&&N<=8?B.push("No modifiers applied — network looks healthy."):(y>20?B.push(`High duplicate rate (${y.toFixed(1)}%) suggests frequent collisions — window widened.`):y>12&&B.push(`Elevated duplicate rate (${y.toFixed(1)}%) — window widened one step.`),N>8&&B.push(`Channel is busy (${N.toFixed(1)}% TX util) — extra spacing added.`));const p=[`Direct uses one forwarder — ×${f.directFactor.toFixed(1)} backoff for channel contention.`];N>8&&p.push("Busy channel — small extra backoff.");const M=[`Flood ×${f.floodFactor.toFixed(1)} (${f.floodSlots} slot${f.floodSlots!==1?"s":""})`,...B,"",`Direct ×${f.directFactor.toFixed(1)}`,...p,"","Click to copy CLI commands"].join(` + */const Es=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],Hs=E("timer",Es),$=lt(()=>({result:null,isComputing:!1})),$s=500,Is=300;let z=null,Z=null;function Os(t){var a;const n=(a=t==null?void 0:t.config)==null?void 0:a.radio;return`${(n==null?void 0:n.spreading_factor)??7}:${(n==null?void 0:n.bandwidth)??125e3}:${(n==null?void 0:n.coding_rate)??5}:${(n==null?void 0:n.preamble_length)??8}`}function zs(){if(z)return z;if(typeof window>"u")return null;try{z=new Worker(new URL("/assets/dashboard-bucketing.worker-RVncOvX0.js",import.meta.url),{type:"module"}),z.onmessage=t=>{if(t.data.type==="error"){console.error("[DashboardBucketing] Worker error:",t.data.error),$.setState({isComputing:!1});return}$.setState({result:t.data.payload,isComputing:!1})},z.onerror=t=>{console.error("[DashboardBucketing] Worker error:",t),$.setState({isComputing:!1})}}catch(t){console.error("[DashboardBucketing] Failed to init worker:",t)}return z}function qs(t,n,a,s){const o=zs();if(!o)return;const i=t.length,d=new Float64Array(i),r=new Float64Array(i),c=new Uint16Array(i),u=new Uint8Array(i),m=new Uint8Array(i),x=new Uint8Array(i),l=new Uint8Array(i),j=new Float32Array(i),b=new Float32Array(i),g=new Uint32Array(i),v=new Map;let w=0;for(let y=0;yparseInt(n,10)).filter(n=>t[n]>0).sort((n,a)=>t[a]-t[n])}function Ws(t,n,a){const s={...t,received:[...t.received],unique_received:[...t.unique_received],transmitted:[...t.transmitted],forwarded:[...t.forwarded],dropped:[...t.dropped],receivedBytesBuckets:t.receivedBytesBuckets.map(m=>({...m,bytesByType:{...m.bytesByType}})),forwardedBytesBuckets:t.forwardedBytesBuckets.map(m=>({...m,bytesByType:{...m.bytesByType}})),droppedBytesBuckets:t.droppedBytesBuckets.map(m=>({...m,bytesByType:{...m.bytesByType}})),receivedTotalByType:{...t.receivedTotalByType},forwardedTotalByType:{...t.forwardedTotalByType},droppedTotalByType:{...t.droppedTotalByType}},{start_time:o,end_time:i,bucket_duration_seconds:d,bucket_count:r}=t,c=new Set;for(const m of n){const x=m.timestamp??0;if(xi)continue;const l=Math.floor((x-o)/d);if(l<0||l>=r)continue;c.has(l)||(c.add(l),s.received[l]={...s.received[l]},s.unique_received[l]={...s.unique_received[l]},s.transmitted[l]={...s.transmitted[l]},s.forwarded[l]={...s.forwarded[l]},s.dropped[l]={...s.dropped[l]});const j=Pe(m,a),b=m.length??m.payload_length??0,g=m.type??m.payload_type??0,v=m.packet_origin;v==="tx_local"?(s.transmitted[l].count++,s.transmitted[l].airtime_ms+=j):v==="tx_forward"||m.transmitted?(s.forwarded[l].count++,s.forwarded[l].airtime_ms+=j,s.forwardedBytesBuckets[l].bytesByType[g]=(s.forwardedBytesBuckets[l].bytesByType[g]??0)+b,s.forwardedBytesBuckets[l].totalBytes+=b,s.forwardedTotalByType[g]=(s.forwardedTotalByType[g]??0)+b,s.totalForwardedCount++):m.drop_reason&&(s.dropped[l].count++,s.dropped[l].airtime_ms+=j,s.droppedBytesBuckets[l].bytesByType[g]=(s.droppedBytesBuckets[l].bytesByType[g]??0)+b,s.droppedBytesBuckets[l].totalBytes+=b,s.droppedTotalByType[g]=(s.droppedTotalByType[g]??0)+b,s.totalDroppedCount++),v!=="tx_local"&&(s.received[l].count++,s.received[l].airtime_ms+=j,s.unique_received[l].count++,s.unique_received[l].airtime_ms+=j,s.receivedBytesBuckets[l].bytesByType[g]=(s.receivedBytesBuckets[l].bytesByType[g]??0)+b,s.receivedBytesBuckets[l].totalBytes+=b,s.receivedTotalByType[g]=(s.receivedTotalByType[g]??0)+b,s.totalReceivedBytes+=b)}const u=s.time_range_minutes/60;return s.kbPerHour=u>0?Math.round(s.totalReceivedBytes/1024/u):0,s.forwardedRatePerHour=u>0?Math.round(s.totalForwardedCount/u):0,s.droppedRatePerHour=u>0?Math.round(s.totalDroppedCount/u):0,s.receivedActiveTypes=de(s.receivedTotalByType),s.forwardedActiveTypes=de(s.forwardedTotalByType),s.droppedActiveTypes=de(s.droppedTotalByType),s}typeof window<"u"&&Promise.all([je(()=>import("./index-BOwCLZTK.js").then(t=>t.fI),__vite__mapDeps([0,1])),je(()=>import("./index-BOwCLZTK.js").then(t=>t.fH),__vite__mapDeps([0,1]))]).then(([t,n])=>{const{DASHBOARD_TIME_RANGES:a}=n;let s=0,o=-1,i="";t.useStore.subscribe(d=>{const r=d.packets.length,c=d.globalTimeRangeIndex,u=Os(d.stats);if(r===s&&c===o&&u===i)return;const m=s,x=o,l=i;if(s=r,o=c,i=u,r===0)return;const j=a[c]??a[4],b=j.minutes,g=j.buckets,v=d.stats,w=Ne(v),C=r-m,y=c!==x,N=u!==l,k=$.getState().result;if(!y&&!N&&C>0&&C<$s&&k!==null&&k.time_range_minutes===b&&k.bucket_count===g){const f=d.packets.slice(r-C),T=Ws(k,f,w);$.setState({result:T})}else Z&&clearTimeout(Z),Z=setTimeout(()=>{Z=null;const f=t.useStore.getState();if(f.packets.length===0||!f.stats)return;const T=a[f.globalTimeRangeIndex]??a[4],_=Ne(f.stats);qs(f.packets,T.minutes,T.buckets,_)},Is)})});const Us=()=>$(t=>t.result),Ue=[{target:"ReceivedChart",fn:"type",minStage:1},{target:"ReceivedChart",fn:"airtime",minStage:1,when:Kt}];O(Ue);function Vs(t){const a=new Date(t*1e3).getHours();return a>=6&&a<18}function Gs(t){return new Date(t*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}function Xs({buckets:t,activeTypes:n,totalByType:a}){I(Ue);const s=ct(),[o,i]=h.useState(null),[d,r]=h.useState(null),[c,u]=h.useState(null),m=h.useCallback((v,w,C)=>{i(w),r(C)},[]),x=t.length>0&&n.length>0,l=o?Vs(o.start):null,j=o?Gs(o.start):"",b=c!==null&&l!==null&&c!==l;l!==c&&u(l);const g=48;return e.jsxs("div",{className:"flex flex-col h-full relative",children:[e.jsx("div",{className:"h-5 relative mb-1 shrink-0",children:o&&d!==null&&e.jsxs("div",{className:"absolute flex items-center gap-1.5 type-data-sm -translate-x-1/2",style:{left:`calc(${g}px + ${d*100}% * (1 - ${g}px / 100%))`},children:[e.jsx(Fe,{mode:"wait",children:e.jsx(Q.span,{initial:b?{opacity:0,scale:.5,rotate:-90}:!1,animate:{opacity:1,scale:1,rotate:0},exit:{opacity:0,scale:.5,rotate:90},transition:{duration:.25,ease:"easeOut"},children:l?e.jsx(dt,{className:"w-4 h-4 text-sys-amber"}):e.jsx(mt,{className:"w-4 h-4 text-sys-blue"})},l?"sun":"moon")}),e.jsx("span",{className:"text-fg-secondary",children:j})]})}),e.jsx("div",{className:"flex-1 min-h-0",children:x&&e.jsx(ut,{buckets:t,activeTypes:n,gridColor:s.grid,axisTickColor:s.axisTick,onHover:m})}),e.jsx("div",{className:"pt-2 px-1 pb-2 shrink-0",children:x&&e.jsx(xt,{activeTypes:n,totalByType:a})})]})}function Ys(t,n,a){var i,d;if(t.length<=a)return t;const s=t.length/a,o=[];for(let r=0;r0&&(x.bytesByType[j]=(x.bytesByType[j]??0)+b)}}o.push(x)}return o}function Ks(t,n,a,s,o,i,d){if(n.length===0)return;const r=Ys(n,a,pt.statsCard),c=r.length,u=i/c,m=r.map(l=>l.totalBytes),x=Math.max(...m);if(x!==0){for(let l=0;l{const d=t.map(c=>c.start),r=t.map(()=>1);return[d,r]},[t]);return h.useEffect(()=>{if(!a.current||t.length===0)return;const d=a.current;let r=null,c=null;const u=ft(()=>{const m=d.getBoundingClientRect(),x=Math.floor(m.width)||200,l=Math.floor(m.height)||60,j={width:x,height:l,padding:[0,0,0,0],cursor:{show:!1},scales:{x:{time:!1},y:{range:[0,1]}},axes:[{show:!1},{show:!1}],series:[{},{show:!1}],legend:{show:!1},hooks:{draw:[b=>{const g=b.ctx,{left:v,top:w,width:C,height:y}=b.bbox;Ks(g,s.current,o.current,v,w,C,y)}]}};r=new ht(j,i,d),c=new ResizeObserver(()=>{const b=d.getBoundingClientRect();b.width>0&&b.height>0&&(r==null||r.setSize({width:Math.floor(b.width),height:Math.floor(b.height)}))}),c.observe(d)});return()=>{u(),c==null||c.disconnect(),r==null||r.destroy()}},[i,t.length]),t.length===0?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsx("div",{className:"w-full h-0.5 rounded-full bg-fg-muted/15"})}):e.jsx("div",{ref:a,className:"w-full h-full"})}const Ve=h.memo(Js),Ge=[{target:"ForwardedCard",fn:"type",minStage:1}];O(Ge);function Zs({value:t,receivedCount:n,buckets:a,activeTypes:s,ratePerHour:o,timeRangeLabel:i,icon:d,isLoaded:r=!0}){I(Ge);const c=n>0?(t/n*100).toFixed(1):null;return r?e.jsxs(H,{children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[d&&e.jsx("span",{className:"icon-sm text-icon-card-title",children:d}),e.jsx("span",{className:"type-micro",children:"FORWARDED"}),i&&e.jsx(U,{color:"zinc",className:"hidden sm:inline-flex",children:i})]}),e.jsx("div",{className:"type-data-xl text-fg-primary",children:e.jsx(V,{value:t,className:"font-mono tabular-nums",priority:"high"})}),e.jsx("div",{className:"flex-1 mt-1 overflow-hidden min-h-[40px] sm:min-h-[60px]",children:s.length>0?e.jsx(Ve,{buckets:a,activeTypes:s}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"w-full h-0.5 rounded-full bg-fg-muted/15"})})}),e.jsx("div",{className:"pt-1.5 sm:pt-2 mt-1",children:e.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Rate"}),e.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[o,"/hr"]})]}),c!==null&&e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Ratio"}),e.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[c,"%"]})]})]})})]}):e.jsx(H,{children:e.jsx(fe,{})})}const Xe=[{target:"DroppedCard",fn:"type",minStage:1}];O(Xe);function Qs({value:t,receivedCount:n,buckets:a,activeTypes:s,ratePerHour:o,timeRangeLabel:i,icon:d,isLoaded:r=!0}){I(Xe);const c=n>0?(t/n*100).toFixed(1):null;return r?e.jsxs(H,{children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[d&&e.jsx("span",{className:"icon-sm text-icon-card-title",children:d}),e.jsx("span",{className:"type-micro",children:"DROPPED"}),i&&e.jsx(U,{color:"zinc",className:"hidden sm:inline-flex",children:i})]}),e.jsx("div",{className:"type-data-xl text-fg-primary",children:e.jsx(V,{value:t,className:"font-mono tabular-nums",priority:"high"})}),e.jsx("div",{className:"flex-1 mt-1 overflow-hidden min-h-[40px] sm:min-h-[60px]",children:s.length>0?e.jsx(Ve,{buckets:a,activeTypes:s}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"w-full h-0.5 rounded-full bg-fg-muted/15"})})}),e.jsx("div",{className:"pt-1.5 sm:pt-2 mt-1",children:e.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Rate"}),e.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[o,"/hr"]})]}),c!==null&&e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Drop %"}),e.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[c,"%"]})]})]})})]}):e.jsx(H,{children:e.jsx(fe,{})})}const en=2,tn=1;function sn(t,n,a){const s=c=>(c==null?void 0:c.reduce((u,m)=>u+m.count,0))??0,o=s(n),i=s(a),d=o||(t==null?void 0:t.rx_count)||1,r=i||(t==null?void 0:t.dropped_count)||0;return d>0?r/(d+r)*100:0}function nn(t,n,a){const s=o=>(o==null?void 0:o.reduce((i,d)=>i+d.count,0))??0;if(n!=null&&n.length&&a){const i=s(n)*100,d=n.length*a*1e3;return i/d*100}if(t){const o=(t.uptime_seconds||1)*1e3;return(t.total_airtime_ms||t.airtime_used_ms||0)/o*100}return 0}function Se(t,n,a){return ss(Math.max(n,Math.min(a,t)))}function an(t,n,a,s,o){let i=Ie(t);n>20?i+=J*2:n>12&&(i+=J),a>8&&(i+=J);const d=Se(i,0,en);let r=ns(t);a>8&&(r+=J);const c=Se(r,0,tn),u=W(d),m=W(c),x=s!==null?W(s):null;let l="stable";return x!==null&&(u>x?l="increase":u{if(u!=="applying"){m("applying");try{const ae=await bt({tx_delay_factor:P,direct_tx_delay_factor:rt});ae!=null&&ae.success?(m("success"),setTimeout(()=>m("idle"),2e3)):(m("error"),setTimeout(()=>m("idle"),2500))}catch{m("error"),setTimeout(()=>m("idle"),2500)}}},[u]);if(!d)return e.jsx(H,{children:e.jsx(fe,{})});const j=10080*60,g=Math.floor(Date.now()/1e3)-j,v=Object.values((t==null?void 0:t.neighbors)??{}).filter(P=>P.zero_hop&&P.last_seen>=g&&ts(P).isRepeater).length,w=x.filter(P=>P.status==="active"||P.lastSeen>=g).length,C=Math.max(v,w),y=sn(t,n,a),N=nn(t,s,o),k=((ge=(pe=t==null?void 0:t.config)==null?void 0:pe.delays)==null?void 0:ge.tx_delay_factor)??null,D=((be=(ye=t==null?void 0:t.config)==null?void 0:ye.delays)==null?void 0:be.direct_tx_delay_factor)??null,f=an(C,y,N,k),T=C!==1,_=Ie(C),B=[`${C} repeater${T?"s":""} heard in the last 7 days (base ×${_.toFixed(1)}).`];f.floodFactor===_&&y<=12&&N<=8?B.push("No modifiers applied — network looks healthy."):(y>20?B.push(`High duplicate rate (${y.toFixed(1)}%) suggests frequent collisions — window widened.`):y>12&&B.push(`Elevated duplicate rate (${y.toFixed(1)}%) — window widened one step.`),N>8&&B.push(`Channel is busy (${N.toFixed(1)}% TX util) — extra spacing added.`));const p=[`Direct uses one forwarder — ×${f.directFactor.toFixed(1)} backoff for channel contention.`];N>8&&p.push("Busy channel — small extra backoff.");const M=[`Flood ×${f.floodFactor.toFixed(1)} (${f.floodSlots} slot${f.floodSlots!==1?"s":""})`,...B,"",`Direct ×${f.directFactor.toFixed(1)}`,...p,"","Click to copy CLI commands"].join(` `),S=k!==null?W(k):null,R=D!==null?W(D):null,ne=S!==null&&f.floodSlots!==S,nt=R!==null&&f.directSlots!==R,at=ne||nt,ot=async()=>{const P=`set txdelay ${f.floodFactor.toFixed(1)} set direct.txdelay ${f.directFactor.toFixed(1)}`;await Nt(P),c(!0),setTimeout(()=>c(!1),1500)},it=()=>l(f.floodFactor,f.directFactor);return e.jsxs(H,{children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3 flex-wrap",children:[e.jsx(as,{className:"w-4 h-4 text-icon-card-title flex-shrink-0"}),e.jsx("span",{className:"type-micro",children:"DELAY DOCTOR"}),i&&e.jsx(U,{color:"zinc",className:"hidden sm:inline-flex",children:i})]}),e.jsxs("button",{onClick:ot,className:"flex gap-3 mb-2 sm:mb-3 w-full text-left hover:bg-subtle-fill radius-inner transition-base p-1 -m-1 group",title:M,children:[e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsx("span",{className:"type-data-xl text-fg-primary",children:e.jsxs(A,{children:["×",f.floodFactor.toFixed(1)]})}),e.jsx("span",{className:"type-micro text-fg-muted mt-0.5 sm:mt-1",children:"Flood"})]}),e.jsxs("div",{className:"flex-1 flex flex-col",children:[e.jsx("span",{className:"type-data-xl text-sys-blue",children:e.jsxs(A,{children:["×",f.directFactor.toFixed(1)]})}),e.jsx("span",{className:"type-micro text-fg-muted mt-0.5 sm:mt-1",children:"Direct"})]}),e.jsx("div",{className:"flex items-center self-center opacity-0 group-hover:opacity-100 transition-opacity",children:r?e.jsx(ve,{className:"w-4 h-4 text-sys-green"}):e.jsx(jt,{className:"w-4 h-4 text-fg-muted"})})]}),e.jsx("div",{className:"flex-1 py-2",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"data-box-label",children:"Dupe"}),e.jsxs("div",{className:`data-box data-box-fill data-box-left ${f.duplicateRate>8?"text-status-warning":""}`,children:[f.duplicateRate.toFixed(1),"%"]})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"data-box-label",children:"TX Util"}),e.jsxs("div",{className:"data-box data-box-fill data-box-left",children:[f.txUtilization.toFixed(2),"%"]})]})]})}),e.jsx("div",{className:"pt-2 mt-auto",children:e.jsxs("div",{className:"flex items-end justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Current"}),e.jsx("div",{className:"flex gap-2",children:k!==null?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"data-box data-box-fill data-box-left",children:["×",k.toFixed(2)]})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"data-box data-box-fill data-box-left",style:{color:"var(--sys-blue)"},children:["×",(D==null?void 0:D.toFixed(2))??"—"]})})]}):e.jsx("span",{className:"text-sm text-fg-muted",children:"No config"})})]}),at&&e.jsxs("button",{onClick:it,disabled:u==="applying"||u==="success",className:`flex items-center gap-1.5 px-2.5 py-1.5 radius-inner type-micro font-medium transition-base ${u==="success"?"bg-sys-green/15 text-sys-green":u==="error"?"bg-sys-red/15 text-sys-red":u==="applying"?"bg-subtle-fill text-fg-muted":"bg-sys-blue/10 text-sys-blue hover:bg-sys-blue/20"}`,title:`Apply ×${f.floodFactor.toFixed(1)} flood, ×${f.directFactor.toFixed(1)} direct`,children:[u==="success"?"Rx'd":u==="error"?"Failed":"Apply",u==="applying"?e.jsx(ee,{className:"w-3.5 h-3.5 animate-spin"}):u==="success"?e.jsx(ve,{className:"w-3.5 h-3.5"}):e.jsxs("span",{className:"relative inline-flex items-end w-6 h-3.5",children:[e.jsx(Rs,{className:"w-3.5 h-3.5 absolute left-0 bottom-0"}),e.jsx(As,{className:"w-3 h-3 absolute right-0 bottom-0"})]})]})]})})]})}const Ye=[{target:"RecentPackets",fn:"rssi",minStage:1},{target:"RecentPackets",fn:"snr",minStage:1}];O(Ye);const rn=25;function ln(){I(Ye);const t=te(),n=vt(),a=wt(),s=se(),o=rs(),i=ue(j=>j.requestChannel),[d,r]=h.useState(!0),c=h.useCallback(j=>r(j),[]),u=h.useMemo(()=>[...t.length<=100?t:t.slice(-100)].sort((b,g)=>(g.timestamp??0)-(b.timestamp??0)),[t]),m=s==null?void 0:s.local_hash,x=s==null?void 0:s.neighbors,l=ls();return e.jsxs(H,{noPadding:!0,className:"!overflow-visible",children:[e.jsx(Le,{listHeader:!0,icon:e.jsx(Ae,{}),title:"Recent Packets",actions:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(kt,{enabled:d,onChange:c,label:"Hide Dupes",size:"sm"}),a&&e.jsx(Ct,{showLabel:!0}),e.jsxs(we,{color:"primary",outline:!0,href:"/packets",children:["View all",e.jsx(_e,{"data-slot":"icon"})]})]})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto px-1",children:e.jsx(os,{packets:u,allPackets:t,localHash:m,neighbors:x,resolveSource:l,getDecodedContent:o,onChannelClick:i,loading:n,maxPackets:rn,showPagination:!1,flashNewest:!0,hideDupes:d,emptyMessage:"No packets received",footerAction:e.jsxs(we,{color:"primary",outline:!0,href:"/packets",children:["View all",e.jsx(_e,{"data-slot":"icon"})]})})})]})}const cn={stable:"M5 12h14",up:"M5 15l7-7 7 7",down:"M19 9l-7 7-7-7"};function dn({trend:t}){return e.jsx("span",{className:`mini-widget-trend ${t}`,children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:cn[t]})})})}function mn(){return e.jsx("div",{className:"mini-widget-loading",children:e.jsx("div",{className:"mini-widget-loading-spinner"})})}function un({message:t}){return e.jsx("div",{className:"mini-widget-error",children:e.jsx("span",{title:t,children:"No data"})})}function q({title:t,icon:n,value:a,unit:s,valueSize:o="md",status:i,subtitle:d,subtitleValue:r,trend:c,children:u,isLoading:m=!1,error:x,className:l="",onClick:j}){const b=["mini-widget-value",o==="lg"&&"mini-widget-value-lg",o==="sm"&&"mini-widget-value-sm"].filter(Boolean).join(" "),g=["mini-widget",l].filter(Boolean).join(" ");return e.jsxs(H,{noPadding:!0,className:g,onClick:j,children:[e.jsxs("div",{className:"mini-widget-header",children:[n,e.jsx("span",{className:"mini-widget-title",children:t}),i&&i!=="unknown"&&e.jsx("div",{className:`mini-widget-status-dot ${i}`}),c&&e.jsx(dn,{trend:c})]}),m?e.jsx(mn,{}):x?e.jsx(un,{message:x}):e.jsxs("div",{className:"mini-widget-content",children:[(a!==void 0||d||r)&&e.jsxs("div",{className:"mini-widget-value-row",children:[a!==void 0&&e.jsxs("div",{className:b,children:[typeof a=="number"?e.jsx(V,{value:a,className:"font-mono tabular-nums",priority:"medium",format:Number.isInteger(a)?void 0:{minimumFractionDigits:1,maximumFractionDigits:1}}):e.jsx(A,{children:a}),s&&e.jsx("span",{className:"mini-widget-unit",children:s})]}),(d||r)&&e.jsxs("span",{className:"mini-widget-badge-group",children:[d&&!r&&e.jsx("span",{className:"data-box mini-widget-subtitle-box",children:d}),d&&r&&e.jsx("span",{className:"mini-widget-subtitle truncate",children:d}),r&&e.jsx("span",{className:"data-box mini-widget-subtitle-box",children:r})]})]}),u]})]})}const xn={DELTA_CRITICAL:10,SLOPE_CRITICAL:4,JITTER_CRITICAL:6,DELTA_WARNING:5,SLOPE_WARNING:2,JITTER_WARNING:4},Ke={baselineMedian:null,baselineP10:null,baselineP90:null,currentMedian:null,currentSampleCount:0,delta:0,slope:0,jitter:0,penalty:0,penaltyReason:null,computedAt:0,isReliable:!1};function xe(t,n){if(t.length===0)return null;const a=[...t].sort((d,r)=>d-r),s=n/100*(a.length-1),o=Math.floor(s),i=Math.ceil(s);return o===i?a[o]:a[o]+(a[i]-a[o])*(s-o)}function De(t){return xe(t,50)}function fn(t){if(t.length<2)return 0;const n=t.reduce((o,i)=>o+i,0)/t.length,s=t.map(o=>Math.pow(o-n,2)).reduce((o,i)=>o+i,0)/t.length;return Math.sqrt(s)}function hn(t){if(t.length<2)return 0;const n=t.length;let a=0,s=0,o=0,i=0;const d=t[0].timestamp;for(const c of t){const u=(c.timestamp-d)/3600,m=c.value;a+=u,s+=m,o+=u*m,i+=u*u}const r=n*i-a*a;return Math.abs(r)<1e-4?0:(n*o-a*s)/r}function pn(t,n,a){const s=xn;return t>=s.DELTA_CRITICAL?[2,`Noise floor ${t.toFixed(1)} dB above baseline`]:n>=s.SLOPE_CRITICAL?[2,`Noise floor rising ${n.toFixed(1)} dB/hour`]:a>=s.JITTER_CRITICAL?[2,`Noise floor unstable (±${a.toFixed(1)} dB)`]:t>=s.DELTA_WARNING?[1,`Noise floor ${t.toFixed(1)} dB above baseline`]:n>=s.SLOPE_WARNING?[1,`Noise floor rising ${n.toFixed(1)} dB/hour`]:a>=s.JITTER_WARNING?[1,`Noise floor variable (±${a.toFixed(1)} dB)`]:[0,null]}function gn(t){if(t.length===0)return{...Ke,computedAt:Math.floor(Date.now()/1e3)};const n=Math.floor(Date.now()/1e3),a=t.filter(v=>Number.isFinite(v)),s=t.length>0?[t[t.length-1]]:[],o=t.slice(-4).filter(v=>Number.isFinite(v)),i=De(a),d=xe(a,10),r=xe(a,90),c=De(s),u=c!==null&&d!==null?c-d:0,m=o.map((v,w)=>({timestamp:n-(o.length-1-w)*3600,value:v})),x=hn(m),l=fn(o),j=a.length>=12,[b,g]=j?pn(u,x,l):[0,null];return{baselineMedian:i,baselineP10:d,baselineP90:r,currentMedian:c,currentSampleCount:s.length,delta:u,slope:x,jitter:l,penalty:b,penaltyReason:g,computedAt:n,isReliable:j}}const yn={lbtStats:null,noiseFloor:null,sparklineNoiseFloor:[],noiseFloorWindowHistory:[],linkQuality:null,channelHealth:null,nfTrend:Ke,radioConfig:null,trends:null,stats:null,recentPackets:[],quickNeighbors:[],isLoading:!0,error:null,refresh:async()=>{}},Je=h.createContext(yn);function bn({children:t}){var p;const n=se(),a=te(),s=Ee(),o=Tt(),i=G(),d=L[i],r=Math.max(1,d.minutes/60),c=n===null,u=h.useMemo(()=>Mt(a,r),[a,r]),m=(n==null?void 0:n.noise_floor_dbm)??null,x=h.useMemo(()=>_t(m)?m:null,[m]),l=h.useMemo(()=>{var S;const M=(S=n==null?void 0:n.config)==null?void 0:S.radio;return M?{sf:M.spreading_factor??7,bwHz:M.bandwidth??125e3}:null},[(p=n==null?void 0:n.config)==null?void 0:p.radio]),j=Bt(r),b=St(r),g=n==null?void 0:n.neighbors,v=h.useMemo(()=>Object.fromEntries(Object.entries(g??{}).filter(([S])=>!o.has(S))),[g,o]),w=h.useMemo(()=>s.filter(M=>!o.has(M.hash)),[s,o]),C=h.useMemo(()=>gn(j),[j]),y=h.useMemo(()=>Dt(w,v,l),[w,v,l]),N=h.useMemo(()=>Rt(u,x,y),[u,x,y]),[k,D]=h.useState({noiseFloor:null,networkScore:null,channelHealth:null}),f=h.useRef(0);h.useEffect(()=>{const M=()=>{const R=Date.now();R-f.current>3e4&&(f.current=R,D({noiseFloor:x,networkScore:(y==null?void 0:y.networkScore)??null,channelHealth:(N==null?void 0:N.score)??null}))};M();const S=setInterval(M,5e3);return()=>clearInterval(S)},[x,y==null?void 0:y.networkScore,N==null?void 0:N.score]);const T=h.useMemo(()=>({noiseFloor:{current:x,previous:k.noiseFloor,trend:x!==null?oe(x,k.noiseFloor,2,!0):"stable"},networkScore:{current:(y==null?void 0:y.networkScore)??0,previous:k.networkScore,trend:oe((y==null?void 0:y.networkScore)??0,k.networkScore,3,!1)},channelHealth:{current:(N==null?void 0:N.score)??0,previous:k.channelHealth,trend:oe((N==null?void 0:N.score)??0,k.channelHealth,3,!1)}}),[x,y==null?void 0:y.networkScore,N==null?void 0:N.score,k]),B={lbtStats:u,noiseFloor:x,sparklineNoiseFloor:j,noiseFloorWindowHistory:b,linkQuality:y,channelHealth:N,nfTrend:C,radioConfig:l,trends:T,stats:n,recentPackets:a,quickNeighbors:s,isLoading:c,error:null,refresh:async()=>{}};return e.jsx(Je.Provider,{value:B,children:t})}function X(){const t=h.useContext(Je);if(t===void 0)throw new Error("useLBTData must be used within an LBTDataProvider");return t}function jn(t){return t<100?"excellent":t<250?"good":t<500?"fair":t<1e3?"congested":"critical"}function Nn(t){return t===0?"No backoffs":"Retries"}function vn(t,n){return t===0?void 0:`${n.toFixed(0)}%`}function wn(){const{lbtStats:t,isLoading:n,error:a}=X(),s=he(),o=(t==null?void 0:t.avgBackoffMs)??0,i=(t==null?void 0:t.retryRate)??0,d=t?jn(o):"unknown",r=t==null?void 0:t.sparklineBackoff,c=h.useMemo(()=>!r||r.length<2?[]:r.map((u,m)=>({timestamp:Date.now()-(r.length-1-m)*36e5,count:u})),[r]);return e.jsx(q,{title:"LBT Backoff",icon:e.jsx(Hs,{className:"mini-widget-icon"}),value:Math.round(o),unit:"ms",status:d,subtitle:t?Nn(o):void 0,subtitleValue:t?vn(o,i):void 0,isLoading:n,error:a,onClick:()=>s("/packets"),children:e.jsx("div",{className:"mini-widget-sparkline w-full",children:e.jsx(qe,{data:c,width:9999,height:24,invertScale:!0,isLoading:n,className:"w-full"})})})}function me(t){return t===0?"—":t<1?"<1":Math.round(t).toString()}function kn(){const{lbtStats:t,isLoading:n,error:a}=X(),s=he(),o=(t==null?void 0:t.channelBusyCount)??0,i=(t==null?void 0:t.totalPacketsWithLBT)??0,d=(t==null?void 0:t.channelBusyRate)??0,r=(t==null?void 0:t.retryRate)??0,c=(t==null?void 0:t.avgBackoffMs)??0,u=(t==null?void 0:t.minBackoffMs)??0,m=(t==null?void 0:t.maxBackoffMs)??0,x=r>0?Math.max(0,(r-d)/r*100):100;return e.jsx(q,{title:"Ch. Busy",icon:e.jsx(es,{className:"mini-widget-icon"}),isLoading:n,error:a,onClick:()=>s("/packets"),children:e.jsx("div",{className:"mini-widget-body-grid",children:e.jsxs("div",{className:"grid grid-cols-[auto_1fr] widget-4col gap-x-2 gap-y-1 w-full min-w-0 items-baseline",children:[e.jsx("span",{className:"text-fg-muted text-[10px] sm:text-sm",title:`${o} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:"Failed"}),e.jsxs("div",{className:"data-box data-box-compact sm:data-box justify-self-end",title:`${o} packets exceeded max CAD attempts (5) out of ${i} total transmissions.`,children:[e.jsx(A,{children:o}),e.jsx("span",{className:"text-fg-muted punc-slash",children:"/"}),e.jsx(A,{children:i})]}),e.jsx("span",{className:"text-fg-muted text-[10px] sm:text-sm",title:`${x.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:"Sent"}),e.jsx("div",{className:"data-box data-box-compact sm:data-box justify-self-end",title:`${x.toFixed(1)}% of packets that needed LBT retries were sent successfully.`,children:e.jsxs(A,{children:[x.toFixed(0),"%"]})}),e.jsx("span",{className:"text-fg-muted text-[10px] sm:text-sm",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:"Mean"}),e.jsxs("div",{className:"data-box data-box-compact sm:data-box justify-self-end",title:`Average LBT backoff delay: ${c.toFixed(0)}ms.`,children:[e.jsx(A,{children:me(c)}),e.jsx("span",{className:"text-fg-muted text-xs",children:"ms"})]}),e.jsx("span",{className:"text-fg-muted text-[10px] sm:text-sm",title:`Backoff range: ${u.toFixed(0)}ms min, ${m.toFixed(0)}ms max.`,children:"Range"}),e.jsxs("div",{className:"data-box data-box-compact sm:data-box justify-self-end",title:`Backoff range: ${u.toFixed(0)}ms min, ${m.toFixed(0)}ms max.`,children:[e.jsx(A,{children:me(u)}),e.jsx("span",{className:"text-fg-muted punc-slash",children:"/"}),e.jsx(A,{children:me(m)})]})]})})})}function Cn(t){return t===null||t<-110?"excellent":t<-100?"good":t<-90?"fair":t<-80?"congested":"critical"}function Tn(t){return t===null?"No reading":t<-115?"Very quiet":t<-105?"Quiet":t<-95?"Moderate":t<-85?"Elevated":"High interference"}function Mn(){const{noiseFloor:t,noiseFloorWindowHistory:n,trends:a,isLoading:s,error:o}=X(),i=Cn(t),d=a==null?void 0:a.noiseFloor.trend,{timestamps:r,values:c}=h.useMemo(()=>!n||n.length<2?{timestamps:[],values:[]}:{timestamps:n.map(m=>m.timestamp),values:n.map(m=>m.noise_floor_dbm)},[n]),u=t!==null?Math.round(t):"—";return e.jsx(q,{title:"Noise Floor",icon:e.jsx(ks,{className:"mini-widget-icon"}),value:u,unit:t!==null?"dBm":void 0,status:i,trend:d,subtitle:Tn(t),isLoading:s,error:o,children:e.jsx("div",{className:"mini-widget-sparkline w-full",children:e.jsx(Pt,{timestamps:r,values:c,compact:!0,height:22})})})}const Ze=[{target:"LinkLeaders",fn:"path",minStage:1,when:Jt},{target:"LinkLeaders",fn:"src_hash",minStage:1,when:Zt}];O(Ze);function _n(){I(Ze);const t=he(),n=Ee(),a=te(),s=se(),o=G(),d=L[o].minutes*60,r=Ft(),c=h.useMemo(()=>{if(r===0)return a;const f=r-d;return a.filter(T=>T.timestamp>=f)},[a,d,r]),u=s===null,m=s!=null&&s.local_hash?ke(s.local_hash):"",x=(s==null?void 0:s.neighbors)??{},{neighborHashes:l,neighborNames:j}=h.useMemo(()=>{const f=new Set,T=new Map;for(const _ of n){f.add(_.hash);const B=x[_.hash],p=(B==null?void 0:B.name)||(B==null?void 0:B.node_name)||_.prefix;T.set(_.hash,p)}return{neighborHashes:f,neighborNames:T}},[n,x]),b=h.useMemo(()=>{if(l.size===0||c.length===0||!m)return{champion:null,listener:null,loudest:null};const{scores:f}=ds(c,l,m),T=[];for(const[M,S]of f)S.blendedScore!==0&&T.push({...S,name:j.get(M)??ke(M)});let _=null,B=null,p=null;for(const M of T)(!_||M.blendedScore>_.blendedScore)&&(_=M),(!B||M.listenerScore>B.listenerScore)&&(B=M),(!p||M.loudScore>p.loudScore)&&(p=M);return{champion:_,listener:B,loudest:p}},[c,l,m,j]),g=f=>e.jsxs("div",{className:"max-w-[220px]",children:[e.jsxs("div",{className:"font-semibold mb-1",children:["🏆 Champion: ",f.name]}),e.jsxs("div",{className:"text-fg-muted mb-1",children:["Blended Score: ",f.blendedScore,e.jsx("span",{className:"text-fg-muted/60 ml-1",children:"(Listener + Loud)"})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-1 mt-1 space-y-0.5",children:[e.jsxs("div",{children:["Listener: ",f.listenerScore,"/100 (",f.listenerCount," shared paths)"]}),e.jsxs("div",{children:["Loud: ",f.loudScore,"/100 (",f.loudCount," packets relayed)"]})]})]}),v=f=>e.jsxs("div",{className:"max-w-[220px]",children:[e.jsxs("div",{className:"font-semibold mb-1",children:["👂 Best Listener: ",f.name]}),e.jsxs("div",{className:"text-fg-muted mb-1",children:["Score: ",f.listenerScore,"/100"]}),e.jsx("div",{className:"border-t border-edge-subtle pt-1 mt-1",children:e.jsxs("div",{children:[f.listenerCount," packets where they heard your transmissions"]})})]}),w=f=>e.jsxs("div",{className:"max-w-[220px]",children:[e.jsxs("div",{className:"font-semibold mb-1",children:["📢 Loudest: ",f.name]}),e.jsxs("div",{className:"text-fg-muted mb-1",children:["Score: ",f.loudScore,"/100"]}),e.jsx("div",{className:"border-t border-edge-subtle pt-1 mt-1",children:e.jsxs("div",{children:[f.loudCount," packets they relayed directly to you"]})})]}),{champion:C,listener:y,loudest:N}=b,D=C||y||N?e.jsxs("div",{className:"flex flex-col gap-0 sm:gap-0.5",children:[C&&e.jsx(ie,{content:g(C),children:e.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[e.jsx(is,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-map-neighbor-color flex-shrink-0"}),e.jsx("span",{className:"font-semibold text-map-neighbor-color font-mono truncate flex-1 min-w-0",children:C.name}),e.jsx("span",{className:"text-map-neighbor-color pl-1 sm:pl-2 tabular-nums flex-shrink-0 w-7 sm:w-9 text-right",children:C.blendedScore})]})}),y&&e.jsx(ie,{content:v(y),children:e.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[e.jsx(_s,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-fg-muted font-mono truncate flex-1 min-w-0",children:y.name}),e.jsx("span",{className:"text-fg-muted pl-1 sm:pl-2 tabular-nums flex-shrink-0 w-7 sm:w-9 text-right",children:y.listenerScore})]})}),N&&e.jsx(ie,{content:w(N),children:e.jsxs("div",{className:"flex items-center gap-1 text-xs sm:text-sm radius-badge px-1 -mx-1 hover-bg transition-base cursor-default",children:[e.jsx(Ss,{className:"w-2.5 h-2.5 sm:w-3 sm:h-3 text-fg-muted flex-shrink-0"}),e.jsx("span",{className:"text-fg-muted font-mono truncate flex-1 min-w-0",children:N.name}),e.jsx("span",{className:"text-fg-muted pl-1 sm:pl-2 tabular-nums flex-shrink-0 w-7 sm:w-9 text-right",children:N.loudScore})]})})]}):n.length===0?e.jsx("div",{className:"flex items-center justify-center text-xs sm:text-sm text-fg-muted mt-auto",children:"No direct neighbors"}):e.jsx("div",{className:"flex items-center justify-center text-xs sm:text-sm text-fg-muted mt-auto",children:"No routing data yet"});return e.jsx(q,{title:"Link Leaders",icon:e.jsx(Fs,{className:"mini-widget-icon"}),isLoading:u,onClick:()=>t("/contacts"),children:D})}function Bn(t){const{retryRate:n,channelBusyCount:a,totalPacketsWithLBT:s,avgBackoffMs:o,maxBackoffMs:i}=t;if(s===0)return 0;const d=Math.min(s/10,1),r=.15,c=Math.log(1+n*r)/Math.log(1+100*r)*40,u=a/s*100,m=Math.min(u*.5,25);let x=0;o>100&&(x=Math.min(Math.log10(o/100)*8,15));let l=0;i>500&&o>0&&i>o*2&&(l=Math.min((i-500)/200,5));const b=(c+m+x+l)*d;return Math.min(b,85)}function Sn(t){return t<15?"excellent":t<30?"good":t<45?"fair":t<60?"congested":"critical"}function Dn(t){return t<15?"Clear channel":t<30?"Light traffic":t<45?"Moderate traffic":t<60?"Heavy traffic":t<75?"Congested":"Severe congestion"}function Rn(){const{lbtStats:t,isLoading:n,error:a}=X(),s=t?Bn(t):0,o=t?Sn(s):"unknown",i=(t==null?void 0:t.maxBackoffMs)??0,d=t?i>200?"Peak":Dn(s):void 0,r=t&&i>200?`${Math.round(i)}ms`:void 0,c=t==null?void 0:t.sparklineCollisionRisk,u=h.useMemo(()=>!c||c.length<2?[]:c.map((x,l)=>({timestamp:Date.now()-(c.length-1-l)*36e5,count:x})),[c]),m=Math.round(s*10)/10;return e.jsx(q,{title:"Collision Risk",icon:e.jsx(ms,{className:"mini-widget-icon"}),value:m,unit:"%",status:o,subtitle:d,subtitleValue:r,isLoading:n,error:a,children:e.jsx("div",{className:"mini-widget-sparkline w-full",children:e.jsx(qe,{data:u,width:9999,height:24,invertScale:!0,isLoading:n,className:"w-full"})})})}function Pn(t){return t<30?"excellent":t<50?"good":t<70?"fair":t<90?"congested":"critical"}function Fn(t){return t<1e3?`${Math.round(t)}ms`:t<6e4?`${(t/1e3).toFixed(1)}s`:`${(t/6e4).toFixed(1)}m`}function Ln(){var g,v;const[t,n]=h.useState(!1),[a]=h.useState(0),{stats:s,lbtStats:o,isLoading:i}=X(),d=((v=(g=s==null?void 0:s.config)==null?void 0:g.duty_cycle)==null?void 0:v.enforcement_enabled)??!1,r=h.useMemo(()=>{if(!s)return null;if(!d){const k=s.airtime_used_ms??0,D=s.max_airtime_ms??1,f=D>0?k/D*100:0;return{usedMs:k,maxMs:D,remainingMs:Math.max(0,D-k),utilizationPercent:f}}const w=s.airtime_used_ms??0,C=s.max_airtime_ms??1,y=s.airtime_remaining_ms??0,N=s.utilization_percent??(C>0?w/C*100:0);return{usedMs:w,maxMs:C,remainingMs:y,utilizationPercent:N}},[s,d]),c=h.useMemo(()=>{if(!o||o.totalPacketsWithLBT===0)return 100;const w=o.totalPacketsWithLBT-o.packetsWithRetries,C=o.totalPacketsWithLBT;return w/C*100},[o]),u=(r==null?void 0:r.utilizationPercent)??0,m=Pn(u),x=(r==null?void 0:r.remainingMs)??0,l=c<95?"1st Try":"Remaining",j=c<95?`${c.toFixed(0)}%`:Fn(x),b=r?e.jsx("div",{className:"mini-widget-progress mt-auto",children:e.jsx("div",{className:`mini-widget-progress-bar ${m}`,style:{width:`${Math.min(u,100)}%`}})}):null;return e.jsx(q,{title:"Duty Cycle",icon:e.jsx(Ae,{className:"mini-widget-icon"}),value:u.toFixed(1),unit:"%",status:m,subtitle:l,subtitleValue:j,isLoading:i,children:b})}function An(){return e.jsxs("div",{className:"mini-widget",children:[e.jsxs("div",{className:"mini-widget-header",children:[e.jsx(Y,{className:"w-4 h-4"}),e.jsx(Y,{className:"h-3 w-16"})]}),e.jsx(Y,{className:"h-7 w-12 mt-2"}),e.jsx(Y,{className:"h-3 w-20 mt-2"})]})}function En(){return e.jsx("div",{className:"widget-row",children:Array.from({length:6}).map((t,n)=>e.jsx(An,{},n))})}const Qe=[{target:"MeshHealth",fn:"type",minStage:1}];O(Qe);function Hn({className:t="",isLoaded:n}){I(Qe);const a=He(),s=n??a??!0;return e.jsxs("div",{className:`mesh-health-container relative ${t}`,children:[e.jsxs("div",{className:"mesh-health-header",children:[e.jsx(Lt,{className:"w-4 h-4 text-sys-blue"}),e.jsx("span",{className:"type-label text-fg-muted",children:"MESH HEALTH"})]}),s?e.jsx(bn,{children:e.jsxs("div",{className:"widget-row",children:[e.jsx(wn,{}),e.jsx(Rn,{}),e.jsx(Mn,{}),e.jsx(Ln,{}),e.jsx(kn,{}),e.jsx(_n,{})]})}):e.jsx(En,{})]})}const et=[{target:"PublicChannel",fn:"decrypt",minStage:2,when:Qt}];O(et);let tt="",st="",Re="";function $n(){const t=new Date,n=t.toDateString();if(n!==Re){Re=n,tt=n;const a=new Date(t);a.setDate(a.getDate()-1),st=a.toDateString()}}function In(t){$n();const n=new Date(t*1e3).toDateString();return n===tt?"Today":n===st?"Yesterday":new Date(t*1e3).toLocaleDateString([],{weekday:"short",month:"short",day:"numeric"})}function On(t,n,a){return`${t||""}|${n}|${a}`}function zn(t,n){const a=t.message,s=n.message;return a.timestamp===s.timestamp&&a.text===s.text&&a.senderName===s.senderName&&a.channelHash===s.channelHash&&a.channelName===s.channelName&&t.isChannelSelected===n.isChannelSelected&&t.onChannelClick===n.onChannelClick}const qn=h.memo(function({message:n,onChannelClick:a,isChannelSelected:s}){const o=n.channelName||n.channelHash.slice(0,6);return e.jsx("div",{style:{transform:"translateZ(0)",willChange:"transform"},children:e.jsx(ps,{senderName:n.senderName||"Unknown",text:n.text,timestamp:n.timestamp,nameAccessory:e.jsx(Oe,{channelName:o,active:s,onClick:()=>a==null?void 0:a(n.channelHash)})})})},zn);function Wn({open:t,onClose:n,messages:a,onLoadMore:s,hasMoreToLoad:o,isDecoding:i,initialChannel:d}){const r=h.useRef(null),c=h.useRef(!0),u=G(),m=$e(),x=h.useRef(!1);h.useEffect(()=>{t?(x.current=!0,Te.resume()):x.current&&Te.pause()},[t]);const l=h.useMemo(()=>{const p=Date.now()/1e3,M=L[u].minutes,S=p-M*60;return[...a].filter(R=>R.timestamp>=S).sort((R,ne)=>R.timestamp-ne.timestamp)},[a,u]),j=h.useCallback(()=>{const p=r.current;p&&(c.current=p.scrollTop>=-50)},[]),b=h.useMemo(()=>{const p=new Map;for(const M of l){const S=M.channelHash,R=p.get(S);R?R.count++:p.set(S,{name:M.channelName||M.channelHash.slice(0,6),hash:M.channelHash,count:1})}return Array.from(p.values()).sort((M,S)=>S.count-M.count)},[l]),g=b.length,[v,w]=h.useState(null),[C,y]=h.useState(!1);h.useEffect(()=>{t&&d&&w(d)},[t,d]);const N=h.useCallback(()=>{s(v,b)},[s,v,b]),k=h.useMemo(()=>v?l.filter(p=>p.channelHash===v):l,[l,v]),D=h.useMemo(()=>{const p=[];let M="";for(const S of k){const R=In(S.timestamp);R!==M&&(p.push({type:"date",date:R}),M=R),p.push({type:"message",message:S})}return p},[k]);h.useLayoutEffect(()=>{const p=r.current;p&&c.current&&(p.scrollTop=0)},[k.length]);const f=19,T=b.slice(0,f),_=b.slice(f),B=_.length>0;return e.jsx(Ot,{open:t,onClose:n,size:"lg",motionPlus:!0,solid:!0,children:e.jsxs(zt,{className:"p-0 flex flex-col h-[80vh] max-h-[700px] rounded-2xl",children:[e.jsx("div",{className:"flex-shrink-0 px-4 sm:px-5 py-3 sm:py-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(We,{className:"size-5 text-icon-card-title flex-shrink-0"}),e.jsx("h2",{className:"type-micro",children:"Public Channels"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ze,{ranges:L,selectedIndex:u,onSelect:m,size:"sm"}),e.jsx("button",{onClick:n,className:"sm:hidden min-h-[44px] min-w-[44px] px-3 flex items-center justify-center text-[15px] font-medium text-sys-blue active:text-sys-blue/70 transition-base radius-inner active:bg-subtle-fill",children:"Done"}),e.jsx("button",{onClick:n,className:"hidden sm:flex items-center justify-center p-2 text-fg-muted hover:text-fg-primary transition-base radius-inner hover:bg-subtle","aria-label":"Close",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})}),e.jsx("div",{className:"flex-shrink-0 px-3 pb-2 relative z-10 isolate",style:{minHeight:g>0?void 0:0},children:g>0&&e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsxs("button",{onClick:()=>w(null),className:F("px-2 py-0.5 rounded text-xs font-medium transition-all","ring-1 ring-inset",v===null?"bg-sys-blue/20 text-sys-blue ring-sys-blue/30":"bg-subtle-fill text-fg-secondary ring-edge-subtle hover:bg-subtle-fill-strong"),children:["All ",g]}),T.map(p=>e.jsx("button",{onClick:()=>w(p.hash),className:F("flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium transition-all","ring-1 ring-inset",v===p.hash?"bg-sys-blue/20 text-sys-blue ring-sys-blue/30":"bg-subtle-fill text-fg-secondary ring-edge-subtle hover:bg-subtle-fill-strong"),children:e.jsx("span",{className:"truncate max-w-[80px]",children:p.name})},p.hash)),B&&e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>y(!C),className:F("flex items-center gap-0.5 px-2 py-0.5 rounded text-xs font-medium transition-all","ring-1 ring-inset",C||_.some(p=>p.hash===v)?"bg-sys-blue/20 text-sys-blue ring-sys-blue/30":"bg-subtle-fill text-fg-secondary ring-edge-subtle hover:bg-subtle-fill-strong"),children:["+",_.length,e.jsx(qt,{className:F("size-3 transition-transform",C&&"rotate-180")})]}),C&&e.jsx("div",{className:F("absolute top-full left-0 mt-1 z-50","min-w-[140px] max-h-[200px] overflow-y-auto","p-1 rounded-lg","bg-elevated backdrop-blur-xl","ring-1 ring-edge-subtle shadow-xl"),children:_.map(p=>e.jsxs("button",{onClick:()=>{w(p.hash),y(!1)},className:F("w-full flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-all text-left",v===p.hash?"bg-sys-blue/20 text-sys-blue":"text-fg-secondary hover:bg-subtle-fill-strong"),children:[e.jsx(gs,{className:"size-2.5 opacity-60 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:p.name}),e.jsxs("span",{className:"opacity-60 ml-auto",children:["(",p.count,")"]})]},p.hash))})]})]})}),e.jsx("div",{ref:r,onScroll:j,className:F("flex-1 overflow-y-auto overflow-x-hidden","mx-3 mb-3 rounded-md","bg-body","ring-1 ring-inset ring-edge-subtle","flex flex-col-reverse"),children:i&&k.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[300px] text-fg-muted px-4 py-4",children:[e.jsx(ee,{className:"size-12 mb-4 text-sys-indigo animate-spin"}),e.jsx("p",{className:"text-lg font-medium",children:"Loading messages..."})]}):k.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full min-h-[300px] text-fg-muted px-4 py-4",children:[e.jsx(ys,{className:"size-16 mb-4 opacity-20"}),e.jsx("p",{className:"text-lg font-medium",children:"No messages yet"}),e.jsx("p",{className:"text-sm mt-1 opacity-70",children:v?"No messages in this channel":"Public channel messages will appear here"})]}):e.jsxs("div",{className:"px-4 py-4",children:[o&&e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("button",{onClick:N,disabled:i,className:F("px-4 py-1.5 rounded-full","text-[11px] font-medium","ring-1 ring-inset",i?"bg-subtle-fill text-fg-muted ring-edge-subtle cursor-wait":"bg-sys-blue/10 text-sys-blue ring-sys-blue/20 hover:bg-sys-blue/20 hover:ring-sys-blue/30"),children:i?e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(ee,{className:"size-3 animate-spin"}),"Loading..."]}):"Load older messages"})}),D.map((p,M)=>{if(p.type==="date")return e.jsx("div",{className:"flex justify-center my-4",children:e.jsx("span",{className:F("px-3.5 py-1.5 rounded-full","bg-subtle-fill backdrop-blur-sm","text-[11px] text-fg-muted/80 font-medium","ring-1 ring-edge-subtle"),children:p.date})},`date-${p.date}-${M}`);const S=`msg-${p.message.timestamp}-${p.message.senderName||"anon"}-${p.message.channelHash}`;return e.jsx("div",{className:"mb-3",children:e.jsx(qn,{message:p.message,onChannelClick:w,isChannelSelected:v===p.message.channelHash})},S)})]})}),e.jsx("div",{className:"flex-shrink-0 px-5 py-2 text-center",children:e.jsxs("p",{className:"text-[11px] text-fg-muted",children:[k.length," messages · ",g," ",g===1?"channel":"channels",i&&e.jsxs("span",{className:"ml-2 text-sys-indigo",children:[e.jsx(ee,{className:"inline size-3 animate-spin mr-1"}),"Decrypting..."]})]})})]})})}function Un(t){const n=[],a=new Set;for(const s of t.values()){const o=s.decoded;if(!o||!o.decrypted||o.macCorrupted||!o.text)continue;const i=On(o.senderName,o.channelHash,o.text);a.has(i)||(a.add(i),n.push({timestamp:s.timestamp,channelName:o.channelName,channelHash:o.channelHash,senderName:o.senderName,text:o.text,rssi:s.rssi,snr:s.snr}))}return n}function Vn({isLoaded:t}){const n=He(),a=t??n??!0;I(et);const s=te(),[o,i]=h.useState(!1),[d,r]=h.useState(null),c=G(),u=h.useCallback(()=>{r(null),i(!0),K.getState().queueDecryption(s)},[s]),m=ue(T=>T.requestedHash),x=ue(T=>T.clearRequest);h.useEffect(()=>{m&&(r(m),i(!0),K.getState().queueDecryption(s),x())},[m,x,s]);const l=At(),j=Et(),b=Ht(),g=h.useMemo(()=>Un(l),[l]),v=h.useMemo(()=>{const T=Date.now()/1e3,_=L[c].minutes,B=T-_*60;return g.filter(p=>p.timestamp>=B)},[g,c]),w=h.useMemo(()=>v.length===0?null:v.reduce((T,_)=>_.timestamp>T.timestamp?_:T),[v]),C=j.isDecoding,N=h.useMemo(()=>{const T=Date.now()/1e3,_=L[c].minutes,B=T-_*60,p=new Set;let M=0;for(const S of s)(S.type??S.payload_type)===Ce.GRP_TXT&&((S.timestamp??0){const T=Date.now()/1e3,_=L[c].minutes,B=T-_*60;for(const p of s)if((p.type??p.payload_type)===Ce.GRP_TXT&&!((p.timestamp??0){if(!C){if(T){const B=_.find(p=>p.hash===T);if(B){console.log(`[PublicChannelCard] Fast-path load for #${B.name}`),K.getState().queueChannelDecryption(s,B.name);return}}K.getState().queueDecryption(s)}},[s,C]);return a?e.jsxs(e.Fragment,{children:[e.jsx("div",{onClick:u,className:F("group cursor-pointer rounded-2xl transition-all duration-150","bg-surface/80 backdrop-blur-lg depth-raised","hover:bg-subtle-fill","px-3 py-2.5 sm:px-4 sm:py-3"),children:e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 flex-shrink-0",children:[e.jsx(We,{className:"size-4 text-icon-card-title flex-shrink-0"}),e.jsx("span",{className:"type-micro",children:"CHAT ACTIVITY"}),N>0&&e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-edge-subtle text-sm tabular-nums text-fg-secondary",children:N}),e.jsx(Be,{className:"size-4 text-fg-muted group-hover:text-sys-indigo transition-colors ml-auto sm:hidden"})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-1.5 min-w-0 overflow-hidden",children:[e.jsx(Fe,{mode:"wait",initial:!1,children:w?e.jsxs(Q.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.2,ease:[.4,0,.2,1]},className:"flex items-center gap-2 sm:gap-1.5 min-w-0",children:[w.channelName&&e.jsx("span",{className:"hidden sm:inline-flex",children:e.jsx(Oe,{channelName:w.channelName})}),e.jsx("div",{className:"hidden sm:flex w-[30px] h-[30px] rounded-full items-center justify-center flex-shrink-0 ring-1 ring-edge-subtle",style:{backgroundColor:xs(re(w.senderName||"").cleanName)},children:re(w.senderName||"").emoji?e.jsx("span",{className:"text-base",children:re(w.senderName||"").emoji}):e.jsx("span",{className:"text-white text-xs font-bold tracking-tighter",children:fs(w.senderName||"")})}),e.jsx("div",{className:"inline-flex items-center px-3 py-1.5 rounded-2xl rounded-tr-md bg-[#007AFF] shadow-sm min-w-0 flex-1 sm:flex-initial sm:max-w-xs sm:-ml-px",children:e.jsx("span",{className:"text-sm text-white truncate tracking-wide",children:hs(w.text)})}),e.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-md bg-subtle-fill ring-1 ring-inset ring-edge-subtle text-sm tabular-nums text-fg-secondary flex-shrink-0",children:It(w.timestamp)})]},`msg-${w.timestamp}-${w.senderName}-${w.channelHash}`):b?e.jsx(Q.span,{initial:{opacity:0},animate:{opacity:1},className:"text-sm text-fg-muted italic",children:"No messages yet"},"empty"):e.jsxs(Q.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,y:-16},transition:{duration:.15},className:"flex items-center gap-2 sm:gap-1.5",children:[e.jsx("div",{className:"hidden sm:block w-8 h-4 rounded bg-subtle-fill-strong animate-pulse"}),e.jsx("div",{className:"hidden sm:block w-[30px] h-[30px] rounded-full bg-subtle-fill-strong animate-pulse"}),e.jsx("div",{className:"h-8 w-32 sm:w-48 rounded-2xl bg-subtle-fill-strong animate-pulse"}),e.jsx("div",{className:"w-12 h-6 rounded-md bg-subtle-fill-strong animate-pulse"})]},"skeleton")}),e.jsx(Be,{className:"size-4 text-fg-muted group-hover:text-sys-indigo transition-colors flex-shrink-0 hidden sm:block ml-1"})]})]})}),e.jsx(Wn,{open:o,onClose:()=>i(!1),messages:g,onLoadMore:f,hasMoreToLoad:D,isDecoding:C,initialChannel:d})]}):e.jsx("div",{className:"h-14 rounded-xl bg-elevated/50 animate-pulse"})}function _a(){var b;const t=se(),n=Wt(),a=Ut(),s=Us(),o=h.useRef(!1);a&&!o.current&&(o.current=!0);const i=o.current,d=G(),r=$e(),c=Vt(),u=L[d]??L[4],m=c.isBackgroundLoading&&d>=5,x=h.useMemo(()=>{const g=T=>(T==null?void 0:T.reduce((_,B)=>_+B.count,0))??0,v=g(s==null?void 0:s.received),w=g(s==null?void 0:s.unique_received),C=g(s==null?void 0:s.forwarded),y=g(s==null?void 0:s.dropped),N=g(s==null?void 0:s.transmitted),k=((s==null?void 0:s.time_range_minutes)??u.minutes)/60,D=k>0?Math.round(v/k):0,f=k>0?Math.round(C/k):0;return{received:v,uniqueReceived:w,forwarded:C,dropped:y,transmitted:N,rxPerHour:D,fwdPerHour:f}},[s,u.minutes]),l=h.useMemo(()=>s?{totalBytes:s.totalReceivedBytes,kbPerHour:s.kbPerHour}:{totalBytes:0,kbPerHour:0},[s]),j=(t==null?void 0:t.node_name)??((b=t==null?void 0:t.config)==null?void 0:b.node_name)??"Unknown Node";return h.useEffect(()=>{j&&j!=="Unknown Node"&&(document.title=`pyMC: ${j}`)},[j]),n?e.jsxs(Me,{neomorphic:!0,className:"p-8 text-center",children:[e.jsx("p",{className:"type-subheading text-sys-red mb-2",children:"Failed to connect to backend"}),e.jsx("p",{className:"type-body text-fg-muted",children:n}),e.jsx("p",{className:"type-data-sm text-fg-muted mt-4",children:"Make sure the backend is running on port 8000"})]}):e.jsxs(Gt,{children:[e.jsx(Xt,{title:j,icon:e.jsx(bs,{}),subtitle:e.jsx(cs,{}),controls:e.jsx(ze,{ranges:L,selectedIndex:d,onSelect:r,isPending:m})}),e.jsxs(Yt,{ready:i,children:[e.jsx(Vn,{}),e.jsx(le,{template:"hero-auto",children:e.jsxs(Me,{neomorphic:!0,children:[e.jsx(Le,{icon:e.jsx(Ts,{}),title:"PACKETS RECEIVED",badge:u.label,badgeColor:"zinc",actions:i?e.jsxs("div",{className:"data-box",children:[l.kbPerHour," KB/hr"]}):e.jsx("div",{className:"data-box opacity-0",children:"0 KB/hr"})}),e.jsxs("div",{className:"flex flex-wrap gap-4 sm:gap-8",children:[e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("div",{className:"type-data-xl text-fg-primary",children:i?e.jsx(V,{value:x.received,className:"font-mono tabular-nums",priority:"high"}):e.jsx("span",{className:"opacity-30",children:"—"})}),e.jsx(U,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"Total Rx"})]}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("div",{className:"type-data-xl text-fg-primary",children:i?e.jsx(V,{value:x.uniqueReceived,className:"font-mono tabular-nums",priority:"high"}):e.jsx("span",{className:"opacity-30",children:"—"})}),e.jsx(U,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"Unique"})]})]}),e.jsxs("div",{className:"mt-2 flex-1 min-h-0 relative",children:[e.jsx("div",{className:`absolute inset-0 flex items-end gap-1 transition-opacity duration-300 ${i?"opacity-0 pointer-events-none":"opacity-100"}`,"aria-hidden":i,children:[45,72,33,58,80,42,65,28,55,75,38,62].map((g,v)=>e.jsx("div",{className:"flex-1 bg-subtle-fill rounded-sm animate-pulse",style:{height:`${g}%`}},v))}),e.jsx("div",{className:`h-full transition-opacity duration-300 ${i?"opacity-100":"opacity-0"}`,children:e.jsx(Xs,{buckets:(s==null?void 0:s.receivedBytesBuckets)??[],activeTypes:(s==null?void 0:s.receivedActiveTypes)??[],totalByType:(s==null?void 0:s.receivedTotalByType)??{}})})]})]})}),e.jsxs(le,{template:"compact",children:[e.jsx(ce,{span:6,lg:4,children:e.jsx(Zs,{value:x.forwarded,receivedCount:x.received,buckets:(s==null?void 0:s.forwardedBytesBuckets)??[],activeTypes:(s==null?void 0:s.forwardedActiveTypes)??[],ratePerHour:(s==null?void 0:s.forwardedRatePerHour)??0,timeRangeLabel:u.label,icon:e.jsx(vs,{className:"w-4 h-4"})})}),e.jsx(ce,{span:6,lg:4,children:e.jsx(Qs,{value:x.dropped,receivedCount:x.received,buckets:(s==null?void 0:s.droppedBytesBuckets)??[],activeTypes:(s==null?void 0:s.droppedActiveTypes)??[],ratePerHour:(s==null?void 0:s.droppedRatePerHour)??0,timeRangeLabel:u.label,icon:e.jsx(js,{className:"w-4 h-4"})})}),e.jsx(ce,{span:12,lg:4,children:e.jsx(on,{stats:t,localHash:t==null?void 0:t.local_hash,receivedBuckets:s==null?void 0:s.received,droppedBuckets:s==null?void 0:s.dropped,forwardedBuckets:s==null?void 0:s.forwarded,bucketDurationSeconds:s==null?void 0:s.bucket_duration_seconds,timeRangeLabel:u.label})})]}),e.jsx(Hn,{}),e.jsx(ln,{}),t&&e.jsx(le,{template:"auto",children:e.jsx(us,{nodeName:j,repeaterVersion:t.version,coreVersion:t.core_version,localHash:t.local_hash,publicKey:t.public_key})})]})]})}export{_a as default}; diff --git a/frontend/dist/assets/DataBox-Da-5DbUW.js b/frontend/dist/assets/DataBox-BVnEv6Au.js similarity index 91% rename from frontend/dist/assets/DataBox-Da-5DbUW.js rename to frontend/dist/assets/DataBox-BVnEv6Au.js index ca3f1af4..99ab0046 100644 --- a/frontend/dist/assets/DataBox-Da-5DbUW.js +++ b/frontend/dist/assets/DataBox-BVnEv6Au.js @@ -1 +1 @@ -import{r as i,F as E,j as e,c as s,D as S,E as T}from"./index-CeMilrX4.js";const k={standard:"w-3 h-3",compact:"w-2.5 h-2.5",responsive:"w-2.5 h-2.5 sm:w-3 sm:h-3"};function $({children:a,copyValue:g,copy:n=!1,size:r="standard",className:u,title:f,color:x,truncate:l}){const[d,m]=i.useState(!1),[w,y]=i.useState(!1),p=i.useRef(null),o=g??(typeof a=="string"?a:""),C=k[r],h=(()=>{if(!l||typeof a!="string")return a;const t=a,[c,j]=l===!0?[6,4]:l;return t.length<=c+j+3?t:`${t.slice(0,c)}…${t.slice(-j)}`})(),N=i.useCallback(async t=>{if(!n)return;t.preventDefault(),t.stopPropagation(),p.current&&clearTimeout(p.current);const c=await E(o);m(!0),p.current=setTimeout(()=>m(!1),2e3),c||console.warn("Copy may have failed for:",o.slice(0,16)+"...")},[n,o]),v=r==="compact"?"data-box-compact":r==="responsive"?"data-box-responsive":"",b=n?f||`Click to copy: ${o}`:f;return n?e.jsxs("button",{type:"button",onClick:N,onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),className:s("data-box interactive",v,"cursor-pointer select-none gap-1","hover-bg",x,u),title:b,"aria-label":`Copy ${o}`,children:[e.jsx("span",{className:s("transition-colors duration-200",d?"text-sys-green":""),children:h}),e.jsx("span",{className:s("flex items-center justify-center",r==="compact"?"w-3 h-3":"w-3.5 h-3.5"),children:d?e.jsx(S,{className:s("text-sys-green",C)}):e.jsx(T,{className:s("transition-opacity duration-200",w?"opacity-70":"opacity-40",C)})})]}):e.jsx("span",{className:s("data-box",v,x,u),title:b,children:h})}export{$ as D}; +import{r as i,F as E,j as e,c as s,D as S,E as T}from"./index-BOwCLZTK.js";const k={standard:"w-3 h-3",compact:"w-2.5 h-2.5",responsive:"w-2.5 h-2.5 sm:w-3 sm:h-3"};function $({children:a,copyValue:g,copy:n=!1,size:r="standard",className:u,title:f,color:x,truncate:l}){const[d,m]=i.useState(!1),[w,y]=i.useState(!1),p=i.useRef(null),o=g??(typeof a=="string"?a:""),C=k[r],h=(()=>{if(!l||typeof a!="string")return a;const t=a,[c,j]=l===!0?[6,4]:l;return t.length<=c+j+3?t:`${t.slice(0,c)}…${t.slice(-j)}`})(),N=i.useCallback(async t=>{if(!n)return;t.preventDefault(),t.stopPropagation(),p.current&&clearTimeout(p.current);const c=await E(o);m(!0),p.current=setTimeout(()=>m(!1),2e3),c||console.warn("Copy may have failed for:",o.slice(0,16)+"...")},[n,o]),v=r==="compact"?"data-box-compact":r==="responsive"?"data-box-responsive":"",b=n?f||`Click to copy: ${o}`:f;return n?e.jsxs("button",{type:"button",onClick:N,onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),className:s("data-box interactive",v,"cursor-pointer select-none gap-1","hover-bg",x,u),title:b,"aria-label":`Copy ${o}`,children:[e.jsx("span",{className:s("transition-colors duration-200",d?"text-sys-green":""),children:h}),e.jsx("span",{className:s("flex items-center justify-center",r==="compact"?"w-3 h-3":"w-3.5 h-3.5"),children:d?e.jsx(S,{className:s("text-sys-green",C)}):e.jsx(T,{className:s("transition-opacity duration-200",w?"opacity-70":"opacity-40",C)})})]}):e.jsx("span",{className:s("data-box",v,x,u),title:b,children:h})}export{$ as D}; diff --git a/frontend/dist/assets/DataValue-BDllMDjE.js b/frontend/dist/assets/DataValue-x_TMPgMk.js similarity index 92% rename from frontend/dist/assets/DataValue-BDllMDjE.js rename to frontend/dist/assets/DataValue-x_TMPgMk.js index c2b60a48..ef8652be 100644 --- a/frontend/dist/assets/DataValue-BDllMDjE.js +++ b/frontend/dist/assets/DataValue-x_TMPgMk.js @@ -1,4 +1,4 @@ -import{d as A,r as a,ct as g,j as o,cu as y}from"./index-CeMilrX4.js";import{A as x}from"./index-BK59_Mkt.js";/** +import{d as A,r as a,cu as g,j as o,cv as y}from"./index-BOwCLZTK.js";import{A as x}from"./index-2RIoVPos.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/Grid-BuDgMX1I.js b/frontend/dist/assets/Grid-eFMUBxsw.js similarity index 95% rename from frontend/dist/assets/Grid-BuDgMX1I.js rename to frontend/dist/assets/Grid-eFMUBxsw.js index 7e205b05..db69bcbe 100644 --- a/frontend/dist/assets/Grid-BuDgMX1I.js +++ b/frontend/dist/assets/Grid-eFMUBxsw.js @@ -1 +1 @@ -import{r as b,j as c,c as d}from"./index-CeMilrX4.js";const g={hero:{mobile:12},"hero-tall":{mobile:12},"hero-auto":{mobile:12},panel:{mobile:12,md:6},feature:{mobile:12,md:6,lg:4},standard:{mobile:12,sm:6,lg:4,xl:3},compact:{mobile:6,lg:3},widget:{mobile:6,sm:4,md:3,lg:2},auto:{mobile:12}},p={hero:"bento-row-hero","hero-tall":"bento-row-hero-tall","hero-auto":"bento-row-hero-auto",panel:"bento-row-panel",feature:"bento-row-feature",standard:"bento-row-standard",compact:"bento-row-compact",widget:"bento-row-widget",auto:"bento-row-auto"};function w({template:o,children:r,className:e,gap:n}){const t=g[o],m=p[o],a=n==="none"?"gap-0":n==="sm"?"bento-gap-sm":n==="lg"?"bento-gap-lg":"bento-gap",i=b.Children.map(r,l=>!b.isValidElement(l)||l.type===u?l:c.jsx(u,{span:t.mobile,sm:t.sm,md:t.md,lg:t.lg,xl:t.xl,children:l}));return c.jsx("div",{className:d("bento-row",m,a,e),children:i})}function s(o,r=""){const e=r?`${r}:`:"";return o==="full"?`${e}col-span-full`:o==="auto"?`${e}col-auto`:o===1.5?`${e}bento-col-1-5`:`${e}bento-col-${o}`}function u({children:o,span:r,sm:e,md:n,lg:t,xl:m,ratio:a,className:i}){const l=d("bento-cell",s(r),e&&s(e,"sm"),n&&s(n,"md"),t&&s(t,"lg"),m&&s(m,"xl"),i);return c.jsx("div",{className:l,"data-ratio":a??void 0,style:a?{"--cell-ratio":a}:void 0,children:o})}export{u as C,w as R}; +import{r as b,j as c,c as d}from"./index-BOwCLZTK.js";const g={hero:{mobile:12},"hero-tall":{mobile:12},"hero-auto":{mobile:12},panel:{mobile:12,md:6},feature:{mobile:12,md:6,lg:4},standard:{mobile:12,sm:6,lg:4,xl:3},compact:{mobile:6,lg:3},widget:{mobile:6,sm:4,md:3,lg:2},auto:{mobile:12}},p={hero:"bento-row-hero","hero-tall":"bento-row-hero-tall","hero-auto":"bento-row-hero-auto",panel:"bento-row-panel",feature:"bento-row-feature",standard:"bento-row-standard",compact:"bento-row-compact",widget:"bento-row-widget",auto:"bento-row-auto"};function w({template:o,children:r,className:e,gap:n}){const t=g[o],m=p[o],a=n==="none"?"gap-0":n==="sm"?"bento-gap-sm":n==="lg"?"bento-gap-lg":"bento-gap",i=b.Children.map(r,l=>!b.isValidElement(l)||l.type===u?l:c.jsx(u,{span:t.mobile,sm:t.sm,md:t.md,lg:t.lg,xl:t.xl,children:l}));return c.jsx("div",{className:d("bento-row",m,a,e),children:i})}function s(o,r=""){const e=r?`${r}:`:"";return o==="full"?`${e}col-span-full`:o==="auto"?`${e}col-auto`:o===1.5?`${e}bento-col-1-5`:`${e}bento-col-${o}`}function u({children:o,span:r,sm:e,md:n,lg:t,xl:m,ratio:a,className:i}){const l=d("bento-cell",s(r),e&&s(e,"sm"),n&&s(n,"md"),t&&s(t,"lg"),m&&s(m,"xl"),i);return c.jsx("div",{className:l,"data-ratio":a??void 0,style:a?{"--cell-ratio":a}:void 0,children:o})}export{u as C,w as R}; diff --git a/frontend/dist/assets/KeycapButton-BFRxj00q.js b/frontend/dist/assets/KeycapButton-uJlkDPOC.js similarity index 98% rename from frontend/dist/assets/KeycapButton-BFRxj00q.js rename to frontend/dist/assets/KeycapButton-uJlkDPOC.js index 914f69c5..8f277e32 100644 --- a/frontend/dist/assets/KeycapButton-BFRxj00q.js +++ b/frontend/dist/assets/KeycapButton-uJlkDPOC.js @@ -1 +1 @@ -import{r as l,j as t,Z as O}from"./index-CeMilrX4.js";import{b as F,c as x}from"./keycap-sfx-ByZp-njj.js";const R={a:"24,3 76,3 83,7 76,11 24,11 17,7",b:"88,22 93,27 93,71 88,76 83,71 83,27",c:"88,106 93,111 93,155 88,160 83,155 83,111",d:"24,171 76,171 83,175 76,179 24,179 17,175",e:"12,106 17,111 17,155 12,160 7,155 7,111",f:"12,22 17,27 17,71 12,76 7,71 7,27",g:"24,86 76,86 83,91 76,96 24,96 17,91"},w=Object.keys(R),N={0:"abcdef",1:"bc",2:"abdeg",3:"abcdg",4:"bcfg",5:"acdfg",6:"acdefg",7:"abc",8:"abcdefg",9:"abcdfg",A:"abcefg",B:"cdefg",C:"adef",D:"bcdeg",E:"adefg",F:"aefg",G:"acdef",H:"bcefg",I:"ef",J:"bcde",L:"def",M:"abcefg",N:"ceg",O:"abcdef",P:"abefg",Q:"abcfg",R:"eg",S:"acdfg",T:"defg",U:"bcdef",V:"cde",Y:"bcdfg",Z:"abdeg",a:"abcefg",b:"cdefg",c:"deg",d:"bcdeg",e:"adefg",f:"aefg",g:"abcdfg",h:"cefg",i:"c",j:"bcde",l:"def",m:"abcef",n:"ceg",o:"cdeg",p:"abefg",r:"eg",s:"acdfg",t:"defg",u:"cde",v:"cde",y:"bcdfg"," ":"",_:"d","-":"g","=":"dg","°":"abfg",'"':"bf","'":"f","(":"adef",")":"abcd","[":"adef","]":"abcd","!":"bc",".":"d"},C=6,D=56,L=2;function B(){return w.filter(()=>Math.random()>.45).join("")}function $(r,i){const n=Array.from(r).map(a=>N[a.toUpperCase()]??N[a]??""),d=Math.max(0,(i??0)-r.length);for(let a=0;a{if(a)return;const e=$(r,d),o=e.length,g=C+(o-1)*L;let y=0,b,E=!1;const k=()=>{if(!E){if(y++,y>=g){f(null);return}f(e.map((j,_)=>{const v=C+_*L;return y>=v?j:B()})),b=setTimeout(k,D)}};return k(),()=>{E=!0,clearTimeout(b)}},[r,d,a]);const c=(e,o)=>t.jsx("svg",{viewBox:"0 0 100 182",width:h,height:n,className:"seven-seg__char","aria-hidden":"true",children:w.map(g=>t.jsx("polygon",{points:R[g],fill:i,stroke:i,strokeWidth:4,strokeLinejoin:"round",opacity:e.includes(g)?1:M},g))},o),s=$(r,d),u=T??s;return t.jsxs("span",{className:`seven-seg${S?` ${S}`:""}`,children:[u.map((e,o)=>c(e,`${o}-${e}`)),t.jsx("span",{className:"sr-only",children:r})]})}const G={grey:"/assets/keycap.svg",red:"/assets/keycap-red.svg"},I=O[900],P="#FFDEB0";function Z({icon:r,variant:i="grey",onClick:n,onPress:d,sentDuration:a=2e3,title:S,disabled:h=!1,className:m,iconColor:M=I,iconActiveColor:T=P,indicators:f}){const c=!!d,[s,u]=l.useState("idle"),[e,o]=l.useState(!1),g=l.useRef(),y=c?s==="held":e,b=c&&(s==="sending"||s==="sent"),E=c?s==="held"||s==="sending":e;l.useEffect(()=>()=>clearTimeout(g.current),[]);const k=l.useCallback(()=>{h||b||(F(),c?u("held"):o(!0))},[h,b,c]),j=l.useCallback(async()=>{if(c){if(s!=="held")return;x(),u("sending");const p=await d();u(p?"sent":"idle"),p&&(g.current=setTimeout(()=>u("idle"),a))}else{if(!e)return;o(!1),x(),n==null||n()}},[c,s,d,a,e,n]),_=l.useCallback(()=>{c?s==="held"&&(x(),u("idle")):(e&&x(),o(!1))},[c,s,e]),v=t.jsx("button",{onMouseDown:k,onMouseUp:j,onMouseLeave:_,onTouchStart:k,onTouchEnd:j,onTouchCancel:_,disabled:h||b,className:`keycap-btn${i==="red"?" keycap-btn--red-cap":""}${E?" keycap-btn--pressed":""}${m&&!f?` ${m}`:""}`,title:S,children:t.jsxs("div",{className:"keycap-wrap",children:[t.jsx("img",{src:G[i],alt:"",className:"keycap-btn__img",draggable:!1}),t.jsx("span",{className:"keycap-icon-overlay",style:{color:y||s==="sending"?T:M},children:r})]})});return f!=null&&f.length?t.jsxs("div",{className:`keycap-group${m?` ${m}`:""}`,children:[v,t.jsx("div",{className:"indicator-key-pair",children:f.map(p=>{const A=p.trackPress?s:p.active?"active":"idle";return t.jsxs("div",{className:`indicator-key${A!=="idle"?` indicator-key--${A}`:""}`,children:[t.jsx("span",{className:"indicator-key__label",children:p.label}),t.jsx("span",{className:"indicator-key__led"})]},p.label)})})]}):v}export{Z as K,Y as S}; +import{r as l,j as t,Z as O}from"./index-BOwCLZTK.js";import{b as F,c as x}from"./keycap-sfx-ByZp-njj.js";const R={a:"24,3 76,3 83,7 76,11 24,11 17,7",b:"88,22 93,27 93,71 88,76 83,71 83,27",c:"88,106 93,111 93,155 88,160 83,155 83,111",d:"24,171 76,171 83,175 76,179 24,179 17,175",e:"12,106 17,111 17,155 12,160 7,155 7,111",f:"12,22 17,27 17,71 12,76 7,71 7,27",g:"24,86 76,86 83,91 76,96 24,96 17,91"},w=Object.keys(R),N={0:"abcdef",1:"bc",2:"abdeg",3:"abcdg",4:"bcfg",5:"acdfg",6:"acdefg",7:"abc",8:"abcdefg",9:"abcdfg",A:"abcefg",B:"cdefg",C:"adef",D:"bcdeg",E:"adefg",F:"aefg",G:"acdef",H:"bcefg",I:"ef",J:"bcde",L:"def",M:"abcefg",N:"ceg",O:"abcdef",P:"abefg",Q:"abcfg",R:"eg",S:"acdfg",T:"defg",U:"bcdef",V:"cde",Y:"bcdfg",Z:"abdeg",a:"abcefg",b:"cdefg",c:"deg",d:"bcdeg",e:"adefg",f:"aefg",g:"abcdfg",h:"cefg",i:"c",j:"bcde",l:"def",m:"abcef",n:"ceg",o:"cdeg",p:"abefg",r:"eg",s:"acdfg",t:"defg",u:"cde",v:"cde",y:"bcdfg"," ":"",_:"d","-":"g","=":"dg","°":"abfg",'"':"bf","'":"f","(":"adef",")":"abcd","[":"adef","]":"abcd","!":"bc",".":"d"},C=6,D=56,L=2;function B(){return w.filter(()=>Math.random()>.45).join("")}function $(r,i){const n=Array.from(r).map(a=>N[a.toUpperCase()]??N[a]??""),d=Math.max(0,(i??0)-r.length);for(let a=0;a{if(a)return;const e=$(r,d),o=e.length,g=C+(o-1)*L;let y=0,b,E=!1;const k=()=>{if(!E){if(y++,y>=g){f(null);return}f(e.map((j,_)=>{const v=C+_*L;return y>=v?j:B()})),b=setTimeout(k,D)}};return k(),()=>{E=!0,clearTimeout(b)}},[r,d,a]);const c=(e,o)=>t.jsx("svg",{viewBox:"0 0 100 182",width:h,height:n,className:"seven-seg__char","aria-hidden":"true",children:w.map(g=>t.jsx("polygon",{points:R[g],fill:i,stroke:i,strokeWidth:4,strokeLinejoin:"round",opacity:e.includes(g)?1:M},g))},o),s=$(r,d),u=T??s;return t.jsxs("span",{className:`seven-seg${S?` ${S}`:""}`,children:[u.map((e,o)=>c(e,`${o}-${e}`)),t.jsx("span",{className:"sr-only",children:r})]})}const G={grey:"/assets/keycap.svg",red:"/assets/keycap-red.svg"},I=O[900],P="#FFDEB0";function Z({icon:r,variant:i="grey",onClick:n,onPress:d,sentDuration:a=2e3,title:S,disabled:h=!1,className:m,iconColor:M=I,iconActiveColor:T=P,indicators:f}){const c=!!d,[s,u]=l.useState("idle"),[e,o]=l.useState(!1),g=l.useRef(),y=c?s==="held":e,b=c&&(s==="sending"||s==="sent"),E=c?s==="held"||s==="sending":e;l.useEffect(()=>()=>clearTimeout(g.current),[]);const k=l.useCallback(()=>{h||b||(F(),c?u("held"):o(!0))},[h,b,c]),j=l.useCallback(async()=>{if(c){if(s!=="held")return;x(),u("sending");const p=await d();u(p?"sent":"idle"),p&&(g.current=setTimeout(()=>u("idle"),a))}else{if(!e)return;o(!1),x(),n==null||n()}},[c,s,d,a,e,n]),_=l.useCallback(()=>{c?s==="held"&&(x(),u("idle")):(e&&x(),o(!1))},[c,s,e]),v=t.jsx("button",{onMouseDown:k,onMouseUp:j,onMouseLeave:_,onTouchStart:k,onTouchEnd:j,onTouchCancel:_,disabled:h||b,className:`keycap-btn${i==="red"?" keycap-btn--red-cap":""}${E?" keycap-btn--pressed":""}${m&&!f?` ${m}`:""}`,title:S,children:t.jsxs("div",{className:"keycap-wrap",children:[t.jsx("img",{src:G[i],alt:"",className:"keycap-btn__img",draggable:!1}),t.jsx("span",{className:"keycap-icon-overlay",style:{color:y||s==="sending"?T:M},children:r})]})});return f!=null&&f.length?t.jsxs("div",{className:`keycap-group${m?` ${m}`:""}`,children:[v,t.jsx("div",{className:"indicator-key-pair",children:f.map(p=>{const A=p.trackPress?s:p.active?"active":"idle";return t.jsxs("div",{className:`indicator-key${A!=="idle"?` indicator-key--${A}`:""}`,children:[t.jsx("span",{className:"indicator-key__label",children:p.label}),t.jsx("span",{className:"indicator-key__led"})]},p.label)})})]}):v}export{Z as K,Y as S}; diff --git a/frontend/dist/assets/LightSparkline-D652BQd5.js b/frontend/dist/assets/LightSparkline-C68RXWon.js similarity index 96% rename from frontend/dist/assets/LightSparkline-D652BQd5.js rename to frontend/dist/assets/LightSparkline-C68RXWon.js index 15914d42..b7ad9806 100644 --- a/frontend/dist/assets/LightSparkline-D652BQd5.js +++ b/frontend/dist/assets/LightSparkline-C68RXWon.js @@ -1 +1 @@ -import{r as y,j as t}from"./index-CeMilrX4.js";const j="var(--sys-cyan)",k="var(--sys-blue)",v="var(--sys-indigo)",g="var(--sparkline-critical)",I="var(--fg-muted)";function E(f,o,s,e=2){if(f.length<2)return"";const r=f.map(n=>n.count),x=Math.max(...r,1),u=Math.min(...r),c=x-u||1,m=o-e*2,l=s-e*2,i=r.map((n,p)=>({x:e+p/(r.length-1)*m,y:e+l-(n-u)/c*l}));let a=`M ${i[0].x.toFixed(1)} ${i[0].y.toFixed(1)}`;for(let n=1;nE(o,s,e),[o,s,e]),a=!r&&o.length>=2,n=r??(a?`url(#${l})`:I);return u&&o.length<2?t.jsx("div",{className:`flex items-center justify-center ${c}`,style:{width:s,height:e},children:t.jsx("div",{className:"rounded animate-pulse bg-subtle-fill-hover",style:{width:s-8,height:e-6}})}):o.length<2?t.jsx("svg",{width:s,height:e,viewBox:`0 0 ${s} ${e}`,className:c,"aria-hidden":"true",children:t.jsx("line",{x1:4,y1:e/2,x2:s-4,y2:e/2,stroke:g,strokeWidth:1.5,strokeDasharray:"3,2"})}):t.jsxs("svg",{width:s,height:e,viewBox:`0 0 ${s} ${e}`,preserveAspectRatio:"none",className:c,"aria-hidden":"true",style:{maxWidth:"100%"},children:[a&&t.jsx("defs",{children:t.jsxs("linearGradient",{id:l,gradientUnits:"userSpaceOnUse",x1:0,y1:2,x2:0,y2:e-2,children:[t.jsx("stop",{offset:"0%",stopColor:x?v:j}),t.jsx("stop",{offset:"50%",stopColor:k}),t.jsx("stop",{offset:"100%",stopColor:x?j:v})]})}),t.jsx("path",{d:i,fill:"none",stroke:n,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})]})});export{O as L}; +import{r as y,j as t}from"./index-BOwCLZTK.js";const j="var(--sys-cyan)",k="var(--sys-blue)",v="var(--sys-indigo)",g="var(--sparkline-critical)",I="var(--fg-muted)";function E(f,o,s,e=2){if(f.length<2)return"";const r=f.map(n=>n.count),x=Math.max(...r,1),u=Math.min(...r),c=x-u||1,m=o-e*2,l=s-e*2,i=r.map((n,p)=>({x:e+p/(r.length-1)*m,y:e+l-(n-u)/c*l}));let a=`M ${i[0].x.toFixed(1)} ${i[0].y.toFixed(1)}`;for(let n=1;nE(o,s,e),[o,s,e]),a=!r&&o.length>=2,n=r??(a?`url(#${l})`:I);return u&&o.length<2?t.jsx("div",{className:`flex items-center justify-center ${c}`,style:{width:s,height:e},children:t.jsx("div",{className:"rounded animate-pulse bg-subtle-fill-hover",style:{width:s-8,height:e-6}})}):o.length<2?t.jsx("svg",{width:s,height:e,viewBox:`0 0 ${s} ${e}`,className:c,"aria-hidden":"true",children:t.jsx("line",{x1:4,y1:e/2,x2:s-4,y2:e/2,stroke:g,strokeWidth:1.5,strokeDasharray:"3,2"})}):t.jsxs("svg",{width:s,height:e,viewBox:`0 0 ${s} ${e}`,preserveAspectRatio:"none",className:c,"aria-hidden":"true",style:{maxWidth:"100%"},children:[a&&t.jsx("defs",{children:t.jsxs("linearGradient",{id:l,gradientUnits:"userSpaceOnUse",x1:0,y1:2,x2:0,y2:e-2,children:[t.jsx("stop",{offset:"0%",stopColor:x?v:j}),t.jsx("stop",{offset:"50%",stopColor:k}),t.jsx("stop",{offset:"100%",stopColor:x?j:v})]})}),t.jsx("path",{d:i,fill:"none",stroke:n,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})]})});export{O as L}; diff --git a/frontend/dist/assets/Login-Dh54gKvu.js b/frontend/dist/assets/Login-CgKEN4-7.js similarity index 99% rename from frontend/dist/assets/Login-Dh54gKvu.js rename to frontend/dist/assets/Login-CgKEN4-7.js index 16ee9a0a..2941d86e 100644 --- a/frontend/dist/assets/Login-Dh54gKvu.js +++ b/frontend/dist/assets/Login-CgKEN4-7.js @@ -1,3 +1,3 @@ -import{r as o,j as e,u as F,g as Y,i as $,s as Z,l as X,m as L,a as q,b as S,c as H,I as A,C as O,A as z,B as U,Z as V}from"./index-CeMilrX4.js";import{g as T,B as G,r as K,T as J}from"./ascii-burst-DN6etEs5.js";const w=["@@@@@@@ @@@ @@@ @@@@@@@@@@ @@@@@@@ ","@@@@@@@@ @@@ @@@ @@@@@@@@@@@ @@@@@@@@ ","@@! @@@ @@! !@@ @@! @@! @@! !@@ ","!@! @!@ !@! @!! !@! !@! !@! !@! ","@!@@!@! !@!@! @!! !!@ @!@ !@! ","!!@!!! @!!! !@! ! !@! !!! ","!!: !!: !!: !!: :!! ",":!: :!: :!: :!: :!: "," :: :: ::: :: ::: ::: "," : : : : :: :: : "],Q=J-1,ee=w.length,te=Math.max(...w.map(s=>s.length)),se=.994,ne=.08,re=.25,ae=8,oe=9.6,ie=20,W=.008,k=20,_=" . ˙·∙⁺˚°:;~*+✧✩×✴░✦✶✳oO▒#%&xX▓@MW8B█████",ce={" ":0,".":.08,":":.15,"!":.5,"@":.85,"#":.6,$:.7,"%":.65,"&":.6,"*":.3,"+":.25,"-":.1,"=":.2,_:.05,"~":.2,"^":.15,"|":.4,"/":.3,"\\":.3,"(":.35,")":.35,"[":.4,"]":.4,"{":.45,"}":.45,"<":.3,">":.3,"?":.4,";":.2,"'":.1,'"':.15,",":.08,"`":.05};function le(s){let t="",n=0,a=!1,x="",p=!1,l=!1,g=!1;for(;n",a=!1),x="",p=!1,l=!1,g=!1;else if(u==="1")p=!0,g=!0;else if(u==="2")l=!0,g=!0;else if(u.startsWith("38;2;")){const C=u.split(";");x=`rgb(${C[2]},${C[3]},${C[4]})`,g=!0}}else{if(g){a&&(t+="");const u=[];x&&u.push(`color:${x}`),p&&u.push("font-weight:700"),l&&u.push("opacity:0.6"),u.length>0?(t+=``,a=!0):a=!1,g=!1}const h=s[n];h==="<"?t+="<":h===">"?t+=">":h==="&"?t+="&":t+=h,n++}return a&&(t+=""),t}function P(s){let t="";for(let n=0;n0&&(t+=` +import{r as o,j as e,u as F,g as Y,i as $,s as Z,l as X,m as L,a as q,b as S,c as H,I as A,C as O,A as z,B as U,Z as V}from"./index-BOwCLZTK.js";import{g as T,B as G,r as K,T as J}from"./ascii-burst-DN6etEs5.js";const w=["@@@@@@@ @@@ @@@ @@@@@@@@@@ @@@@@@@ ","@@@@@@@@ @@@ @@@ @@@@@@@@@@@ @@@@@@@@ ","@@! @@@ @@! !@@ @@! @@! @@! !@@ ","!@! @!@ !@! @!! !@! !@! !@! !@! ","@!@@!@! !@!@! @!! !!@ @!@ !@! ","!!@!!! @!!! !@! ! !@! !!! ","!!: !!: !!: !!: :!! ",":!: :!: :!: :!: :!: "," :: :: ::: :: ::: ::: "," : : : : :: :: : "],Q=J-1,ee=w.length,te=Math.max(...w.map(s=>s.length)),se=.994,ne=.08,re=.25,ae=8,oe=9.6,ie=20,W=.008,k=20,_=" . ˙·∙⁺˚°:;~*+✧✩×✴░✦✶✳oO▒#%&xX▓@MW8B█████",ce={" ":0,".":.08,":":.15,"!":.5,"@":.85,"#":.6,$:.7,"%":.65,"&":.6,"*":.3,"+":.25,"-":.1,"=":.2,_:.05,"~":.2,"^":.15,"|":.4,"/":.3,"\\":.3,"(":.35,")":.35,"[":.4,"]":.4,"{":.45,"}":.45,"<":.3,">":.3,"?":.4,";":.2,"'":.1,'"':.15,",":.08,"`":.05};function le(s){let t="",n=0,a=!1,x="",p=!1,l=!1,g=!1;for(;n",a=!1),x="",p=!1,l=!1,g=!1;else if(u==="1")p=!0,g=!0;else if(u==="2")l=!0,g=!0;else if(u.startsWith("38;2;")){const C=u.split(";");x=`rgb(${C[2]},${C[3]},${C[4]})`,g=!0}}else{if(g){a&&(t+="");const u=[];x&&u.push(`color:${x}`),p&&u.push("font-weight:700"),l&&u.push("opacity:0.6"),u.length>0?(t+=``,a=!0):a=!1,g=!1}const h=s[n];h==="<"?t+="<":h===">"?t+=">":h==="&"?t+="&":t+=h,n++}return a&&(t+=""),t}function P(s){let t="";for(let n=0;n0&&(t+=` `),t+=le(s[n]);return t}const ue="rgb(91,91,214)",y=[[91,91,214],[72,70,200],[110,110,230],[150,150,245],[190,210,255],[0,240,255],[255,50,180],[80,255,180]];function R(s,t,n){return`rgb(${Math.round(s[0]+(t[0]-s[0])*n)},${Math.round(s[1]+(t[1]-s[1])*n)},${Math.round(s[2]+(t[2]-s[2])*n)})`}function de(s){const t=Math.max(0,Math.min(.999,s));return _[Math.floor(t*_.length)]}function me(s){return ce[s]??.5}function he(s,t){const n=Math.abs(s);if(n<.3)return R(y[0],y[2],n/.3);if(n<.6){const a=(n-.3)/.3;return R(y[3],y[4],a)}else{const a=Math.sin(t*17.3)*.5+.5;return a<.4?R(y[4],y[5],(n-.6)/.4):a<.6?`rgb(${y[6].join(",")})`:a<.7?`rgb(${y[7].join(",")})`:"rgb(255,252,255)"}}function I(s){let t="";for(let n=0;n0&&(t+=` `);const a=w[n]||"";for(let x=0;x0?Math.exp(-m*m/2):Math.exp(-m*m/12),j=c*re-C.radius*.4,M=Math.sin(j*Math.PI),d=b*C.strength;l+=b*M*C.strength,d>h&&(h=d,g=j+n*.1+x*.05)}if(l=Math.max(-1,Math.min(1,l)),Math.abs(l)${p}`;else{const r=me(p)+l*.5,i=Math.max(.02,Math.min(.98,r)),c=de(i),f=he(l,g);t+=`${c}`}}}return t}function Ce(){const s=o.useRef(null),t=o.useRef([]),n=o.useRef(0),[a,x]=o.useState(!1);o.useEffect(()=>{const r=s.current;if(!r)return;let i=0;r.innerHTML=P(T(w,0));const c=setInterval(()=>{if(i++,i>Q){clearInterval(c),x(!0);return}r.innerHTML=P(T(w,i))},G);return()=>{clearInterval(c),K()}},[]),o.useEffect(()=>{if(!a)return;const r=s.current;if(!r)return;let i=!0;const c=()=>{if(!i)return;const f=t.current;for(const m of f)m.radius+=ne,m.strength*=se;t.current=f.filter(m=>m.strength>W),t.current.length>0?r.innerHTML=I(t.current):r.innerHTML=I([]),n.current=requestAnimationFrame(c)};return n.current=requestAnimationFrame(c),()=>{i=!1,cancelAnimationFrame(n.current)}},[a]);const p=o.useRef(null),l=o.useCallback((r,i,c=1)=>{const f=s.current;if(!f||!a)return;const m=f.getBoundingClientRect(),b=r-m.left,j=i-m.top,M=b/oe,d=j/ie;t.current.length>=ae&&t.current.shift(),t.current.push({cx:M,cy:d,radius:0,strength:c}),p.current={x:r,y:i}},[a]),g=o.useCallback(r=>{const i=p.current;if(i){const c=r.clientX-i.x,f=r.clientY-i.y;if(Math.sqrt(c*c+f*f){l(r.clientX,r.clientY,1)},[l]),u=o.useCallback(r=>{p.current=null,l(r.clientX,r.clientY,.6)},[l]),C=o.useCallback(r=>{if(r.touches.length>0){const i=r.touches[0],c=p.current;if(c){const f=i.clientX-c.x,m=i.clientY-c.y;if(Math.sqrt(f*f+m*m)e.jsx("span",{className:"text-white/20 text-xs","aria-hidden":"true",children:"•"}),be=o.memo(function(){return e.jsx("div",{className:"fixed inset-0 -z-10",style:{backgroundColor:V[950]},"aria-hidden":"true"})}),ve=o.memo(function(){return e.jsxs(L.footer,{variants:v.footer,initial:"hidden",animate:"visible",className:"fixed bottom-0 inset-x-0 px-4 py-6",children:[e.jsx("p",{className:"text-center type-badge text-white/40 mb-3",children:"Powered By"}),e.jsx("div",{className:"mx-auto max-w-xs",children:e.jsxs("div",{className:"flex items-center justify-center gap-4",children:[e.jsx(E,{href:"https://github.com/rightup/pyMC_Repeater",children:e.jsx("img",{src:Le,alt:"pyMC",className:"h-14"})}),e.jsx(D,{}),e.jsx(E,{href:"https://meshcore.co.uk",children:e.jsx(xe,{height:12,className:"text-white"})}),e.jsx(D,{}),e.jsxs(E,{href:"https://wcmesh.com",children:[e.jsx("div",{className:"size-14 overflow-hidden radius-badge border border-white/10 -translate-y-1",children:e.jsx("img",{src:ge,alt:"",className:"size-full object-cover"})}),e.jsx("span",{className:"font-mono text-sm font-semibold tracking-tight text-white",children:"WCM"})]})]})})]})}),je={session_expired:"Your session has expired. Please sign in again.",no_token:"Authentication required. Please sign in.",token_expired_away:"Your session expired while you were away."};function Ne(){const s=F(),[t,n]=o.useState("admin"),[a,x]=o.useState(""),[p,l]=o.useState(Y),[g,h]=o.useState(!1),[u,C]=o.useState(null),[r]=o.useState(()=>{try{const d=sessionStorage.getItem("auth_redirect_reason");return sessionStorage.removeItem("auth_redirect_reason"),d?je[d]??null:null}catch{return null}}),i=t.length>0&&a.length>0&&!g;o.useEffect(()=>{$()&&s("/",{replace:!0})},[s]);const c=o.useCallback(()=>C(null),[]),f=o.useCallback(d=>{n(d.target.value),u&&c()},[u,c]),m=o.useCallback(d=>{x(d.target.value),u&&c()},[u,c]),b=o.useCallback(d=>{l(d),Z(d)},[]),j=o.useCallback(async d=>{if(d.preventDefault(),!i)return;h(!0),C(null);const N=await X(t,a,p);h(!1),N.success?window.location.href="/":C(N.error??"Login failed")},[i,t,a,p]),M=o.useCallback(d=>{d.key==="Enter"&&i&&d.target.tagName==="INPUT"&&(d.preventDefault(),d.currentTarget.requestSubmit())},[i]);return e.jsxs(e.Fragment,{children:[e.jsx(be,{}),e.jsx("main",{className:"flex min-h-svh items-center justify-center px-4 py-6 sm:px-6 lg:px-8 -mt-6",children:e.jsxs(L.div,{variants:v.container,initial:"hidden",animate:"visible",className:"w-full max-w-sm space-y-10",children:[e.jsx(L.div,{variants:v.item,className:"flex justify-center",children:e.jsx(fe,{})}),r&&!u&&e.jsx(L.div,{variants:v.item,className:"rounded-md bg-sys-amber/10 px-3 py-2.5 text-center",children:e.jsx("p",{className:"text-sm text-sys-amber",children:r})}),e.jsxs(L.form,{variants:v.item,onSubmit:j,onKeyDown:M,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:B,children:"Username"}),e.jsx("div",{className:"mt-2",children:e.jsx(A,{id:"username",name:"username",type:"text",value:t,onChange:f,required:!0,autoComplete:"username",className:"font-mono text-sm font-semibold"})})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:B,children:"Password"}),e.jsx("div",{className:"mt-2",children:e.jsx(A,{id:"password",name:"password",type:"password",value:a,onChange:m,required:!0,autoComplete:"current-password",autoFocus:!0,className:"font-mono text-sm font-semibold"})})]}),e.jsx("div",{className:"-mt-2",children:e.jsx(O,{checked:p,onChange:b,label:e.jsx("span",{className:"type-badge text-fg-secondary",children:"Remember me"}),size:"sm"})}),e.jsx(z,{mode:"wait",children:u&&e.jsx(L.div,{variants:v.error,initial:"hidden",animate:"visible",exit:"exit",role:"alert",className:"rounded-md bg-sys-red/10 p-3 overflow-hidden",children:e.jsx("p",{className:"text-sm text-sys-red text-center",children:u})},"error")}),e.jsx(L.div,{whileTap:i?{scale:.98}:void 0,children:e.jsx(U,{type:"submit",disabled:!i,className:"w-full py-3 radius-pill font-mono text-sm font-semibold uppercase tracking-wide text-white bg-sys-indigo hover:bg-sys-blue shadow-sm transition-colors",children:g?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(ye,{className:"size-4"}),"Signing in…"]}):"Sign in"})})]}),e.jsxs(L.p,{variants:v.item,className:"text-center text-sm/6 text-fg-muted",children:["A ",e.jsx("span",{className:"text-sys-blue",children:"@RightUp"})," X"," ",e.jsx("span",{className:"text-sys-blue",children:"@Treehouse⚡"})," Collab"]})]})}),e.jsx(ve,{})]})}export{Ne as default}; diff --git a/frontend/dist/assets/Logs-CWXxwgV4.js b/frontend/dist/assets/Logs-vtktVQrc.js similarity index 86% rename from frontend/dist/assets/Logs-CWXxwgV4.js rename to frontend/dist/assets/Logs-vtktVQrc.js index 701df96e..30614eaf 100644 --- a/frontend/dist/assets/Logs-CWXxwgV4.js +++ b/frontend/dist/assets/Logs-vtktVQrc.js @@ -1 +1 @@ -import{dm as h,dn as f,J as j,dp as L,dq as v,r as n,dr as N,j as e,ds as m,N as y,B as w,c as r,dt as b,dc as C,m as S,du as E}from"./index-CeMilrX4.js";import{P,a as R,B as k,C as B}from"./PageLayout-Cw_MXmcE.js";import{C as I,a as T}from"./circle-stop-BvffqSZg.js";const D=n.memo(function({log:a}){return e.jsx(S.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:"easeOut"},className:"p-3 bg-subtle-fill/80 radius-inner depth-stroke-raised hover:bg-subtle-fill-strong transition-base",children:e.jsxs("div",{className:"flex items-baseline gap-3",children:[e.jsx("span",{className:r("type-data-sm w-14 shrink-0",E(a.level)),children:a.level}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"type-data-sm text-fg-primary break-words whitespace-pre-wrap",children:a.message}),e.jsx("p",{className:"type-data-xs text-fg-muted mt-1",children:new Date(a.timestamp).toLocaleString()})]})]})})});function M({showDebug:s,onToggle:a}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:r("type-data-sm",s?"text-sys-orange":"text-sys-cyan"),children:s?"DEBUG":"INFO"}),e.jsx(C,{enabled:s,onChange:a,size:"sm"})]})}function O(){const s=h(),a=f(),o=j(),i=L(),g=v(),[c,x]=n.useState(!1),u=n.useCallback(()=>{x(t=>!t)},[]),d=c?s:s.filter(t=>t.level!=="DEBUG"),l=n.useRef(i);return l.current=i,n.useEffect(()=>{if(!o)return;l.current();const t=setInterval(()=>l.current(),N.logs);return()=>clearInterval(t)},[o]),e.jsxs(P,{children:[e.jsx(R,{title:"System Logs",icon:e.jsx(m,{}),controls:e.jsx(M,{showDebug:c,onToggle:u})}),e.jsx(k,{ready:!0,children:e.jsxs(B,{neomorphic:!0,noPadding:!0,children:[e.jsx(y,{listHeader:!0,icon:e.jsx(m,{className:"icon-sm"}),title:"Log Entries",actions:e.jsx(w,{plain:!0,color:o?"danger":"primary",onClick:()=>g(!o),title:o?"Pause":"Resume",className:r(!o&&"animate-pulse-slow"),children:o?e.jsx(I,{"data-slot":"icon",className:"!w-5 !h-5"}):e.jsx(T,{"data-slot":"icon",className:"!w-5 !h-5"})})}),e.jsx("div",{className:"space-y-2 max-h-[calc(100dvh-226px)] sm:max-h-[calc(100dvh-234px)] lg:max-h-[calc(100vh-194px)] overflow-y-auto p-4",children:a&&s.length===0?e.jsx(b,{count:10}):d.length===0?e.jsx("div",{className:"text-center py-12 text-fg-muted",children:s.length===0?"No logs available":"No logs match selected filters"}):d.map((t,p)=>e.jsx(D,{log:t},`${t.timestamp}-${p}`))})]})})]})}export{O as default}; +import{dn as h,dp as f,J as j,dq as L,dr as v,r as n,ds as N,j as e,dt as m,N as y,B as w,c as r,du as b,dd as C,m as S,dv as E}from"./index-BOwCLZTK.js";import{P,a as R,B as k,C as B}from"./PageLayout-QKntxcnp.js";import{C as I,a as T}from"./circle-stop-Buqz2psb.js";const D=n.memo(function({log:a}){return e.jsx(S.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:"easeOut"},className:"p-3 bg-subtle-fill/80 radius-inner depth-stroke-raised hover:bg-subtle-fill-strong transition-base",children:e.jsxs("div",{className:"flex items-baseline gap-3",children:[e.jsx("span",{className:r("type-data-sm w-14 shrink-0",E(a.level)),children:a.level}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"type-data-sm text-fg-primary break-words whitespace-pre-wrap",children:a.message}),e.jsx("p",{className:"type-data-xs text-fg-muted mt-1",children:new Date(a.timestamp).toLocaleString()})]})]})})});function M({showDebug:s,onToggle:a}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:r("type-data-sm",s?"text-sys-orange":"text-sys-cyan"),children:s?"DEBUG":"INFO"}),e.jsx(C,{enabled:s,onChange:a,size:"sm"})]})}function O(){const s=h(),a=f(),o=j(),i=L(),g=v(),[c,x]=n.useState(!1),u=n.useCallback(()=>{x(t=>!t)},[]),d=c?s:s.filter(t=>t.level!=="DEBUG"),l=n.useRef(i);return l.current=i,n.useEffect(()=>{if(!o)return;l.current();const t=setInterval(()=>l.current(),N.logs);return()=>clearInterval(t)},[o]),e.jsxs(P,{children:[e.jsx(R,{title:"System Logs",icon:e.jsx(m,{}),controls:e.jsx(M,{showDebug:c,onToggle:u})}),e.jsx(k,{ready:!0,children:e.jsxs(B,{neomorphic:!0,noPadding:!0,children:[e.jsx(y,{listHeader:!0,icon:e.jsx(m,{className:"icon-sm"}),title:"Log Entries",actions:e.jsx(w,{plain:!0,color:o?"danger":"primary",onClick:()=>g(!o),title:o?"Pause":"Resume",className:r(!o&&"animate-pulse-slow"),children:o?e.jsx(I,{"data-slot":"icon",className:"!w-5 !h-5"}):e.jsx(T,{"data-slot":"icon",className:"!w-5 !h-5"})})}),e.jsx("div",{className:"space-y-2 max-h-[calc(100dvh-226px)] sm:max-h-[calc(100dvh-234px)] lg:max-h-[calc(100vh-194px)] overflow-y-auto p-4",children:a&&s.length===0?e.jsx(b,{count:10}):d.length===0?e.jsx("div",{className:"text-center py-12 text-fg-muted",children:s.length===0?"No logs available":"No logs match selected filters"}):d.map((t,p)=>e.jsx(D,{log:t},`${t.timestamp}-${p}`))})]})})]})}export{O as default}; diff --git a/frontend/dist/assets/MeshGraph-BTt0q-k9.js b/frontend/dist/assets/MeshGraph-OIPdLzAA.js similarity index 99% rename from frontend/dist/assets/MeshGraph-BTt0q-k9.js rename to frontend/dist/assets/MeshGraph-OIPdLzAA.js index 23bf3b39..bf23cce0 100644 --- a/frontend/dist/assets/MeshGraph-BTt0q-k9.js +++ b/frontend/dist/assets/MeshGraph-OIPdLzAA.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/webgl-device-QoBMYpnS-1csuE5Gs.js","assets/index-CeMilrX4.js","assets/max-0cG3bA4z.js","assets/consumer-registry-Hkh6Dv_i.js","assets/badge-colors-DnsnMXHA.js","assets/triangle-alert-DiFold9L.js","assets/database-D2sIhibw.js","assets/DataBox-Da-5DbUW.js","assets/meshcore-tx-constants-DgpFTAmf.js","assets/target-q6HPYno6.js","assets/layers-DVUHhJuY.js","assets/search-Bph9xP9G.js","assets/download-ByVPtD5I.js","assets/settings-2-97rHsI_C.js","assets/chevron-right-D3QL4sfa.js","assets/network-c_XxfhAX.js","assets/index-CLjIU9sF.css"])))=>i.map(i=>d[i]); -var aL=Object.defineProperty;var lL=(i,e,t)=>e in i?aL(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var b=(i,e,t)=>lL(i,typeof e!="symbol"?e+"":e,t);import{d as Vl,r as U,_ as p0,b2 as cn,b_ as pg,cS as cL,cT as uL,j as f,ak as dL,al as m0,bk as Gl,c as oh,cU as hL,m as ga,D as J_,L as mg,cV as RS,cW as jh,cX as PS,cY as fL,c7 as pL,A as Jc,cZ as mL,ao as gL,c_ as _L,c$ as yL,d0 as bL,d1 as vL,d2 as xL,d3 as wL,d4 as SL,K as EL,cj as CL,d5 as TL,d6 as Ge,Z as qt,d7 as g0,x as Di,a7 as be,d8 as kL,d9 as AL,R as gg,da as IL,am as Pc,db as LL,aD as RL,dc as PL,dd as NL,B as ey,E as DL,F as ML,de as OL}from"./index-CeMilrX4.js";import{m as _0,t as _g,a as BL,b as FL,e as Rn,G as Gp,s as zL,c as UL,u as $L,d as jL,M as NS,f as HL,E as VL,g as y0,h as ty}from"./max-0cG3bA4z.js";import{u as GL,r as WL,f as b0,g as YL,e as qL}from"./consumer-registry-Hkh6Dv_i.js";import{C as XL,N as KL,b as ZL}from"./badge-colors-DnsnMXHA.js";import{T as QL}from"./triangle-alert-DiFold9L.js";import{D as v0}from"./database-D2sIhibw.js";import{D as JL}from"./DataBox-Da-5DbUW.js";import{e as eR,f as x0,g as tR}from"./meshcore-tx-constants-DgpFTAmf.js";import{E as iR,T as nR}from"./target-q6HPYno6.js";import{L as w0}from"./layers-DVUHhJuY.js";import{S as S0}from"./search-Bph9xP9G.js";import{D as E0}from"./download-ByVPtD5I.js";import{S as C0}from"./settings-2-97rHsI_C.js";import{C as Wp}from"./chevron-right-D3QL4sfa.js";import{N as sR}from"./network-c_XxfhAX.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/webgl-device-QoBMYpnS-DoprwXHO.js","assets/index-BOwCLZTK.js","assets/max-vSbldOSt.js","assets/consumer-registry-CTjikLma.js","assets/badge-colors-DCbxcv7o.js","assets/triangle-alert-SO3tIa8w.js","assets/database-C6oOGn9y.js","assets/DataBox-BVnEv6Au.js","assets/meshcore-tx-constants-DgpFTAmf.js","assets/target-vmW1ltA0.js","assets/layers-Dg2mpSl7.js","assets/search-Ba9CRHru.js","assets/download-B9g5-0oH.js","assets/settings-2-CXNfSapN.js","assets/chevron-right-DJVm4pVP.js","assets/network-D0Fgg1y-.js","assets/index-DH0lUVGm.css"])))=>i.map(i=>d[i]); +var aL=Object.defineProperty;var lL=(i,e,t)=>e in i?aL(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var b=(i,e,t)=>lL(i,typeof e!="symbol"?e+"":e,t);import{d as Vl,r as U,_ as p0,b2 as cn,b_ as pg,cT as cL,cU as uL,j as f,ak as dL,al as m0,bk as Gl,c as oh,cV as hL,m as ga,D as J_,L as mg,cW as RS,cX as jh,cY as PS,cZ as fL,c7 as pL,A as Jc,c_ as mL,ao as gL,c$ as _L,d0 as yL,d1 as bL,d2 as vL,d3 as xL,d4 as wL,d5 as SL,K as EL,cj as CL,d6 as TL,d7 as Ge,Z as qt,d8 as g0,x as Di,a7 as be,d9 as kL,da as AL,R as gg,db as IL,am as Pc,dc as LL,aD as RL,dd as PL,de as NL,B as ey,E as DL,F as ML,df as OL}from"./index-BOwCLZTK.js";import{m as _0,t as _g,a as BL,b as FL,e as Rn,G as Gp,s as zL,c as UL,u as $L,d as jL,M as NS,f as HL,E as VL,g as y0,h as ty}from"./max-vSbldOSt.js";import{u as GL,r as WL,f as b0,g as YL,e as qL}from"./consumer-registry-CTjikLma.js";import{C as XL,N as KL,b as ZL}from"./badge-colors-DCbxcv7o.js";import{T as QL}from"./triangle-alert-SO3tIa8w.js";import{D as v0}from"./database-C6oOGn9y.js";import{D as JL}from"./DataBox-BVnEv6Au.js";import{e as eR,f as x0,g as tR}from"./meshcore-tx-constants-DgpFTAmf.js";import{E as iR,T as nR}from"./target-vmW1ltA0.js";import{L as w0}from"./layers-Dg2mpSl7.js";import{S as S0}from"./search-Ba9CRHru.js";import{D as E0}from"./download-B9g5-0oH.js";import{S as C0}from"./settings-2-CXNfSapN.js";import{C as Wp}from"./chevron-right-DJVm4pVP.js";import{N as sR}from"./network-D0Fgg1y-.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -39,7 +39,7 @@ ${r}${o}${i.type.toUpperCase()}: ${i.message}

Compilation error in ${r}



 ${o}
-
`,l.style.top="10px",l.style.left="10px",l.style.position="absolute",l.style.zIndex="9999",l.style.width="100%",l.style.textAlign="left",document.body.appendChild(l),(n=document.getElementsByClassName("luma-compiler-log-error")[0])==null||n.scrollIntoView(),l.onclick=()=>{const c=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(c)}}};$(v2,"defaultProps",{..._n.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});let ON=v2;function BN(i){return FN(i.source)||i.id||hy(`unnamed ${i.stage}-shader`)}function FN(i,e="unnamed"){const t=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(i);return t?t[1]:e}const w2=class S2 extends _n{constructor(e,t){super(e,t,S2.defaultProps),$(this,"shaderLayout"),$(this,"bufferLayout"),$(this,"linkStatus","pending"),$(this,"hash",""),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}get[Symbol.toStringTag](){return"RenderPipeline"}};$(w2,"defaultProps",{..._n.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",colorAttachmentFormats:void 0,depthStencilAttachmentFormat:void 0,parameters:{},bindings:{},uniforms:{}});let Zh=w2;const E2=class C2 extends _n{constructor(e,t){super(e,t,C2.defaultProps),$(this,"hash",""),$(this,"shaderLayout"),this.shaderLayout=t.shaderLayout}get[Symbol.toStringTag](){return"ComputePipeline"}};$(E2,"defaultProps",{..._n.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});let Q0=E2;function zN(i){return HN[i]}function UN(i){const[e,t]=jN[i],n=e==="i32"||e==="u32",s=e!=="u32",r=$N[e]*t;return{primitiveType:e,components:t,byteLength:r,integer:n,signed:s}}const $N={f32:4,f16:2,i32:4,u32:4},jN={f32:["f32",1],"vec2":["f32",2],"vec3":["f32",3],"vec4":["f32",4],f16:["f16",1],"vec2":["f16",2],"vec3":["f16",3],"vec4":["f16",4],i32:["i32",1],"vec2":["i32",2],"vec3":["i32",3],"vec4":["i32",4],u32:["u32",1],"vec2":["u32",2],"vec3":["u32",3],"vec4":["u32",4]},HN={f32:{type:"f32",components:1},f16:{type:"f16",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2":{type:"f32",components:2},"vec3":{type:"f32",components:3},"vec4":{type:"f32",components:4},"vec2":{type:"f16",components:2},"vec3":{type:"f16",components:3},"vec4":{type:"f16",components:4},"vec2":{type:"i32",components:2},"vec3":{type:"i32",components:3},"vec4":{type:"i32",components:4},"vec2":{type:"u32",components:2},"vec3":{type:"u32",components:3},"vec4":{type:"u32",components:4},"mat2x2":{type:"f32",components:4},"mat2x3":{type:"f32",components:6},"mat2x4":{type:"f32",components:8},"mat3x2":{type:"f32",components:6},"mat3x3":{type:"f32",components:9},"mat3x4":{type:"f32",components:12},"mat4x2":{type:"f32",components:8},"mat4x3":{type:"f32",components:12},"mat4x4":{type:"f32",components:16},"mat2x2":{type:"f16",components:4},"mat2x3":{type:"f16",components:6},"mat2x4":{type:"f16",components:8},"mat3x2":{type:"f16",components:6},"mat3x3":{type:"f16",components:9},"mat3x4":{type:"f16",components:12},"mat4x2":{type:"f16",components:8},"mat4x3":{type:"f16",components:12},"mat4x4":{type:"f16",components:16},"mat2x2":{type:"i32",components:4},"mat2x3":{type:"i32",components:6},"mat2x4":{type:"i32",components:8},"mat3x2":{type:"i32",components:6},"mat3x3":{type:"i32",components:9},"mat3x4":{type:"i32",components:12},"mat4x2":{type:"i32",components:8},"mat4x3":{type:"i32",components:12},"mat4x4":{type:"i32",components:16},"mat2x2":{type:"u32",components:4},"mat2x3":{type:"u32",components:6},"mat2x4":{type:"u32",components:8},"mat3x2":{type:"u32",components:6},"mat3x3":{type:"u32",components:9},"mat3x4":{type:"u32",components:12},"mat4x2":{type:"u32",components:8},"mat4x3":{type:"u32",components:12},"mat4x4":{type:"u32",components:16}};function T2(i,e){const t={};for(const n of i.attributes){const s=VN(i,e,n.name);s&&(t[n.name]=s)}return t}function Rte(i,e,t=16){const n=T2(i,e),s=new Array(t).fill(null);for(const r of Object.values(n))s[r.location]=r;return s}function VN(i,e,t){const n=GN(i,t),s=WN(e,t);if(!n)return null;const r=UN(n.type),o=uN(r),a=(s==null?void 0:s.vertexFormat)||o,l=py(a);return{attributeName:(s==null?void 0:s.attributeName)||n.name,bufferName:(s==null?void 0:s.bufferName)||n.name,location:n.location,shaderType:n.type,primitiveType:r.primitiveType,shaderComponents:r.components,vertexFormat:a,bufferDataType:l.type,bufferComponents:l.components,normalized:l.normalized,integer:r.integer,stepMode:(s==null?void 0:s.stepMode)||n.stepMode||"vertex",byteOffset:(s==null?void 0:s.byteOffset)||0,byteStride:(s==null?void 0:s.byteStride)||0}}function GN(i,e){const t=i.attributes.find(n=>n.name===e);return t||le.warn(`shader layout attribute "${e}" not present in shader`),t||null}function WN(i,e){YN(i);let t=qN(i,e);return t||(t=XN(i,e),t)?t:(le.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function YN(i){for(const e of i)(e.attributes&&e.format||!e.attributes&&!e.format)&&le.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function qN(i,e){for(const t of i)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function XN(i,e){var t;for(const n of i){let s=n.byteStride;if(typeof n.byteStride!="number")for(const o of n.attributes||[]){const a=py(o.format);s+=a.byteLength}const r=(t=n.attributes)==null?void 0:t.find(o=>o.attribute===e);if(r)return{attributeName:r.attribute,bufferName:n.name,stepMode:n.stepMode,vertexFormat:r.format,byteOffset:r.byteOffset,byteStride:s}}return null}let xd;function k2(i){return(!xd||xd.byteLengthr.type==="uniform"&&r.name===(e==null?void 0:e.name));if(!n)throw new Error(e==null?void 0:e.name);const s=n;for(const r of s.uniforms||[])this.bindingLayout[r.name]=r}}setUniforms(e){for(const[t,n]of Object.entries(e))this._setUniform(t,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${n}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){JN(this.uniforms[e],t)||(this.uniforms[e]=eD(t),this.modifiedUniforms[e]=!0,this.modified=!0)}}let ri=class{constructor(e){$(this,"uniformBlocks",new Map),$(this,"uniformBufferLayouts",new Map),$(this,"uniformBuffers",new Map);for(const[t,n]of Object.entries(e)){const s=t,r=new QN(n.uniformTypes??{},n.uniformSizes??{});this.uniformBufferLayouts.set(s,r);const o=new tD({name:t});o.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(s,o)}}destroy(){for(const e of this.uniformBuffers.values())e.destroy()}setUniforms(e){var t;for(const[n,s]of Object.entries(e))(t=this.uniformBlocks.get(n))==null||t.setUniforms(s);this.updateUniformBuffers()}getUniformBufferByteLength(e){var t;return((t=this.uniformBufferLayouts.get(e))==null?void 0:t.byteLength)||0}getUniformBufferData(e){var t,n;const s=((t=this.uniformBlocks.get(e))==null?void 0:t.getAllUniforms())||{};return(n=this.uniformBufferLayouts.get(e))==null?void 0:n.getData(s)}createUniformBuffer(e,t,n){n&&this.setUniforms(n);const s=this.getUniformBufferByteLength(t),r=e.createBuffer({usage:ge.UNIFORM|ge.COPY_DST,byteLength:s}),o=this.getUniformBufferData(t);return r.write(o),r}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){const n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:ge.UNIFORM|ge.COPY_DST,byteLength:n});this.uniformBuffers.set(t,s)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(const t of this.uniformBlocks.keys()){const n=this.updateUniformBuffer(t);e||(e=n)}return e&&le.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){var t;const n=this.uniformBlocks.get(e);let s=this.uniformBuffers.get(e),r=!1;if(s&&n!=null&&n.needsRedraw){r||(r=n.needsRedraw);const o=this.getUniformBufferData(e);s=this.uniformBuffers.get(e),s==null||s.write(o);const a=(t=this.uniformBlocks.get(e))==null?void 0:t.getAllUniforms();le.log(4,`Writing to uniform buffer ${String(e)}`,o,a)()}return r}};var Do;(function(i){i[i.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",i[i.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",i[i.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i[i.ZERO=0]="ZERO",i[i.ONE=1]="ONE",i[i.SRC_COLOR=768]="SRC_COLOR",i[i.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",i[i.SRC_ALPHA=770]="SRC_ALPHA",i[i.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",i[i.DST_ALPHA=772]="DST_ALPHA",i[i.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",i[i.DST_COLOR=774]="DST_COLOR",i[i.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",i[i.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",i[i.CONSTANT_COLOR=32769]="CONSTANT_COLOR",i[i.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",i[i.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",i[i.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",i[i.FUNC_ADD=32774]="FUNC_ADD",i[i.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",i[i.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",i[i.BLEND_EQUATION=32777]="BLEND_EQUATION",i[i.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",i[i.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",i[i.BLEND_DST_RGB=32968]="BLEND_DST_RGB",i[i.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",i[i.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",i[i.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",i[i.BLEND_COLOR=32773]="BLEND_COLOR",i[i.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",i[i.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",i[i.LINE_WIDTH=2849]="LINE_WIDTH",i[i.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",i[i.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",i[i.CULL_FACE_MODE=2885]="CULL_FACE_MODE",i[i.FRONT_FACE=2886]="FRONT_FACE",i[i.DEPTH_RANGE=2928]="DEPTH_RANGE",i[i.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",i[i.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",i[i.DEPTH_FUNC=2932]="DEPTH_FUNC",i[i.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",i[i.STENCIL_FUNC=2962]="STENCIL_FUNC",i[i.STENCIL_FAIL=2964]="STENCIL_FAIL",i[i.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",i[i.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",i[i.STENCIL_REF=2967]="STENCIL_REF",i[i.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",i[i.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",i[i.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",i[i.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",i[i.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",i[i.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",i[i.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",i[i.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",i[i.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",i[i.VIEWPORT=2978]="VIEWPORT",i[i.SCISSOR_BOX=3088]="SCISSOR_BOX",i[i.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",i[i.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",i[i.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",i[i.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",i[i.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",i[i.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",i[i.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",i[i.RED_BITS=3410]="RED_BITS",i[i.GREEN_BITS=3411]="GREEN_BITS",i[i.BLUE_BITS=3412]="BLUE_BITS",i[i.ALPHA_BITS=3413]="ALPHA_BITS",i[i.DEPTH_BITS=3414]="DEPTH_BITS",i[i.STENCIL_BITS=3415]="STENCIL_BITS",i[i.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",i[i.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",i[i.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",i[i.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",i[i.SAMPLES=32937]="SAMPLES",i[i.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",i[i.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",i[i.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",i[i.VENDOR=7936]="VENDOR",i[i.RENDERER=7937]="RENDERER",i[i.VERSION=7938]="VERSION",i[i.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",i[i.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",i[i.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",i[i.STATIC_DRAW=35044]="STATIC_DRAW",i[i.STREAM_DRAW=35040]="STREAM_DRAW",i[i.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.BUFFER_SIZE=34660]="BUFFER_SIZE",i[i.BUFFER_USAGE=34661]="BUFFER_USAGE",i[i.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",i[i.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",i[i.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",i[i.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",i[i.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",i[i.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",i[i.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",i[i.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",i[i.CULL_FACE=2884]="CULL_FACE",i[i.FRONT=1028]="FRONT",i[i.BACK=1029]="BACK",i[i.FRONT_AND_BACK=1032]="FRONT_AND_BACK",i[i.BLEND=3042]="BLEND",i[i.DEPTH_TEST=2929]="DEPTH_TEST",i[i.DITHER=3024]="DITHER",i[i.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",i[i.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",i[i.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",i[i.SCISSOR_TEST=3089]="SCISSOR_TEST",i[i.STENCIL_TEST=2960]="STENCIL_TEST",i[i.NO_ERROR=0]="NO_ERROR",i[i.INVALID_ENUM=1280]="INVALID_ENUM",i[i.INVALID_VALUE=1281]="INVALID_VALUE",i[i.INVALID_OPERATION=1282]="INVALID_OPERATION",i[i.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",i[i.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",i[i.CW=2304]="CW",i[i.CCW=2305]="CCW",i[i.DONT_CARE=4352]="DONT_CARE",i[i.FASTEST=4353]="FASTEST",i[i.NICEST=4354]="NICEST",i[i.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",i[i.BYTE=5120]="BYTE",i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.SHORT=5122]="SHORT",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.INT=5124]="INT",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.FLOAT=5126]="FLOAT",i[i.DOUBLE=5130]="DOUBLE",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.ALPHA=6406]="ALPHA",i[i.RGB=6407]="RGB",i[i.RGBA=6408]="RGBA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",i[i.VERTEX_SHADER=35633]="VERTEX_SHADER",i[i.COMPILE_STATUS=35713]="COMPILE_STATUS",i[i.DELETE_STATUS=35712]="DELETE_STATUS",i[i.LINK_STATUS=35714]="LINK_STATUS",i[i.VALIDATE_STATUS=35715]="VALIDATE_STATUS",i[i.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",i[i.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",i[i.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",i[i.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",i[i.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",i[i.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",i[i.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",i[i.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",i[i.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",i[i.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",i[i.SHADER_TYPE=35663]="SHADER_TYPE",i[i.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",i[i.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",i[i.NEVER=512]="NEVER",i[i.LESS=513]="LESS",i[i.EQUAL=514]="EQUAL",i[i.LEQUAL=515]="LEQUAL",i[i.GREATER=516]="GREATER",i[i.NOTEQUAL=517]="NOTEQUAL",i[i.GEQUAL=518]="GEQUAL",i[i.ALWAYS=519]="ALWAYS",i[i.KEEP=7680]="KEEP",i[i.REPLACE=7681]="REPLACE",i[i.INCR=7682]="INCR",i[i.DECR=7683]="DECR",i[i.INVERT=5386]="INVERT",i[i.INCR_WRAP=34055]="INCR_WRAP",i[i.DECR_WRAP=34056]="DECR_WRAP",i[i.NEAREST=9728]="NEAREST",i[i.LINEAR=9729]="LINEAR",i[i.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",i[i.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",i[i.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",i[i.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",i[i.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",i[i.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",i[i.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",i[i.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE=5890]="TEXTURE",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i[i.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",i[i.TEXTURE0=33984]="TEXTURE0",i[i.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",i[i.REPEAT=10497]="REPEAT",i[i.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i[i.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",i[i.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",i[i.FLOAT_VEC2=35664]="FLOAT_VEC2",i[i.FLOAT_VEC3=35665]="FLOAT_VEC3",i[i.FLOAT_VEC4=35666]="FLOAT_VEC4",i[i.INT_VEC2=35667]="INT_VEC2",i[i.INT_VEC3=35668]="INT_VEC3",i[i.INT_VEC4=35669]="INT_VEC4",i[i.BOOL=35670]="BOOL",i[i.BOOL_VEC2=35671]="BOOL_VEC2",i[i.BOOL_VEC3=35672]="BOOL_VEC3",i[i.BOOL_VEC4=35673]="BOOL_VEC4",i[i.FLOAT_MAT2=35674]="FLOAT_MAT2",i[i.FLOAT_MAT3=35675]="FLOAT_MAT3",i[i.FLOAT_MAT4=35676]="FLOAT_MAT4",i[i.SAMPLER_2D=35678]="SAMPLER_2D",i[i.SAMPLER_CUBE=35680]="SAMPLER_CUBE",i[i.LOW_FLOAT=36336]="LOW_FLOAT",i[i.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",i[i.HIGH_FLOAT=36338]="HIGH_FLOAT",i[i.LOW_INT=36339]="LOW_INT",i[i.MEDIUM_INT=36340]="MEDIUM_INT",i[i.HIGH_INT=36341]="HIGH_INT",i[i.FRAMEBUFFER=36160]="FRAMEBUFFER",i[i.RENDERBUFFER=36161]="RENDERBUFFER",i[i.RGBA4=32854]="RGBA4",i[i.RGB5_A1=32855]="RGB5_A1",i[i.RGB565=36194]="RGB565",i[i.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",i[i.STENCIL_INDEX=6401]="STENCIL_INDEX",i[i.STENCIL_INDEX8=36168]="STENCIL_INDEX8",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i[i.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",i[i.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",i[i.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",i[i.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",i[i.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",i[i.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",i[i.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",i[i.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",i[i.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",i[i.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",i[i.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",i[i.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",i[i.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",i[i.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",i[i.NONE=0]="NONE",i[i.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",i[i.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",i[i.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",i[i.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",i[i.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",i[i.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",i[i.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",i[i.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",i[i.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",i[i.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",i[i.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",i[i.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",i[i.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",i[i.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",i[i.READ_BUFFER=3074]="READ_BUFFER",i[i.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",i[i.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",i[i.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",i[i.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",i[i.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",i[i.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",i[i.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",i[i.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",i[i.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",i[i.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",i[i.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",i[i.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",i[i.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",i[i.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",i[i.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",i[i.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",i[i.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",i[i.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",i[i.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",i[i.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",i[i.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",i[i.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",i[i.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",i[i.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",i[i.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",i[i.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",i[i.RED=6403]="RED",i[i.RGB8=32849]="RGB8",i[i.RGBA8=32856]="RGBA8",i[i.RGB10_A2=32857]="RGB10_A2",i[i.TEXTURE_3D=32879]="TEXTURE_3D",i[i.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",i[i.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",i[i.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",i[i.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",i[i.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",i[i.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",i[i.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",i[i.SRGB=35904]="SRGB",i[i.SRGB8=35905]="SRGB8",i[i.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",i[i.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",i[i.RGBA32F=34836]="RGBA32F",i[i.RGB32F=34837]="RGB32F",i[i.RGBA16F=34842]="RGBA16F",i[i.RGB16F=34843]="RGB16F",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",i[i.R11F_G11F_B10F=35898]="R11F_G11F_B10F",i[i.RGB9_E5=35901]="RGB9_E5",i[i.RGBA32UI=36208]="RGBA32UI",i[i.RGB32UI=36209]="RGB32UI",i[i.RGBA16UI=36214]="RGBA16UI",i[i.RGB16UI=36215]="RGB16UI",i[i.RGBA8UI=36220]="RGBA8UI",i[i.RGB8UI=36221]="RGB8UI",i[i.RGBA32I=36226]="RGBA32I",i[i.RGB32I=36227]="RGB32I",i[i.RGBA16I=36232]="RGBA16I",i[i.RGB16I=36233]="RGB16I",i[i.RGBA8I=36238]="RGBA8I",i[i.RGB8I=36239]="RGB8I",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.R8=33321]="R8",i[i.RG8=33323]="RG8",i[i.R16F=33325]="R16F",i[i.R32F=33326]="R32F",i[i.RG16F=33327]="RG16F",i[i.RG32F=33328]="RG32F",i[i.R8I=33329]="R8I",i[i.R8UI=33330]="R8UI",i[i.R16I=33331]="R16I",i[i.R16UI=33332]="R16UI",i[i.R32I=33333]="R32I",i[i.R32UI=33334]="R32UI",i[i.RG8I=33335]="RG8I",i[i.RG8UI=33336]="RG8UI",i[i.RG16I=33337]="RG16I",i[i.RG16UI=33338]="RG16UI",i[i.RG32I=33339]="RG32I",i[i.RG32UI=33340]="RG32UI",i[i.R8_SNORM=36756]="R8_SNORM",i[i.RG8_SNORM=36757]="RG8_SNORM",i[i.RGB8_SNORM=36758]="RGB8_SNORM",i[i.RGBA8_SNORM=36759]="RGBA8_SNORM",i[i.RGB10_A2UI=36975]="RGB10_A2UI",i[i.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",i[i.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.HALF_FLOAT=5131]="HALF_FLOAT",i[i.RG=33319]="RG",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",i[i.CURRENT_QUERY=34917]="CURRENT_QUERY",i[i.QUERY_RESULT=34918]="QUERY_RESULT",i[i.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",i[i.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",i[i.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",i[i.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",i[i.DRAW_BUFFER0=34853]="DRAW_BUFFER0",i[i.DRAW_BUFFER1=34854]="DRAW_BUFFER1",i[i.DRAW_BUFFER2=34855]="DRAW_BUFFER2",i[i.DRAW_BUFFER3=34856]="DRAW_BUFFER3",i[i.DRAW_BUFFER4=34857]="DRAW_BUFFER4",i[i.DRAW_BUFFER5=34858]="DRAW_BUFFER5",i[i.DRAW_BUFFER6=34859]="DRAW_BUFFER6",i[i.DRAW_BUFFER7=34860]="DRAW_BUFFER7",i[i.DRAW_BUFFER8=34861]="DRAW_BUFFER8",i[i.DRAW_BUFFER9=34862]="DRAW_BUFFER9",i[i.DRAW_BUFFER10=34863]="DRAW_BUFFER10",i[i.DRAW_BUFFER11=34864]="DRAW_BUFFER11",i[i.DRAW_BUFFER12=34865]="DRAW_BUFFER12",i[i.DRAW_BUFFER13=34866]="DRAW_BUFFER13",i[i.DRAW_BUFFER14=34867]="DRAW_BUFFER14",i[i.DRAW_BUFFER15=34868]="DRAW_BUFFER15",i[i.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",i[i.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",i[i.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",i[i.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",i[i.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",i[i.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",i[i.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",i[i.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",i[i.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",i[i.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",i[i.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",i[i.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",i[i.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",i[i.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",i[i.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",i[i.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",i[i.SAMPLER_3D=35679]="SAMPLER_3D",i[i.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",i[i.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",i[i.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",i[i.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",i[i.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",i[i.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",i[i.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",i[i.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",i[i.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",i[i.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",i[i.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",i[i.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",i[i.MAX_SAMPLES=36183]="MAX_SAMPLES",i[i.SAMPLER_BINDING=35097]="SAMPLER_BINDING",i[i.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",i[i.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",i[i.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",i[i.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",i[i.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",i[i.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",i[i.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",i[i.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",i[i.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",i[i.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",i[i.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",i[i.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",i[i.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",i[i.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",i[i.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",i[i.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",i[i.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",i[i.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",i[i.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",i[i.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",i[i.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",i[i.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",i[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",i[i.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",i[i.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",i[i.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",i[i.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",i[i.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",i[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",i[i.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",i[i.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",i[i.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",i[i.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",i[i.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",i[i.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",i[i.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",i[i.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",i[i.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",i[i.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",i[i.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",i[i.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",i[i.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",i[i.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",i[i.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",i[i.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",i[i.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i[i.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",i[i.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",i[i.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",i[i.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",i[i.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",i[i.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",i[i.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",i[i.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",i[i.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",i[i.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",i[i.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",i[i.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",i[i.UNIFORM_TYPE=35383]="UNIFORM_TYPE",i[i.UNIFORM_SIZE=35384]="UNIFORM_SIZE",i[i.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",i[i.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",i[i.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",i[i.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",i[i.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",i[i.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",i[i.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",i[i.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",i[i.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",i[i.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",i[i.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",i[i.OBJECT_TYPE=37138]="OBJECT_TYPE",i[i.SYNC_CONDITION=37139]="SYNC_CONDITION",i[i.SYNC_STATUS=37140]="SYNC_STATUS",i[i.SYNC_FLAGS=37141]="SYNC_FLAGS",i[i.SYNC_FENCE=37142]="SYNC_FENCE",i[i.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",i[i.UNSIGNALED=37144]="UNSIGNALED",i[i.SIGNALED=37145]="SIGNALED",i[i.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",i[i.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",i[i.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",i[i.WAIT_FAILED=37149]="WAIT_FAILED",i[i.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",i[i.COLOR=6144]="COLOR",i[i.DEPTH=6145]="DEPTH",i[i.STENCIL=6146]="STENCIL",i[i.MIN=32775]="MIN",i[i.MAX=32776]="MAX",i[i.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",i[i.STREAM_READ=35041]="STREAM_READ",i[i.STREAM_COPY=35042]="STREAM_COPY",i[i.STATIC_READ=35045]="STATIC_READ",i[i.STATIC_COPY=35046]="STATIC_COPY",i[i.DYNAMIC_READ=35049]="DYNAMIC_READ",i[i.DYNAMIC_COPY=35050]="DYNAMIC_COPY",i[i.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",i[i.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",i[i.INVALID_INDEX=4294967295]="INVALID_INDEX",i[i.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",i[i.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",i[i.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",i[i.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",i[i.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",i[i.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",i[i.R16_EXT=33322]="R16_EXT",i[i.RG16_EXT=33324]="RG16_EXT",i[i.RGB16_EXT=32852]="RGB16_EXT",i[i.RGBA16_EXT=32859]="RGBA16_EXT",i[i.R16_SNORM_EXT=36760]="R16_SNORM_EXT",i[i.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",i[i.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",i[i.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",i[i.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",i[i.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",i[i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",i[i.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",i[i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",i[i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",i[i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i[i.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",i[i.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",i[i.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",i[i.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",i[i.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",i[i.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",i[i.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",i[i.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",i[i.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",i[i.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",i[i.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",i[i.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",i[i.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",i[i.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",i[i.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",i[i.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",i[i.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",i[i.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",i[i.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",i[i.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",i[i.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",i[i.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",i[i.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",i[i.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",i[i.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",i[i.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",i[i.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",i[i.LINE_WEBGL=6913]="LINE_WEBGL",i[i.FILL_WEBGL=6914]="FILL_WEBGL",i[i.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",i[i.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",i[i.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",i[i.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",i[i.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",i[i.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",i[i.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",i[i.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",i[i.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",i[i.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",i[i.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",i[i.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",i[i.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",i[i.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",i[i.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",i[i.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",i[i.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",i[i.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",i[i.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",i[i.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",i[i.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",i[i.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",i[i.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",i[i.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(Do||(Do={}));const iD={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}},nD=i=>({drawBuffersWEBGL(e){return i.drawBuffers(e)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),sD=i=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return i.createVertexArray()},deleteVertexArrayOES(e){return i.deleteVertexArray(e)},isVertexArrayOES(e){return i.isVertexArray(e)},bindVertexArrayOES(e){return i.bindVertexArray(e)}}),rD=i=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...e){return i.drawArraysInstanced(...e)},drawElementsInstancedANGLE(...e){return i.drawElementsInstanced(...e)},vertexAttribDivisorANGLE(...e){return i.vertexAttribDivisor(...e)}});function oD(i=!0){const e=HTMLCanvasElement.prototype;if(!i&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(t,n){if(t==="webgl"||t==="experimental-webgl"){const s=this.originalGetContext("webgl2",n);return s instanceof HTMLElement&&aD(s),s}return this.originalGetContext(t,n)}}function aD(i){i.getExtension("EXT_color_buffer_float");const e={...iD,WEBGL_disjoint_timer_query:i.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:nD(i),OES_vertex_array_object:sD(i),ANGLE_instanced_arrays:rD(i)},t=i.getExtension;i.getExtension=function(s){return t.call(i,s)||(s in e?e[s]:null)};const n=i.getSupportedExtensions;i.getSupportedExtensions=function(){const s=n.apply(i)||[];return s==null?void 0:s.concat(Object.keys(e))}}async function A2(i,e){const t=document.getElementsByTagName("head")[0];if(!t)throw new Error("loadScript");const n=document.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",i),new Promise((s,r)=>{n.onload=s,n.onerror=o=>r(new Error(`Unable to load script '${i}': ${o}`)),t.appendChild(n)})}const lD=1;let hi=null,J0=!1;const gy={debugSpectorJS:le.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/spectorjs@0.9.30/dist/spector.bundle.js",gl:void 0};async function cD(i){if(!globalThis.SPECTOR)try{await A2(i.debugSpectorJSUrl||gy.debugSpectorJSUrl)}catch(e){le.warn(String(e))}}function Dte(i){var e;if(i={...gy,...i},!i.debugSpectorJS)return null;if(!hi&&globalThis.SPECTOR&&!((e=globalThis.luma)!=null&&e.spector)){le.probe(lD,"SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();const{Spector:t}=globalThis.SPECTOR;hi=new t,globalThis.luma&&(globalThis.luma.spector=hi)}if(!hi)return null;if(J0||(J0=!0,hi.spyCanvases(),hi==null||hi.onCaptureStarted.add(t=>le.info("Spector capture started:",t)()),hi==null||hi.onCapture.add(t=>{le.info("Spector capture complete:",t)(),hi==null||hi.getResultUI(),hi==null||hi.resultView.display(),hi==null||hi.resultView.addCapture(t)})),i.gl){const t=i.gl,n=t.device;hi==null||hi.startCapture(i.gl,500),t.device=n,new Promise(s=>setTimeout(s,2e3)).then(s=>{le.info("Spector capture stopped after 2 seconds")(),hi==null||hi.stopCapture()})}return hi}const uD="https://unpkg.com/webgl-debug@2.0.1/index.js";function I2(i){return i.luma=i.luma||{},i.luma}async function dD(){Vu()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await A2(uD))}function Mte(i,e={}){return e.debugWebGL||e.traceWebGL?fD(i,e):hD(i)}function hD(i){const e=I2(i);return e.realContext?e.realContext:i}function fD(i,e){if(!globalThis.WebGLDebugUtils)return le.warn("webgl-debug not loaded")(),i;const t=I2(i);if(t.debugContext)return t.debugContext;globalThis.WebGLDebugUtils.init({...Do,...i});const n=globalThis.WebGLDebugUtils.makeDebugContext(i,pD.bind(null,e),mD.bind(null,e));for(const o in Do)!(o in n)&&typeof Do[o]=="number"&&(n[o]=Do[o]);class s{}Object.setPrototypeOf(n,Object.getPrototypeOf(i)),Object.setPrototypeOf(s,n);const r=Object.create(s);return t.realContext=i,t.debugContext=r,r.debug=!0,r}function ex(i,e){e=Array.from(e).map(n=>n===void 0?"undefined":n);let t=globalThis.WebGLDebugUtils.glFunctionArgsToString(i,e);return t=`${t.slice(0,100)}${t.length>100?"...":""}`,`gl.${i}(${t})`}function pD(i,e,t,n){n=Array.from(n).map(a=>a===void 0?"undefined":a);const s=globalThis.WebGLDebugUtils.glEnumToString(e),r=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,n),o=`${s} in gl.${t}(${r})`;le.error(o)();debugger}function mD(i,e,t){let n="";le.level>=1&&(n=ex(e,t),i.traceWebGL&&le.log(1,n)());for(const s of t)if(s===void 0){n=n||ex(e,t);debugger}}const wd=1;class gD extends TN{constructor(){super(),$(this,"type","webgl"),Eg.defaultProps={...Eg.defaultProps,...gy}}enforceWebGL2(e){oD(e)}isSupported(){return typeof WebGL2RenderingContext<"u"}isDeviceHandle(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:(typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext&&le.warn("WebGL1 is not supported",e)(),!1)}async attach(e,t={}){const{WebGLDevice:n}=await p0(async()=>{const{WebGLDevice:r}=await import("./webgl-device-QoBMYpnS-1csuE5Gs.js");return{WebGLDevice:r}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]));if(e instanceof n)return e;if((e==null?void 0:e.device)instanceof n)return e.device;if(!_D(e))throw new Error("Invalid WebGL2RenderingContext");const s=t.createCanvasContext===!0?{}:t.createCanvasContext;return new n({...t,_handle:e,createCanvasContext:{canvas:e.canvas,autoResize:!1,...s}})}async create(e={}){const{WebGLDevice:t}=await p0(async()=>{const{WebGLDevice:n}=await import("./webgl-device-QoBMYpnS-1csuE5Gs.js");return{WebGLDevice:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]));le.groupCollapsed(wd,"WebGLDevice created")();try{const n=[];(e.debugWebGL||e.debug)&&n.push(dD()),e.debugSpectorJS&&n.push(cD(e));const s=await Promise.allSettled(n);for(const a of s)a.status==="rejected"&&le.error(`Failed to initialize debug libraries ${a.reason}`)();const r=new t(e),o=`${r._reused?"Reusing":"Created"} device with WebGL2 ${r.props.debug?"debug ":""}context: ${r.info.vendor}, ${r.info.renderer} for canvas: ${r.canvasContext.id}`;return le.probe(wd,o)(),le.table(wd,r.info)(),r}finally{le.groupEnd(wd)()}}}function _D(i){return typeof WebGL2RenderingContext<"u"&&i instanceof WebGL2RenderingContext?!0:!!(i&&Number.isFinite(i._version))}const yD=new gD,bD="#b3b3b3",vD=void 0,kg=void 0,xD=1,wD=4,SD="#666666",ED=.1,CD=1,TD=1,L2="#222222",pe={enableSimulation:!0,spaceSize:8192,pointSizeScale:1,linkWidthScale:1,linkArrowsSizeScale:1,renderLinks:!0,curvedLinks:!1,curvedLinkSegments:19,curvedLinkWeight:.8,curvedLinkControlPointDistance:.5,linkArrows:!1,linkVisibilityDistanceRange:[50,150],linkVisibilityMinTransparency:.25,hoveredPointCursor:"auto",hoveredLinkCursor:"auto",renderHoveredPointRing:!1,hoveredPointRingColor:"white",hoveredLinkColor:void 0,hoveredLinkWidthIncrease:5,focusedPointRingColor:"white",focusedPointIndex:void 0,simulation:{decay:5e3,gravity:.25,center:0,repulsion:1,repulsionTheta:1.15,linkSpring:1,linkDistance:10,linkDistRandomVariationRange:[1,1.2],repulsionFromMouse:2,friction:.85,cluster:.1},showFPSMonitor:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||2,scalePointsOnZoom:!1,scaleLinksOnZoom:!1,enableZoom:!0,enableSimulationDuringZoom:!1,enableDrag:!1,fitViewOnInit:!0,fitViewDelay:250,fitViewPadding:.1,fitViewDuration:250,pointSamplingDistance:150,attribution:"",rescalePositions:void 0,enableRightClickRepulsion:!1},kD=.7,AD=.95,ID=3;/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:R2,setPrototypeOf:tx,isFrozen:LD,getPrototypeOf:RD,getOwnPropertyDescriptor:PD}=Object;let{freeze:hn,seal:_s,create:P2}=Object,{apply:Ag,construct:Ig}=typeof Reflect<"u"&&Reflect;hn||(hn=function(i){return i});_s||(_s=function(i){return i});Ag||(Ag=function(i,e,t){return i.apply(e,t)});Ig||(Ig=function(i,e){return new i(...e)});const Sd=fn(Array.prototype.forEach),ND=fn(Array.prototype.lastIndexOf),ix=fn(Array.prototype.pop),lc=fn(Array.prototype.push),DD=fn(Array.prototype.splice),hh=fn(String.prototype.toLowerCase),im=fn(String.prototype.toString),nx=fn(String.prototype.match),cc=fn(String.prototype.replace),MD=fn(String.prototype.indexOf),OD=fn(String.prototype.trim),Ms=fn(Object.prototype.hasOwnProperty),sn=fn(RegExp.prototype.test),uc=BD(TypeError);function fn(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s2&&arguments[2]!==void 0?arguments[2]:hh;tx&&tx(i,null);let n=e.length;for(;n--;){let s=e[n];if(typeof s=="string"){const r=t(s);r!==s&&(LD(e)||(e[n]=r),s=r)}i[s]=!0}return i}function FD(i){for(let e=0;e/gm),HD=_s(/\$\{[\w\W]*/gm),VD=_s(/^data-[\-\w.\u00B7-\uFFFF]+$/),GD=_s(/^aria-[\-\w]+$/),N2=_s(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),WD=_s(/^(?:\w+script|data):/i),YD=_s(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),D2=_s(/^html$/i),qD=_s(/^[a-z][.\w]*(-[.\w]+)+$/i);var lx=Object.freeze({__proto__:null,ARIA_ATTR:GD,ATTR_WHITESPACE:YD,CUSTOM_ELEMENT:qD,DATA_ATTR:VD,DOCTYPE_NAME:D2,ERB_EXPR:jD,IS_ALLOWED_URI:N2,IS_SCRIPT_OR_DATA:WD,MUSTACHE_EXPR:$D,TMPLIT_EXPR:HD});const hc={element:1,text:3,progressingInstruction:7,comment:8,document:9},XD=function(){return typeof window>"u"?null:window},KD=function(i,e){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let t=null;const n="data-tt-policy-suffix";e&&e.hasAttribute(n)&&(t=e.getAttribute(n));const s="dompurify"+(t?"#"+t:"");try{return i.createPolicy(s,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},cx=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function M2(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:XD();const e=L=>M2(L);if(e.version="3.2.6",e.removed=[],!i||!i.document||i.document.nodeType!==hc.document||!i.Element)return e.isSupported=!1,e;let{document:t}=i;const n=t,s=n.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:d,DOMParser:h,trustedTypes:p}=i,m=l.prototype,y=dc(m,"cloneNode"),g=dc(m,"remove"),_=dc(m,"nextSibling"),S=dc(m,"childNodes"),C=dc(m,"parentNode");if(typeof o=="function"){const L=t.createElement("template");L.content&&L.content.ownerDocument&&(t=L.content.ownerDocument)}let x,A="";const{implementation:I,createNodeIterator:O,createDocumentFragment:H,getElementsByTagName:Z}=t,{importNode:te}=n;let M=cx();e.isSupported=typeof R2=="function"&&typeof C=="function"&&I&&I.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:he,ERB_EXPR:se,TMPLIT_EXPR:R,DATA_ATTR:J,ARIA_ATTR:F,IS_SCRIPT_OR_DATA:X,ATTR_WHITESPACE:ie,CUSTOM_ELEMENT:ee}=lx;let{IS_ALLOWED_URI:ae}=lx,Q=null;const Se=ot({},[...sx,...nm,...sm,...rm,...rx]);let xe=null;const Je=ot({},[...ox,...om,...ax,...Ed]);let de=Object.seal(P2(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),bt=null,Xe=null,ht=!0,re=!0,Te=!1,Pe=!0,q=!1,We=!0,He=!1,it=!1,Vt=!1,me=!1,nt=!1,ui=!1,_i=!0,Zn=!1;const Qo="user-content-";let Zs=!0,Li=!1,en={},Ri=null;const ai=ot({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let vo=null;const Es=ot({},["audio","video","img","source","image","track"]);let Qn=null;const Jn=ot({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Cs="http://www.w3.org/1998/Math/MathML",zi="http://www.w3.org/2000/svg",Ei="http://www.w3.org/1999/xhtml";let ii=Ei,bn=!1,vn=null;const Ts=ot({},[Cs,zi,Ei],im);let On=ot({},["mi","mo","mn","ms","mtext"]),es=ot({},["annotation-xml"]);const Dr=ot({},["title","style","font","a","script"]);let xn=null;const Qs=["application/xhtml+xml","text/html"],Jo="text/html";let Zt=null,Ot=null;const ks=t.createElement("form"),xo=function(L){return L instanceof RegExp||L instanceof Function},Js=function(){let L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ot&&Ot===L)){if((!L||typeof L!="object")&&(L={}),L=Hr(L),xn=Qs.indexOf(L.PARSER_MEDIA_TYPE)===-1?Jo:L.PARSER_MEDIA_TYPE,Zt=xn==="application/xhtml+xml"?im:hh,Q=Ms(L,"ALLOWED_TAGS")?ot({},L.ALLOWED_TAGS,Zt):Se,xe=Ms(L,"ALLOWED_ATTR")?ot({},L.ALLOWED_ATTR,Zt):Je,vn=Ms(L,"ALLOWED_NAMESPACES")?ot({},L.ALLOWED_NAMESPACES,im):Ts,Qn=Ms(L,"ADD_URI_SAFE_ATTR")?ot(Hr(Jn),L.ADD_URI_SAFE_ATTR,Zt):Jn,vo=Ms(L,"ADD_DATA_URI_TAGS")?ot(Hr(Es),L.ADD_DATA_URI_TAGS,Zt):Es,Ri=Ms(L,"FORBID_CONTENTS")?ot({},L.FORBID_CONTENTS,Zt):ai,bt=Ms(L,"FORBID_TAGS")?ot({},L.FORBID_TAGS,Zt):Hr({}),Xe=Ms(L,"FORBID_ATTR")?ot({},L.FORBID_ATTR,Zt):Hr({}),en=Ms(L,"USE_PROFILES")?L.USE_PROFILES:!1,ht=L.ALLOW_ARIA_ATTR!==!1,re=L.ALLOW_DATA_ATTR!==!1,Te=L.ALLOW_UNKNOWN_PROTOCOLS||!1,Pe=L.ALLOW_SELF_CLOSE_IN_ATTR!==!1,q=L.SAFE_FOR_TEMPLATES||!1,We=L.SAFE_FOR_XML!==!1,He=L.WHOLE_DOCUMENT||!1,me=L.RETURN_DOM||!1,nt=L.RETURN_DOM_FRAGMENT||!1,ui=L.RETURN_TRUSTED_TYPE||!1,Vt=L.FORCE_BODY||!1,_i=L.SANITIZE_DOM!==!1,Zn=L.SANITIZE_NAMED_PROPS||!1,Zs=L.KEEP_CONTENT!==!1,Li=L.IN_PLACE||!1,ae=L.ALLOWED_URI_REGEXP||N2,ii=L.NAMESPACE||Ei,On=L.MATHML_TEXT_INTEGRATION_POINTS||On,es=L.HTML_INTEGRATION_POINTS||es,de=L.CUSTOM_ELEMENT_HANDLING||{},L.CUSTOM_ELEMENT_HANDLING&&xo(L.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(de.tagNameCheck=L.CUSTOM_ELEMENT_HANDLING.tagNameCheck),L.CUSTOM_ELEMENT_HANDLING&&xo(L.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(de.attributeNameCheck=L.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),L.CUSTOM_ELEMENT_HANDLING&&typeof L.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(de.allowCustomizedBuiltInElements=L.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(re=!1),nt&&(me=!0),en&&(Q=ot({},rx),xe=[],en.html===!0&&(ot(Q,sx),ot(xe,ox)),en.svg===!0&&(ot(Q,nm),ot(xe,om),ot(xe,Ed)),en.svgFilters===!0&&(ot(Q,sm),ot(xe,om),ot(xe,Ed)),en.mathMl===!0&&(ot(Q,rm),ot(xe,ax),ot(xe,Ed))),L.ADD_TAGS&&(Q===Se&&(Q=Hr(Q)),ot(Q,L.ADD_TAGS,Zt)),L.ADD_ATTR&&(xe===Je&&(xe=Hr(xe)),ot(xe,L.ADD_ATTR,Zt)),L.ADD_URI_SAFE_ATTR&&ot(Qn,L.ADD_URI_SAFE_ATTR,Zt),L.FORBID_CONTENTS&&(Ri===ai&&(Ri=Hr(Ri)),ot(Ri,L.FORBID_CONTENTS,Zt)),Zs&&(Q["#text"]=!0),He&&ot(Q,["html","head","body"]),Q.table&&(ot(Q,["tbody"]),delete bt.tbody),L.TRUSTED_TYPES_POLICY){if(typeof L.TRUSTED_TYPES_POLICY.createHTML!="function")throw uc('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof L.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw uc('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=L.TRUSTED_TYPES_POLICY,A=x.createHTML("")}else x===void 0&&(x=KD(p,s)),x!==null&&typeof A=="string"&&(A=x.createHTML(""));hn&&hn(L),Ot=L}},Rt=ot({},[...nm,...sm,...zD]),Mr=ot({},[...rm,...UD]),ea=function(L){let V=C(L);(!V||!V.tagName)&&(V={namespaceURI:ii,tagName:"template"});const E=hh(L.tagName),G=hh(V.tagName);return vn[L.namespaceURI]?L.namespaceURI===zi?V.namespaceURI===Ei?E==="svg":V.namespaceURI===Cs?E==="svg"&&(G==="annotation-xml"||On[G]):!!Rt[E]:L.namespaceURI===Cs?V.namespaceURI===Ei?E==="math":V.namespaceURI===zi?E==="math"&&es[G]:!!Mr[E]:L.namespaceURI===Ei?V.namespaceURI===zi&&!es[G]||V.namespaceURI===Cs&&!On[G]?!1:!Mr[E]&&(Dr[E]||!Rt[E]):!!(xn==="application/xhtml+xml"&&vn[L.namespaceURI]):!1},ts=function(L){lc(e.removed,{element:L});try{C(L).removeChild(L)}catch{g(L)}},di=function(L,V){try{lc(e.removed,{attribute:V.getAttributeNode(L),from:V})}catch{lc(e.removed,{attribute:null,from:V})}if(V.removeAttribute(L),L==="is")if(me||nt)try{ts(V)}catch{}else try{V.setAttribute(L,"")}catch{}},Bn=function(L){let V=null,E=null;if(Vt)L=""+L;else{const Ce=nx(L,/^[\r\n\t ]+/);E=Ce&&Ce[0]}xn==="application/xhtml+xml"&&ii===Ei&&(L=''+L+"");const G=x?x.createHTML(L):L;if(ii===Ei)try{V=new h().parseFromString(G,xn)}catch{}if(!V||!V.documentElement){V=I.createDocument(ii,"template",null);try{V.documentElement.innerHTML=bn?A:G}catch{}}const ne=V.body||V.documentElement;return L&&E&&ne.insertBefore(t.createTextNode(E),ne.childNodes[0]||null),ii===Ei?Z.call(V,He?"html":"body")[0]:He?V.documentElement:ne},wo=function(L){return O.call(L.ownerDocument||L,L,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ut=function(L){return L instanceof d&&(typeof L.nodeName!="string"||typeof L.textContent!="string"||typeof L.removeChild!="function"||!(L.attributes instanceof u)||typeof L.removeAttribute!="function"||typeof L.setAttribute!="function"||typeof L.namespaceURI!="string"||typeof L.insertBefore!="function"||typeof L.hasChildNodes!="function")},Or=function(L){return typeof a=="function"&&L instanceof a};function st(L,V,E){Sd(L,G=>{G.call(e,V,E,Ot)})}const wn=function(L){let V=null;if(st(M.beforeSanitizeElements,L,null),ut(L))return ts(L),!0;const E=Zt(L.nodeName);if(st(M.uponSanitizeElement,L,{tagName:E,allowedTags:Q}),We&&L.hasChildNodes()&&!Or(L.firstElementChild)&&sn(/<[/\w!]/g,L.innerHTML)&&sn(/<[/\w!]/g,L.textContent)||L.nodeType===hc.progressingInstruction||We&&L.nodeType===hc.comment&&sn(/<[/\w]/g,L.data))return ts(L),!0;if(!Q[E]||bt[E]){if(!bt[E]&&er(E)&&(de.tagNameCheck instanceof RegExp&&sn(de.tagNameCheck,E)||de.tagNameCheck instanceof Function&&de.tagNameCheck(E)))return!1;if(Zs&&!Ri[E]){const G=C(L)||L.parentNode,ne=S(L)||L.childNodes;if(ne&&G){const Ce=ne.length;for(let At=Ce-1;At>=0;--At){const rt=y(ne[At],!0);rt.__removalCount=(L.__removalCount||0)+1,G.insertBefore(rt,_(L))}}}return ts(L),!0}return L instanceof l&&!ea(L)||(E==="noscript"||E==="noembed"||E==="noframes")&&sn(/<\/no(script|embed|frames)/i,L.innerHTML)?(ts(L),!0):(q&&L.nodeType===hc.text&&(V=L.textContent,Sd([he,se,R],G=>{V=cc(V,G," ")}),L.textContent!==V&&(lc(e.removed,{element:L.cloneNode()}),L.textContent=V)),st(M.afterSanitizeElements,L,null),!1)},Br=function(L,V,E){if(_i&&(V==="id"||V==="name")&&(E in t||E in ks))return!1;if(!(re&&!Xe[V]&&sn(J,V))&&!(ht&&sn(F,V))){if(!xe[V]||Xe[V]){if(!(er(L)&&(de.tagNameCheck instanceof RegExp&&sn(de.tagNameCheck,L)||de.tagNameCheck instanceof Function&&de.tagNameCheck(L))&&(de.attributeNameCheck instanceof RegExp&&sn(de.attributeNameCheck,V)||de.attributeNameCheck instanceof Function&&de.attributeNameCheck(V))||V==="is"&&de.allowCustomizedBuiltInElements&&(de.tagNameCheck instanceof RegExp&&sn(de.tagNameCheck,E)||de.tagNameCheck instanceof Function&&de.tagNameCheck(E))))return!1}else if(!Qn[V]&&!sn(ae,cc(E,ie,""))&&!((V==="src"||V==="xlink:href"||V==="href")&&L!=="script"&&MD(E,"data:")===0&&vo[L])&&!(Te&&!sn(X,cc(E,ie,"")))&&E)return!1}return!0},er=function(L){return L!=="annotation-xml"&&nx(L,ee)},Fn=function(L){st(M.beforeSanitizeAttributes,L,null);const{attributes:V}=L;if(!V||ut(L))return;const E={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe,forceKeepAttr:void 0};let G=V.length;for(;G--;){const ne=V[G],{name:Ce,namespaceURI:At,value:rt}=ne,et=Zt(Ce),yi=rt;let ft=Ce==="value"?yi:OD(yi);if(E.attrName=et,E.attrValue=ft,E.keepAttr=!0,E.forceKeepAttr=void 0,st(M.uponSanitizeAttribute,L,E),ft=E.attrValue,Zn&&(et==="id"||et==="name")&&(di(Ce,L),ft=Qo+ft),We&&sn(/((--!?|])>)|<\/(style|title)/i,ft)){di(Ce,L);continue}if(E.forceKeepAttr)continue;if(!E.keepAttr){di(Ce,L);continue}if(!Pe&&sn(/\/>/i,ft)){di(Ce,L);continue}q&&Sd([he,se,R],Bt=>{ft=cc(ft,Bt," ")});const tr=Zt(L.nodeName);if(!Br(tr,et,ft)){di(Ce,L);continue}if(x&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!At)switch(p.getAttributeType(tr,et)){case"TrustedHTML":{ft=x.createHTML(ft);break}case"TrustedScriptURL":{ft=x.createScriptURL(ft);break}}if(ft!==yi)try{At?L.setAttributeNS(At,Ce,ft):L.setAttribute(Ce,ft),ut(L)?ts(L):ix(e.removed)}catch{di(Ce,L)}}st(M.afterSanitizeAttributes,L,null)},tn=function L(V){let E=null;const G=wo(V);for(st(M.beforeSanitizeShadowDOM,V,null);E=G.nextNode();)st(M.uponSanitizeShadowNode,E,null),wn(E),Fn(E),E.content instanceof r&&L(E.content);st(M.afterSanitizeShadowDOM,V,null)};return e.sanitize=function(L){let V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,G=null,ne=null,Ce=null;if(bn=!L,bn&&(L=""),typeof L!="string"&&!Or(L))if(typeof L.toString=="function"){if(L=L.toString(),typeof L!="string")throw uc("dirty is not a string, aborting")}else throw uc("toString is not a function");if(!e.isSupported)return L;if(it||Js(V),e.removed=[],typeof L=="string"&&(Li=!1),Li){if(L.nodeName){const et=Zt(L.nodeName);if(!Q[et]||bt[et])throw uc("root node is forbidden and cannot be sanitized in-place")}}else if(L instanceof a)E=Bn(""),G=E.ownerDocument.importNode(L,!0),G.nodeType===hc.element&&G.nodeName==="BODY"||G.nodeName==="HTML"?E=G:E.appendChild(G);else{if(!me&&!q&&!He&&L.indexOf("<")===-1)return x&&ui?x.createHTML(L):L;if(E=Bn(L),!E)return me?null:ui?A:""}E&&Vt&&ts(E.firstChild);const At=wo(Li?L:E);for(;ne=At.nextNode();)wn(ne),Fn(ne),ne.content instanceof r&&tn(ne.content);if(Li)return L;if(me){if(nt)for(Ce=H.call(E.ownerDocument);E.firstChild;)Ce.appendChild(E.firstChild);else Ce=E;return(xe.shadowroot||xe.shadowrootmode)&&(Ce=te.call(n,Ce,!0)),Ce}let rt=He?E.outerHTML:E.innerHTML;return He&&Q["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&sn(D2,E.ownerDocument.doctype.name)&&(rt=" +`,l.style.top="10px",l.style.left="10px",l.style.position="absolute",l.style.zIndex="9999",l.style.width="100%",l.style.textAlign="left",document.body.appendChild(l),(n=document.getElementsByClassName("luma-compiler-log-error")[0])==null||n.scrollIntoView(),l.onclick=()=>{const c=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(c)}}};$(v2,"defaultProps",{..._n.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});let ON=v2;function BN(i){return FN(i.source)||i.id||hy(`unnamed ${i.stage}-shader`)}function FN(i,e="unnamed"){const t=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(i);return t?t[1]:e}const w2=class S2 extends _n{constructor(e,t){super(e,t,S2.defaultProps),$(this,"shaderLayout"),$(this,"bufferLayout"),$(this,"linkStatus","pending"),$(this,"hash",""),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}get[Symbol.toStringTag](){return"RenderPipeline"}};$(w2,"defaultProps",{..._n.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",colorAttachmentFormats:void 0,depthStencilAttachmentFormat:void 0,parameters:{},bindings:{},uniforms:{}});let Zh=w2;const E2=class C2 extends _n{constructor(e,t){super(e,t,C2.defaultProps),$(this,"hash",""),$(this,"shaderLayout"),this.shaderLayout=t.shaderLayout}get[Symbol.toStringTag](){return"ComputePipeline"}};$(E2,"defaultProps",{..._n.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});let Q0=E2;function zN(i){return HN[i]}function UN(i){const[e,t]=jN[i],n=e==="i32"||e==="u32",s=e!=="u32",r=$N[e]*t;return{primitiveType:e,components:t,byteLength:r,integer:n,signed:s}}const $N={f32:4,f16:2,i32:4,u32:4},jN={f32:["f32",1],"vec2":["f32",2],"vec3":["f32",3],"vec4":["f32",4],f16:["f16",1],"vec2":["f16",2],"vec3":["f16",3],"vec4":["f16",4],i32:["i32",1],"vec2":["i32",2],"vec3":["i32",3],"vec4":["i32",4],u32:["u32",1],"vec2":["u32",2],"vec3":["u32",3],"vec4":["u32",4]},HN={f32:{type:"f32",components:1},f16:{type:"f16",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2":{type:"f32",components:2},"vec3":{type:"f32",components:3},"vec4":{type:"f32",components:4},"vec2":{type:"f16",components:2},"vec3":{type:"f16",components:3},"vec4":{type:"f16",components:4},"vec2":{type:"i32",components:2},"vec3":{type:"i32",components:3},"vec4":{type:"i32",components:4},"vec2":{type:"u32",components:2},"vec3":{type:"u32",components:3},"vec4":{type:"u32",components:4},"mat2x2":{type:"f32",components:4},"mat2x3":{type:"f32",components:6},"mat2x4":{type:"f32",components:8},"mat3x2":{type:"f32",components:6},"mat3x3":{type:"f32",components:9},"mat3x4":{type:"f32",components:12},"mat4x2":{type:"f32",components:8},"mat4x3":{type:"f32",components:12},"mat4x4":{type:"f32",components:16},"mat2x2":{type:"f16",components:4},"mat2x3":{type:"f16",components:6},"mat2x4":{type:"f16",components:8},"mat3x2":{type:"f16",components:6},"mat3x3":{type:"f16",components:9},"mat3x4":{type:"f16",components:12},"mat4x2":{type:"f16",components:8},"mat4x3":{type:"f16",components:12},"mat4x4":{type:"f16",components:16},"mat2x2":{type:"i32",components:4},"mat2x3":{type:"i32",components:6},"mat2x4":{type:"i32",components:8},"mat3x2":{type:"i32",components:6},"mat3x3":{type:"i32",components:9},"mat3x4":{type:"i32",components:12},"mat4x2":{type:"i32",components:8},"mat4x3":{type:"i32",components:12},"mat4x4":{type:"i32",components:16},"mat2x2":{type:"u32",components:4},"mat2x3":{type:"u32",components:6},"mat2x4":{type:"u32",components:8},"mat3x2":{type:"u32",components:6},"mat3x3":{type:"u32",components:9},"mat3x4":{type:"u32",components:12},"mat4x2":{type:"u32",components:8},"mat4x3":{type:"u32",components:12},"mat4x4":{type:"u32",components:16}};function T2(i,e){const t={};for(const n of i.attributes){const s=VN(i,e,n.name);s&&(t[n.name]=s)}return t}function Rte(i,e,t=16){const n=T2(i,e),s=new Array(t).fill(null);for(const r of Object.values(n))s[r.location]=r;return s}function VN(i,e,t){const n=GN(i,t),s=WN(e,t);if(!n)return null;const r=UN(n.type),o=uN(r),a=(s==null?void 0:s.vertexFormat)||o,l=py(a);return{attributeName:(s==null?void 0:s.attributeName)||n.name,bufferName:(s==null?void 0:s.bufferName)||n.name,location:n.location,shaderType:n.type,primitiveType:r.primitiveType,shaderComponents:r.components,vertexFormat:a,bufferDataType:l.type,bufferComponents:l.components,normalized:l.normalized,integer:r.integer,stepMode:(s==null?void 0:s.stepMode)||n.stepMode||"vertex",byteOffset:(s==null?void 0:s.byteOffset)||0,byteStride:(s==null?void 0:s.byteStride)||0}}function GN(i,e){const t=i.attributes.find(n=>n.name===e);return t||le.warn(`shader layout attribute "${e}" not present in shader`),t||null}function WN(i,e){YN(i);let t=qN(i,e);return t||(t=XN(i,e),t)?t:(le.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function YN(i){for(const e of i)(e.attributes&&e.format||!e.attributes&&!e.format)&&le.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function qN(i,e){for(const t of i)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function XN(i,e){var t;for(const n of i){let s=n.byteStride;if(typeof n.byteStride!="number")for(const o of n.attributes||[]){const a=py(o.format);s+=a.byteLength}const r=(t=n.attributes)==null?void 0:t.find(o=>o.attribute===e);if(r)return{attributeName:r.attribute,bufferName:n.name,stepMode:n.stepMode,vertexFormat:r.format,byteOffset:r.byteOffset,byteStride:s}}return null}let xd;function k2(i){return(!xd||xd.byteLengthr.type==="uniform"&&r.name===(e==null?void 0:e.name));if(!n)throw new Error(e==null?void 0:e.name);const s=n;for(const r of s.uniforms||[])this.bindingLayout[r.name]=r}}setUniforms(e){for(const[t,n]of Object.entries(e))this._setUniform(t,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${n}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){JN(this.uniforms[e],t)||(this.uniforms[e]=eD(t),this.modifiedUniforms[e]=!0,this.modified=!0)}}let ri=class{constructor(e){$(this,"uniformBlocks",new Map),$(this,"uniformBufferLayouts",new Map),$(this,"uniformBuffers",new Map);for(const[t,n]of Object.entries(e)){const s=t,r=new QN(n.uniformTypes??{},n.uniformSizes??{});this.uniformBufferLayouts.set(s,r);const o=new tD({name:t});o.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(s,o)}}destroy(){for(const e of this.uniformBuffers.values())e.destroy()}setUniforms(e){var t;for(const[n,s]of Object.entries(e))(t=this.uniformBlocks.get(n))==null||t.setUniforms(s);this.updateUniformBuffers()}getUniformBufferByteLength(e){var t;return((t=this.uniformBufferLayouts.get(e))==null?void 0:t.byteLength)||0}getUniformBufferData(e){var t,n;const s=((t=this.uniformBlocks.get(e))==null?void 0:t.getAllUniforms())||{};return(n=this.uniformBufferLayouts.get(e))==null?void 0:n.getData(s)}createUniformBuffer(e,t,n){n&&this.setUniforms(n);const s=this.getUniformBufferByteLength(t),r=e.createBuffer({usage:ge.UNIFORM|ge.COPY_DST,byteLength:s}),o=this.getUniformBufferData(t);return r.write(o),r}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){const n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:ge.UNIFORM|ge.COPY_DST,byteLength:n});this.uniformBuffers.set(t,s)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(const t of this.uniformBlocks.keys()){const n=this.updateUniformBuffer(t);e||(e=n)}return e&&le.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){var t;const n=this.uniformBlocks.get(e);let s=this.uniformBuffers.get(e),r=!1;if(s&&n!=null&&n.needsRedraw){r||(r=n.needsRedraw);const o=this.getUniformBufferData(e);s=this.uniformBuffers.get(e),s==null||s.write(o);const a=(t=this.uniformBlocks.get(e))==null?void 0:t.getAllUniforms();le.log(4,`Writing to uniform buffer ${String(e)}`,o,a)()}return r}};var Do;(function(i){i[i.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",i[i.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",i[i.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i[i.ZERO=0]="ZERO",i[i.ONE=1]="ONE",i[i.SRC_COLOR=768]="SRC_COLOR",i[i.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",i[i.SRC_ALPHA=770]="SRC_ALPHA",i[i.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",i[i.DST_ALPHA=772]="DST_ALPHA",i[i.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",i[i.DST_COLOR=774]="DST_COLOR",i[i.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",i[i.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",i[i.CONSTANT_COLOR=32769]="CONSTANT_COLOR",i[i.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",i[i.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",i[i.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",i[i.FUNC_ADD=32774]="FUNC_ADD",i[i.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",i[i.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",i[i.BLEND_EQUATION=32777]="BLEND_EQUATION",i[i.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",i[i.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",i[i.BLEND_DST_RGB=32968]="BLEND_DST_RGB",i[i.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",i[i.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",i[i.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",i[i.BLEND_COLOR=32773]="BLEND_COLOR",i[i.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",i[i.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",i[i.LINE_WIDTH=2849]="LINE_WIDTH",i[i.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",i[i.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",i[i.CULL_FACE_MODE=2885]="CULL_FACE_MODE",i[i.FRONT_FACE=2886]="FRONT_FACE",i[i.DEPTH_RANGE=2928]="DEPTH_RANGE",i[i.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",i[i.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",i[i.DEPTH_FUNC=2932]="DEPTH_FUNC",i[i.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",i[i.STENCIL_FUNC=2962]="STENCIL_FUNC",i[i.STENCIL_FAIL=2964]="STENCIL_FAIL",i[i.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",i[i.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",i[i.STENCIL_REF=2967]="STENCIL_REF",i[i.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",i[i.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",i[i.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",i[i.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",i[i.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",i[i.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",i[i.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",i[i.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",i[i.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",i[i.VIEWPORT=2978]="VIEWPORT",i[i.SCISSOR_BOX=3088]="SCISSOR_BOX",i[i.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",i[i.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",i[i.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",i[i.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",i[i.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",i[i.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",i[i.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",i[i.RED_BITS=3410]="RED_BITS",i[i.GREEN_BITS=3411]="GREEN_BITS",i[i.BLUE_BITS=3412]="BLUE_BITS",i[i.ALPHA_BITS=3413]="ALPHA_BITS",i[i.DEPTH_BITS=3414]="DEPTH_BITS",i[i.STENCIL_BITS=3415]="STENCIL_BITS",i[i.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",i[i.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",i[i.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",i[i.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",i[i.SAMPLES=32937]="SAMPLES",i[i.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",i[i.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",i[i.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",i[i.VENDOR=7936]="VENDOR",i[i.RENDERER=7937]="RENDERER",i[i.VERSION=7938]="VERSION",i[i.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",i[i.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",i[i.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",i[i.STATIC_DRAW=35044]="STATIC_DRAW",i[i.STREAM_DRAW=35040]="STREAM_DRAW",i[i.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.BUFFER_SIZE=34660]="BUFFER_SIZE",i[i.BUFFER_USAGE=34661]="BUFFER_USAGE",i[i.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",i[i.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",i[i.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",i[i.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",i[i.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",i[i.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",i[i.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",i[i.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",i[i.CULL_FACE=2884]="CULL_FACE",i[i.FRONT=1028]="FRONT",i[i.BACK=1029]="BACK",i[i.FRONT_AND_BACK=1032]="FRONT_AND_BACK",i[i.BLEND=3042]="BLEND",i[i.DEPTH_TEST=2929]="DEPTH_TEST",i[i.DITHER=3024]="DITHER",i[i.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",i[i.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",i[i.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",i[i.SCISSOR_TEST=3089]="SCISSOR_TEST",i[i.STENCIL_TEST=2960]="STENCIL_TEST",i[i.NO_ERROR=0]="NO_ERROR",i[i.INVALID_ENUM=1280]="INVALID_ENUM",i[i.INVALID_VALUE=1281]="INVALID_VALUE",i[i.INVALID_OPERATION=1282]="INVALID_OPERATION",i[i.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",i[i.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",i[i.CW=2304]="CW",i[i.CCW=2305]="CCW",i[i.DONT_CARE=4352]="DONT_CARE",i[i.FASTEST=4353]="FASTEST",i[i.NICEST=4354]="NICEST",i[i.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",i[i.BYTE=5120]="BYTE",i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.SHORT=5122]="SHORT",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.INT=5124]="INT",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.FLOAT=5126]="FLOAT",i[i.DOUBLE=5130]="DOUBLE",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.ALPHA=6406]="ALPHA",i[i.RGB=6407]="RGB",i[i.RGBA=6408]="RGBA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",i[i.VERTEX_SHADER=35633]="VERTEX_SHADER",i[i.COMPILE_STATUS=35713]="COMPILE_STATUS",i[i.DELETE_STATUS=35712]="DELETE_STATUS",i[i.LINK_STATUS=35714]="LINK_STATUS",i[i.VALIDATE_STATUS=35715]="VALIDATE_STATUS",i[i.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",i[i.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",i[i.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",i[i.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",i[i.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",i[i.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",i[i.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",i[i.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",i[i.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",i[i.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",i[i.SHADER_TYPE=35663]="SHADER_TYPE",i[i.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",i[i.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",i[i.NEVER=512]="NEVER",i[i.LESS=513]="LESS",i[i.EQUAL=514]="EQUAL",i[i.LEQUAL=515]="LEQUAL",i[i.GREATER=516]="GREATER",i[i.NOTEQUAL=517]="NOTEQUAL",i[i.GEQUAL=518]="GEQUAL",i[i.ALWAYS=519]="ALWAYS",i[i.KEEP=7680]="KEEP",i[i.REPLACE=7681]="REPLACE",i[i.INCR=7682]="INCR",i[i.DECR=7683]="DECR",i[i.INVERT=5386]="INVERT",i[i.INCR_WRAP=34055]="INCR_WRAP",i[i.DECR_WRAP=34056]="DECR_WRAP",i[i.NEAREST=9728]="NEAREST",i[i.LINEAR=9729]="LINEAR",i[i.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",i[i.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",i[i.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",i[i.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",i[i.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",i[i.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",i[i.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",i[i.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE=5890]="TEXTURE",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i[i.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",i[i.TEXTURE0=33984]="TEXTURE0",i[i.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",i[i.REPEAT=10497]="REPEAT",i[i.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i[i.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",i[i.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",i[i.FLOAT_VEC2=35664]="FLOAT_VEC2",i[i.FLOAT_VEC3=35665]="FLOAT_VEC3",i[i.FLOAT_VEC4=35666]="FLOAT_VEC4",i[i.INT_VEC2=35667]="INT_VEC2",i[i.INT_VEC3=35668]="INT_VEC3",i[i.INT_VEC4=35669]="INT_VEC4",i[i.BOOL=35670]="BOOL",i[i.BOOL_VEC2=35671]="BOOL_VEC2",i[i.BOOL_VEC3=35672]="BOOL_VEC3",i[i.BOOL_VEC4=35673]="BOOL_VEC4",i[i.FLOAT_MAT2=35674]="FLOAT_MAT2",i[i.FLOAT_MAT3=35675]="FLOAT_MAT3",i[i.FLOAT_MAT4=35676]="FLOAT_MAT4",i[i.SAMPLER_2D=35678]="SAMPLER_2D",i[i.SAMPLER_CUBE=35680]="SAMPLER_CUBE",i[i.LOW_FLOAT=36336]="LOW_FLOAT",i[i.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",i[i.HIGH_FLOAT=36338]="HIGH_FLOAT",i[i.LOW_INT=36339]="LOW_INT",i[i.MEDIUM_INT=36340]="MEDIUM_INT",i[i.HIGH_INT=36341]="HIGH_INT",i[i.FRAMEBUFFER=36160]="FRAMEBUFFER",i[i.RENDERBUFFER=36161]="RENDERBUFFER",i[i.RGBA4=32854]="RGBA4",i[i.RGB5_A1=32855]="RGB5_A1",i[i.RGB565=36194]="RGB565",i[i.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",i[i.STENCIL_INDEX=6401]="STENCIL_INDEX",i[i.STENCIL_INDEX8=36168]="STENCIL_INDEX8",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i[i.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",i[i.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",i[i.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",i[i.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",i[i.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",i[i.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",i[i.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",i[i.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",i[i.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",i[i.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",i[i.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",i[i.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",i[i.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",i[i.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",i[i.NONE=0]="NONE",i[i.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",i[i.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",i[i.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",i[i.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",i[i.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",i[i.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",i[i.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",i[i.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",i[i.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",i[i.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",i[i.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",i[i.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",i[i.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",i[i.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",i[i.READ_BUFFER=3074]="READ_BUFFER",i[i.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",i[i.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",i[i.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",i[i.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",i[i.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",i[i.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",i[i.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",i[i.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",i[i.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",i[i.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",i[i.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",i[i.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",i[i.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",i[i.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",i[i.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",i[i.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",i[i.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",i[i.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",i[i.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",i[i.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",i[i.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",i[i.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",i[i.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",i[i.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",i[i.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",i[i.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",i[i.RED=6403]="RED",i[i.RGB8=32849]="RGB8",i[i.RGBA8=32856]="RGBA8",i[i.RGB10_A2=32857]="RGB10_A2",i[i.TEXTURE_3D=32879]="TEXTURE_3D",i[i.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",i[i.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",i[i.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",i[i.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",i[i.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",i[i.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",i[i.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",i[i.SRGB=35904]="SRGB",i[i.SRGB8=35905]="SRGB8",i[i.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",i[i.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",i[i.RGBA32F=34836]="RGBA32F",i[i.RGB32F=34837]="RGB32F",i[i.RGBA16F=34842]="RGBA16F",i[i.RGB16F=34843]="RGB16F",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",i[i.R11F_G11F_B10F=35898]="R11F_G11F_B10F",i[i.RGB9_E5=35901]="RGB9_E5",i[i.RGBA32UI=36208]="RGBA32UI",i[i.RGB32UI=36209]="RGB32UI",i[i.RGBA16UI=36214]="RGBA16UI",i[i.RGB16UI=36215]="RGB16UI",i[i.RGBA8UI=36220]="RGBA8UI",i[i.RGB8UI=36221]="RGB8UI",i[i.RGBA32I=36226]="RGBA32I",i[i.RGB32I=36227]="RGB32I",i[i.RGBA16I=36232]="RGBA16I",i[i.RGB16I=36233]="RGB16I",i[i.RGBA8I=36238]="RGBA8I",i[i.RGB8I=36239]="RGB8I",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.R8=33321]="R8",i[i.RG8=33323]="RG8",i[i.R16F=33325]="R16F",i[i.R32F=33326]="R32F",i[i.RG16F=33327]="RG16F",i[i.RG32F=33328]="RG32F",i[i.R8I=33329]="R8I",i[i.R8UI=33330]="R8UI",i[i.R16I=33331]="R16I",i[i.R16UI=33332]="R16UI",i[i.R32I=33333]="R32I",i[i.R32UI=33334]="R32UI",i[i.RG8I=33335]="RG8I",i[i.RG8UI=33336]="RG8UI",i[i.RG16I=33337]="RG16I",i[i.RG16UI=33338]="RG16UI",i[i.RG32I=33339]="RG32I",i[i.RG32UI=33340]="RG32UI",i[i.R8_SNORM=36756]="R8_SNORM",i[i.RG8_SNORM=36757]="RG8_SNORM",i[i.RGB8_SNORM=36758]="RGB8_SNORM",i[i.RGBA8_SNORM=36759]="RGBA8_SNORM",i[i.RGB10_A2UI=36975]="RGB10_A2UI",i[i.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",i[i.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.HALF_FLOAT=5131]="HALF_FLOAT",i[i.RG=33319]="RG",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",i[i.CURRENT_QUERY=34917]="CURRENT_QUERY",i[i.QUERY_RESULT=34918]="QUERY_RESULT",i[i.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",i[i.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",i[i.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",i[i.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",i[i.DRAW_BUFFER0=34853]="DRAW_BUFFER0",i[i.DRAW_BUFFER1=34854]="DRAW_BUFFER1",i[i.DRAW_BUFFER2=34855]="DRAW_BUFFER2",i[i.DRAW_BUFFER3=34856]="DRAW_BUFFER3",i[i.DRAW_BUFFER4=34857]="DRAW_BUFFER4",i[i.DRAW_BUFFER5=34858]="DRAW_BUFFER5",i[i.DRAW_BUFFER6=34859]="DRAW_BUFFER6",i[i.DRAW_BUFFER7=34860]="DRAW_BUFFER7",i[i.DRAW_BUFFER8=34861]="DRAW_BUFFER8",i[i.DRAW_BUFFER9=34862]="DRAW_BUFFER9",i[i.DRAW_BUFFER10=34863]="DRAW_BUFFER10",i[i.DRAW_BUFFER11=34864]="DRAW_BUFFER11",i[i.DRAW_BUFFER12=34865]="DRAW_BUFFER12",i[i.DRAW_BUFFER13=34866]="DRAW_BUFFER13",i[i.DRAW_BUFFER14=34867]="DRAW_BUFFER14",i[i.DRAW_BUFFER15=34868]="DRAW_BUFFER15",i[i.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",i[i.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",i[i.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",i[i.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",i[i.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",i[i.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",i[i.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",i[i.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",i[i.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",i[i.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",i[i.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",i[i.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",i[i.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",i[i.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",i[i.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",i[i.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",i[i.SAMPLER_3D=35679]="SAMPLER_3D",i[i.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",i[i.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",i[i.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",i[i.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",i[i.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",i[i.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",i[i.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",i[i.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",i[i.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",i[i.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",i[i.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",i[i.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",i[i.MAX_SAMPLES=36183]="MAX_SAMPLES",i[i.SAMPLER_BINDING=35097]="SAMPLER_BINDING",i[i.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",i[i.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",i[i.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",i[i.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",i[i.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",i[i.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",i[i.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",i[i.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",i[i.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",i[i.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",i[i.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",i[i.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",i[i.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",i[i.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",i[i.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",i[i.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",i[i.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",i[i.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",i[i.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",i[i.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",i[i.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",i[i.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",i[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",i[i.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",i[i.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",i[i.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",i[i.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",i[i.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",i[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",i[i.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",i[i.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",i[i.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",i[i.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",i[i.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",i[i.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",i[i.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",i[i.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",i[i.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",i[i.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",i[i.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",i[i.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",i[i.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",i[i.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",i[i.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",i[i.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",i[i.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",i[i.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",i[i.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i[i.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",i[i.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",i[i.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",i[i.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",i[i.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",i[i.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",i[i.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",i[i.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",i[i.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",i[i.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",i[i.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",i[i.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",i[i.UNIFORM_TYPE=35383]="UNIFORM_TYPE",i[i.UNIFORM_SIZE=35384]="UNIFORM_SIZE",i[i.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",i[i.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",i[i.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",i[i.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",i[i.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",i[i.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",i[i.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",i[i.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",i[i.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",i[i.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",i[i.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",i[i.OBJECT_TYPE=37138]="OBJECT_TYPE",i[i.SYNC_CONDITION=37139]="SYNC_CONDITION",i[i.SYNC_STATUS=37140]="SYNC_STATUS",i[i.SYNC_FLAGS=37141]="SYNC_FLAGS",i[i.SYNC_FENCE=37142]="SYNC_FENCE",i[i.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",i[i.UNSIGNALED=37144]="UNSIGNALED",i[i.SIGNALED=37145]="SIGNALED",i[i.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",i[i.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",i[i.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",i[i.WAIT_FAILED=37149]="WAIT_FAILED",i[i.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",i[i.COLOR=6144]="COLOR",i[i.DEPTH=6145]="DEPTH",i[i.STENCIL=6146]="STENCIL",i[i.MIN=32775]="MIN",i[i.MAX=32776]="MAX",i[i.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",i[i.STREAM_READ=35041]="STREAM_READ",i[i.STREAM_COPY=35042]="STREAM_COPY",i[i.STATIC_READ=35045]="STATIC_READ",i[i.STATIC_COPY=35046]="STATIC_COPY",i[i.DYNAMIC_READ=35049]="DYNAMIC_READ",i[i.DYNAMIC_COPY=35050]="DYNAMIC_COPY",i[i.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",i[i.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",i[i.INVALID_INDEX=4294967295]="INVALID_INDEX",i[i.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",i[i.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",i[i.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",i[i.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",i[i.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",i[i.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",i[i.R16_EXT=33322]="R16_EXT",i[i.RG16_EXT=33324]="RG16_EXT",i[i.RGB16_EXT=32852]="RGB16_EXT",i[i.RGBA16_EXT=32859]="RGBA16_EXT",i[i.R16_SNORM_EXT=36760]="R16_SNORM_EXT",i[i.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",i[i.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",i[i.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",i[i.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",i[i.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",i[i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",i[i.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",i[i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",i[i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",i[i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i[i.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",i[i.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",i[i.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",i[i.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",i[i.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",i[i.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",i[i.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",i[i.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",i[i.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",i[i.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",i[i.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",i[i.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",i[i.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",i[i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",i[i.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",i[i.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",i[i.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",i[i.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",i[i.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",i[i.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",i[i.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",i[i.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",i[i.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",i[i.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",i[i.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",i[i.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",i[i.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",i[i.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",i[i.LINE_WEBGL=6913]="LINE_WEBGL",i[i.FILL_WEBGL=6914]="FILL_WEBGL",i[i.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",i[i.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",i[i.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",i[i.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",i[i.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",i[i.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",i[i.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",i[i.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",i[i.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",i[i.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",i[i.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",i[i.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",i[i.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",i[i.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",i[i.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",i[i.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",i[i.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",i[i.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",i[i.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",i[i.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",i[i.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",i[i.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",i[i.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",i[i.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(Do||(Do={}));const iD={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}},nD=i=>({drawBuffersWEBGL(e){return i.drawBuffers(e)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),sD=i=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return i.createVertexArray()},deleteVertexArrayOES(e){return i.deleteVertexArray(e)},isVertexArrayOES(e){return i.isVertexArray(e)},bindVertexArrayOES(e){return i.bindVertexArray(e)}}),rD=i=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...e){return i.drawArraysInstanced(...e)},drawElementsInstancedANGLE(...e){return i.drawElementsInstanced(...e)},vertexAttribDivisorANGLE(...e){return i.vertexAttribDivisor(...e)}});function oD(i=!0){const e=HTMLCanvasElement.prototype;if(!i&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(t,n){if(t==="webgl"||t==="experimental-webgl"){const s=this.originalGetContext("webgl2",n);return s instanceof HTMLElement&&aD(s),s}return this.originalGetContext(t,n)}}function aD(i){i.getExtension("EXT_color_buffer_float");const e={...iD,WEBGL_disjoint_timer_query:i.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:nD(i),OES_vertex_array_object:sD(i),ANGLE_instanced_arrays:rD(i)},t=i.getExtension;i.getExtension=function(s){return t.call(i,s)||(s in e?e[s]:null)};const n=i.getSupportedExtensions;i.getSupportedExtensions=function(){const s=n.apply(i)||[];return s==null?void 0:s.concat(Object.keys(e))}}async function A2(i,e){const t=document.getElementsByTagName("head")[0];if(!t)throw new Error("loadScript");const n=document.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",i),new Promise((s,r)=>{n.onload=s,n.onerror=o=>r(new Error(`Unable to load script '${i}': ${o}`)),t.appendChild(n)})}const lD=1;let hi=null,J0=!1;const gy={debugSpectorJS:le.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/spectorjs@0.9.30/dist/spector.bundle.js",gl:void 0};async function cD(i){if(!globalThis.SPECTOR)try{await A2(i.debugSpectorJSUrl||gy.debugSpectorJSUrl)}catch(e){le.warn(String(e))}}function Dte(i){var e;if(i={...gy,...i},!i.debugSpectorJS)return null;if(!hi&&globalThis.SPECTOR&&!((e=globalThis.luma)!=null&&e.spector)){le.probe(lD,"SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();const{Spector:t}=globalThis.SPECTOR;hi=new t,globalThis.luma&&(globalThis.luma.spector=hi)}if(!hi)return null;if(J0||(J0=!0,hi.spyCanvases(),hi==null||hi.onCaptureStarted.add(t=>le.info("Spector capture started:",t)()),hi==null||hi.onCapture.add(t=>{le.info("Spector capture complete:",t)(),hi==null||hi.getResultUI(),hi==null||hi.resultView.display(),hi==null||hi.resultView.addCapture(t)})),i.gl){const t=i.gl,n=t.device;hi==null||hi.startCapture(i.gl,500),t.device=n,new Promise(s=>setTimeout(s,2e3)).then(s=>{le.info("Spector capture stopped after 2 seconds")(),hi==null||hi.stopCapture()})}return hi}const uD="https://unpkg.com/webgl-debug@2.0.1/index.js";function I2(i){return i.luma=i.luma||{},i.luma}async function dD(){Vu()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await A2(uD))}function Mte(i,e={}){return e.debugWebGL||e.traceWebGL?fD(i,e):hD(i)}function hD(i){const e=I2(i);return e.realContext?e.realContext:i}function fD(i,e){if(!globalThis.WebGLDebugUtils)return le.warn("webgl-debug not loaded")(),i;const t=I2(i);if(t.debugContext)return t.debugContext;globalThis.WebGLDebugUtils.init({...Do,...i});const n=globalThis.WebGLDebugUtils.makeDebugContext(i,pD.bind(null,e),mD.bind(null,e));for(const o in Do)!(o in n)&&typeof Do[o]=="number"&&(n[o]=Do[o]);class s{}Object.setPrototypeOf(n,Object.getPrototypeOf(i)),Object.setPrototypeOf(s,n);const r=Object.create(s);return t.realContext=i,t.debugContext=r,r.debug=!0,r}function ex(i,e){e=Array.from(e).map(n=>n===void 0?"undefined":n);let t=globalThis.WebGLDebugUtils.glFunctionArgsToString(i,e);return t=`${t.slice(0,100)}${t.length>100?"...":""}`,`gl.${i}(${t})`}function pD(i,e,t,n){n=Array.from(n).map(a=>a===void 0?"undefined":a);const s=globalThis.WebGLDebugUtils.glEnumToString(e),r=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,n),o=`${s} in gl.${t}(${r})`;le.error(o)();debugger}function mD(i,e,t){let n="";le.level>=1&&(n=ex(e,t),i.traceWebGL&&le.log(1,n)());for(const s of t)if(s===void 0){n=n||ex(e,t);debugger}}const wd=1;class gD extends TN{constructor(){super(),$(this,"type","webgl"),Eg.defaultProps={...Eg.defaultProps,...gy}}enforceWebGL2(e){oD(e)}isSupported(){return typeof WebGL2RenderingContext<"u"}isDeviceHandle(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:(typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext&&le.warn("WebGL1 is not supported",e)(),!1)}async attach(e,t={}){const{WebGLDevice:n}=await p0(async()=>{const{WebGLDevice:r}=await import("./webgl-device-QoBMYpnS-DoprwXHO.js");return{WebGLDevice:r}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]));if(e instanceof n)return e;if((e==null?void 0:e.device)instanceof n)return e.device;if(!_D(e))throw new Error("Invalid WebGL2RenderingContext");const s=t.createCanvasContext===!0?{}:t.createCanvasContext;return new n({...t,_handle:e,createCanvasContext:{canvas:e.canvas,autoResize:!1,...s}})}async create(e={}){const{WebGLDevice:t}=await p0(async()=>{const{WebGLDevice:n}=await import("./webgl-device-QoBMYpnS-DoprwXHO.js");return{WebGLDevice:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]));le.groupCollapsed(wd,"WebGLDevice created")();try{const n=[];(e.debugWebGL||e.debug)&&n.push(dD()),e.debugSpectorJS&&n.push(cD(e));const s=await Promise.allSettled(n);for(const a of s)a.status==="rejected"&&le.error(`Failed to initialize debug libraries ${a.reason}`)();const r=new t(e),o=`${r._reused?"Reusing":"Created"} device with WebGL2 ${r.props.debug?"debug ":""}context: ${r.info.vendor}, ${r.info.renderer} for canvas: ${r.canvasContext.id}`;return le.probe(wd,o)(),le.table(wd,r.info)(),r}finally{le.groupEnd(wd)()}}}function _D(i){return typeof WebGL2RenderingContext<"u"&&i instanceof WebGL2RenderingContext?!0:!!(i&&Number.isFinite(i._version))}const yD=new gD,bD="#b3b3b3",vD=void 0,kg=void 0,xD=1,wD=4,SD="#666666",ED=.1,CD=1,TD=1,L2="#222222",pe={enableSimulation:!0,spaceSize:8192,pointSizeScale:1,linkWidthScale:1,linkArrowsSizeScale:1,renderLinks:!0,curvedLinks:!1,curvedLinkSegments:19,curvedLinkWeight:.8,curvedLinkControlPointDistance:.5,linkArrows:!1,linkVisibilityDistanceRange:[50,150],linkVisibilityMinTransparency:.25,hoveredPointCursor:"auto",hoveredLinkCursor:"auto",renderHoveredPointRing:!1,hoveredPointRingColor:"white",hoveredLinkColor:void 0,hoveredLinkWidthIncrease:5,focusedPointRingColor:"white",focusedPointIndex:void 0,simulation:{decay:5e3,gravity:.25,center:0,repulsion:1,repulsionTheta:1.15,linkSpring:1,linkDistance:10,linkDistRandomVariationRange:[1,1.2],repulsionFromMouse:2,friction:.85,cluster:.1},showFPSMonitor:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||2,scalePointsOnZoom:!1,scaleLinksOnZoom:!1,enableZoom:!0,enableSimulationDuringZoom:!1,enableDrag:!1,fitViewOnInit:!0,fitViewDelay:250,fitViewPadding:.1,fitViewDuration:250,pointSamplingDistance:150,attribution:"",rescalePositions:void 0,enableRightClickRepulsion:!1},kD=.7,AD=.95,ID=3;/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:R2,setPrototypeOf:tx,isFrozen:LD,getPrototypeOf:RD,getOwnPropertyDescriptor:PD}=Object;let{freeze:hn,seal:_s,create:P2}=Object,{apply:Ag,construct:Ig}=typeof Reflect<"u"&&Reflect;hn||(hn=function(i){return i});_s||(_s=function(i){return i});Ag||(Ag=function(i,e,t){return i.apply(e,t)});Ig||(Ig=function(i,e){return new i(...e)});const Sd=fn(Array.prototype.forEach),ND=fn(Array.prototype.lastIndexOf),ix=fn(Array.prototype.pop),lc=fn(Array.prototype.push),DD=fn(Array.prototype.splice),hh=fn(String.prototype.toLowerCase),im=fn(String.prototype.toString),nx=fn(String.prototype.match),cc=fn(String.prototype.replace),MD=fn(String.prototype.indexOf),OD=fn(String.prototype.trim),Ms=fn(Object.prototype.hasOwnProperty),sn=fn(RegExp.prototype.test),uc=BD(TypeError);function fn(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s2&&arguments[2]!==void 0?arguments[2]:hh;tx&&tx(i,null);let n=e.length;for(;n--;){let s=e[n];if(typeof s=="string"){const r=t(s);r!==s&&(LD(e)||(e[n]=r),s=r)}i[s]=!0}return i}function FD(i){for(let e=0;e/gm),HD=_s(/\$\{[\w\W]*/gm),VD=_s(/^data-[\-\w.\u00B7-\uFFFF]+$/),GD=_s(/^aria-[\-\w]+$/),N2=_s(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),WD=_s(/^(?:\w+script|data):/i),YD=_s(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),D2=_s(/^html$/i),qD=_s(/^[a-z][.\w]*(-[.\w]+)+$/i);var lx=Object.freeze({__proto__:null,ARIA_ATTR:GD,ATTR_WHITESPACE:YD,CUSTOM_ELEMENT:qD,DATA_ATTR:VD,DOCTYPE_NAME:D2,ERB_EXPR:jD,IS_ALLOWED_URI:N2,IS_SCRIPT_OR_DATA:WD,MUSTACHE_EXPR:$D,TMPLIT_EXPR:HD});const hc={element:1,text:3,progressingInstruction:7,comment:8,document:9},XD=function(){return typeof window>"u"?null:window},KD=function(i,e){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let t=null;const n="data-tt-policy-suffix";e&&e.hasAttribute(n)&&(t=e.getAttribute(n));const s="dompurify"+(t?"#"+t:"");try{return i.createPolicy(s,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},cx=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function M2(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:XD();const e=L=>M2(L);if(e.version="3.2.6",e.removed=[],!i||!i.document||i.document.nodeType!==hc.document||!i.Element)return e.isSupported=!1,e;let{document:t}=i;const n=t,s=n.currentScript,{DocumentFragment:r,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:d,DOMParser:h,trustedTypes:p}=i,m=l.prototype,y=dc(m,"cloneNode"),g=dc(m,"remove"),_=dc(m,"nextSibling"),S=dc(m,"childNodes"),C=dc(m,"parentNode");if(typeof o=="function"){const L=t.createElement("template");L.content&&L.content.ownerDocument&&(t=L.content.ownerDocument)}let x,A="";const{implementation:I,createNodeIterator:O,createDocumentFragment:H,getElementsByTagName:Z}=t,{importNode:te}=n;let M=cx();e.isSupported=typeof R2=="function"&&typeof C=="function"&&I&&I.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:he,ERB_EXPR:se,TMPLIT_EXPR:R,DATA_ATTR:J,ARIA_ATTR:F,IS_SCRIPT_OR_DATA:X,ATTR_WHITESPACE:ie,CUSTOM_ELEMENT:ee}=lx;let{IS_ALLOWED_URI:ae}=lx,Q=null;const Se=ot({},[...sx,...nm,...sm,...rm,...rx]);let xe=null;const Je=ot({},[...ox,...om,...ax,...Ed]);let de=Object.seal(P2(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),bt=null,Xe=null,ht=!0,re=!0,Te=!1,Pe=!0,q=!1,We=!0,He=!1,it=!1,Vt=!1,me=!1,nt=!1,ui=!1,_i=!0,Zn=!1;const Qo="user-content-";let Zs=!0,Li=!1,en={},Ri=null;const ai=ot({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let vo=null;const Es=ot({},["audio","video","img","source","image","track"]);let Qn=null;const Jn=ot({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Cs="http://www.w3.org/1998/Math/MathML",zi="http://www.w3.org/2000/svg",Ei="http://www.w3.org/1999/xhtml";let ii=Ei,bn=!1,vn=null;const Ts=ot({},[Cs,zi,Ei],im);let On=ot({},["mi","mo","mn","ms","mtext"]),es=ot({},["annotation-xml"]);const Dr=ot({},["title","style","font","a","script"]);let xn=null;const Qs=["application/xhtml+xml","text/html"],Jo="text/html";let Zt=null,Ot=null;const ks=t.createElement("form"),xo=function(L){return L instanceof RegExp||L instanceof Function},Js=function(){let L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ot&&Ot===L)){if((!L||typeof L!="object")&&(L={}),L=Hr(L),xn=Qs.indexOf(L.PARSER_MEDIA_TYPE)===-1?Jo:L.PARSER_MEDIA_TYPE,Zt=xn==="application/xhtml+xml"?im:hh,Q=Ms(L,"ALLOWED_TAGS")?ot({},L.ALLOWED_TAGS,Zt):Se,xe=Ms(L,"ALLOWED_ATTR")?ot({},L.ALLOWED_ATTR,Zt):Je,vn=Ms(L,"ALLOWED_NAMESPACES")?ot({},L.ALLOWED_NAMESPACES,im):Ts,Qn=Ms(L,"ADD_URI_SAFE_ATTR")?ot(Hr(Jn),L.ADD_URI_SAFE_ATTR,Zt):Jn,vo=Ms(L,"ADD_DATA_URI_TAGS")?ot(Hr(Es),L.ADD_DATA_URI_TAGS,Zt):Es,Ri=Ms(L,"FORBID_CONTENTS")?ot({},L.FORBID_CONTENTS,Zt):ai,bt=Ms(L,"FORBID_TAGS")?ot({},L.FORBID_TAGS,Zt):Hr({}),Xe=Ms(L,"FORBID_ATTR")?ot({},L.FORBID_ATTR,Zt):Hr({}),en=Ms(L,"USE_PROFILES")?L.USE_PROFILES:!1,ht=L.ALLOW_ARIA_ATTR!==!1,re=L.ALLOW_DATA_ATTR!==!1,Te=L.ALLOW_UNKNOWN_PROTOCOLS||!1,Pe=L.ALLOW_SELF_CLOSE_IN_ATTR!==!1,q=L.SAFE_FOR_TEMPLATES||!1,We=L.SAFE_FOR_XML!==!1,He=L.WHOLE_DOCUMENT||!1,me=L.RETURN_DOM||!1,nt=L.RETURN_DOM_FRAGMENT||!1,ui=L.RETURN_TRUSTED_TYPE||!1,Vt=L.FORCE_BODY||!1,_i=L.SANITIZE_DOM!==!1,Zn=L.SANITIZE_NAMED_PROPS||!1,Zs=L.KEEP_CONTENT!==!1,Li=L.IN_PLACE||!1,ae=L.ALLOWED_URI_REGEXP||N2,ii=L.NAMESPACE||Ei,On=L.MATHML_TEXT_INTEGRATION_POINTS||On,es=L.HTML_INTEGRATION_POINTS||es,de=L.CUSTOM_ELEMENT_HANDLING||{},L.CUSTOM_ELEMENT_HANDLING&&xo(L.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(de.tagNameCheck=L.CUSTOM_ELEMENT_HANDLING.tagNameCheck),L.CUSTOM_ELEMENT_HANDLING&&xo(L.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(de.attributeNameCheck=L.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),L.CUSTOM_ELEMENT_HANDLING&&typeof L.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(de.allowCustomizedBuiltInElements=L.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),q&&(re=!1),nt&&(me=!0),en&&(Q=ot({},rx),xe=[],en.html===!0&&(ot(Q,sx),ot(xe,ox)),en.svg===!0&&(ot(Q,nm),ot(xe,om),ot(xe,Ed)),en.svgFilters===!0&&(ot(Q,sm),ot(xe,om),ot(xe,Ed)),en.mathMl===!0&&(ot(Q,rm),ot(xe,ax),ot(xe,Ed))),L.ADD_TAGS&&(Q===Se&&(Q=Hr(Q)),ot(Q,L.ADD_TAGS,Zt)),L.ADD_ATTR&&(xe===Je&&(xe=Hr(xe)),ot(xe,L.ADD_ATTR,Zt)),L.ADD_URI_SAFE_ATTR&&ot(Qn,L.ADD_URI_SAFE_ATTR,Zt),L.FORBID_CONTENTS&&(Ri===ai&&(Ri=Hr(Ri)),ot(Ri,L.FORBID_CONTENTS,Zt)),Zs&&(Q["#text"]=!0),He&&ot(Q,["html","head","body"]),Q.table&&(ot(Q,["tbody"]),delete bt.tbody),L.TRUSTED_TYPES_POLICY){if(typeof L.TRUSTED_TYPES_POLICY.createHTML!="function")throw uc('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof L.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw uc('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=L.TRUSTED_TYPES_POLICY,A=x.createHTML("")}else x===void 0&&(x=KD(p,s)),x!==null&&typeof A=="string"&&(A=x.createHTML(""));hn&&hn(L),Ot=L}},Rt=ot({},[...nm,...sm,...zD]),Mr=ot({},[...rm,...UD]),ea=function(L){let V=C(L);(!V||!V.tagName)&&(V={namespaceURI:ii,tagName:"template"});const E=hh(L.tagName),G=hh(V.tagName);return vn[L.namespaceURI]?L.namespaceURI===zi?V.namespaceURI===Ei?E==="svg":V.namespaceURI===Cs?E==="svg"&&(G==="annotation-xml"||On[G]):!!Rt[E]:L.namespaceURI===Cs?V.namespaceURI===Ei?E==="math":V.namespaceURI===zi?E==="math"&&es[G]:!!Mr[E]:L.namespaceURI===Ei?V.namespaceURI===zi&&!es[G]||V.namespaceURI===Cs&&!On[G]?!1:!Mr[E]&&(Dr[E]||!Rt[E]):!!(xn==="application/xhtml+xml"&&vn[L.namespaceURI]):!1},ts=function(L){lc(e.removed,{element:L});try{C(L).removeChild(L)}catch{g(L)}},di=function(L,V){try{lc(e.removed,{attribute:V.getAttributeNode(L),from:V})}catch{lc(e.removed,{attribute:null,from:V})}if(V.removeAttribute(L),L==="is")if(me||nt)try{ts(V)}catch{}else try{V.setAttribute(L,"")}catch{}},Bn=function(L){let V=null,E=null;if(Vt)L=""+L;else{const Ce=nx(L,/^[\r\n\t ]+/);E=Ce&&Ce[0]}xn==="application/xhtml+xml"&&ii===Ei&&(L=''+L+"");const G=x?x.createHTML(L):L;if(ii===Ei)try{V=new h().parseFromString(G,xn)}catch{}if(!V||!V.documentElement){V=I.createDocument(ii,"template",null);try{V.documentElement.innerHTML=bn?A:G}catch{}}const ne=V.body||V.documentElement;return L&&E&&ne.insertBefore(t.createTextNode(E),ne.childNodes[0]||null),ii===Ei?Z.call(V,He?"html":"body")[0]:He?V.documentElement:ne},wo=function(L){return O.call(L.ownerDocument||L,L,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ut=function(L){return L instanceof d&&(typeof L.nodeName!="string"||typeof L.textContent!="string"||typeof L.removeChild!="function"||!(L.attributes instanceof u)||typeof L.removeAttribute!="function"||typeof L.setAttribute!="function"||typeof L.namespaceURI!="string"||typeof L.insertBefore!="function"||typeof L.hasChildNodes!="function")},Or=function(L){return typeof a=="function"&&L instanceof a};function st(L,V,E){Sd(L,G=>{G.call(e,V,E,Ot)})}const wn=function(L){let V=null;if(st(M.beforeSanitizeElements,L,null),ut(L))return ts(L),!0;const E=Zt(L.nodeName);if(st(M.uponSanitizeElement,L,{tagName:E,allowedTags:Q}),We&&L.hasChildNodes()&&!Or(L.firstElementChild)&&sn(/<[/\w!]/g,L.innerHTML)&&sn(/<[/\w!]/g,L.textContent)||L.nodeType===hc.progressingInstruction||We&&L.nodeType===hc.comment&&sn(/<[/\w]/g,L.data))return ts(L),!0;if(!Q[E]||bt[E]){if(!bt[E]&&er(E)&&(de.tagNameCheck instanceof RegExp&&sn(de.tagNameCheck,E)||de.tagNameCheck instanceof Function&&de.tagNameCheck(E)))return!1;if(Zs&&!Ri[E]){const G=C(L)||L.parentNode,ne=S(L)||L.childNodes;if(ne&&G){const Ce=ne.length;for(let At=Ce-1;At>=0;--At){const rt=y(ne[At],!0);rt.__removalCount=(L.__removalCount||0)+1,G.insertBefore(rt,_(L))}}}return ts(L),!0}return L instanceof l&&!ea(L)||(E==="noscript"||E==="noembed"||E==="noframes")&&sn(/<\/no(script|embed|frames)/i,L.innerHTML)?(ts(L),!0):(q&&L.nodeType===hc.text&&(V=L.textContent,Sd([he,se,R],G=>{V=cc(V,G," ")}),L.textContent!==V&&(lc(e.removed,{element:L.cloneNode()}),L.textContent=V)),st(M.afterSanitizeElements,L,null),!1)},Br=function(L,V,E){if(_i&&(V==="id"||V==="name")&&(E in t||E in ks))return!1;if(!(re&&!Xe[V]&&sn(J,V))&&!(ht&&sn(F,V))){if(!xe[V]||Xe[V]){if(!(er(L)&&(de.tagNameCheck instanceof RegExp&&sn(de.tagNameCheck,L)||de.tagNameCheck instanceof Function&&de.tagNameCheck(L))&&(de.attributeNameCheck instanceof RegExp&&sn(de.attributeNameCheck,V)||de.attributeNameCheck instanceof Function&&de.attributeNameCheck(V))||V==="is"&&de.allowCustomizedBuiltInElements&&(de.tagNameCheck instanceof RegExp&&sn(de.tagNameCheck,E)||de.tagNameCheck instanceof Function&&de.tagNameCheck(E))))return!1}else if(!Qn[V]&&!sn(ae,cc(E,ie,""))&&!((V==="src"||V==="xlink:href"||V==="href")&&L!=="script"&&MD(E,"data:")===0&&vo[L])&&!(Te&&!sn(X,cc(E,ie,"")))&&E)return!1}return!0},er=function(L){return L!=="annotation-xml"&&nx(L,ee)},Fn=function(L){st(M.beforeSanitizeAttributes,L,null);const{attributes:V}=L;if(!V||ut(L))return;const E={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe,forceKeepAttr:void 0};let G=V.length;for(;G--;){const ne=V[G],{name:Ce,namespaceURI:At,value:rt}=ne,et=Zt(Ce),yi=rt;let ft=Ce==="value"?yi:OD(yi);if(E.attrName=et,E.attrValue=ft,E.keepAttr=!0,E.forceKeepAttr=void 0,st(M.uponSanitizeAttribute,L,E),ft=E.attrValue,Zn&&(et==="id"||et==="name")&&(di(Ce,L),ft=Qo+ft),We&&sn(/((--!?|])>)|<\/(style|title)/i,ft)){di(Ce,L);continue}if(E.forceKeepAttr)continue;if(!E.keepAttr){di(Ce,L);continue}if(!Pe&&sn(/\/>/i,ft)){di(Ce,L);continue}q&&Sd([he,se,R],Bt=>{ft=cc(ft,Bt," ")});const tr=Zt(L.nodeName);if(!Br(tr,et,ft)){di(Ce,L);continue}if(x&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!At)switch(p.getAttributeType(tr,et)){case"TrustedHTML":{ft=x.createHTML(ft);break}case"TrustedScriptURL":{ft=x.createScriptURL(ft);break}}if(ft!==yi)try{At?L.setAttributeNS(At,Ce,ft):L.setAttribute(Ce,ft),ut(L)?ts(L):ix(e.removed)}catch{di(Ce,L)}}st(M.afterSanitizeAttributes,L,null)},tn=function L(V){let E=null;const G=wo(V);for(st(M.beforeSanitizeShadowDOM,V,null);E=G.nextNode();)st(M.uponSanitizeShadowNode,E,null),wn(E),Fn(E),E.content instanceof r&&L(E.content);st(M.afterSanitizeShadowDOM,V,null)};return e.sanitize=function(L){let V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,G=null,ne=null,Ce=null;if(bn=!L,bn&&(L=""),typeof L!="string"&&!Or(L))if(typeof L.toString=="function"){if(L=L.toString(),typeof L!="string")throw uc("dirty is not a string, aborting")}else throw uc("toString is not a function");if(!e.isSupported)return L;if(it||Js(V),e.removed=[],typeof L=="string"&&(Li=!1),Li){if(L.nodeName){const et=Zt(L.nodeName);if(!Q[et]||bt[et])throw uc("root node is forbidden and cannot be sanitized in-place")}}else if(L instanceof a)E=Bn(""),G=E.ownerDocument.importNode(L,!0),G.nodeType===hc.element&&G.nodeName==="BODY"||G.nodeName==="HTML"?E=G:E.appendChild(G);else{if(!me&&!q&&!He&&L.indexOf("<")===-1)return x&&ui?x.createHTML(L):L;if(E=Bn(L),!E)return me?null:ui?A:""}E&&Vt&&ts(E.firstChild);const At=wo(Li?L:E);for(;ne=At.nextNode();)wn(ne),Fn(ne),ne.content instanceof r&&tn(ne.content);if(Li)return L;if(me){if(nt)for(Ce=H.call(E.ownerDocument);E.firstChild;)Ce.appendChild(E.firstChild);else Ce=E;return(xe.shadowroot||xe.shadowrootmode)&&(Ce=te.call(n,Ce,!0)),Ce}let rt=He?E.outerHTML:E.innerHTML;return He&&Q["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&sn(D2,E.ownerDocument.doctype.name)&&(rt=" `+rt),q&&Sd([he,se,R],et=>{rt=cc(rt,et," ")}),x&&ui?x.createHTML(rt):rt},e.setConfig=function(){let L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Js(L),it=!0},e.clearConfig=function(){Ot=null,it=!1},e.isValidAttribute=function(L,V,E){Ot||Js({});const G=Zt(L),ne=Zt(V);return Br(G,ne,E)},e.addHook=function(L,V){typeof V=="function"&&lc(M[L],V)},e.removeHook=function(L,V){if(V!==void 0){const E=ND(M[L],V);return E===-1?void 0:DD(M[L],E,1)[0]}return ix(M[L])},e.removeHooks=function(L){M[L]=[]},e.removeAllHooks=function(){M=cx()},e}var ZD=M2();const QD=i=>typeof i=="function",O2=i=>Array.isArray(i),JD=i=>i instanceof Object,eM=i=>i instanceof Object?i.constructor.name!=="Function"&&i.constructor.name!=="Object":!1,ux=i=>JD(i)&&!O2(i)&&!QD(i)&&!eM(i);function Mo(i){let e;if(O2(i))e=i;else{const t=Uo(i),n=t==null?void 0:t.rgb();e=[(n==null?void 0:n.r)||0,(n==null?void 0:n.g)||0,(n==null?void 0:n.b)||0,(t==null?void 0:t.opacity)??1]}return[e[0]/255,e[1]/255,e[2]/255,e[3]]}function tM(i,e,t){return .2126*i+.7152*e+.0722*t}function jn(i,e,t=0,n=0,s,r){return i.readPixelsToArrayWebGL(e,{sourceX:t,sourceY:n,sourceWidth:s,sourceHeight:r})}function iM(i,e,t){return Math.min(Math.max(i,e),t)}function rs(i){return i!=null&&!Number.isNaN(i)}function nM(i,e){return ZD.sanitize(i,{ALLOWED_TAGS:["a","b","i","em","strong","span","div","p","br"],ALLOWED_ATTR:["href","target","class","id","style"],ALLOW_DATA_ATTR:!1,...e})}class sM{constructor(){this.enableSimulation=pe.enableSimulation,this.backgroundColor=L2,this.spaceSize=pe.spaceSize,this.pointColor=bD,this.pointDefaultColor=void 0,this.pointGreyoutOpacity=vD,this.pointGreyoutColor=kg,this.pointSize=wD,this.pointDefaultSize=void 0,this.pointOpacity=xD,this.pointSizeScale=pe.pointSizeScale,this.hoveredPointCursor=pe.hoveredPointCursor,this.hoveredLinkCursor=pe.hoveredLinkCursor,this.renderHoveredPointRing=pe.renderHoveredPointRing,this.hoveredPointRingColor=pe.hoveredPointRingColor,this.focusedPointRingColor=pe.focusedPointRingColor,this.focusedPointIndex=pe.focusedPointIndex,this.linkColor=SD,this.linkDefaultColor=void 0,this.linkOpacity=CD,this.linkGreyoutOpacity=ED,this.linkWidth=TD,this.linkDefaultWidth=void 0,this.linkWidthScale=pe.linkWidthScale,this.hoveredLinkColor=pe.hoveredLinkColor,this.hoveredLinkWidthIncrease=pe.hoveredLinkWidthIncrease,this.renderLinks=pe.renderLinks,this.curvedLinks=pe.curvedLinks,this.curvedLinkSegments=pe.curvedLinkSegments,this.curvedLinkWeight=pe.curvedLinkWeight,this.curvedLinkControlPointDistance=pe.curvedLinkControlPointDistance,this.linkArrows=pe.linkArrows,this.linkDefaultArrows=void 0,this.linkArrowsSizeScale=pe.linkArrowsSizeScale,this.scaleLinksOnZoom=pe.scaleLinksOnZoom,this.linkVisibilityDistanceRange=pe.linkVisibilityDistanceRange,this.linkVisibilityMinTransparency=pe.linkVisibilityMinTransparency,this.simulationDecay=pe.simulation.decay,this.simulationGravity=pe.simulation.gravity,this.simulationCenter=pe.simulation.center,this.simulationRepulsion=pe.simulation.repulsion,this.simulationRepulsionTheta=pe.simulation.repulsionTheta,this.simulationLinkSpring=pe.simulation.linkSpring,this.simulationLinkDistance=pe.simulation.linkDistance,this.simulationLinkDistRandomVariationRange=pe.simulation.linkDistRandomVariationRange,this.simulationRepulsionFromMouse=pe.simulation.repulsionFromMouse,this.enableRightClickRepulsion=pe.enableRightClickRepulsion,this.simulationFriction=pe.simulation.friction,this.simulationCluster=pe.simulation.cluster,this.onSimulationStart=void 0,this.onSimulationTick=void 0,this.onSimulationEnd=void 0,this.onSimulationPause=void 0,this.onSimulationRestart=void 0,this.onSimulationUnpause=void 0,this.onClick=void 0,this.onPointClick=void 0,this.onLinkClick=void 0,this.onBackgroundClick=void 0,this.onMouseMove=void 0,this.onPointMouseOver=void 0,this.onPointMouseOut=void 0,this.onLinkMouseOver=void 0,this.onLinkMouseOut=void 0,this.onZoomStart=void 0,this.onZoom=void 0,this.onZoomEnd=void 0,this.onDragStart=void 0,this.onDrag=void 0,this.onDragEnd=void 0,this.showFPSMonitor=pe.showFPSMonitor,this.pixelRatio=pe.pixelRatio,this.scalePointsOnZoom=pe.scalePointsOnZoom,this.initialZoomLevel=void 0,this.enableZoom=pe.enableZoom,this.enableSimulationDuringZoom=pe.enableSimulationDuringZoom,this.enableDrag=pe.enableDrag,this.fitViewOnInit=pe.fitViewOnInit,this.fitViewDelay=pe.fitViewDelay,this.fitViewPadding=pe.fitViewPadding,this.fitViewDuration=pe.fitViewDuration,this.fitViewByPointsInRect=void 0,this.fitViewByPointIndices=void 0,this.randomSeed=void 0,this.pointSamplingDistance=pe.pointSamplingDistance,this.attribution=pe.attribution,this.rescalePositions=pe.rescalePositions}init(e){Object.keys(e).forEach(t=>{this.deepMergeConfig(this.getConfig(),e,t)})}deepMergeConfig(e,t,n){ux(e[n])&&ux(t[n])?Object.keys(t[n]).forEach(s=>{this.deepMergeConfig(e[n],t[n],s)}):e[n]=t[n]}getConfig(){return this}}function _y(i,e){if(!i)throw new Error(e||"shadertools: assertion failed.")}const am={number:{type:"number",validate(i,e){return Number.isFinite(i)&&typeof e=="object"&&(e.max===void 0||i<=e.max)&&(e.min===void 0||i>=e.min)}},array:{type:"array",validate(i,e){return Array.isArray(i)||ArrayBuffer.isView(i)}}};function rM(i){const e={};for(const[t,n]of Object.entries(i))e[t]=oM(n);return e}function oM(i){let e=dx(i);if(e!=="object")return{value:i,...am[e],type:e};if(typeof i=="object")return i?i.type!==void 0?{...i,...am[i.type],type:i.type}:i.value===void 0?{type:"object",value:i}:(e=dx(i.value),{...i,...am[e],type:e}):{type:"object",value:null};throw new Error("props")}function dx(i){return Array.isArray(i)||ArrayBuffer.isView(i)?"array":typeof i}const aM=`#ifdef MODULE_LOGDEPTH logdepth_adjustPosition(gl_Position); #endif diff --git a/frontend/dist/assets/Mqtt-D450VFG-.js b/frontend/dist/assets/Mqtt-D1z1DeQb.js similarity index 98% rename from frontend/dist/assets/Mqtt-D450VFG-.js rename to frontend/dist/assets/Mqtt-D1z1DeQb.js index 2dcaf674..a5f3c041 100644 --- a/frontend/dist/assets/Mqtt-D450VFG-.js +++ b/frontend/dist/assets/Mqtt-D1z1DeQb.js @@ -1,4 +1,4 @@ -import{d as re,eK as f,eL as Me,r as c,j as e,I as W,B as ne,c as C,el as Pe,em as ke,am as pe,en as Re,T as Ne,x as H,D as ae,bk as Ae,eM as xe,cR as fe,eN as be,eO as Be,R as ie,N as Ue,ce as Te}from"./index-CeMilrX4.js";import{C as ee,P as De,a as Oe,B as Ge}from"./PageLayout-Cw_MXmcE.js";import{L as Ee,a as de}from"./listbox-CGIGCOya.js";import{S as Ie}from"./settings-2-97rHsI_C.js";import{P as se}from"./plus-D-z0bUE_.js";import{M as He}from"./map-pin-D6_BkIVb.js";import{C as Ke,u as Fe,a as ze}from"./circle-x-B6UCLWHM.js";import{Z as Q}from"./zap-09srAnh-.js";import{S as je}from"./search-Bph9xP9G.js";import{C as oe}from"./chevron-right-D3QL4sfa.js";import{H as Ve}from"./hash-CBEVBQJR.js";import{F as We}from"./funnel-D2SUJQ8o.js";import{a as $e,C as Ze}from"./circle-stop-BvffqSZg.js";import{T as Ye}from"./trash-2-Bu7BoH4P.js";import{M as Je}from"./message-square-VqJiaYsP.js";import{C as Xe}from"./cpu-C5-ss1x-.js";import{R as me,C as he}from"./Grid-BuDgMX1I.js";import{W as _e}from"./wifi-DjxkOZ88.js";import{W as qe}from"./wifi-off-Y-Y9dpWj.js";import{T as Qe}from"./triangle-alert-DiFold9L.js";import"./element-movement-zLH7y51p.js";/** +import{d as re,eL as f,eM as Me,r as c,j as e,I as W,B as ne,c as C,em as Pe,en as ke,am as pe,eo as Re,T as Ne,x as H,D as ae,bk as Ae,eN as xe,cS as fe,eO as be,eP as Be,R as ie,N as Ue,ce as Te}from"./index-BOwCLZTK.js";import{C as ee,P as De,a as Oe,B as Ge}from"./PageLayout-QKntxcnp.js";import{L as Ee,a as de}from"./listbox-C1tUi7YC.js";import{S as Ie}from"./settings-2-CXNfSapN.js";import{P as se}from"./plus-ClrHVFhr.js";import{M as He}from"./map-pin-C2z_C0J3.js";import{C as Ke,u as Fe,a as ze}from"./circle-x-BJVhIbR2.js";import{Z as Q}from"./zap-Bd-kARJ1.js";import{S as je}from"./search-Ba9CRHru.js";import{C as oe}from"./chevron-right-DJVm4pVP.js";import{H as Ve}from"./hash-Dwn2PbMF.js";import{F as We}from"./funnel-CWx99rlN.js";import{a as $e,C as Ze}from"./circle-stop-Buqz2psb.js";import{T as Ye}from"./trash-2-qMD09ppP.js";import{M as Je}from"./message-square-BcKhgYbO.js";import{C as Xe}from"./cpu-D7sbzQ8o.js";import{R as me,C as he}from"./Grid-eFMUBxsw.js";import{W as _e}from"./wifi-CI57D5A3.js";import{W as qe}from"./wifi-off-DC4jBRps.js";import{T as Qe}from"./triangle-alert-SO3tIa8w.js";import"./element-movement-BLnr83nT.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/MqttModeBadge-C_MEMmDd.js b/frontend/dist/assets/MqttModeBadge-CSj5wNzF.js similarity index 95% rename from frontend/dist/assets/MqttModeBadge-C_MEMmDd.js rename to frontend/dist/assets/MqttModeBadge-CSj5wNzF.js index fe80e95d..d384149b 100644 --- a/frontend/dist/assets/MqttModeBadge-C_MEMmDd.js +++ b/frontend/dist/assets/MqttModeBadge-CSj5wNzF.js @@ -1,4 +1,4 @@ -import{aw as Le,aT as be,av as Qe,cv as Pe,ay as qe,ax as Z,r as l,aB as He,aC as ee,aG as z,aF as J,aq as k,aJ as q,cw as se,cx as _e,aO as Ke,aP as Ve,aU as We,aQ as re,aV as Ye,aR as me,cy as Fe,cz as H,cA as A,cB as he,cC as G,cD as ge,aS as le,b2 as C,cE as ye,cF as xe,aW as we,au as Xe,aX as Oe,aY as Te,a_ as Ze,a$ as ze,b1 as Ee,cG as Je,cH as je,b3 as Ue,cI as et,cJ as tt,b4 as Ie,cK as nt,cL as at,cM as ot,ar as st,ba as rt,aZ as U,cN as Ne,bc as lt,be as ie,cO as ut,cP as ct,cQ as it,d as dt,j as P,c as M,A as pt,m as ft,cu as vt,cR as bt,u as mt,x as ht,R as ke}from"./index-CeMilrX4.js";import{C as yt}from"./chevron-right-D3QL4sfa.js";import{F as xt,y as Pt,R as gt,T as $t,w as St,A as Ct}from"./map-pin-D6_BkIVb.js";var wt=Object.defineProperty,It=(e,n,t)=>n in e?wt(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Be=(e,n,t)=>(It(e,typeof n!="symbol"?n+"":n,t),t),g=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(g||{}),kt=(e=>(e[e.OpenPopover=0]="OpenPopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(kt||{});let Bt={0:e=>e.popoverState===0?e:{...e,popoverState:0,__demoMode:!1},1(e){return e.popoverState===1?e:{...e,popoverState:1,__demoMode:!1}},2(e,n){return e.button===n.button?e:{...e,button:n.button}},3(e,n){return e.buttonId===n.buttonId?e:{...e,buttonId:n.buttonId}},4(e,n){return e.panel===n.panel?e:{...e,panel:n.panel}},5(e,n){return e.panelId===n.panelId?e:{...e,panelId:n.panelId}}};class $e extends Le{constructor(n){super(n),Be(this,"actions",{close:()=>this.send({type:1}),refocusableClose:t=>{this.actions.close();let f=t?be(t)?t:"current"in t&&be(t.current)?t.current:this.state.button:this.state.button;f==null||f.focus()},open:()=>this.send({type:0}),setButtonId:t=>this.send({type:3,buttonId:t}),setButton:t=>this.send({type:2,button:t}),setPanelId:t=>this.send({type:5,panelId:t}),setPanel:t=>this.send({type:4,panel:t})}),Be(this,"selectors",{isPortalled:t=>{var f;if(!t.button||!t.panel)return!1;let m=(f=Qe(t.button))!=null?f:document;for(let $ of m.querySelectorAll("body > *"))if(Number($==null?void 0:$.contains(t.button))^Number($==null?void 0:$.contains(t.panel)))return!0;let c=Pe(m),r=c.indexOf(t.button),a=(r+c.length-1)%c.length,S=(r+1)%c.length,y=c[a],s=c[S];return!t.panel.contains(y)&&!t.panel.contains(s)}});{let t=this.state.id,f=qe.get(null);this.on(0,()=>f.actions.push(t)),this.on(1,()=>f.actions.pop(t))}}static new({id:n,__demoMode:t=!1}){return new $e({id:n,__demoMode:t,popoverState:t?0:1,buttons:{current:[]},button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:{current:null},afterPanelSentinel:{current:null},afterButtonSentinel:{current:null}})}reduce(n,t){return Z(t.type,Bt,n,t)}}const Me=l.createContext(null);function de(e){let n=l.useContext(Me);if(n===null){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,de),t}return n}function _t({id:e,__demoMode:n=!1}){let t=l.useMemo(()=>$e.new({id:e,__demoMode:n}),[]);return He(()=>t.dispose()),t}let Se=l.createContext(null);Se.displayName="PopoverGroupContext";function Re(){return l.useContext(Se)}let pe=l.createContext(null);pe.displayName="PopoverPanelContext";function Ft(){return l.useContext(pe)}let Ot="div";function Tt(e,n){var t;let f=l.useId(),{__demoMode:m=!1,...c}=e,r=_t({id:f,__demoMode:m}),a=l.useRef(null),S=J(n,et(u=>{a.current=u})),[y,s,$,w,B]=z(r,l.useCallback(u=>[u.popoverState,u.button,u.panel,u.buttonId,u.panelId],[])),I=tt((t=a.current)!=null?t:s),v=Ie(w),p=Ie(B),b=l.useMemo(()=>({buttonId:v,panelId:p,close:r.actions.close}),[v,p,r]),x=Re(),i=x==null?void 0:x.registerPopover,_=k(()=>{var u,F;let T=se((u=a.current)!=null?u:s);return(F=x==null?void 0:x.isFocusWithinPopoverGroup())!=null?F:T&&((s==null?void 0:s.contains(T))||($==null?void 0:$.contains(T)))});l.useEffect(()=>i==null?void 0:i(b),[i,b]);let[te,ne]=nt(),L=at(s),R=ot({mainTreeNode:L,portals:te,defaultContainers:[{get current(){return r.state.button}},{get current(){return r.state.panel}}]});st(I,"focus",u=>{var F,T,j,Y,N,X;u.target!==window&&ut(u.target)&&r.state.popoverState===g.Open&&(_()||r.state.button&&r.state.panel&&(R.contains(u.target)||(T=(F=r.state.beforePanelSentinel.current)==null?void 0:F.contains)!=null&&T.call(F,u.target)||(Y=(j=r.state.afterPanelSentinel.current)==null?void 0:j.contains)!=null&&Y.call(j,u.target)||(X=(N=r.state.afterButtonSentinel.current)==null?void 0:N.contains)!=null&&X.call(N,u.target)||r.actions.close()))},!0);let K=y===g.Open;rt(K,R.resolveContainers,(u,F)=>{r.actions.close(),ct(F,it.Loose)||(u.preventDefault(),s==null||s.focus())});let ae=re({open:y===g.Open,close:r.actions.refocusableClose}),oe=z(r,l.useCallback(u=>Z(u.popoverState,{[g.Open]:U.Open,[g.Closed]:U.Closed}),[])),V={ref:S},W=le();return C.createElement(Ne,{node:L},C.createElement(Ct,null,C.createElement(pe.Provider,{value:null},C.createElement(Me.Provider,{value:r},C.createElement(je,{value:r.actions.refocusableClose},C.createElement(lt,{value:oe},C.createElement(ne,null,W({ourProps:V,theirProps:c,slot:ae,defaultTag:Ot,name:"Popover"}))))))))}let Et="button";function jt(e,n){let t=l.useId(),{id:f=`headlessui-popover-button-${t}`,disabled:m=!1,autoFocus:c=!1,...r}=e,a=de("Popover.Button"),[S,y,s,$,w,B,I]=z(a,l.useCallback(o=>[o.popoverState,a.selectors.isPortalled(o),o.button,o.buttonId,o.panel,o.panelId,o.afterButtonSentinel],[])),v=l.useRef(null),p=`headlessui-focus-sentinel-${l.useId()}`,b=Re(),x=b==null?void 0:b.closeOthers,i=Ft()!==null;l.useEffect(()=>{if(!i)return a.actions.setButtonId(f),()=>a.actions.setButtonId(null)},[i,f,a]);let[_]=l.useState(()=>Symbol()),te=J(v,n,xt(),k(o=>{if(!i){if(o)a.state.buttons.current.push(_);else{let d=a.state.buttons.current.indexOf(_);d!==-1&&a.state.buttons.current.splice(d,1)}a.state.buttons.current.length>1&&console.warn("You are already using a but only 1 is supported."),o&&a.actions.setButton(o)}})),ne=J(v,n),L=k(o=>{var d,O,E;if(i){if(a.state.popoverState===g.Closed)return;switch(o.key){case q.Space:case q.Enter:o.preventDefault(),(O=(d=o.target).click)==null||O.call(d),a.actions.close(),(E=a.state.button)==null||E.focus();break}}else switch(o.key){case q.Space:case q.Enter:o.preventDefault(),o.stopPropagation(),a.state.popoverState===g.Closed?(x==null||x(a.state.buttonId),a.actions.open()):a.actions.close();break;case q.Escape:if(a.state.popoverState!==g.Open)return x==null?void 0:x(a.state.buttonId);if(!v.current)return;let D=se(v.current);if(D&&!v.current.contains(D))return;o.preventDefault(),o.stopPropagation(),a.actions.close();break}}),R=k(o=>{i||o.key===q.Space&&o.preventDefault()}),K=k(o=>{var d,O;_e(o.currentTarget)||m||(i?(a.actions.close(),(d=a.state.button)==null||d.focus()):(o.preventDefault(),o.stopPropagation(),a.state.popoverState===g.Closed?(x==null||x(a.state.buttonId),a.actions.open()):a.actions.close(),(O=a.state.button)==null||O.focus()))}),ae=k(o=>{o.preventDefault(),o.stopPropagation()}),{isFocusVisible:oe,focusProps:V}=Ke({autoFocus:c}),{isHovered:W,hoverProps:u}=Ve({isDisabled:m}),{pressed:F,pressProps:T}=We({disabled:m}),j=S===g.Open,Y=re({open:j,active:F||j,disabled:m,hover:W,focus:oe,autofocus:c}),N=Ye(e,s),X=i?me({ref:ne,type:N,onKeyDown:L,onClick:K,disabled:m||void 0,autoFocus:c},V,u,T):me({ref:te,id:$,type:N,"aria-expanded":S===g.Open,"aria-controls":w?B:void 0,disabled:m||void 0,autoFocus:c,onKeyDown:L,onKeyUp:R,onClick:K,onMouseDown:ae},V,u,T),ue=Fe(),fe=k(()=>{if(!be(a.state.panel))return;let o=a.state.panel;function d(){Z(ue.current,{[A.Forwards]:()=>H(o,G.First),[A.Backwards]:()=>H(o,G.Last)})===he.Error&&H(Pe(ge(a.state.button)).filter(O=>O.dataset.headlessuiFocusGuard!=="true"),Z(ue.current,{[A.Forwards]:G.Next,[A.Backwards]:G.Previous}),{relativeTo:a.state.button})}d()}),h=le();return C.createElement(C.Fragment,null,h({ourProps:X,theirProps:r,slot:Y,defaultTag:Et,name:"Popover.Button"}),j&&!i&&y&&C.createElement(ye,{id:p,ref:I,features:xe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:fe}))}let Nt="div",Mt=ie.RenderStrategy|ie.Static;function De(e,n){let t=l.useId(),{id:f=`headlessui-popover-backdrop-${t}`,transition:m=!1,...c}=e,r=de("Popover.Backdrop"),a=z(r,l.useCallback(b=>b.popoverState,[])),[S,y]=l.useState(null),s=J(n,y),$=Oe(),[w,B]=Te(m,S,$!==null?($&U.Open)===U.Open:a===g.Open),I=k(b=>{if(_e(b.currentTarget))return b.preventDefault();r.actions.close()}),v=re({open:a===g.Open}),p={ref:s,id:f,"aria-hidden":!0,onClick:I,...Ee(B)};return le()({ourProps:p,theirProps:c,slot:v,defaultTag:Nt,features:Mt,visible:w,name:"Popover.Backdrop"})}let Rt="div",Dt=ie.RenderStrategy|ie.Static;function At(e,n){let t=l.useId(),{id:f=`headlessui-popover-panel-${t}`,focus:m=!1,anchor:c,portal:r=!1,modal:a=!1,transition:S=!1,...y}=e,s=de("Popover.Panel"),$=z(s,s.selectors.isPortalled),[w,B,I,v,p]=z(s,l.useCallback(h=>[h.popoverState,h.button,h.__demoMode,h.beforePanelSentinel,h.afterPanelSentinel],[])),b=`headlessui-focus-sentinel-before-${t}`,x=`headlessui-focus-sentinel-after-${t}`,i=l.useRef(null),_=Pt(c),[te,ne]=gt(_),L=$t();_&&(r=!0);let[R,K]=l.useState(null),ae=J(i,n,_?te:null,s.actions.setPanel,K),oe=we(B),V=we(i.current);Xe(()=>(s.actions.setPanelId(f),()=>s.actions.setPanelId(null)),[f,s]);let W=Oe(),[u,F]=Te(S,R,W!==null?(W&U.Open)===U.Open:w===g.Open);Ze(u,B,s.actions.close),ze(I?!1:a&&u,V);let T=k(h=>{var o;switch(h.key){case q.Escape:if(s.state.popoverState!==g.Open||!i.current)return;let d=se(i.current);if(d&&!i.current.contains(d))return;h.preventDefault(),h.stopPropagation(),s.actions.close(),(o=s.state.button)==null||o.focus();break}});l.useEffect(()=>{var h;e.static||w===g.Closed&&((h=e.unmount)==null||h)&&s.actions.setPanel(null)},[w,e.unmount,e.static,s]),l.useEffect(()=>{if(I||!m||w!==g.Open||!i.current)return;let h=se(i.current);i.current.contains(h)||H(i.current,G.First)},[I,m,i.current,w]);let j=re({open:w===g.Open,close:s.actions.refocusableClose}),Y=me(_?L():{},{ref:ae,id:f,onKeyDown:T,onBlur:m&&w===g.Open?h=>{var o,d,O,E,D;let Q=h.relatedTarget;Q&&i.current&&((o=i.current)!=null&&o.contains(Q)||(s.actions.close(),((O=(d=v.current)==null?void 0:d.contains)!=null&&O.call(d,Q)||(D=(E=p.current)==null?void 0:E.contains)!=null&&D.call(E,Q))&&Q.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...y.style,...ne,"--button-width":St(u,B,!0).width},...Ee(F)}),N=Fe(),X=k(()=>{let h=i.current;if(!h)return;function o(){Z(N.current,{[A.Forwards]:()=>{var d;H(h,G.First)===he.Error&&((d=s.state.afterPanelSentinel.current)==null||d.focus())},[A.Backwards]:()=>{var d;(d=s.state.button)==null||d.focus({preventScroll:!0})}})}o()}),ue=k(()=>{let h=i.current;if(!h)return;function o(){Z(N.current,{[A.Forwards]:()=>{var d;if(!s.state.button)return;let O=(d=ge(s.state.button))!=null?d:document.body,E=Pe(O),D=E.indexOf(s.state.button),Q=E.slice(0,D+1),ce=[...E.slice(D+1),...Q];for(let ve of ce.slice())if(ve.dataset.headlessuiFocusGuard==="true"||R!=null&&R.contains(ve)){let Ce=ce.indexOf(ve);Ce!==-1&&ce.splice(Ce,1)}H(ce,G.First,{sorted:!1})},[A.Backwards]:()=>{var d;H(h,G.Previous)===he.Error&&((d=s.state.button)==null||d.focus())}})}o()}),fe=le();return C.createElement(Je,null,C.createElement(pe.Provider,{value:f},C.createElement(je,{value:s.actions.refocusableClose},C.createElement(Ue,{enabled:r?e.static||u:!1,ownerDocument:oe},u&&$&&C.createElement(ye,{id:b,ref:v,features:xe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:X}),fe({ourProps:Y,theirProps:y,slot:j,defaultTag:Rt,features:Dt,visible:u,name:"Popover.Panel"}),u&&$&&C.createElement(ye,{id:x,ref:p,features:xe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:ue})))))}let Gt="div";function Lt(e,n){let t=l.useRef(null),f=J(t,n),[m,c]=l.useState([]),r=k(v=>{c(p=>{let b=p.indexOf(v);if(b!==-1){let x=p.slice();return x.splice(b,1),x}return p})}),a=k(v=>(c(p=>[...p,v]),()=>r(v))),S=k(()=>{var v;let p=ge(t.current);if(!p)return!1;let b=se(t.current);return(v=t.current)!=null&&v.contains(b)?!0:m.some(x=>{var i,_;return((i=p.getElementById(x.buttonId.current))==null?void 0:i.contains(b))||((_=p.getElementById(x.panelId.current))==null?void 0:_.contains(b))})}),y=k(v=>{for(let p of m)p.buttonId.current!==v&&p.close()}),s=l.useMemo(()=>({registerPopover:a,unregisterPopover:r,isFocusWithinPopoverGroup:S,closeOthers:y}),[a,r,S,y]),$=re({}),w=e,B={ref:f},I=le();return C.createElement(Ne,null,C.createElement(Se.Provider,{value:s},I({ourProps:B,theirProps:w,slot:$,defaultTag:Gt,name:"Popover.Group"})))}let Qt=ee(Tt),Ae=ee(jt),qt=ee(De),Ht=ee(De),Ge=ee(At),Kt=ee(Lt),Vt=Object.assign(Qt,{Button:Ae,Backdrop:Ht,Overlay:qt,Panel:Ge,Group:Kt});/** +import{aw as Le,aT as be,av as Qe,cw as Pe,ay as qe,ax as Z,r as l,aB as He,aC as ee,aG as z,aF as J,aq as k,aJ as q,cx as se,cy as _e,aO as Ke,aP as Ve,aU as We,aQ as re,aV as Ye,aR as me,cz as Fe,cA as H,cB as A,cC as he,cD as G,cE as ge,aS as le,b2 as C,cF as ye,cG as xe,aW as we,au as Xe,aX as Oe,aY as Te,a_ as Ze,a$ as ze,b1 as Ee,cH as Je,cI as je,b3 as Ue,cJ as et,cK as tt,b4 as Ie,cL as nt,cM as at,cN as ot,ar as st,ba as rt,aZ as U,cO as Ne,bc as lt,be as ie,cP as ut,cQ as ct,cR as it,d as dt,j as P,c as M,A as pt,m as ft,cv as vt,cS as bt,u as mt,x as ht,R as ke}from"./index-BOwCLZTK.js";import{C as yt}from"./chevron-right-DJVm4pVP.js";import{F as xt,y as Pt,R as gt,T as $t,w as St,A as Ct}from"./map-pin-C2z_C0J3.js";var wt=Object.defineProperty,It=(e,n,t)=>n in e?wt(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Be=(e,n,t)=>(It(e,typeof n!="symbol"?n+"":n,t),t),g=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(g||{}),kt=(e=>(e[e.OpenPopover=0]="OpenPopover",e[e.ClosePopover=1]="ClosePopover",e[e.SetButton=2]="SetButton",e[e.SetButtonId=3]="SetButtonId",e[e.SetPanel=4]="SetPanel",e[e.SetPanelId=5]="SetPanelId",e))(kt||{});let Bt={0:e=>e.popoverState===0?e:{...e,popoverState:0,__demoMode:!1},1(e){return e.popoverState===1?e:{...e,popoverState:1,__demoMode:!1}},2(e,n){return e.button===n.button?e:{...e,button:n.button}},3(e,n){return e.buttonId===n.buttonId?e:{...e,buttonId:n.buttonId}},4(e,n){return e.panel===n.panel?e:{...e,panel:n.panel}},5(e,n){return e.panelId===n.panelId?e:{...e,panelId:n.panelId}}};class $e extends Le{constructor(n){super(n),Be(this,"actions",{close:()=>this.send({type:1}),refocusableClose:t=>{this.actions.close();let f=t?be(t)?t:"current"in t&&be(t.current)?t.current:this.state.button:this.state.button;f==null||f.focus()},open:()=>this.send({type:0}),setButtonId:t=>this.send({type:3,buttonId:t}),setButton:t=>this.send({type:2,button:t}),setPanelId:t=>this.send({type:5,panelId:t}),setPanel:t=>this.send({type:4,panel:t})}),Be(this,"selectors",{isPortalled:t=>{var f;if(!t.button||!t.panel)return!1;let m=(f=Qe(t.button))!=null?f:document;for(let $ of m.querySelectorAll("body > *"))if(Number($==null?void 0:$.contains(t.button))^Number($==null?void 0:$.contains(t.panel)))return!0;let c=Pe(m),r=c.indexOf(t.button),a=(r+c.length-1)%c.length,S=(r+1)%c.length,y=c[a],s=c[S];return!t.panel.contains(y)&&!t.panel.contains(s)}});{let t=this.state.id,f=qe.get(null);this.on(0,()=>f.actions.push(t)),this.on(1,()=>f.actions.pop(t))}}static new({id:n,__demoMode:t=!1}){return new $e({id:n,__demoMode:t,popoverState:t?0:1,buttons:{current:[]},button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:{current:null},afterPanelSentinel:{current:null},afterButtonSentinel:{current:null}})}reduce(n,t){return Z(t.type,Bt,n,t)}}const Me=l.createContext(null);function de(e){let n=l.useContext(Me);if(n===null){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,de),t}return n}function _t({id:e,__demoMode:n=!1}){let t=l.useMemo(()=>$e.new({id:e,__demoMode:n}),[]);return He(()=>t.dispose()),t}let Se=l.createContext(null);Se.displayName="PopoverGroupContext";function Re(){return l.useContext(Se)}let pe=l.createContext(null);pe.displayName="PopoverPanelContext";function Ft(){return l.useContext(pe)}let Ot="div";function Tt(e,n){var t;let f=l.useId(),{__demoMode:m=!1,...c}=e,r=_t({id:f,__demoMode:m}),a=l.useRef(null),S=J(n,et(u=>{a.current=u})),[y,s,$,w,B]=z(r,l.useCallback(u=>[u.popoverState,u.button,u.panel,u.buttonId,u.panelId],[])),I=tt((t=a.current)!=null?t:s),v=Ie(w),p=Ie(B),b=l.useMemo(()=>({buttonId:v,panelId:p,close:r.actions.close}),[v,p,r]),x=Re(),i=x==null?void 0:x.registerPopover,_=k(()=>{var u,F;let T=se((u=a.current)!=null?u:s);return(F=x==null?void 0:x.isFocusWithinPopoverGroup())!=null?F:T&&((s==null?void 0:s.contains(T))||($==null?void 0:$.contains(T)))});l.useEffect(()=>i==null?void 0:i(b),[i,b]);let[te,ne]=nt(),L=at(s),R=ot({mainTreeNode:L,portals:te,defaultContainers:[{get current(){return r.state.button}},{get current(){return r.state.panel}}]});st(I,"focus",u=>{var F,T,j,Y,N,X;u.target!==window&&ut(u.target)&&r.state.popoverState===g.Open&&(_()||r.state.button&&r.state.panel&&(R.contains(u.target)||(T=(F=r.state.beforePanelSentinel.current)==null?void 0:F.contains)!=null&&T.call(F,u.target)||(Y=(j=r.state.afterPanelSentinel.current)==null?void 0:j.contains)!=null&&Y.call(j,u.target)||(X=(N=r.state.afterButtonSentinel.current)==null?void 0:N.contains)!=null&&X.call(N,u.target)||r.actions.close()))},!0);let K=y===g.Open;rt(K,R.resolveContainers,(u,F)=>{r.actions.close(),ct(F,it.Loose)||(u.preventDefault(),s==null||s.focus())});let ae=re({open:y===g.Open,close:r.actions.refocusableClose}),oe=z(r,l.useCallback(u=>Z(u.popoverState,{[g.Open]:U.Open,[g.Closed]:U.Closed}),[])),V={ref:S},W=le();return C.createElement(Ne,{node:L},C.createElement(Ct,null,C.createElement(pe.Provider,{value:null},C.createElement(Me.Provider,{value:r},C.createElement(je,{value:r.actions.refocusableClose},C.createElement(lt,{value:oe},C.createElement(ne,null,W({ourProps:V,theirProps:c,slot:ae,defaultTag:Ot,name:"Popover"}))))))))}let Et="button";function jt(e,n){let t=l.useId(),{id:f=`headlessui-popover-button-${t}`,disabled:m=!1,autoFocus:c=!1,...r}=e,a=de("Popover.Button"),[S,y,s,$,w,B,I]=z(a,l.useCallback(o=>[o.popoverState,a.selectors.isPortalled(o),o.button,o.buttonId,o.panel,o.panelId,o.afterButtonSentinel],[])),v=l.useRef(null),p=`headlessui-focus-sentinel-${l.useId()}`,b=Re(),x=b==null?void 0:b.closeOthers,i=Ft()!==null;l.useEffect(()=>{if(!i)return a.actions.setButtonId(f),()=>a.actions.setButtonId(null)},[i,f,a]);let[_]=l.useState(()=>Symbol()),te=J(v,n,xt(),k(o=>{if(!i){if(o)a.state.buttons.current.push(_);else{let d=a.state.buttons.current.indexOf(_);d!==-1&&a.state.buttons.current.splice(d,1)}a.state.buttons.current.length>1&&console.warn("You are already using a but only 1 is supported."),o&&a.actions.setButton(o)}})),ne=J(v,n),L=k(o=>{var d,O,E;if(i){if(a.state.popoverState===g.Closed)return;switch(o.key){case q.Space:case q.Enter:o.preventDefault(),(O=(d=o.target).click)==null||O.call(d),a.actions.close(),(E=a.state.button)==null||E.focus();break}}else switch(o.key){case q.Space:case q.Enter:o.preventDefault(),o.stopPropagation(),a.state.popoverState===g.Closed?(x==null||x(a.state.buttonId),a.actions.open()):a.actions.close();break;case q.Escape:if(a.state.popoverState!==g.Open)return x==null?void 0:x(a.state.buttonId);if(!v.current)return;let D=se(v.current);if(D&&!v.current.contains(D))return;o.preventDefault(),o.stopPropagation(),a.actions.close();break}}),R=k(o=>{i||o.key===q.Space&&o.preventDefault()}),K=k(o=>{var d,O;_e(o.currentTarget)||m||(i?(a.actions.close(),(d=a.state.button)==null||d.focus()):(o.preventDefault(),o.stopPropagation(),a.state.popoverState===g.Closed?(x==null||x(a.state.buttonId),a.actions.open()):a.actions.close(),(O=a.state.button)==null||O.focus()))}),ae=k(o=>{o.preventDefault(),o.stopPropagation()}),{isFocusVisible:oe,focusProps:V}=Ke({autoFocus:c}),{isHovered:W,hoverProps:u}=Ve({isDisabled:m}),{pressed:F,pressProps:T}=We({disabled:m}),j=S===g.Open,Y=re({open:j,active:F||j,disabled:m,hover:W,focus:oe,autofocus:c}),N=Ye(e,s),X=i?me({ref:ne,type:N,onKeyDown:L,onClick:K,disabled:m||void 0,autoFocus:c},V,u,T):me({ref:te,id:$,type:N,"aria-expanded":S===g.Open,"aria-controls":w?B:void 0,disabled:m||void 0,autoFocus:c,onKeyDown:L,onKeyUp:R,onClick:K,onMouseDown:ae},V,u,T),ue=Fe(),fe=k(()=>{if(!be(a.state.panel))return;let o=a.state.panel;function d(){Z(ue.current,{[A.Forwards]:()=>H(o,G.First),[A.Backwards]:()=>H(o,G.Last)})===he.Error&&H(Pe(ge(a.state.button)).filter(O=>O.dataset.headlessuiFocusGuard!=="true"),Z(ue.current,{[A.Forwards]:G.Next,[A.Backwards]:G.Previous}),{relativeTo:a.state.button})}d()}),h=le();return C.createElement(C.Fragment,null,h({ourProps:X,theirProps:r,slot:Y,defaultTag:Et,name:"Popover.Button"}),j&&!i&&y&&C.createElement(ye,{id:p,ref:I,features:xe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:fe}))}let Nt="div",Mt=ie.RenderStrategy|ie.Static;function De(e,n){let t=l.useId(),{id:f=`headlessui-popover-backdrop-${t}`,transition:m=!1,...c}=e,r=de("Popover.Backdrop"),a=z(r,l.useCallback(b=>b.popoverState,[])),[S,y]=l.useState(null),s=J(n,y),$=Oe(),[w,B]=Te(m,S,$!==null?($&U.Open)===U.Open:a===g.Open),I=k(b=>{if(_e(b.currentTarget))return b.preventDefault();r.actions.close()}),v=re({open:a===g.Open}),p={ref:s,id:f,"aria-hidden":!0,onClick:I,...Ee(B)};return le()({ourProps:p,theirProps:c,slot:v,defaultTag:Nt,features:Mt,visible:w,name:"Popover.Backdrop"})}let Rt="div",Dt=ie.RenderStrategy|ie.Static;function At(e,n){let t=l.useId(),{id:f=`headlessui-popover-panel-${t}`,focus:m=!1,anchor:c,portal:r=!1,modal:a=!1,transition:S=!1,...y}=e,s=de("Popover.Panel"),$=z(s,s.selectors.isPortalled),[w,B,I,v,p]=z(s,l.useCallback(h=>[h.popoverState,h.button,h.__demoMode,h.beforePanelSentinel,h.afterPanelSentinel],[])),b=`headlessui-focus-sentinel-before-${t}`,x=`headlessui-focus-sentinel-after-${t}`,i=l.useRef(null),_=Pt(c),[te,ne]=gt(_),L=$t();_&&(r=!0);let[R,K]=l.useState(null),ae=J(i,n,_?te:null,s.actions.setPanel,K),oe=we(B),V=we(i.current);Xe(()=>(s.actions.setPanelId(f),()=>s.actions.setPanelId(null)),[f,s]);let W=Oe(),[u,F]=Te(S,R,W!==null?(W&U.Open)===U.Open:w===g.Open);Ze(u,B,s.actions.close),ze(I?!1:a&&u,V);let T=k(h=>{var o;switch(h.key){case q.Escape:if(s.state.popoverState!==g.Open||!i.current)return;let d=se(i.current);if(d&&!i.current.contains(d))return;h.preventDefault(),h.stopPropagation(),s.actions.close(),(o=s.state.button)==null||o.focus();break}});l.useEffect(()=>{var h;e.static||w===g.Closed&&((h=e.unmount)==null||h)&&s.actions.setPanel(null)},[w,e.unmount,e.static,s]),l.useEffect(()=>{if(I||!m||w!==g.Open||!i.current)return;let h=se(i.current);i.current.contains(h)||H(i.current,G.First)},[I,m,i.current,w]);let j=re({open:w===g.Open,close:s.actions.refocusableClose}),Y=me(_?L():{},{ref:ae,id:f,onKeyDown:T,onBlur:m&&w===g.Open?h=>{var o,d,O,E,D;let Q=h.relatedTarget;Q&&i.current&&((o=i.current)!=null&&o.contains(Q)||(s.actions.close(),((O=(d=v.current)==null?void 0:d.contains)!=null&&O.call(d,Q)||(D=(E=p.current)==null?void 0:E.contains)!=null&&D.call(E,Q))&&Q.focus({preventScroll:!0})))}:void 0,tabIndex:-1,style:{...y.style,...ne,"--button-width":St(u,B,!0).width},...Ee(F)}),N=Fe(),X=k(()=>{let h=i.current;if(!h)return;function o(){Z(N.current,{[A.Forwards]:()=>{var d;H(h,G.First)===he.Error&&((d=s.state.afterPanelSentinel.current)==null||d.focus())},[A.Backwards]:()=>{var d;(d=s.state.button)==null||d.focus({preventScroll:!0})}})}o()}),ue=k(()=>{let h=i.current;if(!h)return;function o(){Z(N.current,{[A.Forwards]:()=>{var d;if(!s.state.button)return;let O=(d=ge(s.state.button))!=null?d:document.body,E=Pe(O),D=E.indexOf(s.state.button),Q=E.slice(0,D+1),ce=[...E.slice(D+1),...Q];for(let ve of ce.slice())if(ve.dataset.headlessuiFocusGuard==="true"||R!=null&&R.contains(ve)){let Ce=ce.indexOf(ve);Ce!==-1&&ce.splice(Ce,1)}H(ce,G.First,{sorted:!1})},[A.Backwards]:()=>{var d;H(h,G.Previous)===he.Error&&((d=s.state.button)==null||d.focus())}})}o()}),fe=le();return C.createElement(Je,null,C.createElement(pe.Provider,{value:f},C.createElement(je,{value:s.actions.refocusableClose},C.createElement(Ue,{enabled:r?e.static||u:!1,ownerDocument:oe},u&&$&&C.createElement(ye,{id:b,ref:v,features:xe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:X}),fe({ourProps:Y,theirProps:y,slot:j,defaultTag:Rt,features:Dt,visible:u,name:"Popover.Panel"}),u&&$&&C.createElement(ye,{id:x,ref:p,features:xe.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:ue})))))}let Gt="div";function Lt(e,n){let t=l.useRef(null),f=J(t,n),[m,c]=l.useState([]),r=k(v=>{c(p=>{let b=p.indexOf(v);if(b!==-1){let x=p.slice();return x.splice(b,1),x}return p})}),a=k(v=>(c(p=>[...p,v]),()=>r(v))),S=k(()=>{var v;let p=ge(t.current);if(!p)return!1;let b=se(t.current);return(v=t.current)!=null&&v.contains(b)?!0:m.some(x=>{var i,_;return((i=p.getElementById(x.buttonId.current))==null?void 0:i.contains(b))||((_=p.getElementById(x.panelId.current))==null?void 0:_.contains(b))})}),y=k(v=>{for(let p of m)p.buttonId.current!==v&&p.close()}),s=l.useMemo(()=>({registerPopover:a,unregisterPopover:r,isFocusWithinPopoverGroup:S,closeOthers:y}),[a,r,S,y]),$=re({}),w=e,B={ref:f},I=le();return C.createElement(Ne,null,C.createElement(Se.Provider,{value:s},I({ourProps:B,theirProps:w,slot:$,defaultTag:Gt,name:"Popover.Group"})))}let Qt=ee(Tt),Ae=ee(jt),qt=ee(De),Ht=ee(De),Ge=ee(At),Kt=ee(Lt),Vt=Object.assign(Qt,{Button:Ae,Backdrop:Ht,Overlay:qt,Panel:Ge,Group:Kt});/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/NodeInformationCard-DGC6n0fh.js b/frontend/dist/assets/NodeInformationCard-PgTi9luy.js similarity index 90% rename from frontend/dist/assets/NodeInformationCard-DGC6n0fh.js rename to frontend/dist/assets/NodeInformationCard-PgTi9luy.js index a9741ed3..ba0f561e 100644 --- a/frontend/dist/assets/NodeInformationCard-DGC6n0fh.js +++ b/frontend/dist/assets/NodeInformationCard-PgTi9luy.js @@ -1 +1 @@ -import{j as s,N as i,R as d,cV as c}from"./index-CeMilrX4.js";import{C as n}from"./PageLayout-Cw_MXmcE.js";import{D as m}from"./DataBox-Da-5DbUW.js";function j({nodeName:e,repeaterVersion:a,coreVersion:t,localHash:r,publicKey:l}){return s.jsxs(n,{neomorphic:!0,children:[s.jsx(i,{icon:s.jsx(d,{}),title:"Node Information"}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 sm:gap-4",children:[s.jsxs("div",{className:"min-w-0 col-span-2 sm:col-span-1",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Node Name"}),s.jsx("p",{className:"type-body text-fg-primary mt-0.5 sm:mt-1 truncate",title:e,children:e})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Repeater"}),s.jsxs("p",{className:"type-data text-fg-primary mt-0.5 sm:mt-1 truncate",title:`v${a}`,children:["v",a]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Core"}),s.jsxs("p",{className:"type-data text-fg-primary mt-0.5 sm:mt-1 truncate",title:`v${t}`,children:["v",t]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Console"}),s.jsxs("p",{className:"type-data text-fg-primary mt-0.5 sm:mt-1 truncate",title:`v${c}`,children:["v",c]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Local Hash"}),s.jsx("div",{className:"mt-0.5 sm:mt-1",children:r?s.jsx(m,{copy:!0,size:"compact",children:r}):s.jsx("span",{className:"type-data-sm text-fg-secondary",children:"N/A"})})]})]}),l&&s.jsxs("div",{className:"mt-3 sm:mt-4 pt-3 sm:pt-4 border-t border-edge-subtle",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Public Key"}),s.jsx("div",{className:"mt-0.5 sm:mt-1",children:s.jsx(m,{copy:!0,size:"responsive",children:l})})]})]})}export{j as N}; +import{j as s,N as i,R as d,cW as c}from"./index-BOwCLZTK.js";import{C as n}from"./PageLayout-QKntxcnp.js";import{D as m}from"./DataBox-BVnEv6Au.js";function j({nodeName:e,repeaterVersion:a,coreVersion:t,localHash:r,publicKey:l}){return s.jsxs(n,{neomorphic:!0,children:[s.jsx(i,{icon:s.jsx(d,{}),title:"Node Information"}),s.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3 sm:gap-4",children:[s.jsxs("div",{className:"min-w-0 col-span-2 sm:col-span-1",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Node Name"}),s.jsx("p",{className:"type-body text-fg-primary mt-0.5 sm:mt-1 truncate",title:e,children:e})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Repeater"}),s.jsxs("p",{className:"type-data text-fg-primary mt-0.5 sm:mt-1 truncate",title:`v${a}`,children:["v",a]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Core"}),s.jsxs("p",{className:"type-data text-fg-primary mt-0.5 sm:mt-1 truncate",title:`v${t}`,children:["v",t]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Console"}),s.jsxs("p",{className:"type-data text-fg-primary mt-0.5 sm:mt-1 truncate",title:`v${c}`,children:["v",c]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Local Hash"}),s.jsx("div",{className:"mt-0.5 sm:mt-1",children:r?s.jsx(m,{copy:!0,size:"compact",children:r}):s.jsx("span",{className:"type-data-sm text-fg-secondary",children:"N/A"})})]})]}),l&&s.jsxs("div",{className:"mt-3 sm:mt-4 pt-3 sm:pt-4 border-t border-edge-subtle",children:[s.jsx("span",{className:"type-label text-fg-secondary",children:"Public Key"}),s.jsx("div",{className:"mt-0.5 sm:mt-1",children:s.jsx(m,{copy:!0,size:"responsive",children:l})})]})]})}export{j as N}; diff --git a/frontend/dist/assets/PacketList-BviFr-nL.js b/frontend/dist/assets/PacketList-DquMVCqT.js similarity index 99% rename from frontend/dist/assets/PacketList-BviFr-nL.js rename to frontend/dist/assets/PacketList-DquMVCqT.js index 65f5b27e..ac59cbdb 100644 --- a/frontend/dist/assets/PacketList-BviFr-nL.js +++ b/frontend/dist/assets/PacketList-DquMVCqT.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PathMapMapLibre-DNuTnT6x.js","assets/index-CeMilrX4.js","assets/BasemapLayer-CNBmoufo.js","assets/useMapViewStore-DgL-E_Uc.js","assets/index-BK59_Mkt.js","assets/index-CLjIU9sF.css","assets/BasemapLayer-B1CfjdFi.css"])))=>i.map(i=>d[i]); -import{d as ye,bl as as,bm as Pt,bn as ns,bo as rs,j as e,c as R,B as nt,e as ls,r as h,E as rt,x as M,bp as Mt,bq as Bt,br as Lt,R as de,bs as Rt,bt as Ht,bu as Ft,bv as he,bw as Xe,a6 as Ee,_ as is,bx as cs,by as os,bz as ds,bA as xs,bB as ms,bC as hs,m as oe,af as re,F as us,D as ps,bD as fs,bE as le,bF as ht,bG as gs,bH as ys,bI as js,bJ as bs,bK as Ns,bL as vs,bM as Ze,bN as ws,ab as ks,K as Dt,bO as Cs,bP as _s,bQ as Ss,bR as Ts,ak as At,al as Et,A as qe,bS as Ps,am as Ms,bT as Bs,bU as lt}from"./index-CeMilrX4.js";import{a as Ls,u as Rs}from"./circle-x-B6UCLWHM.js";import{p as Hs,d as Fs,e as It,g as Ds,b as As}from"./primitives-Dgc86_cp.js";import{u as Es,r as Is,a as zs,b as $s,c as Us,d as Os,i as Vs}from"./consumer-registry-Hkh6Dv_i.js";import{D as Pe,R as Ie,P as Me,g as Gs,C as xe}from"./badge-colors-DnsnMXHA.js";import{g as zt,e as _e,a as $t}from"./chat-utils-BJwCtjDV.js";import{A as ue,S as ze,i as $e,a as Qs,g as ut}from"./SignalIndicator-CpBGKD5A.js";import{a as Ws,A as Ut}from"./arrow-up-C471XgXc.js";import{C as it}from"./chevron-right-D3QL4sfa.js";import{M as Ue}from"./map-pin-D6_BkIVb.js";import{C as qs}from"./circle-question-mark-Bqc_DPUo.js";import{T as Je}from"./triangle-alert-DiFold9L.js";import{D as X}from"./DataBox-Da-5DbUW.js";import{L as Ks}from"./layers-DVUHhJuY.js";import{H as Ot}from"./hash-CBEVBQJR.js";import{A as Ys}from"./activity-BZFnO4kb.js";import{C as Xs}from"./circle-check-CY6Nl8LU.js";import{D as Zs}from"./database-D2sIhibw.js";import{H as Js,D as et,u as ea}from"./useMapViewStore-DgL-E_Uc.js";import{S as we}from"./shield-D-fYOAoy.js";import{C as Vt}from"./MqttModeBadge-C_MEMmDd.js";import{Z as pt}from"./zap-09srAnh-.js";/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PathMapMapLibre-BxRhUmZr.js","assets/index-BOwCLZTK.js","assets/BasemapLayer-B-5TmAfZ.js","assets/useMapViewStore-DpXuD1iT.js","assets/index-2RIoVPos.js","assets/index-DH0lUVGm.css","assets/BasemapLayer-B1CfjdFi.css"])))=>i.map(i=>d[i]); +import{d as ye,bl as as,bm as Pt,bn as ns,bo as rs,j as e,c as R,B as nt,e as ls,r as h,E as rt,x as M,bp as Mt,bq as Bt,br as Lt,R as de,bs as Rt,bt as Ht,bu as Ft,bv as he,bw as Xe,a6 as Ee,_ as is,bx as cs,by as os,bz as ds,bA as xs,bB as ms,bC as hs,m as oe,af as re,F as us,D as ps,bD as fs,bE as le,bF as ht,bG as gs,bH as ys,bI as js,bJ as bs,bK as Ns,bL as vs,bM as Ze,bN as ws,ab as ks,K as Dt,bO as Cs,bP as _s,bQ as Ss,bR as Ts,ak as At,al as Et,A as qe,bS as Ps,am as Ms,bT as Bs,bU as lt}from"./index-BOwCLZTK.js";import{a as Ls,u as Rs}from"./circle-x-BJVhIbR2.js";import{p as Hs,d as Fs,e as It,g as Ds,b as As}from"./primitives-DEqdAn1G.js";import{u as Es,r as Is,a as zs,b as $s,c as Us,d as Os,i as Vs}from"./consumer-registry-CTjikLma.js";import{D as Pe,R as Ie,P as Me,g as Gs,C as xe}from"./badge-colors-DCbxcv7o.js";import{g as zt,e as _e,a as $t}from"./chat-utils-D21OFED5.js";import{A as ue,S as ze,i as $e,a as Qs,g as ut}from"./SignalIndicator-Calk-LyB.js";import{a as Ws,A as Ut}from"./arrow-up-BqsZCBBC.js";import{C as it}from"./chevron-right-DJVm4pVP.js";import{M as Ue}from"./map-pin-C2z_C0J3.js";import{C as qs}from"./circle-question-mark-XDnZ1ChV.js";import{T as Je}from"./triangle-alert-SO3tIa8w.js";import{D as X}from"./DataBox-BVnEv6Au.js";import{L as Ks}from"./layers-Dg2mpSl7.js";import{H as Ot}from"./hash-Dwn2PbMF.js";import{A as Ys}from"./activity-D5uH2SFx.js";import{C as Xs}from"./circle-check-CmQaOkab.js";import{D as Zs}from"./database-C6oOGn9y.js";import{H as Js,D as et,u as ea}from"./useMapViewStore-DpXuD1iT.js";import{S as we}from"./shield-DYw72pvS.js";import{C as Vt}from"./MqttModeBadge-CSj5wNzF.js";import{Z as pt}from"./zap-Bd-kARJ1.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -39,7 +39,7 @@ import{d as ye,bl as as,bm as Pt,bn as ns,bo as rs,j as e,c as R,B as nt,e as ls * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xa=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ke=ye("user",xa);function ma(t){t.values.forEach(a=>a.stop())}function tt(t,a){[...a].reverse().forEach(n=>{const r=t.getVariant(n);r&&Pt(t,r),t.variantChildren&&t.variantChildren.forEach(i=>{tt(i,a)})})}function ha(t,a){if(Array.isArray(a))return tt(t,a);if(typeof a=="string")return tt(t,[a]);Pt(t,a)}function ua(){const t=new Set,a={subscribe(s){return t.add(s),()=>void t.delete(s)},start(s,n){const r=[];return t.forEach(i=>{r.push(as(i,s,{transitionOverride:n}))}),Promise.all(r)},set(s){return t.forEach(n=>{ha(n,s)})},stop(){t.forEach(s=>{ma(s)})},mount(){return()=>{a.stop()}}};return a}function pa(){const t=ns(ua);return rs(t.mount,[]),t}function fa({"aria-label":t="Page navigation",className:a,...s}){return e.jsx("nav",{"aria-label":t,...s,className:R("flex gap-x-2",a)})}function ga({onClick:t,disabled:a=!1,className:s,children:n="Previous"}){return e.jsx("span",{className:R("grow basis-0",s),children:e.jsxs(nt,{plain:!0,onClick:t,disabled:a,"aria-label":"Previous page",className:R("gap-1",a&&"invisible"),children:[e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M2.75 8H13.25M2.75 8L5.25 5.5M2.75 8L5.25 10.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),n]})})}function ya({onClick:t,disabled:a=!1,className:s,children:n="Next"}){return e.jsx("span",{className:R("flex grow basis-0 justify-end",s),children:e.jsxs(nt,{plain:!0,onClick:t,disabled:a,"aria-label":"Next page",className:R("gap-1",a&&"invisible"),children:[n,e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M13.25 8L2.75 8M13.25 8L10.75 10.5M13.25 8L10.75 5.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})]})})}function ja({className:t,...a}){return e.jsx("span",{...a,className:R("hidden items-baseline gap-x-2 sm:flex",t)})}function ba({page:t,current:a=!1,onClick:s,className:n,children:r}){return e.jsx(nt,{plain:!a,outline:a,onClick:()=>s==null?void 0:s(t),"aria-label":`Page ${t}`,"aria-current":a?"page":void 0,className:R("min-w-[2.25rem] before:absolute before:-inset-px before:rounded-lg",a&&"before:bg-subtle-fill",n),children:r??t})}function Na({className:t,...a}){return e.jsx("span",{"aria-hidden":"true",...a,className:R("w-[2.25rem] select-none text-center text-sm text-fg-muted",t),children:"…"})}function va(t,a,s=1){if(a<=7)return Array.from({length:a},(m,g)=>g+1);const n=Math.max(t-s,1),r=Math.min(t+s,a),i=n>2,l=ry+1),"gap",a]}if(i&&!l){const m=3+2*s;return[1,"gap",...Array.from({length:m},(u,y)=>a-m+y+1)]}return[1,"gap",...Array.from({length:r-n+1},(m,g)=>n+g),"gap",a]}const dr=ls(t=>({requestedHash:null,requestChannel:a=>t({requestedHash:a}),clearRequest:()=>t({requestedHash:null})}));function wa(t){if(t.length===0)return[];const a=[];let s=0;for(;s{const l=i===t.length-1,o=n&&r.toUpperCase()===n;return e.jsxs("span",{className:"flex items-center flex-shrink-0",children:[o?e.jsx("span",{className:"px-1 py-0.5 rounded bg-sys-amber/20 text-sys-amber text-[9px] font-medium",children:"You"}):e.jsx("span",{className:"px-1 py-0.5 rounded bg-subtle-fill-hover text-fg-secondary",children:r.toUpperCase()}),!l&&e.jsx(it,{className:"w-2.5 h-2.5 text-fg-muted mx-0.5 flex-shrink-0"})]},`${r}-${i}`)})})}const Wt=h.memo(Ta);function qt({channelName:t,onClick:a,active:s,compact:n,className:r}){const i=t.startsWith("#")?t:`#${t}`,l=R("inline-flex items-center flex-shrink-0","font-medium",n?"px-1.5 h-4 leading-4 rounded text-[10px]":"px-2 h-5 leading-5 rounded text-xs",s?"bg-sys-blue/20 text-sys-blue":"bg-sys-blue/10 text-sys-blue",a&&!s&&"hover:bg-sys-blue/20 cursor-pointer",r);return a?e.jsx("button",{type:"button",onClick:a,className:l,children:i}):e.jsx("span",{className:l,children:i})}function Se(t){return{"--data-box-accent":he[t]}}function Kt(t){const a=t.payload_type_name||Ht(t.payload_type??t.type),s=t.route_type_name||Ft(t.route_type??t.route),n=Me[a]??"zinc",r=Ie[s]??"zinc";return{payloadType:a,routeType:s,payloadColor:n,routeColor:r}}function Oe(t){if(!t)return[];if(Array.isArray(t))return t;try{const a=JSON.parse(t);return Array.isArray(a)?a:[]}catch{return[]}}function Yt(t,a){if(a){const s=a(t);return{name:s.name,isCompanion:s.isCompanion,isRepeater:s.isRepeater}}return{name:null,isCompanion:!1,isRepeater:!1}}function Pa({packet:t,onClick:a,localHash:s,neighbors:n,resolveSource:r,isFlashing:i=!1,isTraceHighlighted:l,onTraceHover:o,traceTag:m,onViewTraceReport:g,dupeGroupPosition:u,isDupeGroupHovered:y=!1,onDupeGroupHover:w,dupeCount:j,getDecodedContent:x,onChannelClick:k}){const B=j?!1:Mt(t.is_duplicate),d=u!==void 0,{payloadType:b,routeType:f,payloadColor:_,routeColor:v}=Kt(t),p=t.packet_origin==="tx_local",E=b==="TRACE",O=Oe(t.original_path),G=Oe(t.forwarded_path),K=G.length>0?G:O,D=t.src_hash?(t.src_hash.startsWith("0x")?t.src_hash.slice(2,6):t.src_hash.slice(0,4)).toUpperCase():null,{name:Y,isRepeater:I}=Yt(t,r);let H=null,$=null,U=null,J=null;if(b==="GRP_TXT"&&x){const S=x(t);S!=null&&S.decrypted&&($=S.senderName,U=S.channelName,J=S.channelHash,S.text&&(H=S.text))}else if(b==="TXT_MSG"&&t.raw_packet)try{const S=Bt.fromHex(t.raw_packet);if(S.success&&S.packet){const ce=Lt(S.packet.payload);ce&&!ce.encrypted&&(H=ce.text)}}catch{}const T=$||(I?null:Y),z=!!T,te=!z&&I&&!!Y,se=!z&&!te&&b==="GRP_TXT"&&!H,c=t.payload_length??t.length??0;t.lbt_attempts;const Z=h.useCallback(()=>{E&&m&&g?g(m):a(t)},[E,m,g,a,t]),q=h.useCallback(()=>{E&&m&&o&&o(m),d&&w&&t.packet_hash&&w(t.packet_hash)},[E,m,o,d,w,t.packet_hash]),ie=h.useCallback(()=>{o&&o(null),w&&w(null)},[o,w]),P=he[_]||he.zinc,F=y,ae=()=>{const S={pointerEvents:"none"};return u==="first"?{...S,borderTop:`2px solid ${P}`,borderLeft:`2px solid ${P}`,borderRight:`2px solid ${P}`,borderBottom:"none",borderRadius:"8px 8px 0 0",inset:"-2px -2px 0 -2px"}:u==="middle"?{...S,borderTop:"none",borderLeft:`2px solid ${P}`,borderRight:`2px solid ${P}`,borderBottom:"none",borderRadius:0,inset:"0 -2px"}:u==="last"?{...S,borderTop:"none",borderLeft:`2px solid ${P}`,borderRight:`2px solid ${P}`,borderBottom:`2px solid ${P}`,borderRadius:"0 0 8px 8px",inset:"0 -2px -2px -2px"}:{...S,border:`2px solid ${P}`,borderRadius:"8px",inset:"-2px"}};return e.jsxs("div",{onClick:Z,onMouseEnter:q,onMouseLeave:ie,className:R("group relative cursor-pointer","hover:bg-subtle-fill",B&&!y&&"opacity-40",i&&"flash-row",p&&"bg-sys-indigo/5",l&&"bg-sys-teal/10"),children:[e.jsx("div",{className:R("absolute pointer-events-none transition-opacity duration-75",d?F?"opacity-100":"opacity-0":"opacity-0 group-hover:opacity-100"),style:ae()}),e.jsxs("div",{className:"relative flex items-center gap-2 min-[600px]:gap-3 px-2 py-2 min-[600px]:px-3 min-[600px]:py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("div",{className:"relative flex-shrink-0",children:z?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:zt(_e(T).cleanName)},children:_e(T).emoji?e.jsx("span",{className:"text-base leading-none",children:_e(T).emoji}):e.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:$t(T)})}):te?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(de,{className:"size-5 text-sys-blue"})}):se?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:e.jsx(Gt,{className:"size-4 text-fg-muted"})}):e.jsx(Qt,{packet:t,variant:"avatar",size:"sm"})}),e.jsx("div",{className:"min-w-0",children:z?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:T}),D&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:D})]}):te?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:Y}),D&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:D})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-bold text-[13px] text-fg-primary font-sans truncate",children:D||"—"}),Y&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate max-w-[70px]",children:Y})]})})]}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 min-[600px]:gap-1.5 min-[900px]:gap-2 min-w-0",children:[e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:Se(_),children:b}),p&&e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:Se("indigo"),children:"LOCAL"}),j&&j>1&&e.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",j]}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:Se(v),children:f}),e.jsxs("span",{className:"hidden min-[520px]:inline type-data-xs text-fg-muted flex-shrink-0",children:[c,"B"]}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:H||U?e.jsxs("span",{className:"text-[11px] text-fg-secondary truncate block flex items-center gap-1",children:[U&&e.jsx(qt,{channelName:U,compact:!0,onClick:k&&J?S=>{S.stopPropagation(),k(J)}:void 0}),H&&e.jsx("span",{className:"italic truncate",children:H})]}):e.jsx(Wt,{path:K,localHash:s})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("span",{className:"data-box data-box-compact",children:Rt(t.timestamp)}),e.jsx(ze,{rssi:t.rssi,snr:t.snr,compact:!0,showValues:!0,validated:$e(t)})]})]})]})}function Ma({packet:t,onClick:a,localHash:s,neighbors:n,resolveSource:r,isFlashing:i=!1,isTraceHighlighted:l,traceTag:o,onViewTraceReport:m,dupeGroupPosition:g,isDupeGroupHovered:u=!1,onDupeGroupHover:y,dupeCount:w,getDecodedContent:j,onChannelClick:x}){const{payloadType:k,routeType:B,payloadColor:d,routeColor:b}=Kt(t),f=t.packet_origin==="tx_local",_=k==="TRACE",v=w?!1:Mt(t.is_duplicate),p=Oe(t.original_path),E=Oe(t.forwarded_path),O=E.length>0?E:p,G=t._hopCount??O.length,K=t.src_hash?(t.src_hash.startsWith("0x")?t.src_hash.slice(2,6):t.src_hash.slice(0,4)).toUpperCase():null,{name:D,isRepeater:Y}=Yt(t,r);let I=null,H=null,$=null,U=null;if(k==="GRP_TXT"&&j){const P=j(t);P!=null&&P.decrypted&&(H=P.senderName,$=P.channelName,U=P.channelHash,P.text&&(I=P.text))}else if(k==="TXT_MSG"&&t.raw_packet)try{const P=Bt.fromHex(t.raw_packet);if(P.success&&P.packet){const F=Lt(P.packet.payload);F&&!F.encrypted&&(I=F.text)}}catch{}const J=H||(Y?null:D),T=!!J,z=!T&&Y&&!!D,te=!T&&!z&&k==="GRP_TXT"&&!I,se=t.payload_length??t.length??0,c=t.lbt_attempts??0,Z=()=>{_&&o&&m?m(o):a(t)},q=he[d]||he.zinc,ie=()=>{if(!g)return{opacity:0};const P=u?1:.4,F=u?"3px":"2px";return g==="first"?{backgroundColor:q,opacity:P,width:F,top:"6px",bottom:0,borderRadius:"0 9999px 0 0"}:g==="middle"?{backgroundColor:q,opacity:P,width:F,top:0,bottom:0,borderRadius:0}:g==="last"?{backgroundColor:q,opacity:P,width:F,top:0,bottom:"6px",borderRadius:"0 0 9999px 0"}:{backgroundColor:q,opacity:P,width:F,top:"6px",bottom:"6px",borderRadius:"9999px"}};return e.jsxs("div",{onClick:Z,className:R("relative pl-3 pr-2.5 py-2 cursor-pointer","active:bg-subtle-fill-hover",v&&"opacity-40",i&&"flash-row",f&&"bg-sys-indigo/5",l&&"bg-sys-teal/10"),children:[e.jsx("div",{className:"absolute left-0 transition-all",style:ie()}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"relative flex-shrink-0 mt-0.5",children:T?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:zt(_e(J).cleanName)},children:_e(J).emoji?e.jsx("span",{className:"text-base leading-none",children:_e(J).emoji}):e.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:$t(J)})}):z?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(de,{className:"size-5 text-sys-blue"})}):te?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:e.jsx(Gt,{className:"size-4 text-fg-muted"})}):e.jsx(Qt,{packet:t,variant:"avatar",size:"sm"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[T?e.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:J}):z?e.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:D}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold text-[14px] text-fg-primary tracking-tight flex-shrink-0",children:K||"—"}),D&&e.jsx("span",{className:"text-[12px] text-fg-muted truncate min-w-0",children:D})]}),e.jsx("div",{className:"flex-1"}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:Se(d),children:k}),f&&e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:Se("indigo"),children:"LOCAL"}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:Se(b),children:B}),w&&w>1&&e.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",w]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("span",{className:"type-data-xs text-fg-muted w-[28px] text-right",children:t.rssi}),e.jsx(ze,{rssi:t.rssi,compact:!0,showValues:!1,validated:$e(t)})]})]}),e.jsxs("div",{className:"flex items-center gap-1 type-data-xs text-fg-muted",children:[e.jsx("span",{className:"data-box data-box-compact flex-shrink-0",children:Rt(t.timestamp)}),se>0&&e.jsxs("span",{children:[se,"B"]}),c>0&&e.jsxs("span",{className:c>1?"text-sys-amber/60":void 0,children:["LBT:",c]}),t.snr!=null&&e.jsxs("span",{children:[t.snr.toFixed(0),"dB"]}),I||$?e.jsxs("span",{className:"text-[11px] text-fg-secondary truncate flex items-center gap-1 min-w-0",children:[$&&e.jsx(qt,{channelName:$,compact:!0,onClick:x&&U?P=>{P.stopPropagation(),x(U)}:void 0}),I&&e.jsx("span",{className:"italic truncate",children:I})]}):G>0?e.jsx(Wt,{path:O,localHash:s}):null]})]})]})]})}const Ba=h.memo(Pa),La=h.memo(Ma);function Ra(t,a,s,n,r=!1){const i=t.toUpperCase(),l=[],o=s&&Xe(i,s);o&&l.push(s);for(const j of Object.keys(a))Xe(i,j)&&l.push(j);if(r&&o&&s&&l.length===1)return{matches:l,probability:1,bestMatch:s};if(r&&o&&l.length>1){const j=l.filter(x=>x!==s);if(j.length===1)return{matches:l,probability:1,bestMatch:j[0]}}const m=l.length>0?1/l.length:0,g=[...l].sort();let u=null,y=-1;if(g.length===1)u=g[0];else if(g.length>1&&n){for(const j of g){const x=n.get(j),k=x?typeof x=="number"?x:x.combinedScore:0;k>y&&(y=k,u=j)}u||(u=g[0])}else g.length>0&&(u=g[0]);let w=m;if(l.length>1&&n&&y>0){let j=0;for(const x of l){const k=n.get(x);j+=k?typeof k=="number"?k:k.combinedScore:0}j>0&&(w=Math.min(.95,y/j))}return{matches:l,probability:w,bestMatch:u}}function Ha(t,a,s,n){const i=(s-t)*Math.PI/180,l=(n-a)*Math.PI/180,o=Math.sin(i/2)*Math.sin(i/2)+Math.cos(t*Math.PI/180)*Math.cos(s*Math.PI/180)*Math.sin(l/2)*Math.sin(l/2);return 6371e3*(2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o)))}function Fa(t){return t<100?1:t<500?.9:t<1e3?.7:t<5e3?.5:t<1e4?.3:.1}const Da=h.lazy(()=>is(()=>import("./PathMapMapLibre-DNuTnT6x.js"),__vite__mapDeps([0,1,2,3,4,5,6])));function Aa(t,a,s,n,r=!1,i,l,o){const m=cs(a);let g;l&&(g=os(l,t,{position:o,isLastHop:r}).confidence);const{matches:u,probability:y}=Ra(t,m,n,i,r),w=u.length,j=[],x=t.toUpperCase(),k=s&&s.latitude!==void 0&&s.longitude!==void 0&&(s.latitude!==0||s.longitude!==0);for(const d of u){if(n&&Xe(x,n)&&d===n&&k&&s){j.push({hash:d,name:s.name||"Local Node",latitude:s.latitude,longitude:s.longitude,probability:r?1:y,isLocal:!0});continue}const b=m[d];b!=null&&b.latitude&&(b!=null&&b.longitude)&&!(b.latitude===0&&b.longitude===0)&&j.push({hash:d,name:b.node_name||b.name||"Unknown",latitude:b.latitude,longitude:b.longitude,probability:y,isLocal:!1,isDirectNeighbor:b.zero_hop===!0})}const B=j.length;if(B===1)j[0].probability=g??1;else if(B>1)if(g!==void 0&&g>0){const d=j[0];d.probability=g;const b=1-g,f=B-1;j.slice(1).forEach(_=>{_.probability=b/f})}else{let d=0;const b=j.map(f=>{if(f.isLocal)return{candidate:f,score:1};const _=i==null?void 0:i.get(f.hash);let v=.5;if(k&&s){const E=Ha(s.latitude,s.longitude,f.latitude,f.longitude);v=Fa(E)}let p;return _?p=v*.3+_.hopConsistencyScore*.3+_.frequencyScore*.4:(p=v,f.isDirectNeighbor&&(p=Math.max(p,.8))),d+=p,{candidate:f,score:p}});if(d>0)b.forEach(({candidate:f,score:_})=>{f.probability=Math.min(.95,_/d)});else{const f=1/B;j.forEach(_=>_.probability=f)}}return{candidates:j,totalMatches:w}}function Ea(t,a,s,n,r,i){if(!t||t.length===0)return{hops:[],overallConfidence:0,hasValidPath:!1};const l=t.length-1,o=t.map((u,y)=>{const w=y===l,j=t.length-y,{candidates:x,totalMatches:k}=Aa(u,a,s,n,w,r,i,j),B=x.length>0?Math.max(...x.map(d=>d.probability)):0;return{prefix:u,candidates:x,confidence:B,totalMatches:k}}),m=o.reduce((u,y)=>y.confidence===0?0:u*y.confidence,1),g=o.some(u=>u.candidates.length>0);return{hops:o,overallConfidence:m,hasValidPath:g}}function Ia(t){return`${(t*100).toFixed(0)}%`}function za(t){return t>=1?"text-sys-green":t>=.5?"text-sys-indigo":t>=.25?"text-signal-poor":t>0?"text-sys-red":"text-fg-muted"}function $a(t,a,s){let n;return a===0?n=s.muted:t>=1?n=s.success:t>=.5?n=s.secondary:t>=.25?n=s.poor:t>0?n=s.danger:n=s.muted,{color:n}}class Ua extends h.Component{constructor(a){super(a),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?e.jsxs("div",{className:"h-[200px] flex items-center justify-center text-fg-muted",children:[e.jsx(Je,{className:"w-4 h-4 mr-2"}),"Map failed to load"]}):this.props.children}}function Ve({path:t,neighbors:a,localNode:s,localHash:n,srcHash:r,dstHash:i,neighborAffinity:l,prefixLookup:o,hubNodes:m,traceSnr:g,advertiserSource:u}){const[y,w]=h.useState(null),j=h.useMemo(()=>{if(!u)return null;const f=u.nodeType==="wardrive";return{prefix:u.prefix||"??",candidates:[{hash:u.publicKey||u.prefix||"source",name:u.name,latitude:u.latitude,longitude:u.longitude,probability:1,isLocal:!1,isWardrive:f}],confidence:1,totalMatches:1,isSource:!0}},[u]),x=h.useMemo(()=>{if(u||!r)return null;const f=Ee(r),_=a[r];if((_==null?void 0:_.latitude)&&(_==null?void 0:_.longitude)&&!(_.latitude===0&&_.longitude===0))return{prefix:f,candidates:[{hash:r,name:_.node_name||_.name||"Source",latitude:_.latitude,longitude:_.longitude,probability:1,isLocal:!1,isDirectNeighbor:_.zero_hop===!0}],confidence:1,totalMatches:1,isSource:!0};const p=(_==null?void 0:_.node_name)||(_==null?void 0:_.name)||r.slice(0,8);return{prefix:f,candidates:[{hash:r,name:p,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isSource:!0}},[u,r,a]),k=h.useMemo(()=>{const f=i!=null&&i.startsWith("0x")?i.slice(2):i;if((!f||f==="00"||f==="0000000000000000")&&s&&n){const G=Ee(n),K=s.latitude!==0||s.longitude!==0;return{prefix:G,candidates:[{hash:n,name:s.name||"Local Node",latitude:K?s.latitude:0,longitude:K?s.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}if(!i)return null;const v=Ee(i);if(n&&i===n&&s){const G=s.latitude!==0||s.longitude!==0;return{prefix:v,candidates:[{hash:i,name:s.name||"Local Node",latitude:G?s.latitude:0,longitude:G?s.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}const p=a[i];if((p==null?void 0:p.latitude)&&(p==null?void 0:p.longitude)&&!(p.latitude===0&&p.longitude===0))return{prefix:v,candidates:[{hash:i,name:p.node_name||p.name||"Destination",latitude:p.latitude,longitude:p.longitude,probability:1,isLocal:!1,isDirectNeighbor:p.zero_hop===!0}],confidence:1,totalMatches:1,isDestination:!0};const O=(p==null?void 0:p.node_name)||(p==null?void 0:p.name)||i.slice(0,8);return{prefix:v,candidates:[{hash:i,name:O,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isDestination:!0}},[i,a,s,n]),B=h.useMemo(()=>Ea(t,a,s,n,l,o),[t,a,s,n,l,o]),d=h.useMemo(()=>{const f=[];j?f.push(j):x&&f.push(x),f.push(...B.hops),k&&f.push(k);const _=f.reduce((p,E)=>E.confidence===0?0:p*E.confidence,1),v=f.some(p=>p.candidates.some(E=>E.latitude!==0||E.longitude!==0));return{hops:f,overallConfidence:_,hasValidPath:v}},[j,x,B,k]),b=h.useMemo(()=>{const f=getComputedStyle(document.documentElement);return{success:f.getPropertyValue("--sys-green").trim()||"#39D98A",secondary:f.getPropertyValue("--sys-indigo").trim()||"#F9D26F",poor:f.getPropertyValue("--signal-poor").trim()||"#FF8A5C",danger:f.getPropertyValue("--sys-red").trim()||"#FF5C7A",muted:f.getPropertyValue("--text-muted").trim()||"#767688"}},[]);return d.hasValidPath?e.jsxs("div",{className:"h-full flex flex-col space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-fg-muted",children:"Path Confidence:"}),e.jsx("span",{className:za(d.overallConfidence),children:Ia(d.overallConfidence)}),e.jsx("button",{className:"text-fg-muted hover:text-fg-secondary transition-colors",title:"Confidence is calculated based on how many known nodes match each path prefix. Multiple matches reduce confidence due to collision probability.",children:e.jsx(qs,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-green"}),e.jsx("span",{className:"text-fg-muted",children:"Exact"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-indigo"}),e.jsx("span",{className:"text-fg-muted",children:"Multi"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-fg-muted"}),e.jsx("span",{className:"text-fg-muted",children:"Unknown"})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(Ua,{children:e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"h-full bg-elevated flex items-center justify-center text-fg-muted text-sm",children:"Loading map..."}),children:e.jsx(Da,{resolvedPath:d,localNode:s,hubNodes:m,hoveredHopIndex:y,onHoverHop:w,traceSnr:g})})})}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:d.hops.map((f,_)=>{var G,K,D;const v=f.isSource===!0,p=f.isDestination===!0,E=y===_;let O;return v?O=`Source: ${((G=f.candidates[0])==null?void 0:G.name)||"Unknown"}`:p?O=`Destination: ${((K=f.candidates[0])==null?void 0:K.name)||"Unknown"}`:f.totalMatches===0?O="No matching nodes found":f.totalMatches===1?O=`Exact match: ${((D=f.candidates[0])==null?void 0:D.name)||"Unknown"}`:O=`${f.totalMatches} possible matches (${(f.confidence*100).toFixed(0)}% confidence)`,e.jsxs("div",{className:R("flex items-center gap-1 px-1.5 py-0.5 rounded type-data-xs cursor-pointer transition-all",E?"bg-sys-blue/20 ring-1 ring-sys-blue/50":"bg-elevated hover:bg-subtle",v&&"border border-sys-green/30",p&&"border border-sys-blue/30"),title:O,onMouseEnter:()=>w(_),onMouseLeave:()=>w(null),children:[v&&e.jsx("span",{className:"text-sys-green text-[8px] mr-0.5",children:"SRC"}),p&&e.jsx("span",{className:"text-sys-blue text-[8px] mr-0.5",children:"DST"}),e.jsx("span",{style:$a(f.confidence,f.totalMatches,b),children:f.prefix}),!v&&!p&&f.totalMatches>1&&e.jsxs("span",{className:"text-fg-muted",children:["×",f.totalMatches]}),!v&&!p&&f.totalMatches===0&&e.jsx("span",{className:"text-fg-muted",children:"?"})]},_)})})]}):e.jsxs("div",{className:"flex items-center justify-center text-fg-muted text-xs py-4",children:[e.jsx(Ue,{className:"w-3.5 h-3.5 mr-1.5 opacity-50"}),"No location data available for path nodes"]})}const Ke=16;function Ge(t){return t.match(/.{1,2}/g)||[]}function je(t){return t!==null&&t.startsWith("payload:")}const Te={hexRestOpacity:15,cardRestBg:"color-mix(in srgb, var(--elevated) 60%, var(--body))",cardRestShadow:` + */const xa=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ke=ye("user",xa);function ma(t){t.values.forEach(a=>a.stop())}function tt(t,a){[...a].reverse().forEach(n=>{const r=t.getVariant(n);r&&Pt(t,r),t.variantChildren&&t.variantChildren.forEach(i=>{tt(i,a)})})}function ha(t,a){if(Array.isArray(a))return tt(t,a);if(typeof a=="string")return tt(t,[a]);Pt(t,a)}function ua(){const t=new Set,a={subscribe(s){return t.add(s),()=>void t.delete(s)},start(s,n){const r=[];return t.forEach(i=>{r.push(as(i,s,{transitionOverride:n}))}),Promise.all(r)},set(s){return t.forEach(n=>{ha(n,s)})},stop(){t.forEach(s=>{ma(s)})},mount(){return()=>{a.stop()}}};return a}function pa(){const t=ns(ua);return rs(t.mount,[]),t}function fa({"aria-label":t="Page navigation",className:a,...s}){return e.jsx("nav",{"aria-label":t,...s,className:R("flex gap-x-2",a)})}function ga({onClick:t,disabled:a=!1,className:s,children:n="Previous"}){return e.jsx("span",{className:R("grow basis-0",s),children:e.jsxs(nt,{plain:!0,onClick:t,disabled:a,"aria-label":"Previous page",className:R("gap-1",a&&"invisible"),children:[e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M2.75 8H13.25M2.75 8L5.25 5.5M2.75 8L5.25 10.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),n]})})}function ya({onClick:t,disabled:a=!1,className:s,children:n="Next"}){return e.jsx("span",{className:R("flex grow basis-0 justify-end",s),children:e.jsxs(nt,{plain:!0,onClick:t,disabled:a,"aria-label":"Next page",className:R("gap-1",a&&"invisible"),children:[n,e.jsx("svg",{className:"size-4 stroke-current",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M13.25 8L2.75 8M13.25 8L10.75 10.5M13.25 8L10.75 5.5",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})]})})}function ja({className:t,...a}){return e.jsx("span",{...a,className:R("hidden items-baseline gap-x-2 sm:flex",t)})}function ba({page:t,current:a=!1,onClick:s,className:n,children:r}){return e.jsx(nt,{plain:!a,outline:a,onClick:()=>s==null?void 0:s(t),"aria-label":`Page ${t}`,"aria-current":a?"page":void 0,className:R("min-w-[2.25rem] before:absolute before:-inset-px before:rounded-lg",a&&"before:bg-subtle-fill",n),children:r??t})}function Na({className:t,...a}){return e.jsx("span",{"aria-hidden":"true",...a,className:R("w-[2.25rem] select-none text-center text-sm text-fg-muted",t),children:"…"})}function va(t,a,s=1){if(a<=7)return Array.from({length:a},(m,g)=>g+1);const n=Math.max(t-s,1),r=Math.min(t+s,a),i=n>2,l=ry+1),"gap",a]}if(i&&!l){const m=3+2*s;return[1,"gap",...Array.from({length:m},(u,y)=>a-m+y+1)]}return[1,"gap",...Array.from({length:r-n+1},(m,g)=>n+g),"gap",a]}const dr=ls(t=>({requestedHash:null,requestChannel:a=>t({requestedHash:a}),clearRequest:()=>t({requestedHash:null})}));function wa(t){if(t.length===0)return[];const a=[];let s=0;for(;s{const l=i===t.length-1,o=n&&r.toUpperCase()===n;return e.jsxs("span",{className:"flex items-center flex-shrink-0",children:[o?e.jsx("span",{className:"px-1 py-0.5 rounded bg-sys-amber/20 text-sys-amber text-[9px] font-medium",children:"You"}):e.jsx("span",{className:"px-1 py-0.5 rounded bg-subtle-fill-hover text-fg-secondary",children:r.toUpperCase()}),!l&&e.jsx(it,{className:"w-2.5 h-2.5 text-fg-muted mx-0.5 flex-shrink-0"})]},`${r}-${i}`)})})}const Wt=h.memo(Ta);function qt({channelName:t,onClick:a,active:s,compact:n,className:r}){const i=t.startsWith("#")?t:`#${t}`,l=R("inline-flex items-center flex-shrink-0","font-medium",n?"px-1.5 h-4 leading-4 rounded text-[10px]":"px-2 h-5 leading-5 rounded text-xs",s?"bg-sys-blue/20 text-sys-blue":"bg-sys-blue/10 text-sys-blue",a&&!s&&"hover:bg-sys-blue/20 cursor-pointer",r);return a?e.jsx("button",{type:"button",onClick:a,className:l,children:i}):e.jsx("span",{className:l,children:i})}function Se(t){return{"--data-box-accent":he[t]}}function Kt(t){const a=t.payload_type_name||Ht(t.payload_type??t.type),s=t.route_type_name||Ft(t.route_type??t.route),n=Me[a]??"zinc",r=Ie[s]??"zinc";return{payloadType:a,routeType:s,payloadColor:n,routeColor:r}}function Oe(t){if(!t)return[];if(Array.isArray(t))return t;try{const a=JSON.parse(t);return Array.isArray(a)?a:[]}catch{return[]}}function Yt(t,a){if(a){const s=a(t);return{name:s.name,isCompanion:s.isCompanion,isRepeater:s.isRepeater}}return{name:null,isCompanion:!1,isRepeater:!1}}function Pa({packet:t,onClick:a,localHash:s,neighbors:n,resolveSource:r,isFlashing:i=!1,isTraceHighlighted:l,onTraceHover:o,traceTag:m,onViewTraceReport:g,dupeGroupPosition:u,isDupeGroupHovered:y=!1,onDupeGroupHover:w,dupeCount:j,getDecodedContent:x,onChannelClick:k}){const B=j?!1:Mt(t.is_duplicate),d=u!==void 0,{payloadType:b,routeType:f,payloadColor:_,routeColor:v}=Kt(t),p=t.packet_origin==="tx_local",E=b==="TRACE",O=Oe(t.original_path),G=Oe(t.forwarded_path),K=G.length>0?G:O,D=t.src_hash?(t.src_hash.startsWith("0x")?t.src_hash.slice(2,6):t.src_hash.slice(0,4)).toUpperCase():null,{name:Y,isRepeater:I}=Yt(t,r);let H=null,$=null,U=null,J=null;if(b==="GRP_TXT"&&x){const S=x(t);S!=null&&S.decrypted&&($=S.senderName,U=S.channelName,J=S.channelHash,S.text&&(H=S.text))}else if(b==="TXT_MSG"&&t.raw_packet)try{const S=Bt.fromHex(t.raw_packet);if(S.success&&S.packet){const ce=Lt(S.packet.payload);ce&&!ce.encrypted&&(H=ce.text)}}catch{}const T=$||(I?null:Y),z=!!T,te=!z&&I&&!!Y,se=!z&&!te&&b==="GRP_TXT"&&!H,c=t.payload_length??t.length??0;t.lbt_attempts;const Z=h.useCallback(()=>{E&&m&&g?g(m):a(t)},[E,m,g,a,t]),q=h.useCallback(()=>{E&&m&&o&&o(m),d&&w&&t.packet_hash&&w(t.packet_hash)},[E,m,o,d,w,t.packet_hash]),ie=h.useCallback(()=>{o&&o(null),w&&w(null)},[o,w]),P=he[_]||he.zinc,F=y,ae=()=>{const S={pointerEvents:"none"};return u==="first"?{...S,borderTop:`2px solid ${P}`,borderLeft:`2px solid ${P}`,borderRight:`2px solid ${P}`,borderBottom:"none",borderRadius:"8px 8px 0 0",inset:"-2px -2px 0 -2px"}:u==="middle"?{...S,borderTop:"none",borderLeft:`2px solid ${P}`,borderRight:`2px solid ${P}`,borderBottom:"none",borderRadius:0,inset:"0 -2px"}:u==="last"?{...S,borderTop:"none",borderLeft:`2px solid ${P}`,borderRight:`2px solid ${P}`,borderBottom:`2px solid ${P}`,borderRadius:"0 0 8px 8px",inset:"0 -2px -2px -2px"}:{...S,border:`2px solid ${P}`,borderRadius:"8px",inset:"-2px"}};return e.jsxs("div",{onClick:Z,onMouseEnter:q,onMouseLeave:ie,className:R("group relative cursor-pointer","hover:bg-subtle-fill",B&&!y&&"opacity-40",i&&"flash-row",p&&"bg-sys-indigo/5",l&&"bg-sys-teal/10"),children:[e.jsx("div",{className:R("absolute pointer-events-none transition-opacity duration-75",d?F?"opacity-100":"opacity-0":"opacity-0 group-hover:opacity-100"),style:ae()}),e.jsxs("div",{className:"relative flex items-center gap-2 min-[600px]:gap-3 px-2 py-2 min-[600px]:px-3 min-[600px]:py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("div",{className:"relative flex-shrink-0",children:z?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:zt(_e(T).cleanName)},children:_e(T).emoji?e.jsx("span",{className:"text-base leading-none",children:_e(T).emoji}):e.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:$t(T)})}):te?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(de,{className:"size-5 text-sys-blue"})}):se?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:e.jsx(Gt,{className:"size-4 text-fg-muted"})}):e.jsx(Qt,{packet:t,variant:"avatar",size:"sm"})}),e.jsx("div",{className:"min-w-0",children:z?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:T}),D&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:D})]}):te?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-semibold text-[13px] text-fg-primary font-sans truncate max-w-[90px]",children:Y}),D&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate",children:D})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-bold text-[13px] text-fg-primary font-sans truncate",children:D||"—"}),Y&&e.jsx("div",{className:"hidden min-[900px]:block text-[9px] text-fg-muted truncate max-w-[70px]",children:Y})]})})]}),e.jsxs("div",{className:"flex-1 flex items-center gap-1 min-[600px]:gap-1.5 min-[900px]:gap-2 min-w-0",children:[e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:Se(_),children:b}),p&&e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:Se("indigo"),children:"LOCAL"}),j&&j>1&&e.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",j]}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:Se(v),children:f}),e.jsxs("span",{className:"hidden min-[520px]:inline type-data-xs text-fg-muted flex-shrink-0",children:[c,"B"]}),e.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:H||U?e.jsxs("span",{className:"text-[11px] text-fg-secondary truncate block flex items-center gap-1",children:[U&&e.jsx(qt,{channelName:U,compact:!0,onClick:k&&J?S=>{S.stopPropagation(),k(J)}:void 0}),H&&e.jsx("span",{className:"italic truncate",children:H})]}):e.jsx(Wt,{path:K,localHash:s})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[e.jsx("span",{className:"data-box data-box-compact",children:Rt(t.timestamp)}),e.jsx(ze,{rssi:t.rssi,snr:t.snr,compact:!0,showValues:!0,validated:$e(t)})]})]})]})}function Ma({packet:t,onClick:a,localHash:s,neighbors:n,resolveSource:r,isFlashing:i=!1,isTraceHighlighted:l,traceTag:o,onViewTraceReport:m,dupeGroupPosition:g,isDupeGroupHovered:u=!1,onDupeGroupHover:y,dupeCount:w,getDecodedContent:j,onChannelClick:x}){const{payloadType:k,routeType:B,payloadColor:d,routeColor:b}=Kt(t),f=t.packet_origin==="tx_local",_=k==="TRACE",v=w?!1:Mt(t.is_duplicate),p=Oe(t.original_path),E=Oe(t.forwarded_path),O=E.length>0?E:p,G=t._hopCount??O.length,K=t.src_hash?(t.src_hash.startsWith("0x")?t.src_hash.slice(2,6):t.src_hash.slice(0,4)).toUpperCase():null,{name:D,isRepeater:Y}=Yt(t,r);let I=null,H=null,$=null,U=null;if(k==="GRP_TXT"&&j){const P=j(t);P!=null&&P.decrypted&&(H=P.senderName,$=P.channelName,U=P.channelHash,P.text&&(I=P.text))}else if(k==="TXT_MSG"&&t.raw_packet)try{const P=Bt.fromHex(t.raw_packet);if(P.success&&P.packet){const F=Lt(P.packet.payload);F&&!F.encrypted&&(I=F.text)}}catch{}const J=H||(Y?null:D),T=!!J,z=!T&&Y&&!!D,te=!T&&!z&&k==="GRP_TXT"&&!I,se=t.payload_length??t.length??0,c=t.lbt_attempts??0,Z=()=>{_&&o&&m?m(o):a(t)},q=he[d]||he.zinc,ie=()=>{if(!g)return{opacity:0};const P=u?1:.4,F=u?"3px":"2px";return g==="first"?{backgroundColor:q,opacity:P,width:F,top:"6px",bottom:0,borderRadius:"0 9999px 0 0"}:g==="middle"?{backgroundColor:q,opacity:P,width:F,top:0,bottom:0,borderRadius:0}:g==="last"?{backgroundColor:q,opacity:P,width:F,top:0,bottom:"6px",borderRadius:"0 0 9999px 0"}:{backgroundColor:q,opacity:P,width:F,top:"6px",bottom:"6px",borderRadius:"9999px"}};return e.jsxs("div",{onClick:Z,className:R("relative pl-3 pr-2.5 py-2 cursor-pointer","active:bg-subtle-fill-hover",v&&"opacity-40",i&&"flash-row",f&&"bg-sys-indigo/5",l&&"bg-sys-teal/10"),children:[e.jsx("div",{className:"absolute left-0 transition-all",style:ie()}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"relative flex-shrink-0 mt-0.5",children:T?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-1 ring-edge-subtle",style:{backgroundColor:zt(_e(J).cleanName)},children:_e(J).emoji?e.jsx("span",{className:"text-base leading-none",children:_e(J).emoji}):e.jsx("span",{className:"text-white text-[10px] font-bold tracking-tighter",children:$t(J)})}):z?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center ring-[1.5px] ring-sys-blue",children:e.jsx(de,{className:"size-5 text-sys-blue"})}):te?e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-zinc-500/20 ring-1 ring-edge-subtle",children:e.jsx(Gt,{className:"size-4 text-fg-muted"})}):e.jsx(Qt,{packet:t,variant:"avatar",size:"sm"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[T?e.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:J}):z?e.jsx("span",{className:"font-medium text-[14px] text-fg-primary tracking-tight truncate min-w-0",children:D}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-semibold text-[14px] text-fg-primary tracking-tight flex-shrink-0",children:K||"—"}),D&&e.jsx("span",{className:"text-[12px] text-fg-muted truncate min-w-0",children:D})]}),e.jsx("div",{className:"flex-1"}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:Se(d),children:k}),f&&e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:Se("indigo"),children:"LOCAL"}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined flex-shrink-0",style:Se(b),children:B}),w&&w>1&&e.jsxs("span",{className:"data-box data-box-compact flex-shrink-0",children:["×",w]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx("span",{className:"type-data-xs text-fg-muted w-[28px] text-right",children:t.rssi}),e.jsx(ze,{rssi:t.rssi,compact:!0,showValues:!1,validated:$e(t)})]})]}),e.jsxs("div",{className:"flex items-center gap-1 type-data-xs text-fg-muted",children:[e.jsx("span",{className:"data-box data-box-compact flex-shrink-0",children:Rt(t.timestamp)}),se>0&&e.jsxs("span",{children:[se,"B"]}),c>0&&e.jsxs("span",{className:c>1?"text-sys-amber/60":void 0,children:["LBT:",c]}),t.snr!=null&&e.jsxs("span",{children:[t.snr.toFixed(0),"dB"]}),I||$?e.jsxs("span",{className:"text-[11px] text-fg-secondary truncate flex items-center gap-1 min-w-0",children:[$&&e.jsx(qt,{channelName:$,compact:!0,onClick:x&&U?P=>{P.stopPropagation(),x(U)}:void 0}),I&&e.jsx("span",{className:"italic truncate",children:I})]}):G>0?e.jsx(Wt,{path:O,localHash:s}):null]})]})]})]})}const Ba=h.memo(Pa),La=h.memo(Ma);function Ra(t,a,s,n,r=!1){const i=t.toUpperCase(),l=[],o=s&&Xe(i,s);o&&l.push(s);for(const j of Object.keys(a))Xe(i,j)&&l.push(j);if(r&&o&&s&&l.length===1)return{matches:l,probability:1,bestMatch:s};if(r&&o&&l.length>1){const j=l.filter(x=>x!==s);if(j.length===1)return{matches:l,probability:1,bestMatch:j[0]}}const m=l.length>0?1/l.length:0,g=[...l].sort();let u=null,y=-1;if(g.length===1)u=g[0];else if(g.length>1&&n){for(const j of g){const x=n.get(j),k=x?typeof x=="number"?x:x.combinedScore:0;k>y&&(y=k,u=j)}u||(u=g[0])}else g.length>0&&(u=g[0]);let w=m;if(l.length>1&&n&&y>0){let j=0;for(const x of l){const k=n.get(x);j+=k?typeof k=="number"?k:k.combinedScore:0}j>0&&(w=Math.min(.95,y/j))}return{matches:l,probability:w,bestMatch:u}}function Ha(t,a,s,n){const i=(s-t)*Math.PI/180,l=(n-a)*Math.PI/180,o=Math.sin(i/2)*Math.sin(i/2)+Math.cos(t*Math.PI/180)*Math.cos(s*Math.PI/180)*Math.sin(l/2)*Math.sin(l/2);return 6371e3*(2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o)))}function Fa(t){return t<100?1:t<500?.9:t<1e3?.7:t<5e3?.5:t<1e4?.3:.1}const Da=h.lazy(()=>is(()=>import("./PathMapMapLibre-BxRhUmZr.js"),__vite__mapDeps([0,1,2,3,4,5,6])));function Aa(t,a,s,n,r=!1,i,l,o){const m=cs(a);let g;l&&(g=os(l,t,{position:o,isLastHop:r}).confidence);const{matches:u,probability:y}=Ra(t,m,n,i,r),w=u.length,j=[],x=t.toUpperCase(),k=s&&s.latitude!==void 0&&s.longitude!==void 0&&(s.latitude!==0||s.longitude!==0);for(const d of u){if(n&&Xe(x,n)&&d===n&&k&&s){j.push({hash:d,name:s.name||"Local Node",latitude:s.latitude,longitude:s.longitude,probability:r?1:y,isLocal:!0});continue}const b=m[d];b!=null&&b.latitude&&(b!=null&&b.longitude)&&!(b.latitude===0&&b.longitude===0)&&j.push({hash:d,name:b.node_name||b.name||"Unknown",latitude:b.latitude,longitude:b.longitude,probability:y,isLocal:!1,isDirectNeighbor:b.zero_hop===!0})}const B=j.length;if(B===1)j[0].probability=g??1;else if(B>1)if(g!==void 0&&g>0){const d=j[0];d.probability=g;const b=1-g,f=B-1;j.slice(1).forEach(_=>{_.probability=b/f})}else{let d=0;const b=j.map(f=>{if(f.isLocal)return{candidate:f,score:1};const _=i==null?void 0:i.get(f.hash);let v=.5;if(k&&s){const E=Ha(s.latitude,s.longitude,f.latitude,f.longitude);v=Fa(E)}let p;return _?p=v*.3+_.hopConsistencyScore*.3+_.frequencyScore*.4:(p=v,f.isDirectNeighbor&&(p=Math.max(p,.8))),d+=p,{candidate:f,score:p}});if(d>0)b.forEach(({candidate:f,score:_})=>{f.probability=Math.min(.95,_/d)});else{const f=1/B;j.forEach(_=>_.probability=f)}}return{candidates:j,totalMatches:w}}function Ea(t,a,s,n,r,i){if(!t||t.length===0)return{hops:[],overallConfidence:0,hasValidPath:!1};const l=t.length-1,o=t.map((u,y)=>{const w=y===l,j=t.length-y,{candidates:x,totalMatches:k}=Aa(u,a,s,n,w,r,i,j),B=x.length>0?Math.max(...x.map(d=>d.probability)):0;return{prefix:u,candidates:x,confidence:B,totalMatches:k}}),m=o.reduce((u,y)=>y.confidence===0?0:u*y.confidence,1),g=o.some(u=>u.candidates.length>0);return{hops:o,overallConfidence:m,hasValidPath:g}}function Ia(t){return`${(t*100).toFixed(0)}%`}function za(t){return t>=1?"text-sys-green":t>=.5?"text-sys-indigo":t>=.25?"text-signal-poor":t>0?"text-sys-red":"text-fg-muted"}function $a(t,a,s){let n;return a===0?n=s.muted:t>=1?n=s.success:t>=.5?n=s.secondary:t>=.25?n=s.poor:t>0?n=s.danger:n=s.muted,{color:n}}class Ua extends h.Component{constructor(a){super(a),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?e.jsxs("div",{className:"h-[200px] flex items-center justify-center text-fg-muted",children:[e.jsx(Je,{className:"w-4 h-4 mr-2"}),"Map failed to load"]}):this.props.children}}function Ve({path:t,neighbors:a,localNode:s,localHash:n,srcHash:r,dstHash:i,neighborAffinity:l,prefixLookup:o,hubNodes:m,traceSnr:g,advertiserSource:u}){const[y,w]=h.useState(null),j=h.useMemo(()=>{if(!u)return null;const f=u.nodeType==="wardrive";return{prefix:u.prefix||"??",candidates:[{hash:u.publicKey||u.prefix||"source",name:u.name,latitude:u.latitude,longitude:u.longitude,probability:1,isLocal:!1,isWardrive:f}],confidence:1,totalMatches:1,isSource:!0}},[u]),x=h.useMemo(()=>{if(u||!r)return null;const f=Ee(r),_=a[r];if((_==null?void 0:_.latitude)&&(_==null?void 0:_.longitude)&&!(_.latitude===0&&_.longitude===0))return{prefix:f,candidates:[{hash:r,name:_.node_name||_.name||"Source",latitude:_.latitude,longitude:_.longitude,probability:1,isLocal:!1,isDirectNeighbor:_.zero_hop===!0}],confidence:1,totalMatches:1,isSource:!0};const p=(_==null?void 0:_.node_name)||(_==null?void 0:_.name)||r.slice(0,8);return{prefix:f,candidates:[{hash:r,name:p,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isSource:!0}},[u,r,a]),k=h.useMemo(()=>{const f=i!=null&&i.startsWith("0x")?i.slice(2):i;if((!f||f==="00"||f==="0000000000000000")&&s&&n){const G=Ee(n),K=s.latitude!==0||s.longitude!==0;return{prefix:G,candidates:[{hash:n,name:s.name||"Local Node",latitude:K?s.latitude:0,longitude:K?s.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}if(!i)return null;const v=Ee(i);if(n&&i===n&&s){const G=s.latitude!==0||s.longitude!==0;return{prefix:v,candidates:[{hash:i,name:s.name||"Local Node",latitude:G?s.latitude:0,longitude:G?s.longitude:0,probability:1,isLocal:!0}],confidence:1,totalMatches:1,isDestination:!0}}const p=a[i];if((p==null?void 0:p.latitude)&&(p==null?void 0:p.longitude)&&!(p.latitude===0&&p.longitude===0))return{prefix:v,candidates:[{hash:i,name:p.node_name||p.name||"Destination",latitude:p.latitude,longitude:p.longitude,probability:1,isLocal:!1,isDirectNeighbor:p.zero_hop===!0}],confidence:1,totalMatches:1,isDestination:!0};const O=(p==null?void 0:p.node_name)||(p==null?void 0:p.name)||i.slice(0,8);return{prefix:v,candidates:[{hash:i,name:O,latitude:0,longitude:0,probability:1,isLocal:!1}],confidence:1,totalMatches:1,isDestination:!0}},[i,a,s,n]),B=h.useMemo(()=>Ea(t,a,s,n,l,o),[t,a,s,n,l,o]),d=h.useMemo(()=>{const f=[];j?f.push(j):x&&f.push(x),f.push(...B.hops),k&&f.push(k);const _=f.reduce((p,E)=>E.confidence===0?0:p*E.confidence,1),v=f.some(p=>p.candidates.some(E=>E.latitude!==0||E.longitude!==0));return{hops:f,overallConfidence:_,hasValidPath:v}},[j,x,B,k]),b=h.useMemo(()=>{const f=getComputedStyle(document.documentElement);return{success:f.getPropertyValue("--sys-green").trim()||"#39D98A",secondary:f.getPropertyValue("--sys-indigo").trim()||"#F9D26F",poor:f.getPropertyValue("--signal-poor").trim()||"#FF8A5C",danger:f.getPropertyValue("--sys-red").trim()||"#FF5C7A",muted:f.getPropertyValue("--text-muted").trim()||"#767688"}},[]);return d.hasValidPath?e.jsxs("div",{className:"h-full flex flex-col space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-fg-muted",children:"Path Confidence:"}),e.jsx("span",{className:za(d.overallConfidence),children:Ia(d.overallConfidence)}),e.jsx("button",{className:"text-fg-muted hover:text-fg-secondary transition-colors",title:"Confidence is calculated based on how many known nodes match each path prefix. Multiple matches reduce confidence due to collision probability.",children:e.jsx(qs,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-green"}),e.jsx("span",{className:"text-fg-muted",children:"Exact"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-sys-indigo"}),e.jsx("span",{className:"text-fg-muted",children:"Multi"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-fg-muted"}),e.jsx("span",{className:"text-fg-muted",children:"Unknown"})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(Ua,{children:e.jsx(h.Suspense,{fallback:e.jsx("div",{className:"h-full bg-elevated flex items-center justify-center text-fg-muted text-sm",children:"Loading map..."}),children:e.jsx(Da,{resolvedPath:d,localNode:s,hubNodes:m,hoveredHopIndex:y,onHoverHop:w,traceSnr:g})})})}),e.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:d.hops.map((f,_)=>{var G,K,D;const v=f.isSource===!0,p=f.isDestination===!0,E=y===_;let O;return v?O=`Source: ${((G=f.candidates[0])==null?void 0:G.name)||"Unknown"}`:p?O=`Destination: ${((K=f.candidates[0])==null?void 0:K.name)||"Unknown"}`:f.totalMatches===0?O="No matching nodes found":f.totalMatches===1?O=`Exact match: ${((D=f.candidates[0])==null?void 0:D.name)||"Unknown"}`:O=`${f.totalMatches} possible matches (${(f.confidence*100).toFixed(0)}% confidence)`,e.jsxs("div",{className:R("flex items-center gap-1 px-1.5 py-0.5 rounded type-data-xs cursor-pointer transition-all",E?"bg-sys-blue/20 ring-1 ring-sys-blue/50":"bg-elevated hover:bg-subtle",v&&"border border-sys-green/30",p&&"border border-sys-blue/30"),title:O,onMouseEnter:()=>w(_),onMouseLeave:()=>w(null),children:[v&&e.jsx("span",{className:"text-sys-green text-[8px] mr-0.5",children:"SRC"}),p&&e.jsx("span",{className:"text-sys-blue text-[8px] mr-0.5",children:"DST"}),e.jsx("span",{style:$a(f.confidence,f.totalMatches,b),children:f.prefix}),!v&&!p&&f.totalMatches>1&&e.jsxs("span",{className:"text-fg-muted",children:["×",f.totalMatches]}),!v&&!p&&f.totalMatches===0&&e.jsx("span",{className:"text-fg-muted",children:"?"})]},_)})})]}):e.jsxs("div",{className:"flex items-center justify-center text-fg-muted text-xs py-4",children:[e.jsx(Ue,{className:"w-3.5 h-3.5 mr-1.5 opacity-50"}),"No location data available for path nodes"]})}const Ke=16;function Ge(t){return t.match(/.{1,2}/g)||[]}function je(t){return t!==null&&t.startsWith("payload:")}const Te={hexRestOpacity:15,cardRestBg:"color-mix(in srgb, var(--elevated) 60%, var(--body))",cardRestShadow:` var(--depth-stroke-tl), var(--depth-stroke-br) `,selectionBorderWidth:2},st={type:"tween",duration:.25,ease:[.25,.1,.25,1]};function Oa(t,a){return t?`inset 0 0 0 ${Te.selectionBorderWidth}px ${he[a]}`:Te.cardRestShadow}function Va(t,a){return t?a:`color-mix(in srgb, ${a} ${Te.hexRestOpacity}%, transparent)`}function Ga({segments:t,selectedSegment:a,onSegmentClick:s}){const[n,r]=h.useState(null),[i,l]=h.useState(null),o=t.some(u=>u.id!==void 0)&&s,m=[];for(const u of t){const y=Ge(u.hex);for(const w of y)m.push({byte:w.toUpperCase(),color:u.color,id:u.id})}const g=[];for(let u=0;u{const w=u.length{const d=B===u.length-1,b=w&&d,f=he[x],p=(k?n===k:i===x)||!!(k&&a===k);return e.jsx("span",{className:`w-[1.75rem] text-xs text-center py-0.5 font-mono select-text ${o?"cursor-pointer":""}`,style:{backgroundColor:Va(p,f),color:p?"rgba(255,255,255,0.95)":f,transition:p?"none":"background-color 0.15s ease-out, color 0.15s ease-out",touchAction:"manipulation",...b?{borderRadius:"0 0.375rem 0.375rem 0"}:{}},onMouseEnter:()=>{k?r(k):l(x)},onMouseLeave:()=>{r(null),l(null)},onClick:()=>k&&(s==null?void 0:s(k)),onTouchStart:()=>{k?r(k):l(x)},onTouchEnd:()=>{r(null),l(null)},children:j},B)})},y)})})}function Qa({rawHex:t,hexSegments:a,selectedSegment:s,onSegmentClick:n}){const[r,i]=h.useState(!1),l=h.useCallback(async()=>{await us(t.toUpperCase()),i(!0),setTimeout(()=>i(!1),2e3)},[t]);return e.jsxs("div",{className:"bg-inset radius-inner p-6 relative depth-stroke-inset",children:[e.jsx(Ga,{segments:a,selectedSegment:s,onSegmentClick:n}),e.jsx("button",{onClick:l,className:"absolute bottom-3 right-3 flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg bg-subtle-fill-hover hover:bg-subtle-fill-strong text-fg-muted hover:text-fg-secondary transition-all text-xs font-sans",title:"Copy raw packet hex",children:r?e.jsxs(e.Fragment,{children:[e.jsx(ps,{className:"w-3.5 h-3.5 text-sys-green"}),e.jsx("span",{className:"text-sys-green",children:"Copied"})]}):e.jsxs(e.Fragment,{children:[e.jsx(rt,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Copy"})]})})]})}function Wa(t,a){const s=[];let n=0;const r=a.slice(0,64);s.push({id:"payload:publicKey",title:"Public Key",color:"pink",hex:r,startByte:n,endByte:n+31,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:t.publicKey.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Ed25519 public key (32 bytes)"})]})}),n+=32;const i=a.slice(64,72);s.push({id:"payload:timestamp",title:"Timestamp",color:"orange",hex:i,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:i.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[t.timestamp," (",le(t.timestamp),")"]})]})}),n+=4;const l=a.slice(72,200);s.push({id:"payload:signature",title:"Signature",color:"teal",hex:l,startByte:n,endByte:n+63,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:t.signature.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Ed25519 signature (64 bytes)"})]})}),n+=64;const o=a.slice(200,202);if(s.push({id:"payload:flags",title:"Flags",color:"blue",hex:o,startByte:n,endByte:n,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(X,{size:"standard",copy:!0,children:["0x",t.flags.toString(16).padStart(2,"0").toUpperCase()]}),e.jsx("p",{className:"text-xs text-fg-primary mt-1",children:t.flagsDescription}),e.jsxs("p",{className:"text-xs text-fg-muted",children:["Node Type: ",t.nodeType]})]})}),n+=1,t.latitude!==void 0){const m=a.slice(n*2,n*2+8);s.push({id:"payload:latitude",title:"Latitude",color:"green",hex:m,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:m.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[t.latitude.toFixed(6),"°"]})]})}),n+=4}if(t.longitude!==void 0){const m=a.slice(n*2,n*2+8);s.push({id:"payload:longitude",title:"Longitude",color:"indigo",hex:m,startByte:n,endByte:n+3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:m.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:[t.longitude.toFixed(6),"°"]})]})}),n+=4}if(t.name){const m=a.slice(n*2),g=m.length/2;s.push({id:"payload:name",title:"Name",color:"amber",hex:m,startByte:n,endByte:n+g-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:m.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:['"',t.name,'"']})]})})}return s}function qa(t,a){return[{id:"payload:crc",title:"CRC",color:"green",hex:a.slice(0,8),startByte:0,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(X,{size:"standard",copy:!0,children:["0x",t.crc]}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"CRC32 of acknowledged packet"})]})}]}function Ka(t,a){const s=[];s.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:a.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(X,{size:"standard",copy:!0,children:["0x",t.channelHash]}),t.channelName&&e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:["Channel: ",t.channelName]})]})}),t.macHex&&s.push({id:"payload:mac",title:"MAC",color:"indigo",hex:a.slice(2,6),startByte:1,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:t.macHex.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=a.slice(6);return n&&s.push({id:"payload:ciphertext",title:t.decrypted?"Message":"Ciphertext",color:t.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:t.decrypted?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-fg-primary",children:['"',t.text,'"']}),t.senderName&&e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:["From: ",t.senderName]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:n.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"AES-128-ECB encrypted"})]})}),s}function Ya(t,a){const s=[];s.push({id:"payload:channelHash",title:"Channel Hash",color:"blue",hex:a.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(X,{size:"standard",copy:!0,children:["0x",t.channelHash]}),t.channelName&&e.jsxs("p",{className:"text-xs text-fg-primary mt-1",children:["Channel: ",t.channelName]})]})}),t.macHex&&s.push({id:"payload:mac",title:"MAC",color:"indigo",hex:a.slice(2,6),startByte:1,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:t.macHex.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Truncated HMAC-SHA256"})]})});const n=a.slice(6);return n&&s.push({id:"payload:ciphertext",title:t.decrypted?"Decrypted Data":"Encrypted Data",color:t.decrypted?"green":"zinc",hex:n,startByte:3,endByte:3+n.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:(t.decryptedHex||n).toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[t.dataLength," bytes",t.decrypted?"":" (AES-128-ECB encrypted)"]})]})}),s}function Xa(t,a){const s=[];if(s.push({id:"payload:pathLength",title:"Path Length",color:"blue",hex:a.slice(0,2),startByte:0,endByte:0,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",children:t.pathLength}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[t.pathLength," hop",t.pathLength!==1?"s":""]})]})}),t.path.length>0){const n=a.slice(2,2+t.pathLength*2);s.push({id:"payload:path",title:"Path Hops",color:"amber",hex:n,startByte:1,endByte:t.pathLength,decoded:e.jsx(e.Fragment,{children:e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:t.path.map((r,i)=>e.jsxs("span",{className:"flex items-center gap-1",children:[i>0&&e.jsx(ue,{className:"w-3 h-3 text-fg-muted"}),e.jsx(M,{color:"amber",className:"font-mono",children:r})]},i))})})})}if(t.extraType!=null){const n=1+t.pathLength;s.push({id:"payload:extraType",title:"Extra Type",color:"indigo",hex:a.slice(n*2,n*2+2),startByte:n,endByte:n,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",children:t.extraTypeName??`0x${t.extraType.toString(16).padStart(2,"0")}`}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Bundled payload type"})]})})}if(t.extraData){const n=1+t.pathLength+1,r=a.slice(n*2);r&&s.push({id:"payload:extraData",title:"Extra Data",color:"indigo",hex:r,startByte:n,endByte:n+r.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:r.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[r.length/2," bytes"]})]})})}return s}function Za(t,a){const s=[];s.push({id:"payload:crc",title:"Trace Tag",color:"blue",hex:a.slice(0,8),startByte:0,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(X,{size:"standard",copy:!0,children:["0x",t.traceTag]}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Unique trace request identifier"})]})}),s.push({id:"payload:mac",title:"Auth Code",color:"indigo",hex:a.slice(8,16),startByte:4,endByte:7,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:t.authCode}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Authentication/verification code"})]})}),s.push({id:"payload:flags",title:"Flags",color:"amber",hex:a.slice(16,18),startByte:8,endByte:8,decoded:e.jsxs(e.Fragment,{children:[e.jsxs(X,{size:"standard",copy:!0,children:["0x",t.flags.toString(16).toUpperCase().padStart(2,"0")]}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:t.flags===0?"No flags set":`Flags: ${t.flags.toString(2).padStart(8,"0")}b`})]})});const n=a.slice(18);return n&&s.push({id:"payload:path",title:"Target Path",color:"indigo",hex:n,startByte:9,endByte:9+n.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:t.pathHashes.map((r,i)=>{const l=t.snrValues[i],o=l!==void 0?Gs(l):"zinc";return e.jsxs("span",{className:"flex items-center gap-1",children:[i>0&&e.jsx(ue,{className:"w-3 h-3 text-fg-muted"}),e.jsx(M,{color:"indigo",className:"font-mono",children:r}),l!==void 0&&e.jsxs(M,{color:o,className:"font-mono",children:[l>=0?"+":"",Number.isInteger(l)?l:l.toFixed(1),"dB"]})]},i)})}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[t.pathHashes.length," target ",t.pathHashes.length===1?"hop":"hops",t.snrValues.length>0&&` • ${t.snrValues.length} SNR ${t.snrValues.length===1?"value":"values"} collected`,t.isComplete&&" • ✓ Complete"]})]})}),s}function Ja(t,a){const s=[];s.push({id:"payload:msgId",title:"Message ID",color:"blue",hex:a.slice(0,4),startByte:0,endByte:1,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:t.messageId.toUpperCase()}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"Unique message identifier"})]})}),s.push({id:"payload:partNum",title:"Part Number",color:"amber",hex:a.slice(4,6),startByte:2,endByte:2,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:t.partNumber}),e.jsx("p",{className:"text-xs text-fg-muted mt-1",children:"0-indexed part number"})]})}),s.push({id:"payload:totalParts",title:"Total Parts",color:"orange",hex:a.slice(6,8),startByte:3,endByte:3,decoded:e.jsxs(e.Fragment,{children:[e.jsx(X,{size:"standard",copy:!0,children:t.totalParts}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:["Part ",t.partNumber+1," of ",t.totalParts]})]})});const n=a.slice(8);return n&&s.push({id:"payload:partData",title:"Part Data",color:"cyan",hex:n,startByte:4,endByte:4+n.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:n.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[n.length/2," bytes"]})]})}),s}function en(t,a){switch(t.type){case"advert":return Wa(t,a);case"ack":return qa(t,a);case"grp_txt":return Ka(t,a);case"grp_data":return Ya(t,a);case"path":return Xa(t,a);case"trace":return Za(t,a);case"multipart":return Ja(t,a);default:return[{id:"payload:ciphertext",title:"Raw Data",color:"zinc",hex:a,startByte:0,endByte:a.length/2-1,decoded:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-[11px] text-fg-secondary break-all p-2 rounded bg-body/50 font-mono",children:a.toUpperCase()}),e.jsxs("p",{className:"text-xs text-fg-muted mt-1",children:[a.length/2," bytes"]})]})}]}}function tn(t){return t.map(a=>({id:a.id,hex:a.hex,color:a.color}))}function sn({bits:t,field:a,value:s,binary:n}){const r=()=>{if(a==="Payload Type"){const i=Me[s]||"zinc";return e.jsx(M,{color:i,children:s})}if(a==="Route Type"){const i=Ie[s]||"zinc";return e.jsx(M,{color:i,children:s})}return e.jsx("span",{className:"text-sm text-fg-primary",children:s})};return e.jsxs("tr",{children:[e.jsx("td",{className:"py-1.5 text-xs text-fg-muted tabular-nums",children:t}),e.jsx("td",{className:"py-1.5 text-sm text-fg-secondary",children:a}),e.jsx("td",{className:"py-1.5",children:r()}),e.jsx("td",{className:"py-1.5 type-data-xs text-sys-cyan",children:n})]})}function jt({id:t,title:a,color:s,hexBytes:n,startByte:r,endByte:i,isSelected:l,children:o}){const m=n?Ge(n):[];return e.jsxs(oe.div,{layout:"position",layoutId:t,transition:st,className:"w-full min-w-0 overflow-hidden radius-inner p-4 sm:p-5 space-y-4",style:{backgroundColor:Te.cardRestBg,boxShadow:Oa(l,s)},children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 min-w-0",children:[e.jsx(M,{color:s,children:a}),m.length>0&&m.length<=16&&m.map((g,u)=>e.jsx(M,{color:s,className:"font-mono",children:g.toUpperCase()},u))]}),e.jsxs("span",{className:"type-data-xs text-fg-muted flex-shrink-0",children:["Bytes ",r,"-",i]})]}),e.jsx("div",{className:"min-w-0 overflow-hidden",children:o})]})}function an({advert:t,timestamp:a}){const s=a?le(a):le(t.timestamp);return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-indigo/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-indigo) 0%, var(--sys-blue) 100%)"},children:e.jsx(de,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:t.name||"Unknown Node"}),e.jsx("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:t.nodeType})]})]}),e.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[t.latitude!==void 0&&t.longitude!==void 0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ue,{className:"w-4 h-4 text-sys-indigo flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-fg-secondary font-mono",children:[t.latitude.toFixed(5),"°, ",t.longitude.toFixed(5),"°"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(xe,{className:"w-4 h-4 text-sys-indigo flex-shrink-0"}),e.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:s})]})]})]})})}function nn({decoded:t,timestamp:a}){const s=a?le(a):"Unknown";return e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-2xl overflow-hidden bg-sys-teal/10",style:{backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[e.jsxs("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl flex items-center justify-center shadow-lg",style:{background:"linear-gradient(135deg, var(--sys-teal) 0%, var(--sys-cyan) 100%)"},children:e.jsx(Zs,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-fg-primary font-sans truncate leading-tight",children:t.channelName||"Channel Data"}),e.jsxs("p",{className:"text-sm text-fg-muted font-sans mt-0.5",children:[t.dataLength," bytes • ",t.decrypted?"Decrypted":"Encrypted"]})]})]}),e.jsx("div",{className:"mx-4 border-t border-edge-subtle"}),e.jsxs("div",{className:"px-4 py-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ot,{className:"w-4 h-4 text-sys-teal flex-shrink-0"}),e.jsxs("span",{className:"text-sm text-fg-secondary font-sans",children:["Channel: ",e.jsxs("span",{className:"font-mono",children:["0x",t.channelHash]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(xe,{className:"w-4 h-4 text-sys-teal flex-shrink-0"}),e.jsx("span",{className:"text-sm text-fg-secondary font-sans",children:s})]}),t.decrypted&&t.decryptedHex&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle",children:[e.jsx("p",{className:"type-micro text-fg-muted mb-1 font-sans",children:"Decrypted Data"}),e.jsx("div",{className:"max-w-full overflow-x-auto",children:e.jsx(X,{size:"compact",copy:!0,className:"inline-block",children:e.jsx("span",{className:"break-all text-xs",children:t.decryptedHex.toUpperCase()})})})]})]})]})})}function rn({decoded:t,timestamp:a,isLoading:s=!1,onDecrypted:n}){const r=a?le(a):"Unknown",[i,l]=h.useState(""),[o,m]=h.useState(!1),[g,u]=h.useState(null),[y,w]=h.useState(!1),j=h.useCallback(async()=>{if(!(!i.trim()||!t.ciphertextHex||!t.macHex)){m(!0),u(null);try{const x=parseInt(t.channelHash,16),k=ht(t.macHex),B=ht(t.ciphertextHex),d=await gs(i.trim(),x,k,B);if(d.success){const b=d.result.plaintext,f=new TextDecoder("utf-8",{fatal:!1}).decode(b.slice(5)),_=f.indexOf(": "),v={...t,channelName:d.result.channelName,decrypted:!0,timestamp:b[0]|b[1]<<8|b[2]<<16|b[3]<<24,flags:b[4],senderName:_>0?f.slice(0,_):void 0,text:_>0?f.slice(_+2):f};n==null||n(v),l(""),w(!1)}else u(d.error)}catch(x){u(x instanceof Error?x.message:"Unknown error")}finally{m(!1)}}},[i,t,n]);return s?e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"rounded-xl p-4 sm:p-5",style:{backgroundColor:"color-mix(in srgb, var(--elevated) 60%, var(--body))",boxShadow:` diff --git a/frontend/dist/assets/PacketObservatory-B-NONP_Q.js b/frontend/dist/assets/PacketObservatory-B-NONP_Q.js new file mode 100644 index 00000000..75b275d7 --- /dev/null +++ b/frontend/dist/assets/PacketObservatory-B-NONP_Q.js @@ -0,0 +1,5 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/usePipelineStore-Cw6U5jyB.js","assets/index-BOwCLZTK.js","assets/node-types-C6okL8rE.js","assets/index-DH0lUVGm.css"])))=>i.map(i=>d[i]); +import{bU as O,r as T,ec as Fe,ed as Ee,ee as Oe,ef as ze,bu as Be,eg as Ie,eh as Ge,ei as Ke,ej as Ue,bt as Ne,_ as ue,ek as Ve,el as we,by as pe,j as e,em as G,en as K,eo as U,dR as xe,ep as qe,x as M,bG as We,bR as Ce,b_ as Ye,eq as Ze,er as Xe,es as Qe,et as Je,eu as et,ev as J,ew as tt,ex as st,ey as nt,ez as he,ab as me,a6 as Se,e as rt,eA as at,G as lt,K as ot,eB as ct,bg as it,db as dt}from"./index-BOwCLZTK.js";import{usePipelineStore as Y}from"./usePipelineStore-Cw6U5jyB.js";import{e as Te,p as ut,a as pt,A as I,S as V,c as se,f as E,K as i,H as A,B as xt,R as F,T as d,P as re,h as ht,i as S,C as _e,s as ee,j as mt}from"./primitives-DEqdAn1G.js";import{m as ke,i as gt}from"./node-types-C6okL8rE.js";function ft(t){const s=t.type??t.payload_type,r=t.duplicates??[],c=t.is_duplicate,a=r.length;let n=null,l=null;if(a>0){const x=[t.rssi,...r.map(g=>g.rssi).filter(g=>g!=null)],m=[t.snr,...r.map(g=>g.snr).filter(g=>g!=null)];x.length>1&&(n=[Math.min(...x),Math.max(...x)]),m.length>1&&(l=[Math.min(...m),Math.max(...m)])}const o=s===O.TRACE;return{isDuplicate:c,dupeCount:a,rssiRange:n,snrRange:l,hashIncludesPathLen:o}}function bt(t,s,r){const c={traceTag:null,siblingCount:0,isLocallyOriginated:!1,method:"none",confidence:"none",inferredSrc:null,inferredName:null,evidence:[],thisPathLen:0,minPathLen:0,firstHopPrefix:null};let a=t._traceTag;if(!a&&t.payload&&(a=Te(t.payload)),!a)return{...c,evidence:["no traceTag — cannot correlate"]};const n=s.get(a)??[],l=N=>N.path_length!=null?N.path_length:Array.isArray(N.original_path)?N.original_path.length:0,o=l(t),x=n.length>0?Math.min(...n.map(l)):o,m=t.payload?t.payload.slice(18):"",g=m.length>=2?m.slice(0,2).toUpperCase():null,u=[];if(u.push(`traceTag: ${a}`),u.push(`siblings: ${n.length} observation${n.length!==1?"s":""}`),t.packet_origin==="tx_local")return u.push("packet_origin = tx_local → we initiated this trace"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!0,method:"tx_local",confidence:"certain",inferredSrc:"LOCAL",inferredName:null,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g};const v=n.find(N=>N.packet_origin==="tx_local");if(v)return u.push(`sibling (hash ${v.packet_hash}) has packet_origin = tx_local`),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!0,method:"tx_local",confidence:"certain",inferredSrc:"LOCAL",inferredName:null,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g};if(u.push(`this observation: path_len=${o}, min across siblings: ${x}`),g){if(u.push(`first hop in target path: ${g}`),o===0)return u.push("path_len = 0 → heard directly from initiator (no SNR appended yet)"),u.push("initiator is a direct RF neighbor"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!1,method:"min_path_len",confidence:"speculative",inferredSrc:null,inferredName:null,evidence:[...u,"initiator is within direct RF range (zero forwarding hops)"],thisPathLen:o,minPathLen:x,firstHopPrefix:g};const f=Object.entries(r).filter(([k])=>k.replace(/^0x/i,"").slice(0,2).toUpperCase()===g);if(f.length===1){const[k,$]=f[0],h=$.name||$.node_name||null;return u.push(`first hop ${g} → unique neighbor: ${h??k}`),u.push("initiator is whoever sent TO this first hop"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!1,method:"first_hop_neighbor",confidence:"likely",inferredSrc:g,inferredName:h,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g}}else f.length>1?u.push(`first hop ${g} matches ${f.length} neighbors (ambiguous)`):u.push(`first hop ${g} is not a known neighbor`)}return u.push("insufficient data to identify initiator"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!1,method:"none",confidence:"none",inferredSrc:null,inferredName:null,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g}}let ne=null,ce=null;typeof window<"u"&&setTimeout(()=>{ue(()=>import("./usePipelineStore-Cw6U5jyB.js"),__vite__mapDeps([0,1,2,3])).then(t=>{ne=t}),ue(()=>import("./index-BOwCLZTK.js").then(t=>t.fI),__vite__mapDeps([1,3])).then(t=>{ce=t})},0);const He={advertSender:null,advertNodeType:null,advertFlags:null,advertHasLocation:null,advertHasName:null,advertName:null,advertLatitude:null,advertLongitude:null,channelHash:null,byteLength:void 0,hopCount:0,isZeroHop:!0,preComputed:!1};function yt(t,s){const r=t.type??t.payload_type,c=Ne(r),a=Be(t.route),n=r===O.ADVERT,l=r===O.TRACE,o=r===O.PATH,x=r===O.GRP_TXT||r===O.GRP_DATA,m=Ie(t.snr,t.rssi),g=(m==null?void 0:m.finalGrade)??"critical",u=Ge(t.route),v=Ke(t.route),N=Ue(t.route),f=t.route==null?"unknown":u?"flood":v?"direct":"unknown",k=N?`transport-${f}`:f,$=!!s.advertSender;let h="none";$?h="pubkey":x?h="encrypted":t.src_hash&&(h="prefix");const y=gt(r),p=s.advertNodeType!=null?ke(s.advertNodeType):"unknown",_=y!=="unknown"?y:p,H=t.packet_origin??"rx",C=Math.floor(Date.now()/1e3)-t.timestamp,D=C<10?"live":C<300?"recent":C<3600?"warm":C<86400?"stale":"historic",L=t.path_length??(Array.isArray(t.original_path)?t.original_path.length:void 0),P=Array.isArray(t.original_path)&&t.original_path.length>0,R=L??0,b=s.byteLength??(t.raw_packet?Math.floor(t.raw_packet.length/2):0),w=ft(t);return{pType:r,payloadTypeName:c,routeTypeName:a,isAdvert:n,isTrace:l,isPath:o,isGrp:x,signalClass:g,routeClass:k,isFlood:u,isDirect:v,hasTransport:N,senderTier:h,hasPubkey:$,inferredType:y,advertType:p,effectiveType:_,origin:H,age:D,pathLen:L,pathAvail:P,pathHopCount:R,byteLen:b,dupeAnalysis:w}}function jt(t){var f,k,$,h,y,p;const s=pt(t);if(!s||s.pathHashes.length===0)return null;const{pathHashes:r,snrValues:c}=s;if(r.length<2||!ne||!ce)return null;const a=ne.usePipelineStore.getState().srcHashResolverMap,n=ne.usePipelineStore.getState().neighborContext,l=(n==null?void 0:n.hashToName)??new Map,o=ce.useStore.getState().stats,x=(o==null?void 0:o.neighbors)??{},m=o==null?void 0:o.local_hash,g=(k=(f=o==null?void 0:o.config)==null?void 0:f.repeater)==null?void 0:k.latitude,u=(h=($=o==null?void 0:o.config)==null?void 0:$.repeater)==null?void 0:h.longitude,v=Object.keys(x).length>0?Ve([],x,m,g,u):null,N=[];for(let _=0;_0?[r[_-1].toUpperCase()]:[]],P=ge(H,_,L,a,v),R=[H,..._+20?N:null}function ge(t,s,r,c,a){if(s===0){const l=c==null?void 0:c.get(t);if(l)return{hash:l,confidence:.8};if(a){const o=pe(a,t,{position:s,adjacentPrefixes:r});if(o.hash)return{hash:o.hash,confidence:o.confidence}}}else{if(a){const o=pe(a,t,{position:s,adjacentPrefixes:r});if(o.hash)return{hash:o.hash,confidence:o.confidence}}const l=c==null?void 0:c.get(t);if(l)return{hash:l,confidence:.6}}return{hash:null,confidence:0}}function vt(t){var l;const s=t.raw_packet;if(!s||s.length<2)return null;const r=s.replace(/\s/g,""),c=Math.floor(r.length/2),a=((l=r.match(/.{1,2}/g))==null?void 0:l.join(" "))??"";let n="";for(let o=0;o=32&&x<=126?String.fromCharCode(x):"·"}return{hexBytes:a,utf8:n,byteCount:c}}function Nt(t){const s=new Map;let r=0,c="";for(const a of t){if((a.type??a.payload_type)!==O.TRACE)continue;r++,c=a.packet_hash;const l=a._traceTag??(a.payload?Te(a.payload):null);if(!l)continue;let o=s.get(l);o||(o=[],s.set(l,o)),o.push(a)}return{index:s,fingerprint:`${r}:${c}`}}function wt(t,s,r){const c=T.useRef({parse:0,decode:0,enrich:0,traceIndex:0,total:0}),a=T.useMemo(()=>t?vt(t):null,[t]),n=T.useMemo(()=>{if(!s||s.length<4)return c.current.parse=0,c.current.decode=0,null;const h=performance.now(),y=ut(s),p=performance.now()-h;return y?(c.current.parse=p,c.current.decode=0,{protocolPacket:y.packet,display:{headerFields:y.headerFields,transportCodesHex:y.transportCodesHex,pathLengthHex:y.pathLengthHex,pathDataHex:y.pathDataHex,payloadHex:y.payloadHex,payloadByteOffset:y.payloadStartByte,pathByteOffset:y.pathByteOffset,pathLenByteOffset:y.pathLenByteOffset},decoded:y.decoded,error:null}):(c.current.parse=p,c.current.decode=0,{protocolPacket:null,display:null,decoded:null,error:"Packet.fromHex() returned failure"})},[s]),l=T.useMemo(()=>{if(!t)return c.current.enrich=0,He;const h=performance.now();if(t._advertSender!==void 0)return c.current.enrich=performance.now()-h,{advertSender:t._advertSender??null,advertNodeType:t._advertNodeType??null,advertFlags:t._advertFlags??null,advertHasLocation:t._advertHasLocation??null,advertHasName:t._advertHasName??null,advertName:t._advertName??null,advertLatitude:t._advertLatitude??null,advertLongitude:t._advertLongitude??null,channelHash:t._channelHash??null,byteLength:t._byteLength,hopCount:t._hopCount??0,isZeroHop:t._isZeroHop??!0,preComputed:!0};const y=t.type??t.payload_type,p=Fe(s,y),_=Ee(s,y),H=Oe(s,t),C=ze(t);return c.current.enrich=performance.now()-h,{...p,channelHash:_,byteLength:H,...C,preComputed:!1}},[t,s]),o=T.useRef({fingerprint:"",index:new Map}),x=T.useMemo(()=>{const h=performance.now(),{index:y,fingerprint:p}=Nt(r);return c.current.traceIndex=performance.now()-h,p===o.current.fingerprint?o.current.index:(o.current={fingerprint:p,index:y},y)},[r]),m=T.useMemo(()=>{const h=c.current;return{parse:h.parse,decode:h.decode,enrich:h.enrich,traceIndex:h.traceIndex,total:h.parse+h.decode+h.enrich+h.traceIndex}},[n,l,x]);if(!t)return null;const g=s?n?n.error:"rawHex too short":"No raw_packet (warm-tier)",u=(n==null?void 0:n.protocolPacket)??null,v=u?u.payloadVersion:null,N=v===0,f=v===1,k=yt(t,l);let $=null;return k.isTrace&&($=jt(t)),{wire:a,display:(n==null?void 0:n.display)??null,parseError:g,protocolPacket:u,decoded:(n==null?void 0:n.decoded)??null,payloadVersion:v,isV1:N,isV2:f,enrichment:l,traceTagIndex:x,analysis:k,traceHopDetail:$,timing:m}}function ae({options:t,nextFn:s}){var n;const r=t.find(l=>l.active),c=(r==null?void 0:r.color)??"green",a=((n=I[c])==null?void 0:n.stem)??"bg-edge-subtle";return e.jsxs("div",{className:"flex flex-col items-start py-1 gap-0 px-2",children:[e.jsx("div",{className:`w-px h-2 ml-4 ${a}`}),e.jsxs("div",{className:"border border-dashed border-edge-subtle rounded-md overflow-hidden w-full",children:[t.map((l,o)=>{const x=I[l.color??"green"]??I.green;return e.jsxs("div",{className:`flex items-center gap-1.5 px-2 py-px font-mono text-[10px] leading-relaxed transition-opacity ${l.active?x.row:"opacity-25"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${l.active?x.dot:"border border-zinc-500/40"}`}),e.jsx("span",{className:`w-16 shrink-0 font-medium ${l.active?"text-fg-primary":"text-fg-muted"}`,children:l.label}),l.detail&&e.jsx("span",{className:l.active?"text-fg-primary/70":"text-fg-muted",children:l.detail})]},o)}),s&&e.jsx("div",{className:"flex items-center px-2 py-0.5 border-t border-edge-subtle",children:e.jsxs("span",{className:"text-[10px] text-fg-muted font-mono",children:["→ ",s]})})]}),e.jsx("div",{className:`w-px h-2 ml-4 ${a}`})]})}function Ct({tokens:t,nextFn:s}){var n;const r=t.find(l=>l.active),c=(r==null?void 0:r.color)??"green",a=((n=I[c])==null?void 0:n.stem)??"bg-edge-subtle";return e.jsxs("div",{className:"flex flex-col items-start py-1 gap-0 px-2",children:[e.jsx("div",{className:`w-px h-2 ml-4 ${a}`}),e.jsxs("div",{className:"border border-dashed border-edge-subtle rounded-md overflow-hidden w-full",children:[t.map((l,o)=>{const x=I[l.color??"green"]??I.green;return e.jsxs("div",{className:`flex items-center gap-1 px-2 py-px font-mono text-[10px] leading-relaxed transition-opacity ${l.active?x.row:"opacity-25"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${l.active?x.dot:"border border-zinc-500/40"}`}),e.jsx("span",{className:"text-fg-muted shrink-0",children:l.fn}),e.jsxs("span",{className:l.active?"text-fg-primary":"text-fg-muted",children:["(",l.value??"",")"]})]},o)}),s&&e.jsx("div",{className:"flex items-center px-2 py-0.5 border-t border-edge-subtle",children:e.jsxs("span",{className:"text-[10px] text-fg-muted font-mono",children:["→ ",s]})})]}),e.jsx("div",{className:`w-px h-2 ml-4 ${a}`})]})}const St={0:"border-l-sys-green",1:"border-l-sys-blue",2:"border-l-sys-teal",3:"border-l-sys-purple"};function le({stage:t,name:s,fn:r,verdict:c,timeMs:a,skipped:n,skipReason:l,children:o}){const x=St[t]??"";return e.jsx(e.Fragment,{children:e.jsx(G,{defaultOpen:!n,children:e.jsxs("div",{className:`surface-base rounded-lg border border-edge-subtle overflow-hidden border-l-2 ${x}`,children:[e.jsxs(K,{className:"px-3 py-2 w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"font-mono text-xs font-bold text-sys-blue shrink-0",children:t}),e.jsx("span",{className:"font-mono text-xs font-medium text-fg-primary truncate",children:s}),r&&!c&&e.jsx("span",{className:"font-mono text-[11px] text-fg-muted truncate hidden sm:inline",children:r}),c&&e.jsx("span",{className:"font-mono text-[11px] text-fg-muted/70 truncate hidden sm:inline",children:c})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[n&&e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-zinc-500/20 text-fg-muted",children:"N/A"}),a!=null&&!n&&e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-sys-green/15 text-sys-green",children:a<1?`${(a*1e3).toFixed(0)}µs`:`${a.toFixed(2)}ms`})]})]}),e.jsx(U,{children:e.jsx("div",{className:"px-3 pb-3 font-mono text-xs",children:n?e.jsx("p",{className:"text-fg-muted italic",children:l??"Not applicable for this packet type"}):o})})]})})})}function Tt(t,s){return s?"manual":t._stripped?"bulk-tier":qe.isConnected()?"ws-push":"rest-poll"}const _t={connected:"green",degraded:"amber",offline:"red"};function kt({packet:t,isSynthetic:s}){const r=xe(g=>g.wsState),c=xe(g=>g.health),a=Tt(t,s),l=!!t._stripped?"WARM":"HOT",o=[{label:"ws-push",detail:"wsConnected && onPacket()",active:a==="ws-push",color:"green"},{label:"rest-poll",detail:"!wsConnected, 3s interval",active:a==="rest-poll",color:"amber"},{label:"catchup",detail:"wsReconnected, delta > 50",active:a==="catchup",color:"amber"},{label:"bulk-tier",detail:"user extends time range → gzip",active:a==="bulk-tier",color:"blue"},{label:"manual",detail:"hex input — no transport",active:a==="manual",color:"zinc"}],x=[{fn:"transport",value:a,group:"transport",color:a==="ws-push"?"green":a==="bulk-tier"?"blue":"amber"},{fn:"tier",value:l,group:"transport",color:"blue"},{fn:"wsState",value:r,group:"transport",color:r==="connected"?"green":"amber"},{fn:"health",value:c,group:"transport",color:_t[c]}],m=s?"manual hex input":`${a} (${c})`;return e.jsx(le,{stage:0,name:"TRANSPORT",fn:"websocketService / useStore.startPolling",verdict:m,children:s?e.jsx("p",{className:"text-fg-muted italic",children:"Manual hex input — no transport context"}):e.jsx(V,{prefix:"transport",children:e.jsxs("div",{className:"space-y-0",children:[e.jsx(ae,{options:o,nextFn:"ingest()"}),e.jsx(se,{tokens:x})]})})})}function q({start:t,end:s}){const r=s!=null&&s!==t?`[${t}..${s}]`:`[${t}]`;return e.jsx("span",{className:"text-fg-muted text-[9px] font-mono mr-1 select-none",children:r})}const Ht={advert:"decodeAdvert()",ack:"decodeAck()",path:"decodePath()",trace:"decodeTraceWithSnr()",txt_msg:"decodeTextMessage()",grp_txt:"decodeGroupText()",grp_data:"decodeGroupData()",multipart:"decodeMultipart()",control:"decodeControl()",req:"decodeRequest()",response:"decodeResponse()",anon_req:"decodeAnonReq()",generic:"decodeGeneric()"};function $t({rawHex:t,display:s,protocolPacket:r,parseError:c,parseTimeMs:a,payloadVersion:n,isV1:l,isV2:o}){return e.jsx("dl",{className:"space-y-0.5",children:s&&r&&t?e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"A. Parse — Packet.fromHex()"}),a>0&&e.jsx("div",{className:"flex justify-end",children:e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-sys-green/15 text-sys-green",children:a<1?`${(a*1e3).toFixed(0)}µs`:`${a.toFixed(2)}ms`})}),e.jsxs(i,{label:"header byte",children:[e.jsx(q,{start:0}),e.jsx(A,{value:t.slice(0,2)})," ",e.jsx(xt,{value:parseInt(t.slice(0,2),16)})]}),s.headerFields.map(x=>e.jsx(i,{label:` ${x.field}`,children:e.jsx(F,{raw:e.jsxs("span",{className:"text-[10px]",children:["bits[",x.bits,"] = ",x.binary]}),children:e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-2 py-0.5 font-mono text-[11px] text-sys-amber",children:x.value})})},x.field)),e.jsx(i,{label:" version",children:n!=null?e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(d,{fn:"payloadVer",value:`${n}`,color:"amber"}),e.jsx(M,{color:l?"green":o?"blue":"zinc",children:l?"v1":o?"v2":`v${n}`}),l&&e.jsx("span",{className:"text-fg-muted text-[10px]",children:"1-byte hashes, 2-byte MAC"}),o&&e.jsx("span",{className:"text-sys-blue text-[10px]",children:"2-byte hashes, 4-byte MAC (speculative)"})]}):e.jsx("span",{className:"text-fg-muted",children:"unknown"})}),e.jsx(E,{title:"Wire Framing"}),e.jsx(i,{label:"transportCodes",children:s.transportCodesHex?e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(q,{start:1,end:4}),e.jsx(d,{fn:"transport",value:s.transportCodesHex,color:"amber"})]}):e.jsx("span",{className:"text-fg-muted",children:"N/A (non-transport route)"})}),e.jsx(i,{label:"pathLen",children:e.jsx(F,{raw:e.jsxs(e.Fragment,{children:[e.jsx(q,{start:s.pathLenByteOffset}),e.jsx(A,{value:s.pathLengthHex})]}),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(q,{start:s.pathLenByteOffset}),e.jsx(d,{fn:"pathLen",value:`${r.pathLen} hop${r.pathLen!==1?"s":""}`,color:"amber"})]})})}),e.jsx(i,{label:"path",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.pathLen>0&&e.jsx(q,{start:s.pathByteOffset,end:s.pathByteOffset+r.pathLen-1}),e.jsx(re,{hops:r.pathHexArray,hexPrefix:s.pathDataHex||void 0})]})}),e.jsx(i,{label:"payloadLen",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(q,{start:s.payloadByteOffset,end:s.payloadByteOffset+s.payloadHex.length/2-1}),e.jsx(d,{fn:"payloadLen",value:`${s.payloadHex.length/2} bytes`,color:"amber"})]})}),e.jsx(i,{label:"payloadHex",children:e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-2 py-0.5 font-mono text-[11px] text-sys-amber break-all",children:s.payloadHex})})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"A. Parse"}),e.jsxs(i,{label:"result",children:[e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-2 py-0.5 font-mono text-[11px] text-sys-amber",children:"Skipped"}),e.jsx("span",{className:"ml-1 text-fg-muted",children:c??"No raw_packet (warm-tier)"})]})]})})}function Dt({decoded:t,packet:s}){if(!t)return e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"B. Decode"}),e.jsx("p",{className:"text-fg-muted italic text-[10px]",children:"No decoded payload"})]});const r=Ht[t.type]??`decode${t.type}()`;return e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"B. Decode — decodePayload()"}),e.jsx(V,{prefix:"decodePayload",children:e.jsxs("dl",{className:"space-y-0.5",children:[e.jsx(i,{label:"dispatched",children:r}),e.jsx(E,{}),e.jsx(Lt,{decoded:t,packet:s})]})})]})}function Lt({decoded:t,packet:s}){var r;switch(t.type){case"advert":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"publicKey",children:e.jsx(F,{raw:e.jsx("span",{className:"text-[10px] break-all",children:t.publicKey}),children:e.jsx(d,{fn:"publicKey",value:t.publicKey,color:"green"})})}),e.jsx(i,{label:"timestamp",children:e.jsx(d,{fn:"timestamp",value:String(t.timestamp),color:"green"})}),e.jsx(i,{label:"flags",children:e.jsx(F,{raw:e.jsx(A,{value:t.flags}),children:e.jsx(d,{fn:"flags",value:t.flagsDescription,color:"green"})})}),e.jsx(i,{label:"nodeType",children:e.jsx(d,{fn:"nodeType",value:t.nodeType,color:"green"})}),t.latitude!=null&&e.jsx(i,{label:"latitude",children:e.jsx(d,{fn:"lat",value:t.latitude.toFixed(6),color:"green"})}),t.longitude!=null&&e.jsx(i,{label:"longitude",children:e.jsx(d,{fn:"lon",value:t.longitude.toFixed(6),color:"green"})}),t.name&&e.jsx(i,{label:"name",children:e.jsx(d,{fn:"name",value:t.name,color:"green"})})]});case"ack":return e.jsx(i,{label:"crc",children:e.jsx(F,{raw:e.jsx("span",{className:"text-[10px]",children:t.crc}),children:e.jsx(d,{fn:"crc",value:t.crc,color:"green"})})});case"trace":{const c=s!=null&&s.src_hash?s.src_hash.replace(/^0x/i,"").slice(0,2).toUpperCase():null;return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"traceTag",children:e.jsx(d,{fn:"traceTag",value:t.traceTag,color:"green"})}),e.jsx(i,{label:"authCode",children:e.jsx(d,{fn:"authCode",value:String(t.authCode),color:"green"})}),e.jsx(i,{label:"flags",children:e.jsx(A,{value:t.flags})}),e.jsx(i,{label:"target path",children:t.pathHashes.length>0?e.jsx(re,{hops:t.pathHashes.map(a=>a.toUpperCase()),color:"green"}):e.jsx("span",{className:"text-fg-muted italic",children:"∅ empty"})}),e.jsx(i,{label:"complete",children:t.isComplete?e.jsxs("span",{className:"text-sys-green",children:["✓ all ",t.pathHashes.length," hops reported SNR"]}):e.jsxs("span",{className:"text-sys-amber",children:["✗ ",t.snrValues.length,"/",t.pathHashes.length," hops reported"]})}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1 text-[10px]",children:"Directional Edge SNR — per-hop link quality"}),t.snrValues.length===0?e.jsx("p",{className:"text-fg-muted italic text-[11px] ml-2",children:"No SNR values in path field"}):e.jsx("div",{className:"space-y-0.5 ml-2",children:t.snrValues.map((a,n)=>{var g,u,v,N,f;const l=((g=t.pathHashes[n])==null?void 0:g.toUpperCase())??"??",o=n===0?c??"SRC":((u=t.pathHashes[n-1])==null?void 0:u.toUpperCase())??"??",x=(f=(N=(v=Ye.getState().stats)==null?void 0:v.config)==null?void 0:N.radio)==null?void 0:f.spreading_factor,m=we(a,x);return e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-mono",children:[e.jsx("span",{className:"text-fg-muted w-3 text-right",children:n}),e.jsx("span",{className:"text-fg-primary",children:o}),e.jsx("span",{className:"text-fg-muted",children:"→"}),e.jsx("span",{className:"text-fg-primary",children:l}),e.jsx("span",{className:"text-fg-muted",children:"@"}),e.jsxs("span",{className:"font-bold text-sys-green",children:[a>0?"+":"",a.toFixed(1)," dB"]}),e.jsx(M,{color:"green",children:m})]},n)})})]})]})}case"path":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"pathLength",children:e.jsx(d,{fn:"pathLength",value:String(t.pathLength),color:"green"})}),e.jsx(i,{label:"path",children:t.path&&t.path.length>0?e.jsx(re,{hops:t.path.map(c=>c.toUpperCase()),color:"green"}):e.jsx("span",{className:"text-fg-muted italic",children:"∅ empty"})}),t.extraType!=null&&e.jsx(i,{label:"extraType",children:e.jsx(d,{fn:"extraType",value:t.extraTypeName??String(t.extraType),color:"purple"})}),t.extraData&&e.jsxs(i,{label:"extraData",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.extraData}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.extraData.length/2,"B)"]})]})]});case"txt_msg":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"srcHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.srcHash}),children:e.jsx(d,{fn:"srcHash",value:t.srcHash,color:"green"})})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsx(i,{label:"timestamp",children:e.jsx(d,{fn:"timestamp",value:String(t.timestamp),color:"green"})}),e.jsx(i,{label:"text",children:e.jsx(d,{fn:"text",value:t.text,color:"green"})}),e.jsx(i,{label:"encrypted",children:e.jsx(d,{fn:"encrypted",value:String(t.encrypted),color:"green"})})]});case"grp_txt":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channelHash",children:e.jsx(A,{value:t.channelHash})}),t.channelName&&e.jsx(i,{label:"channelName",children:e.jsx(d,{fn:"channel",value:t.channelName,color:"green"})}),e.jsx(i,{label:"decrypted",children:e.jsx(d,{fn:"decrypted",value:String(t.decrypted),color:"green"})}),t.text&&e.jsx(i,{label:"text",children:e.jsx(d,{fn:"text",value:t.text,color:"green"})}),t.senderName&&e.jsx(i,{label:"senderName",children:e.jsx(d,{fn:"sender",value:t.senderName,color:"green"})}),t.macCorrupted&&e.jsx(i,{label:"macCorrupted",children:e.jsx(d,{fn:"macCorrupted",value:"true",color:"green"})})]});case"grp_data":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channelHash",children:e.jsx(A,{value:t.channelHash})}),e.jsx(i,{label:"dataLength",children:t.dataLength}),e.jsx(i,{label:"decrypted",children:String(t.decrypted)})]});case"multipart":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"messageId",children:t.messageId}),e.jsxs(i,{label:"part",children:[t.partNumber+1," / ",t.totalParts]})]});case"control":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"controlType",children:e.jsx(F,{raw:e.jsx(A,{value:t.controlType}),children:e.jsx(d,{fn:"controlType",value:t.subtypeName,color:"green"})})}),e.jsx(i,{label:"subtype",children:e.jsx(d,{fn:"subtype",value:`0x${t.subtype.toString(16).padStart(2,"0")}`,color:"green"})}),t.nodeTypeName&&e.jsxs(i,{label:"nodeType",children:[e.jsx(d,{fn:"nodeType",value:t.nodeTypeName,color:"green"}),e.jsxs("span",{className:"text-fg-muted text-[10px] ml-1",children:["(flags & 0x0F = 0x",(r=t.nodeType)==null?void 0:r.toString(16).padStart(2,"0"),")"]})]}),t.snrDb!=null&&e.jsxs(i,{label:"snr",children:[e.jsxs("span",{className:"font-bold text-sys-green",children:[t.snrDb>0?"+":"",t.snrDb.toFixed(1)," dB"]}),e.jsx(M,{color:"green",children:t.snrDb>=5?"strong":t.snrDb>=0?"fair":"weak"})]}),t.tag&&e.jsx(i,{label:"tag",children:e.jsx(d,{fn:"tag",value:t.tag,color:"green"})}),t.publicKey&&e.jsxs(i,{label:"publicKey",children:[e.jsx("span",{className:"break-all text-[10px] font-mono text-sys-green",children:t.publicKey}),e.jsx(M,{color:t.publicKeyFull?"green":"amber",children:t.publicKeyFull?"32B full":`${t.publicKey.length/2}B prefix`})]}),t.typeFilter!=null&&e.jsx(i,{label:"typeFilter",children:e.jsx(F,{raw:e.jsx(A,{value:t.typeFilter}),children:e.jsx(d,{fn:"typeFilter",value:t.typeFilterDescription??"none",color:"green"})})}),t.prefixOnly!=null&&e.jsx(i,{label:"prefixOnly",children:e.jsx(d,{fn:"prefixOnly",value:String(t.prefixOnly),color:"green"})}),t.since!=null&&e.jsx(i,{label:"since",children:e.jsx(d,{fn:"since",value:t.since===0?"all (0)":String(t.since),color:"green"})}),!t.nodeTypeName&&t.typeFilter==null&&t.dataLength>0&&e.jsxs(i,{label:"data",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.dataHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.dataLength,"B)"]})]})]});case"req":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"srcHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.srcHash}),children:e.jsx(d,{fn:"srcHash",value:t.srcHash,color:"green"})})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsxs(i,{label:"ciphertext",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.ciphertextHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.ciphertextLength,"B)"]})]})]});case"response":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"srcHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.srcHash}),children:e.jsx(d,{fn:"srcHash",value:t.srcHash,color:"green"})})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsxs(i,{label:"ciphertext",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.ciphertextHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.ciphertextLength,"B)"]})]})]});case"anon_req":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"senderPubKey",children:e.jsx("span",{className:"break-all text-[10px] font-mono text-sys-green",children:t.senderPublicKey})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsxs(i,{label:"ciphertext",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.ciphertextHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.ciphertextLength,"B)"]})]})]});case"generic":return e.jsxs(e.Fragment,{children:[e.jsxs(i,{label:"payloadType",children:[e.jsx(ht,{value:t.payloadType})," (",t.payloadTypeName,")"]}),e.jsx(i,{label:"length",children:t.length}),e.jsx(i,{label:"rawHex",children:e.jsx("span",{className:"break-all",children:t.rawHex})})]});default:return e.jsx("p",{className:"text-fg-muted",children:"Unknown decoded type"})}}function Pt({protocolPacket:t,packetHash:s}){const r=t==null?void 0:t.payloadType,c=r===Ze||r===Xe,a=T.useMemo(()=>{if(!c||!t)return null;const p=t.payload;return p.length<4?null:{channelHash:p[0],mac:p.slice(1,3),ciphertext:p.slice(3)}},[t,c]),[n,l]=T.useState("pending"),[o,x]=T.useState([]),[m,g]=T.useState(0);T.useEffect(()=>{if(!a){l(null);return}let p=!1;return(async()=>{const H=performance.now(),C=await Qe(a.channelHash,a.mac,a.ciphertext);p||(l(C),g(performance.now()-H));const D=await Je(a.channelHash);p||x(D)})(),()=>{p=!0}},[a]);const[u,v]=T.useState(""),[N,f]=T.useState(null),[k,$]=T.useState(!1),h=T.useCallback(async()=>{if(!(!a||!u.trim())){$(!0);try{const p=await We(u.trim(),a.channelHash,a.mac,a.ciphertext);if(p.success){const _=new TextDecoder("utf-8",{fatal:!1}).decode(p.result.plaintext.slice(5));f({success:!0,text:_})}else f({success:!1,error:p.error})}catch(p){f({success:!1,error:String(p)})}finally{$(!1)}}},[a,u]),y=Ce(s);return!c||!a?null:e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"C. Decrypt — tryDecryptGroupMessage()"}),m>0&&e.jsx("div",{className:"flex justify-end",children:e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-sys-green/15 text-sys-green",children:m<1?`${(m*1e3).toFixed(0)}µs`:`${m.toFixed(2)}ms`})}),e.jsx(V,{prefix:"tryDecryptGroupMessage",children:e.jsxs("dl",{className:"space-y-0.5",children:[e.jsx(i,{label:"channelHash",children:e.jsx(d,{fn:"channelHash",value:`0x${a.channelHash.toString(16).toUpperCase().padStart(2,"0")}`,color:"teal"})}),e.jsx(i,{label:"mac",children:e.jsx(d,{fn:"mac",value:Array.from(a.mac).map(p=>p.toString(16).padStart(2,"0")).join(""),color:"teal"})}),e.jsx(i,{label:"cipherLen",children:e.jsx(d,{fn:"cipherLen",value:`${a.ciphertext.length}B`,color:"teal"})}),e.jsx(i,{label:"candidates",children:e.jsx(d,{fn:"candidates",value:o.length>0?`${o.length} names`:"0",color:o.length>0?"teal":"zinc"})}),o.length>0&&e.jsxs("details",{className:"mt-1",children:[e.jsx("summary",{className:"text-fg-muted cursor-pointer hover:text-fg-primary text-[10px]",children:"show candidate names"}),e.jsx("div",{className:"mt-1 text-[10px] text-fg-muted break-all max-h-24 overflow-y-auto",children:o.join(", ")})]}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1",children:"Result:"}),n==="pending"?e.jsx("p",{className:"text-fg-muted italic",children:"decrypting…"}):n?e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channel",children:e.jsx(d,{fn:"channel",value:n.channelName,color:"teal"})}),e.jsx(i,{label:"plaintext",children:e.jsx(d,{fn:"plaintext",value:new TextDecoder("utf-8",{fatal:!1}).decode(n.plaintext.slice(5)).trim()||"(empty)",color:"teal"})}),e.jsx(i,{label:"macValid",children:e.jsx(d,{fn:"macValid",value:n.macCorrupted?"false":"true",color:"teal"})})]}):e.jsxs(i,{label:"decrypt",children:[e.jsx(d,{fn:"decrypt",value:"failed",color:"red"}),e.jsx("span",{className:"text-fg-muted ml-1",children:"channel not in known list"})]})]}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1",children:"testChannelName() — manual test:"}),e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("input",{type:"text",value:u,onChange:p=>{v(p.target.value),f(null)},onKeyDown:p=>p.key==="Enter"&&h(),placeholder:"channel name",className:"surface-input px-2 py-1 rounded text-[11px] font-mono text-fg-primary w-40"}),e.jsx("button",{onClick:h,disabled:k||!u.trim(),className:"px-2 py-1 rounded text-[10px] font-mono bg-sys-blue/20 text-sys-blue hover:bg-sys-blue/30 disabled:opacity-40 transition-colors",children:k?"…":"Try"})]}),N&&e.jsx("div",{className:"mt-1",children:N.success?e.jsx(i,{label:"result",children:e.jsx(d,{fn:"plaintext",value:N.text??"(empty)",color:"teal"})}):e.jsx(i,{label:"error",children:e.jsx(d,{fn:"error",value:N.error??"unknown",color:"red"})})})]}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1",children:"useDecodedMessage() store result:"}),y?y.decoded?e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channel",children:e.jsx(d,{fn:"channel",value:y.decoded.channelName??"?",color:"teal"})}),e.jsx(i,{label:"text",children:e.jsx(d,{fn:"text",value:y.decoded.text,color:"teal"})})]}):e.jsx(i,{label:"decrypt",children:e.jsx(d,{fn:"decrypt",value:"failed",color:"red"})}):e.jsx(i,{label:"decrypt",children:e.jsx(d,{fn:"decrypt",value:"pending",color:"zinc"})})]})]})})]})}function Mt(t){const{rawHex:s,display:r,protocolPacket:c,decoded:a,parseError:n,parseTimeMs:l,payloadVersion:o,isV1:x,isV2:m,packetHash:g,packet:u}=t,v=!!s&&s.length>=4;return e.jsxs(G,{children:[e.jsx(K,{className:"w-full mt-2 mb-1",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-[10px] font-mono text-fg-muted",children:"🔬"}),e.jsx("span",{className:"text-[10px] font-mono font-medium text-fg-muted",children:"Wire Inspection"}),e.jsx("span",{className:"text-[9px] text-fg-muted/50",children:"observatory diagnostic — not a runtime stage"})]})}),e.jsx(U,{children:e.jsxs("div",{className:"border border-dashed border-edge-subtle rounded-lg p-3 space-y-1 bg-surface/30",children:[e.jsx("p",{className:"text-[9px] text-fg-muted/50 mb-2",children:"The backend parsed these fields server-side. This panel verifies the wire-level encoding client-side."}),v?e.jsxs(e.Fragment,{children:[e.jsx($t,{rawHex:s,display:r,protocolPacket:c,parseError:n,parseTimeMs:l,payloadVersion:o,isV1:x,isV2:m}),e.jsx(Dt,{decoded:a,packet:u}),e.jsx(Pt,{protocolPacket:c,packetHash:g})]}):e.jsx("p",{className:"text-fg-muted italic text-[10px]",children:n??"No raw_packet — wire inspection unavailable (warm-tier packet)"})]})})]})}function fe(t){if(!t)return[{fn:"decode",value:"no raw_packet",group:"decode",color:"zinc"}];switch(t.type){case"advert":{const s=t,r=[{fn:"decode.nodeType",value:s.nodeType,group:"decode",color:"blue"}];return s.name&&r.push({fn:"decode.name",value:s.name,group:"decode",color:"blue"}),s.latitude!=null&&s.longitude!=null&&r.push({fn:"decode.location",value:`${s.latitude.toFixed(4)}, ${s.longitude.toFixed(4)}`,group:"decode",color:"blue"}),r.push({fn:"decode.publicKey",value:s.publicKey,group:"decode",color:"blue"}),r}case"trace":{const s=t;return[{fn:"decode.traceTag",value:s.traceTag,group:"decode",color:"blue"},{fn:"decode.hops",value:s.pathHashes.length>0?s.pathString:"empty",group:"decode",color:"blue"},{fn:"decode.snr",value:s.snrValues.length>0?`${s.snrValues.length} values`:"none",group:"decode",color:s.snrValues.length>0?"blue":"zinc"},{fn:"decode.complete",value:s.isComplete?"yes":"partial",group:"decode",color:s.isComplete?"green":"amber"}]}case"path":{const s=t,r=[{fn:"decode.pathLength",value:String(s.pathLength),group:"decode",color:"blue"},{fn:"decode.path",value:s.path.length>0?s.pathString:"empty",group:"decode",color:"blue"}];return s.extraType!=null&&r.push({fn:"decode.extraType",value:s.extraTypeName??String(s.extraType),group:"decode",color:"purple"}),s.extraData&&r.push({fn:"decode.extraData",value:`${s.extraData.length/2}B`,group:"decode",color:"purple"}),r}case"ack":return[{fn:"decode.crc",value:t.crc,group:"decode",color:"blue"}];case"grp_txt":return[{fn:"decode.channelHash",value:t.channelHash,group:"decode",color:"blue"},{fn:"decode.encrypted",value:"true — decrypt at cascade",group:"decode",color:"zinc"}];case"grp_data":{const s=t;return[{fn:"decode.channelHash",value:s.channelHash,group:"decode",color:"blue"},{fn:"decode.dataLength",value:`${s.dataLength}B`,group:"decode",color:"blue"}]}case"txt_msg":{const s=t;return[{fn:"decode.srcHash",value:s.srcHash,group:"decode",color:"blue"},{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.encrypted",value:s.encrypted?"true":"false",group:"decode",color:s.encrypted?"zinc":"green"},...s.encrypted?[]:[{fn:"decode.text",value:s.text,group:"decode",color:"blue"}]]}case"multipart":{const s=t;return[{fn:"decode.part",value:`${s.partNumber+1}/${s.totalParts}`,group:"decode",color:"blue"},{fn:"decode.msgId",value:s.messageId,group:"decode",color:"blue"}]}case"control":{const s=t,r=[{fn:"decode.subtype",value:s.subtypeName,group:"decode",color:"blue"}];return s.nodeTypeName&&r.push({fn:"decode.nodeType",value:s.nodeTypeName,group:"decode",color:"blue"}),s.snrDb!=null&&r.push({fn:"decode.snr",value:`${s.snrDb>0?"+":""}${s.snrDb.toFixed(1)} dB`,group:"decode",color:"blue"}),s.tag&&r.push({fn:"decode.tag",value:s.tag,group:"decode",color:"blue"}),s.publicKey&&r.push({fn:"decode.publicKey",value:s.publicKey,group:"decode",color:s.publicKeyFull?"green":"blue"}),s.typeFilter!=null&&r.push({fn:"decode.typeFilter",value:s.typeFilterDescription??`0x${s.typeFilter.toString(16)}`,group:"decode",color:"blue"}),s.prefixOnly!=null&&r.push({fn:"decode.prefixOnly",value:String(s.prefixOnly),group:"decode",color:"blue"}),!s.nodeTypeName&&!s.tag&&(r.push({fn:"decode.subtypeFlags",value:`0x${s.subtypeFlags.toString(16)}`,group:"decode",color:"blue"}),r.push({fn:"decode.dataLength",value:`${s.dataLength}B`,group:"decode",color:"blue"})),r}case"req":{const s=t;return[{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.srcHash",value:s.srcHash,group:"decode",color:"blue"},{fn:"decode.cipherMac",value:s.cipherMac,group:"decode",color:"purple"},{fn:"decode.ciphertext",value:`${s.ciphertextLength}B`,group:"decode",color:"zinc"}]}case"response":{const s=t;return[{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.srcHash",value:s.srcHash,group:"decode",color:"blue"},{fn:"decode.cipherMac",value:s.cipherMac,group:"decode",color:"purple"},{fn:"decode.ciphertext",value:`${s.ciphertextLength}B`,group:"decode",color:"zinc"}]}case"anon_req":{const s=t;return[{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.senderPubKey",value:s.senderPublicKey,group:"decode",color:"green"},{fn:"decode.cipherMac",value:s.cipherMac,group:"decode",color:"purple"},{fn:"decode.ciphertext",value:`${s.ciphertextLength}B`,group:"decode",color:"zinc"}]}case"generic":return[{fn:"decode.raw",value:`${t.length}B`,group:"decode",color:"zinc"}];default:return[]}}function Rt({packet:t,pipeline:s,rawHex:r,traceTagIndex:c,neighbors:a}){const{enrichment:n,timing:l,display:o,protocolPacket:x,decoded:m,parseError:g,payloadVersion:u,isV1:v,isV2:N,analysis:f}=s,$=(t.type??t.payload_type)===et,h=f.dupeAnalysis,y=T.useRef(0),p=T.useMemo(()=>{if(!$)return null;const D=performance.now(),L=bt(t,c,a);return y.current=performance.now()-D,L},[t,c,a,$]),_=l.enrich+y.current,H=[];f.byteLen&&H.push(`${f.byteLen}B`),H.push(f.payloadTypeName),n.advertName&&H.push(`"${n.advertName}"`),n.isZeroHop?H.push("zero-hop"):f.pathHopCount>0&&H.push(`${f.pathHopCount}h`),H.push(`${t.rssi}dBm`),h.isDuplicate&&H.push("DUPE");const C=H.join(" — ");return e.jsxs(le,{stage:1,name:"INGEST",fn:n.preComputed?"PacketCache.mergePackets()":"extractAdvertData() + extractHopData() + ...",verdict:C,timeMs:_,children:[e.jsx(Mt,{rawHex:r,display:o,protocolPacket:x,decoded:m,parseError:g,parseTimeMs:l.parse,payloadVersion:u,isV1:v,isV2:N,packetHash:t.packet_hash,packet:t}),e.jsx(E,{title:"Cache Enrichment"}),e.jsx(V,{prefix:"packetCache",children:e.jsxs("dl",{className:"space-y-0.5",children:[e.jsxs("div",{className:"mb-1.5",children:[n.preComputed?e.jsx(M,{color:"green",children:"PacketCache"}):e.jsx(M,{color:"amber",children:"computed"}),e.jsx("span",{className:"text-[10px] text-fg-muted ml-1.5",children:n.preComputed?"pre-enriched by real pipeline":"synthetic — computed on the fly"})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1 mb-1",children:[e.jsx(d,{fn:"_byteLength",value:n.byteLength!=null?`${n.byteLength}B`:void 0,color:"blue"}),e.jsx(d,{fn:"_hopCount",value:String(n.hopCount),color:"blue"}),e.jsx(d,{fn:"_isZeroHop",value:String(n.isZeroHop),color:n.isZeroHop?"green":"blue"}),n.isZeroHop&&e.jsx(M,{color:"blue",children:"direct"}),n.channelHash!=null&&e.jsx(d,{fn:"_channelHash",value:n.channelHash,color:"blue"}),$&&t._traceTag&&e.jsx(d,{fn:"_traceTag",value:t._traceTag,color:"blue"})]}),n.advertSender||n.advertNodeType!=null||n.advertName!=null?e.jsxs("div",{className:"mt-1 mb-1",children:[e.jsx("p",{className:"text-[10px] text-sys-blue font-medium mb-0.5",children:"ADVERT Enrichment"}),e.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[n.advertSender&&e.jsx(d,{fn:"_advertSender",value:n.advertSender.slice(0,16)+"…",color:"blue"}),n.advertNodeType!=null&&e.jsx(d,{fn:"_advertNodeType",value:ke(n.advertNodeType),color:"blue"}),n.advertName!=null&&e.jsx(d,{fn:"_advertName",value:n.advertName,color:"blue"}),n.advertFlags!=null&&e.jsx(d,{fn:"_advertFlags",value:`0x${n.advertFlags.toString(16).padStart(2,"0")}`,color:"blue"}),n.advertHasLocation!=null&&e.jsx(d,{fn:"_advertHasLocation",value:String(n.advertHasLocation),color:"blue"}),n.advertHasName!=null&&e.jsx(d,{fn:"_advertHasName",value:String(n.advertHasName),color:"blue"}),n.advertLatitude!=null&&n.advertLongitude!=null&&e.jsx(d,{fn:"location",value:`${n.advertLatitude.toFixed(4)}, ${n.advertLongitude.toFixed(4)}`,color:"blue"})]})]}):e.jsx("p",{className:"text-[10px] text-fg-muted/30 mb-1",children:"ADVERT fields: N/A (non-ADVERT packet)"}),e.jsx(E,{title:"Payload Decode"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${m?"bg-sys-blue":"bg-zinc-500/40"}`}),e.jsx("span",{className:"font-mono text-[10px] font-medium text-fg-primary",children:"decodePayload()"}),e.jsx("span",{className:"text-[9px] text-fg-muted",children:"sync — wire data only, no crypto"})]}),e.jsx("div",{className:"ml-3",children:m?e.jsx("div",{className:"flex flex-wrap gap-x-1.5 gap-y-1",children:fe(m).map((D,L)=>e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-1.5 py-0.5",children:e.jsx(d,{fn:D.fn,value:D.value,color:D.color})},L))}):e.jsx(S,{children:"no raw_packet — warm-tier packet, decode unavailable"})})]}),e.jsx(E,{}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono",children:[e.jsx("span",{className:"text-fg-muted",children:"dupe:"}),h.isDuplicate?e.jsx(d,{fn:"is_duplicate",value:"true",color:"purple"}):e.jsx(S,{children:"none"}),h.dupeCount>0&&e.jsx(d,{fn:"dupeCount",value:`×${h.dupeCount}`,color:"purple"}),h.rssiRange&&e.jsxs(S,{c:"text-fg-primary",children:["Δ",Math.abs(h.rssiRange[1]-h.rssiRange[0]),"dB RSSI"]})]}),p&&e.jsxs(e.Fragment,{children:[e.jsx(E,{}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono",children:[e.jsx("span",{className:"text-fg-muted",children:"TRACE SRC:"}),p.inferredSrc?e.jsxs(e.Fragment,{children:[e.jsx(d,{fn:"inferredSrc",value:p.inferredSrc,color:"purple"}),p.inferredName&&e.jsx(d,{fn:"name",value:p.inferredName,color:"purple"})]}):e.jsx(S,{children:"unresolvable"}),e.jsx(_e,{color:"purple",children:p.method}),e.jsxs(S,{children:["(",p.confidence,")"]}),e.jsxs(S,{children:["siblings=",p.siblingCount]})]})]}),(()=>{const D=f.pType!=null?`0x${f.pType.toString(16).toUpperCase().padStart(2,"0")}`:void 0,L=t.route!=null?`0x${t.route.toString(16).toUpperCase().padStart(2,"0")}`:void 0,P=fe(m),R=f.signalClass==="excellent"||f.signalClass==="good"?"green":f.signalClass==="fair"?"amber":"red",b=f.senderTier==="pubkey"?"green":f.senderTier==="prefix"?"amber":f.senderTier==="encrypted"?"teal":"zinc",w=[{fn:"type",value:f.payloadTypeName,raw:D,group:"wire",color:"blue"},{fn:"route",value:f.routeTypeName,raw:L,group:"wire",color:"blue"},{fn:"src_hash",value:t.src_hash||void 0,group:"wire",color:"blue"},{fn:"rssi",value:`${t.rssi}dBm`,group:"wire",color:"blue"},{fn:"snr",value:`${t.snr}dB`,group:"wire",color:"blue"},{fn:"_byteLength",value:f.byteLen?`${f.byteLen}B`:void 0,group:"enrichment",color:"blue"},{fn:"_hopCount",value:String(n.hopCount),group:"enrichment",color:"blue"},{fn:"_isZeroHop",value:String(n.isZeroHop),group:"enrichment",color:"blue"},{fn:"_advertSender",value:n.advertSender||void 0,group:"enrichment",color:"blue"},{fn:"_advertNodeType",value:f.advertType!=="unknown"?f.advertType:void 0,group:"enrichment",color:"blue"},{fn:"_advertName",value:n.advertName||void 0,group:"enrichment",color:"blue"},{fn:"_channelHash",value:n.channelHash||void 0,group:"enrichment",color:"blue"},...P,{fn:"is_duplicate",value:String(h.isDuplicate),group:"analysis",color:"purple"},p!=null&&p.inferredSrc?{fn:"traceSrc",value:p.inferredSrc,group:"analysis",color:"purple"}:{fn:"traceSrc"},{fn:"_signalClass",value:f.signalClass,group:"analysis",color:R},{fn:"_routeClass",value:f.routeClass,group:"analysis",color:"purple"},{fn:"_senderTier",value:f.senderTier,group:"analysis",color:b},{fn:"_origin",value:f.origin,group:"analysis",color:f.origin==="tx_local"?"green":f.origin==="tx_forward"?"amber":"purple"},{fn:"_pathAvail",value:f.pathAvail?`${f.pathHopCount} hops`:"none",group:"analysis",color:f.pathAvail?"green":"zinc"},{fn:"_age",value:f.age,group:"analysis",color:f.age==="live"||f.age==="recent"?"green":"zinc"},...h.dupeCount>0?[{fn:"_dupeCount",value:`×${h.dupeCount}`,group:"analysis",color:"purple"},...h.rssiRange?[{fn:"_multipath",value:`Δ${Math.abs(h.rssiRange[1]-h.rssiRange[0])}dB`,group:"analysis",color:Math.abs(h.rssiRange[1]-h.rssiRange[0])>6?"amber":"green"}]:[]]:[],...t.lbt_attempts!=null?[{fn:"_lbt",value:`${t.lbt_attempts} attempt${t.lbt_attempts!==1?"s":""}`,group:"analysis",color:(t.lbt_attempts??0)>1?"amber":"green"}]:[],...t.drop_reason?[{fn:"_dropReason",value:t.drop_reason,group:"analysis",color:"red"}]:[]];return e.jsx(se,{tokens:w})})()]})})]})}function be(t){switch(t){case"excellent":return"green";case"good":return"green";case"fair":return"amber";case"poor":return"red";case"critical":return"red";default:return"zinc"}}function ye(t){return`${Math.round(t*100)}%`}function je(t,s,r){return t||(s?s.slice(0,12):`~${r}`)}function At({hops:t}){return t.length===0?null:e.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle/40",children:[e.jsx("p",{className:"text-[9px] text-fg-muted/40 uppercase tracking-widest font-mono mb-1.5",children:"per-hop trace inspection"}),e.jsx("div",{className:"space-y-1",children:t.map(s=>e.jsx(V,{prefix:`trace.hop[${s.hopIndex}]`,children:e.jsxs("div",{className:"border border-edge-subtle/40 rounded px-2 py-1.5",children:[e.jsxs(i,{label:"link",children:[e.jsx(re,{hops:[s.fromPrefix,s.toPrefix],color:"blue"}),e.jsx("span",{className:"ml-1.5",children:e.jsx(_e,{color:be(s.quality),children:s.quality})})]}),e.jsx(i,{label:"snr",children:e.jsx(F,{raw:e.jsx("span",{className:"text-sys-blue",children:s.snrRaw}),children:e.jsx(d,{fn:"snr",value:`${s.snrRaw.toFixed(1)} dB`,color:be(s.quality)})})}),e.jsxs(i,{label:"from",children:[e.jsx(d,{fn:"resolve",value:je(s.fromName,s.fromHash,s.fromPrefix),color:s.fromHash?s.fromConfidence>=.8?"green":"amber":"purple"}),e.jsx("span",{className:"ml-1",children:e.jsx(d,{fn:"conf",value:ye(s.fromConfidence),color:"zinc"})})]}),e.jsxs(i,{label:"to",children:[e.jsx(d,{fn:"resolve",value:je(s.toName,s.toHash,s.toPrefix),color:s.toHash?s.toConfidence>=.8?"green":"amber":"purple"}),e.jsx("span",{className:"ml-1",children:e.jsx(d,{fn:"conf",value:ye(s.toConfidence),color:"zinc"})})]})]})},s.hopIndex))}),e.jsx(se,{label:"trace contributes",tokens:Ft(t)})]})}function Ft(t){const s=t.reduce((n,l)=>n+(l.fromHash?1:0)+(l.toHash?1:0),0),r=t.length*2,c=r-s,a=t.length>0?t.reduce((n,l)=>n+l.snrRaw,0)/t.length:0;return[{fn:"hops",value:String(t.length),group:"wire",color:"blue"},{fn:"resolved",value:`${s}/${r}`,group:"worker",color:"green"},...c>0?[{fn:"ghosts",value:String(c),group:"worker",color:"purple"}]:[],{fn:"avgSnr",value:`${a.toFixed(1)} dB`,group:"analysis",color:a>=5?"green":a>=0?"amber":"red"}]}function Et(t){if(!t)return"never";const s=Math.floor((Date.now()-t)/1e3);return s<60?`${s}s ago`:s<3600?`${Math.floor(s/60)}m ago`:`${Math.floor(s/3600)}h ago`}function Ot(t){if(!t)return[];const s=t.decoded;if(!s)return[{fn:"decrypt.result",value:"failed",group:"crypto",color:"red"}];if(!s.decrypted)return[{fn:"decrypt.result",value:"no key match",group:"crypto",color:"zinc"}];const r=[];return s.channelName&&r.push({fn:"decrypt.channelName",value:s.channelName,group:"crypto",color:"teal"}),s.senderName&&r.push({fn:"decrypt.senderName",value:s.senderName,group:"crypto",color:"teal"}),s.text&&r.push({fn:"decrypt.text",value:s.text,group:"crypto",color:"teal"}),s.timestamp&&r.push({fn:"decrypt.timestamp",value:new Date(s.timestamp*1e3).toISOString().slice(11,19),group:"crypto",color:"teal"}),s.macCorrupted&&r.push({fn:"decrypt.macCorrupted",value:"true",group:"crypto",color:"amber"}),r}function zt({packet:t,decrypted:s,pipeline:r}){var b;const c=J(w=>w.isComputing),a=J(w=>w.lastUpdated),n=J(w=>w.lastComputeTimeMs),l=J(w=>w.topology.edges.length),o=J(w=>w.topology.discoveredNodes.length),x=tt(),m=st(),g=nt(),u=he(w=>w.isComputing),v=he(w=>w.nodeCount),N=me(w=>w.progress),f=me(w=>w.initialDecodeComplete),k=t.type??t.payload_type,$=k===O.GRP_TXT||k===O.GRP_DATA,h=k===O.TRACE,y=k===O.PATH,p=$,_=[{label:"full",detail:"all GRP_TXT → decryption worker",active:p&&f,color:"teal"},{label:"quick",detail:"100 most recent (initial load)",active:p&&!f,color:"amber"},{label:"skip",detail:"non-GRP or catchup path",active:!p,color:"zinc"}],H=Ot(s),C=((b=s==null?void 0:s.decoded)==null?void 0:b.decrypted)===!0,D=c?"running":`${l}e ${o}g`,L=u?"running":`${v}n`,P=p?C?"decrypted":N.isDecoding?`${N.percent}%`:"pending":"N/A",R=`topo ${c?"○":"✓"} ${D} · spark ${u?"○":"✓"} ${L} · decrypt ${P}`;return e.jsx(le,{stage:2,name:"CASCADE",fn:"hydrateDownstream()",verdict:R,children:e.jsx(V,{prefix:"cascade",children:e.jsxs("div",{className:"space-y-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 py-1.5 text-[11px] font-mono",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${c?"bg-sys-amber animate-pulse":"bg-sys-green"}`}),e.jsx("span",{className:"text-fg-primary",children:"topology"}),e.jsxs("span",{className:"text-fg-muted",children:[l,"e ",o,"g"]}),(h||y)&&e.jsx("span",{className:"text-sys-green text-[9px]",children:"↑signal"})]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u?"bg-sys-amber animate-pulse":"bg-sys-green"}`}),e.jsx("span",{className:"text-fg-primary",children:"sparkline"}),e.jsxs("span",{className:"text-fg-muted",children:[v,"n"]})]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${N.isDecoding?"bg-sys-amber animate-pulse":p?"bg-sys-teal":"bg-zinc-500/40"}`}),e.jsx("span",{className:"text-fg-primary",children:"decrypt"}),e.jsx("span",{className:p?"text-sys-teal":"text-fg-muted",children:p?C?"decrypted":N.isDecoding?`${N.percent}%`:"pending":"N/A"})]})]}),e.jsxs(G,{defaultOpen:h||y,children:[e.jsx(K,{className:"text-[10px] w-full border-t border-edge-subtle pt-1.5",children:e.jsx("span",{className:"font-mono text-fg-muted/50",children:"topology detail…"})}),e.jsx(U,{children:e.jsxs("div",{className:"ml-3 pb-2",children:[e.jsx(i,{label:"status",children:e.jsx(d,{fn:"isComputing",value:c?"running":"idle",color:c?"amber":"green"})}),e.jsxs(i,{label:"last",children:[e.jsx(d,{fn:"lastUpdated",value:Et(a),color:"zinc"}),n>0&&e.jsxs("span",{className:"ml-2 text-fg-muted text-[10px]",children:["(",n<1e3?`${n.toFixed(0)}ms`:`${(n/1e3).toFixed(1)}s`,")"]})]}),e.jsxs(i,{label:"output",children:[e.jsx(d,{fn:"edges",value:String(l),color:"green"}),e.jsx(d,{fn:"ghostNodes",value:String(o),color:"purple"})]}),m&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{label:"trace links",children:[e.jsx(d,{fn:"directed",value:String(x.totalDirectedLinks),color:"teal"}),e.jsx(d,{fn:"bidir",value:String(x.bidirectionalLinks),color:"teal"}),e.jsx(d,{fn:"traces",value:String(x.totalTraces),color:"zinc"})]}),e.jsxs(i,{label:"trace SNR",children:[e.jsx(d,{fn:"mean",value:`${x.meanSnr.toFixed(1)} dB`,color:x.meanSnr>=5?"green":x.meanSnr>=0?"amber":"red"}),e.jsx(d,{fn:"median",value:`${x.medianSnr.toFixed(1)} dB`,color:"zinc"}),e.jsx(d,{fn:"confidence",value:`${Math.round(x.avgConfidence*100)}%`,color:"zinc"})]}),h&&e.jsxs(i,{label:"quality",children:[e.jsx(d,{fn:"excellent",value:String(x.qualityCounts.excellent),color:"green"}),e.jsx(d,{fn:"good",value:String(x.qualityCounts.good),color:"green"}),e.jsx(d,{fn:"fair",value:String(x.qualityCounts.fair),color:"amber"}),e.jsx(d,{fn:"poor",value:String(x.qualityCounts.poor),color:"red"}),e.jsx(d,{fn:"critical",value:String(x.qualityCounts.critical),color:"red"})]}),g.confirmedResolutions.size>0&&e.jsxs(i,{label:"feedback",children:[e.jsx(d,{fn:"feedback.confirmed",value:String(g.confirmedResolutions.size),color:"teal"}),e.jsx(d,{fn:"feedback.links",value:String(g.confirmedLinks.length),color:"teal"})]})]}),h&&(r==null?void 0:r.traceHopDetail)&&e.jsx(At,{hops:r.traceHopDetail})]})})]}),p&&e.jsx("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:e.jsxs("div",{className:"ml-3",children:[e.jsx(i,{label:"mode",children:e.jsx(ae,{options:_,nextFn:"queueDecryption()"})}),e.jsx(i,{label:"result",children:e.jsx(d,{fn:"decrypt",value:C?"decrypted":s?"failed":"pending",color:C?"teal":s?"red":"zinc"})}),C&&e.jsx("div",{className:"mt-1 flex flex-wrap gap-x-1.5 gap-y-1",children:H.map((w,oe)=>e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-1.5 py-0.5",children:e.jsx(d,{fn:w.fn,value:w.value,color:w.color})},oe))})]})}),(()=>{const w=[{fn:"topology.edges",value:String(l),group:"worker",color:"green"},{fn:"topology.ghostNodes",value:String(o),group:"worker",color:"purple"},{fn:"sparkline.nodes",value:`${v}`,group:"worker",color:"green"},...m?[{fn:"trace.directedLinks",value:String(x.totalDirectedLinks),group:"worker",color:"teal"},{fn:"trace.meanSnr",value:`${x.meanSnr.toFixed(1)} dB`,group:"worker",color:"teal"}]:[],...H];return e.jsx(se,{tokens:w})})()]})})})}function Bt(t,s,r,c){var n;const a=t.src_hash?Se(t.src_hash):"";if(t._advertSender&&s.hash&&s.confident)return{tier:1,label:"_advertSender → pubkey",detail:"ADVERT carried full 32-byte public key — definitive match"};if(c&&s.confident&&((n=s.name)==null?void 0:n.toLowerCase())===c.toLowerCase())return{tier:1.5,label:"decrypt.senderName → nameToHash",detail:`Decrypted sender name “${c}” matched neighbor — high-confidence`};if(a&&r.crossClassPrefixes.has(a))return{tier:2,label:"cross-class prefix",detail:"Prefix has mixed types (repeater + non-repeater); payload type narrows to one class"};if(s.confident){const l=r.prefixIndex.get(a);return(l==null?void 0:l.length)===1?{tier:3,label:"single candidate",detail:"Only one node matches this prefix — unambiguous"}:{tier:3,label:"resolver",detail:"Multi-signal scoring selected best candidate from collision set"}}return{tier:4,label:"ambiguous",detail:"Cannot confidently resolve — multiple same-class candidates, insufficient scoring separation"}}function It(t,s){const r=t.original_path??t.forwarded_path,c=new Set;if(r&&Array.isArray(r))for(const a of r){const n=String(a).toUpperCase().slice(0,2);n.length>=2&&n!==s&&c.add(n)}return c}function Gt(t,s,r,c,a,n,l){const o=Math.floor(Date.now()/1e3),x=new Map(r.map(m=>[m.hash,m]));return t.map(m=>{const g=s[m.hash],u=x.get(m.hash);let v=!0,N="";c!=="unknown"?m.type!=="unknown"&&m.type!==c?(v=!1,N=`${m.type} ≠ required ${c}`):m.type===c?N="type matches":N="type unknown — not ruled out":N="payload ambiguous — all types eligible";const f=!!(g!=null&&g.zero_hop),k=(g==null?void 0:g.last_seen)??0;let $=0;if(f&&k>0){const b=(o-k)/3600;$=50*Math.exp(-b/l)}let h=0;if(k>0){const b=(o-k)/3600;h=Math.exp(-b/n)}const y=h*20,p=!!(g!=null&&g.latitude&&(g!=null&&g.longitude)&&(g.latitude!==0||g.longitude!==0)),_=p?5:0,H=(u==null?void 0:u.advertCount)??0,C=Math.min(H*2,30),D=(u==null?void 0:u.forwarderPrefixes.size)??0,L=Math.min(D*3,15);let P=0;if(u&&u.totalForwarderObservations>0&&a.size>0){let b=0;for(const w of a)u.forwarderPrefixes.has(w)&&b++;P=b/a.size}const R=$+y+_+C+L;return{hash:m.hash,name:m.name,type:m.type,roleCompatible:v,roleReason:N,zeroHop:f,zeroHopScore:$,lastSeen:k,recencyScore:h,recencyPoints:y,hasGps:p,gpsScore:_,advertCount:H,advertScore:C,topoWidth:D,topoScore:L,affinity:P,total:R}}).sort((m,g)=>g.total-m.total)}function Kt({packet:t,pipeline:s,resolved:r,resolveTimeMs:c,advertName:a,neighbors:n,decrypted:l}){var ie,de;const o=Y(j=>j.neighborContext),x=Y(j=>j.topologyProfiles),m=Y(j=>j.config),{analysis:g}=s,u=r??{hash:null,type:"unknown",name:null,confident:!1},v=t.src_hash?Se(t.src_hash):"",N=v?o.prefixIndex.get(v)??[]:[],f=v?x.get(v)??[]:[],k=g.pType??-1,$=k>=0?k.toString(16).toUpperCase().padStart(2,"0"):"??",h=g.inferredType,y=g.advertType,p=g.effectiveType,_=t._advertNodeType!=null?t._advertNodeType.toString(16).padStart(2,"0").toUpperCase():"",H=((ie=l==null?void 0:l.decoded)==null?void 0:ie.senderName)??null,C=Bt(t,u,o,H),D=T.useMemo(()=>It(t,v),[t,v]),L=g.pathLen,P=T.useMemo(()=>Gt(N,n,f,p,D,m.recencyDecayHours,m.zeroHopDecayHours),[N,n,f,p,D,m.recencyDecayHours,m.zeroHopDecayHours]),R=P.filter(j=>!j.roleCompatible),b=P.filter(j=>j.roleCompatible),w=t._advertSender?o.pubKeyMap.get(t._advertSender)??null:null,oe=C.tier===1,De=[{fn:"src_hash",value:v||"",active:!!v,color:"blue"},{fn:"_advertSender",value:t._advertSender?t._advertSender.slice(0,12)+"…":"",active:!!t._advertSender,color:"blue"},{fn:"_advertNodeType",value:_?`0x${_}`:"",active:t._advertNodeType!=null,color:"blue"},{fn:"path_length",value:L!=null?L===0?"zero-hop":String(L):"",active:L!=null,color:"blue"},{fn:"decrypt.senderName",value:H??"",active:!!H,color:"teal"}],Le=[{label:"hit",detail:"pubKeyMap.get(_advertSender) → definitive",active:!!w,color:"green"},{label:"miss",detail:t._advertSender?"pubkey not in neighbor table":"no _advertSender",active:!w,color:"zinc"}],Pe=[{label:"payload",detail:`inferDeviceType(0x${$}) → ${h}`,active:h!=="unknown",color:"amber"},{label:"flags",detail:_?`mapAdvertTypeCode(0x${_}) → ${y}`:"no _advertNodeType",active:h==="unknown"&&y!=="unknown",color:"green"},{label:"ambiguous",detail:"all types eligible",active:p==="unknown",color:"zinc"}],Me=u.name??((de=u.hash)==null?void 0:de.slice(0,12))??"?",Re=u.confident?"confident":"ambiguous",Ae=`→ ${Me} (${Re}, Tier ${C.tier})`;return e.jsx(le,{stage:3,name:"RESOLVE",fn:"usePipelineStore.resolveSource()",verdict:Ae,timeMs:c,children:e.jsx(V,{prefix:"resolvePacketSource",children:e.jsxs("div",{className:"space-y-0",children:[e.jsx("div",{className:"pt-1 pb-1",children:e.jsx(Ct,{tokens:De,nextFn:"resolvePacketSource()"})}),t.src_hash?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"1"})," ","PUBKEY LOOKUP"]}),e.jsx(ae,{options:Le,nextFn:"pubKeyMap.get()"}),e.jsx("div",{className:"ml-3 mt-1",children:w?e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"resolved",children:e.jsx(d,{fn:"hash",value:w,color:"green"})}),a&&e.jsxs(i,{label:"name",children:[e.jsx(d,{fn:"name",value:a,color:"green"}),u.name&&a===u.name&&e.jsx(S,{c:"text-sys-green ml-1",children:"✓ neighbor match"})]}),e.jsxs(i,{label:"result",children:[e.jsx(M,{color:"green",children:"Tier 1"}),e.jsx(S,{c:"text-fg-primary ml-1",children:"definitive — scoring bypassed"})]})]}):t._advertSender?e.jsx(i,{label:"status",children:e.jsx(S,{c:"text-sys-amber",children:"✗ pubkey not in neighbor table"})}):e.jsx(i,{label:"status",children:e.jsx(S,{children:"no _advertSender — skip to prefix resolution"})})})]}),oe?e.jsx("div",{className:"border-t border-edge-subtle py-2",children:e.jsx("p",{className:"text-[11px] text-fg-muted/40 font-mono ml-3",children:"Steps 2–5 bypassed — pubkey definitive"})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"2"})," ","CANDIDATE POOL — ",N.length," node",N.length!==1?"s":"",' match "',v,'"']}),e.jsxs("div",{className:"space-y-0.5 ml-3",children:[P.map(j=>e.jsxs("div",{className:"flex gap-2 items-center text-[11px]",children:[e.jsx("span",{className:"break-all text-[10px]",children:j.hash}),e.jsx(M,{color:"zinc",children:j.type||"unknown"}),j.name&&e.jsx(S,{children:j.name})]},j.hash)),N.length===0&&e.jsx(S,{children:"no known nodes for this prefix"})]})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"3"})," ","TYPE INFERENCE"]}),e.jsx(ae,{options:Pe,nextFn:"effectiveType()"}),e.jsx("div",{className:"ml-3 mt-1",children:e.jsx(i,{label:"effective",children:e.jsx(d,{fn:"effectiveType",value:p,color:p!=="unknown"?h!=="unknown"?"amber":"green":"zinc"})})})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"4"})," ","ROLE-TYPE SCRUB"]}),e.jsx("div",{className:"space-y-0.5 ml-3",children:P.map(j=>e.jsxs("div",{className:"flex gap-2 items-center text-[11px]",children:[e.jsx("span",{className:j.roleCompatible?"text-sys-green":"text-sys-red",children:j.roleCompatible?"✓":"✗"}),e.jsx("span",{className:`break-all text-[10px] ${j.roleCompatible?"":"line-through text-fg-muted"}`,children:j.hash}),e.jsx(M,{color:j.roleCompatible?"zinc":"red",children:j.type||"unknown"}),e.jsx(S,{c:j.roleCompatible?"text-fg-muted":"text-sys-red",children:j.roleReason})]},j.hash))}),R.length>0&&e.jsxs("p",{className:"text-[10px] text-fg-muted mt-1 ml-3",children:[R.length," eliminated, ",b.length," surviving"]})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"5"})," ","CANDIDATE SCORING"]}),b.length===0?e.jsx("p",{className:"text-fg-muted italic ml-3",children:"No surviving candidates"}):b.length===1?e.jsxs("div",{className:"ml-3 text-[11px]",children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(S,{c:"text-sys-green",children:"→"}),e.jsx("span",{className:"break-all text-[10px]",children:b[0].hash}),b[0].name&&e.jsx(S,{c:"text-fg-muted ml-1",children:b[0].name})]}),e.jsx("p",{className:"text-fg-muted ml-4",children:"single survivor — scoring not needed"})]}):e.jsxs(G,{children:[e.jsx(K,{className:"text-[10px] ml-3",children:e.jsxs("span",{className:"font-mono text-fg-muted/50",children:[b.length," candidates scored…"]})}),e.jsx(U,{children:e.jsx("div",{className:"space-y-2 ml-3 mt-1",children:b.map(j=>{const Q=j.hash===u.hash;return e.jsxs("div",{className:`text-[11px] leading-relaxed rounded px-2 py-1 ${Q?"bg-sys-green/8 border border-sys-green/20":"bg-zinc-500/5"}`,children:[e.jsxs("div",{className:"flex gap-2 items-center mb-0.5",children:[e.jsx(S,{c:Q?"text-sys-green":"text-fg-muted",children:Q?"→":" "}),e.jsx("span",{className:`break-all text-[10px] ${Q?"text-fg-primary":"text-fg-muted"}`,children:j.hash}),e.jsx(M,{color:Q?"green":"zinc",children:j.type||"unknown"}),j.name&&e.jsx(S,{children:j.name})]}),e.jsxs("div",{className:"ml-4 flex flex-wrap gap-x-3 gap-y-0.5",children:[e.jsxs("span",{children:[e.jsx(S,{children:"zero_hop:"})," ",e.jsx(S,{c:j.zeroHop?"text-sys-green":"text-fg-muted",children:j.zeroHop?"✓":"✗"})," ",e.jsxs(M,{color:ee(j.zeroHopScore),children:["+",j.zeroHopScore]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"recency:"})," ",e.jsx(S,{c:"text-fg-primary",children:mt(j.lastSeen)})," ",e.jsxs(M,{color:ee(j.recencyPoints),children:["+",j.recencyPoints.toFixed(1)]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"gps:"})," ",e.jsx(S,{c:j.hasGps?"text-sys-green":"text-fg-muted",children:j.hasGps?"✓":"✗"})," ",e.jsxs(M,{color:ee(j.gpsScore),children:["+",j.gpsScore]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"adverts:"})," ",e.jsx(S,{c:"text-fg-primary",children:j.advertCount})," ",e.jsxs(M,{color:ee(j.advertScore),children:["+",j.advertScore]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"topo:"})," ",e.jsx(S,{c:"text-fg-primary",children:j.topoWidth})," ",e.jsxs(M,{color:ee(j.topoScore),children:["+",j.topoScore]})]})]}),e.jsxs("div",{className:"ml-4 mt-0.5",children:[e.jsx(S,{children:"score ≈"})," ",e.jsx(S,{c:"text-fg-primary font-bold",children:j.total.toFixed(1)})]})]},j.hash)})})})]})]})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-green font-bold",children:"✓"})," ","RESOLUTION"]}),e.jsxs("div",{className:"ml-3",children:[e.jsx(i,{label:"hash",children:u.hash?e.jsx(d,{fn:"resolved.hash",value:u.hash,color:"green"}):e.jsx(S,{children:"null"})}),e.jsx(i,{label:"type",children:e.jsx(d,{fn:"resolved.type",value:u.type,color:u.confident?"green":"zinc"})}),e.jsx(i,{label:"name",children:u.name?e.jsx(d,{fn:"resolved.name",value:u.name,color:u.confident?"green":"amber"}):e.jsx(S,{children:"null"})}),e.jsx(i,{label:"confident",children:e.jsx(S,{c:u.confident?"text-sys-green":"text-sys-red",children:String(u.confident)})}),e.jsxs(i,{label:"tier",children:[e.jsx(M,{color:C.tier<=2?"green":C.tier===3?"amber":"red",children:C.tier}),e.jsx(S,{c:"text-fg-primary ml-1",children:C.label})]})]})]})]}):e.jsx("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono",children:[e.jsx(S,{c:"text-sys-amber",children:"⚠ no src_hash"}),H&&e.jsx(d,{fn:"decrypt.senderName",value:H,color:"teal"}),u.confident?e.jsxs(S,{c:"text-sys-green",children:["→ resolved via ",C.label]}):e.jsx(S,{c:"text-sys-red",children:"ambiguous"})]})}),(()=>{const j=[{fn:"resolved.hash",value:u.hash??"null",group:"resolution",color:u.confident?"green":"zinc"},{fn:"resolved.type",value:u.type,group:"resolution",color:u.type!=="unknown"?u.confident?"green":"amber":"zinc"},{fn:"resolved.name",value:u.name??"null",group:"resolution",color:u.confident?"green":u.name?"amber":"zinc"},{fn:"resolved.confident",value:String(u.confident),group:"resolution",color:u.confident?"green":"red"}];return e.jsx(se,{tokens:j})})()]})})})}const Ut={id:"packet-parse",label:"Packet Parse",inputs:["rawPacket"],outputs:["parsedPacket","decoded","headerFields"],emits:[{fn:"routeType",group:"wire",color:"blue"},{fn:"payloadType",group:"wire",color:"blue"},{fn:"pathLength",group:"wire",color:"blue"},{fn:"version",group:"wire",color:"blue"}],async:!1,observatoryStage:0},Vt={id:"enrichment",label:"Ingestion Enrichment",inputs:["parsedPacket"],outputs:["advertSender","channelHash","hopData","byteLength"],emits:[{fn:"_advertSender",group:"enrichment",color:"blue"},{fn:"_advertNodeType",group:"enrichment",color:"blue"},{fn:"_channelHash",group:"enrichment",color:"blue"},{fn:"_hopCount",group:"enrichment",color:"blue"},{fn:"_isZeroHop",group:"enrichment",color:"blue"},{fn:"_byteLength",group:"enrichment",color:"blue"}],async:!1,observatoryStage:1},qt={id:"topology",label:"Topology Analysis",inputs:["packets","neighbors","srcHashResolver"],outputs:["edges","nodeMetrics","pathHealth","ghostNodes","centrality","loops"],emits:[{fn:"edges",group:"worker",color:"green"},{fn:"ghostNodes",group:"worker",color:"purple"},{fn:"loops",group:"analysis",color:"amber"},{fn:"nodeMetrics",group:"worker",color:"green"},{fn:"pathHealth",group:"worker",color:"green"},{fn:"centrality",group:"worker",color:"green"}],async:!0,worker:"topology.worker.ts",observatoryStage:2},Wt={id:"trace-enrichment",label:"Trace Link Quality",inputs:["packets","prefixLookup","srcHashResolver","edges","pathHealth","nodeMetrics"],outputs:["traceLinks","traceLinkSummary","traceDisambiguationFeedback"],emits:[{fn:"traceLinks.directed",group:"worker",color:"teal"},{fn:"traceLinks.bidir",group:"worker",color:"teal"},{fn:"traceSummary.meanSnr",group:"analysis",color:"green"},{fn:"traceSummary.medianSnr",group:"analysis",color:"zinc"},{fn:"traceSummary.confidence",group:"analysis",color:"zinc"},{fn:"feedback.confirmed",group:"worker",color:"teal"},{fn:"feedback.links",group:"worker",color:"teal"}],async:!1,observatoryStage:2},Yt={id:"disambiguation",label:"Source Disambiguation",inputs:["packets","neighbors","decodedMessages"],outputs:["srcHashResolverMap","neighborContext"],emits:[{fn:"resolvedHash",group:"resolution",color:"purple"},{fn:"resolvedName",group:"resolution",color:"purple"},{fn:"resolvedType",group:"resolution",color:"purple"},{fn:"confidence",group:"resolution",color:"green"}],async:!1,observatoryStage:3},Zt={id:"sparkline",label:"Sparkline Computation",inputs:["packets","neighbors"],outputs:["sparklineData"],emits:[{fn:"sparklines",group:"worker",color:"blue"}],async:!1},Xt={id:"decryption",label:"Channel Decryption",inputs:["packets","channelKeys"],outputs:["decodedMessages"],emits:[{fn:"decrypt.text",group:"crypto",color:"teal"},{fn:"decrypt.senderName",group:"crypto",color:"teal"},{fn:"decrypt.channelName",group:"crypto",color:"teal"},{fn:"decrypt.macCorrupted",group:"crypto",color:"amber"}],async:!0,worker:"decryption.worker.ts",observatoryStage:2},Qt={id:"decoded-content",label:"Decoded Content Policy",inputs:["decodedMessages","packets"],outputs:["decodedContent","contentInheritance"],emits:[{fn:"content.senderName",group:"crypto",color:"teal"},{fn:"content.text",group:"crypto",color:"teal"},{fn:"content.channelName",group:"crypto",color:"teal"},{fn:"content.corrupted",group:"crypto",color:"amber"},{fn:"content.inherited",group:"analysis",color:"purple"}],async:!1},Z=[Ut,Vt,qt,Wt,Yt,Zt,Xt,Qt],Jt=new Map(Z.map(t=>[t.id,t])),es=new Map;for(const t of Z)for(const s of t.emits)es.set(s.fn,t);const $e=new Map;for(const t of Z)for(const s of t.outputs)$e.set(s,t);function ts(){const t=new Map,s=new Map;for(const a of Z)t.has(a.id)||t.set(a.id,0),s.has(a.id)||s.set(a.id,new Set);for(const a of Z)for(const n of a.inputs){const l=$e.get(n);if(l&&l.id!==a.id){const o=s.get(l.id);o.has(a.id)||(o.add(a.id),t.set(a.id,(t.get(a.id)??0)+1))}}const r=[];for(const[a,n]of t)n===0&&r.push(a);const c=[];for(;r.length>0;){const a=r.shift(),n=Jt.get(a);n&&c.push(n);for(const l of s.get(a)??[]){const o=(t.get(l)??1)-1;t.set(l,o),o===0&&r.push(l)}}for(const a of Z)c.includes(a)||c.push(a);return c}const ss={0:"text-sys-green",1:"text-sys-blue",2:"text-sys-teal",3:"text-sys-purple"};function ns({stage:t,isActive:s,onClick:r}){const c=t.observatoryStage!=null?ss[t.observatoryStage]??"text-fg-muted":"text-fg-muted/40";return e.jsxs("button",{type:"button",onClick:r,className:` + flex items-center gap-1.5 w-full px-1.5 py-1 rounded transition-base text-left + ${s?"bg-sys-blue/10 ring-1 ring-sys-blue/30":"hover:bg-zinc-500/5"} + `,children:[e.jsx("span",{className:`font-mono text-[9px] font-bold w-3 shrink-0 text-center ${c}`,children:t.observatoryStage??"·"}),e.jsx("span",{className:"font-mono text-[9px] text-fg-primary truncate flex-1",children:t.label}),t.async&&e.jsx("span",{className:"font-mono text-[7px] px-1 py-px rounded bg-sys-amber/15 text-sys-amber shrink-0 leading-tight",children:"⚡"}),t.emits.length>0&&e.jsxs("span",{className:"flex items-center gap-px shrink-0",children:[t.emits.slice(0,6).map(a=>{var n;return e.jsx("span",{className:`inline-block w-1 h-1 rounded-full ${((n=I[a.color])==null?void 0:n.dot)??"bg-zinc-500"}`,title:`${a.fn} [${a.group}]`},a.fn)}),t.emits.length>6&&e.jsxs("span",{className:"font-mono text-[7px] text-fg-muted/40 ml-0.5",children:["+",t.emits.length-6]})]})]})}function rs({activeStageId:t,onStageClick:s}){const r=T.useMemo(()=>ts(),[]),c=T.useMemo(()=>{const a=new Map;for(const l of r){const o=l.observatoryStage??"other";let x=a.get(o);x||(x=[],a.set(o,x)),x.push(l)}const n=[];for(const l of[0,1,2,3,"other"]){const o=a.get(l);o!=null&&o.length&&n.push({key:l,stages:o})}return n},[r]);return e.jsxs("div",{className:"surface-base rounded-lg border border-edge-subtle p-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-mono text-[8px] text-fg-muted/40 uppercase tracking-widest",children:"Pipeline DAG"}),e.jsxs("span",{className:"font-mono text-[8px] text-fg-muted/30",children:[r.length," stages"]})]}),e.jsx("div",{className:"space-y-px",children:c.map((a,n)=>e.jsxs("div",{children:[n>0&&e.jsx("div",{className:"flex items-center pl-2.5 py-px",children:e.jsx("svg",{width:"6",height:"8",viewBox:"0 0 6 8",className:"text-fg-muted/20",children:e.jsx("path",{d:"M3 0 L3 6 M1 4 L3 6 L5 4",fill:"none",stroke:"currentColor",strokeWidth:"1"})})}),a.stages.map(l=>e.jsx(ns,{stage:l,isActive:t===l.id,onClick:s?()=>s(l.id):void 0},l.id))]},String(a.key)))})]})}const ve=200,z={status:"idle",lastDurationMs:null,lastTs:null,runCount:0};function as(t,s,r){var c,a,n;switch(t.type){case"transport:ws:state":s.wsState=((c=t.data)==null?void 0:c.state)??r.wsState;break;case"transport:ws:packet":s.wsPacketCount=(s.wsPacketCount??r.wsPacketCount)+1;break;case"transport:ws:stats":s.wsStatsCount=(s.wsStatsCount??r.wsStatsCount)+1;break;case"transport:rest:stats":s.restStatsCount=(s.restStatsCount??r.restStatsCount)+1;break;case"transport:rest:packets":s.restPacketsCount=(s.restPacketsCount??r.restPacketsCount)+1;break;case"store:packets:ws-merge":s.wsMergeCount=(s.wsMergeCount??r.wsMergeCount)+1;break;case"cascade:hydrate":s.lastHydrateTs=t.ts,s.hydrateCount=(s.hydrateCount??r.hydrateCount)+1;break;case"worker:topology:start":case"worker:sparkline:start":{const l=t.type.split(":")[1],o=s.workers??r.workers,x=o[l]??{...z};s.workers={...o,[l]:{...x,status:"running",lastTs:t.ts}}}break;case"worker:topology:done":case"worker:sparkline:done":{const l=t.type.split(":")[1],o=s.workers??r.workers,x=o[l]??{...z},m=((a=t.data)==null?void 0:a.ms)??null;s.workers={...o,[l]:{...x,status:"done",lastDurationMs:m,lastTs:t.ts,runCount:x.runCount+1}}}break;case"worker:decryption:batch":{const l=s.workers??r.workers,o=l.decryption??{...z},x=((n=t.data)==null?void 0:n.ms)??null;s.workers={...l,decryption:{...o,status:"done",lastDurationMs:x,lastTs:t.ts,runCount:o.runCount+1}}}break;case"pipeline:disambig:recompute":s.disambigCount=(s.disambigCount??r.disambigCount)+1;break}}const te=rt(t=>({events:[],eventCount:0,wsState:"disconnected",wsPacketCount:0,wsStatsCount:0,restStatsCount:0,restPacketsCount:0,workers:{topology:{...z},sparkline:{...z},decryption:{...z}},wsMergeCount:0,lastHydrateTs:null,hydrateCount:0,disambigCount:0,lastDisambigMs:null,_pushBatch:s=>t(r=>{if(s.length===0)return r;let c=[...r.events,...s];c.length>ve&&(c=c.slice(c.length-ve));const a={events:c,eventCount:r.eventCount+s.length};for(const n of s)as(n,a,r);return a}),clear:()=>t({events:[],eventCount:0,wsState:"disconnected",wsPacketCount:0,wsStatsCount:0,restStatsCount:0,restPacketsCount:0,workers:{topology:{...z},sparkline:{...z},decryption:{...z}},wsMergeCount:0,lastHydrateTs:null,hydrateCount:0,disambigCount:0,lastDisambigMs:null})}));let W=null,B=[],X=null;function ls(){if(X=null,B.length===0)return;const t=B;B=[],te.getState()._pushBatch(t)}function os(){W||(B=[],W=at.subscribe(t=>{B.push(t),X===null&&(X=requestAnimationFrame(ls))}))}function cs(){if(W==null||W(),W=null,X!==null&&(cancelAnimationFrame(X),X=null),B.length>0){const t=B;B=[],te.getState()._pushBatch(t)}}function is(t){switch(t){case"active":return"●";case"skipped":return"○";case"inferred":return"◌"}}function ds(t){switch(t){case"active":return"text-sys-green";case"skipped":return"text-fg-muted/30";case"inferred":return"text-sys-amber"}}function us(t){switch(t){case"transport":return"text-sys-blue";case"store":return"text-sys-amber";case"worker":return"text-sys-violet";case"pipeline":return"text-sys-green";case"consumer":return"text-sys-teal"}}function ps(t,s,r,c,a){var m,g;const n=[];if(a?n.push({label:"Hex Input",detail:"Manual hex — no transport",status:"skipped",lane:"transport"}):s.age==="live"||s.age==="recent"?n.push({label:"WebSocket",detail:"ws:packet → real-time push",status:"active",lane:"transport"}):n.push({label:"REST Poll",detail:"fetchPackets → packetCache.poll()",status:"inferred",lane:"transport"}),!a){n.push({label:"Cache Merge",detail:"packetCache.mergePacketsDirectly()",status:"active",lane:"store"});const u=s.age==="live"||s.age==="recent";n.push({label:"Flash",detail:u?"flashReceived++ → sidebar blink":"Not newest — no flash",status:u?"active":"skipped",lane:"store"}),n.push({label:"Hydrate Cascade",detail:"hydrateDownstream() → schedule workers",status:"active",lane:"store"})}const l=s.pathAvail||s.pathHopCount>0;n.push({label:"Topology Worker",detail:l?`Path data (${s.pathHopCount} hops) → edge extraction`:"No path data — still included in batch recompute",status:"active",lane:"worker"}),n.push({label:"Sparkline Worker",detail:`Contributes to sparkline for src ${((m=t.src_hash)==null?void 0:m.slice(0,4))??"??"}`,status:"active",lane:"worker"});const o=s.isGrp;n.push({label:"Decryption Worker",detail:o?`GRP_TXT → queued for channel key search${c?" → decrypted ✓":""}`:`${s.payloadTypeName} — not encrypted, skipped`,status:o?"active":"skipped",lane:"worker"}),n.push({label:"Source Disambiguation",detail:r?`→ ${r.name??((g=r.hash)==null?void 0:g.slice(0,8))??"?"} (${r.type}${r.confident?", confident":", ambiguous"})`:"Pending recompute",status:r?"active":"inferred",lane:"pipeline"}),s.isAdvert&&n.push({label:"ADVERT Discovery",detail:"pubkey → extended hash-to-type + name extraction",status:"active",lane:"pipeline"}),o&&(c!=null&&c.decoded)&&n.push({label:"Decoded Content Policy",detail:`macCorrupted=${c.decoded.macCorrupted?"true":"false"} → cross-hash inheritance`,status:"active",lane:"pipeline"});const x=["Packets","Dashboard","Statistics"];return l&&x.push("Map","Graph"),s.isTrace&&x.push("Trace Detail"),n.push({label:"Page Hydration",detail:x.join(", "),status:"active",lane:"consumer"}),n}const xs=[],hs=["transport","store","worker","pipeline","consumer"],ms={transport:"Transport",store:"Store",worker:"Workers",pipeline:"Pipeline",consumer:"Consumers"};function gs(t){return t.replace("transport:","").replace("store:packets:","").replace("cascade:","").replace("worker:","w:").replace("pipeline:","p:").replace("packet","pkt").replace("sparkline","spark").replace("topology","topo").replace("decryption","dec").replace("disambig","dis").replace("recompute","recomp")}function fs(t){return t.startsWith("transport:")?"text-sys-blue":t.startsWith("store:")||t.startsWith("cascade:")?"text-sys-amber":t.startsWith("worker:")?"text-sys-violet":t.startsWith("pipeline:")?"text-sys-green":"text-fg-muted"}const bs=T.memo(function({event:s}){const r=`${(s.ts/1e3).toFixed(1)}s`,c=s.data?Object.entries(s.data).map(([a,n])=>{var l;return`${a}=${typeof n=="number"?((l=n.toFixed)==null?void 0:l.call(n,1))??n:n}`}).join(" "):"";return e.jsxs("div",{className:"flex gap-2 text-[9px] font-mono leading-tight",children:[e.jsx("span",{className:"text-fg-muted/40 w-12 shrink-0 text-right",children:r}),e.jsx("span",{className:`w-20 shrink-0 ${fs(s.type)}`,children:gs(s.type)}),e.jsx("span",{className:"text-fg-muted/60 truncate",children:c})]})});function ys({packet:t,pipeline:s,resolved:r,decrypted:c,isSynthetic:a,liveMode:n}){const[l,o]=T.useState(!1);T.useEffect(()=>{if(l)return os(),()=>{cs()}},[l]);const x=s==null?void 0:s.analysis,m=T.useMemo(()=>!t||!x?null:ps(t,x,r,c,a),[t,x,r,c,a]),g=T.useMemo(()=>{if(!m)return null;const h=new Map;for(const y of m){let p=h.get(y.lane);p||(p=[],h.set(y.lane,p)),p.push(y)}return h},[m]),u=te(h=>l?h.events:xs),v=te(h=>l?h.eventCount:0),N=te(h=>h.clear),f=T.useRef(null);T.useEffect(()=>{l&&f.current&&(f.current.scrollTop=f.current.scrollHeight)},[v,l]);const k=(m==null?void 0:m.filter(h=>h.status==="active").length)??0,$=(m==null?void 0:m.length)??0;return e.jsxs(G,{defaultOpen:!0,children:[e.jsx(K,{className:"text-[10px]",children:e.jsxs("span",{className:"flex items-center gap-2 font-mono",children:[e.jsx("span",{className:"text-sys-green",children:"CFT"}),e.jsx("span",{className:"text-fg-muted/40",children:"Control Flow Trace"}),t&&e.jsxs("span",{className:"text-fg-muted/30",children:["— ",k,"/",$," stages active"]})]})}),e.jsx(U,{children:e.jsxs("div",{className:"surface-base rounded-lg border border-edge-subtle p-3 space-y-3",children:[t?g?e.jsx("div",{className:"space-y-2",children:hs.map(h=>{const y=g.get(h);return y?e.jsxs("div",{children:[e.jsx("div",{className:`text-[8px] uppercase tracking-widest font-mono mb-0.5 ${us(h)}`,children:ms[h]}),y.map((p,_)=>e.jsxs("div",{className:"flex items-start gap-1.5 text-[10px] font-mono leading-snug ml-1",children:[e.jsx("span",{className:`shrink-0 ${ds(p.status)}`,children:is(p.status)}),e.jsx("span",{className:"text-fg-primary",children:p.label}),e.jsx("span",{className:"text-fg-muted/50 truncate",children:p.detail})]},_))]},h):null})}):null:e.jsx("div",{className:"text-[9px] text-fg-muted/30 font-mono py-2 text-center",children:"Select a packet to trace its flow"}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 flex items-center gap-2",children:[e.jsx("button",{onClick:()=>o(h=>!h),className:`px-2 py-0.5 rounded text-[9px] font-mono transition-colors ${l?"bg-sys-green/20 text-sys-green":"bg-zinc-500/20 text-fg-muted hover:text-fg-primary"}`,children:l?"● LIVE":"○ LIVE"}),e.jsx("span",{className:"text-[9px] text-fg-muted/40 font-mono",children:l?`${v} events`:"Subscribe to all pipeline events"}),l&&e.jsx("button",{onClick:N,className:"text-[9px] text-fg-muted/40 hover:text-fg-muted font-mono transition-colors ml-auto",children:"clear"})]}),l&&e.jsx("div",{ref:f,className:"max-h-32 overflow-y-auto space-y-px",children:u.length===0?e.jsx("div",{className:"text-[9px] text-fg-muted/30 font-mono py-1 text-center",children:"Waiting for events…"}):u.map((h,y)=>e.jsx(bs,{event:h},`${h.ts}-${y}`))})]})})]})}function js(t){const s=Ne(t.type??t.payload_type??-1).padEnd(7),r=t.packet_hash.slice(0,8),c=(t.src_hash??"—").replace(/^0x/i,"").slice(0,4).toUpperCase(),a=t._hopCount!=null?`${t._hopCount}h`:"",n=dt(t.timestamp);return`${r} ${s} ←${c} ${t.rssi}dBm ${a} ${n}`}function Ss(){const t=lt(),s=ot(),r=ct(),c=(s==null?void 0:s.neighbors)??{},a=Y(b=>b.resolveSource),n=Y(b=>b.config),l=Y(b=>b.setConfig),[o,x]=T.useState(-1),m=T.useMemo(()=>{let b=t;return o!==-1&&(b=t.filter(w=>(w.type??w.payload_type)===o)),b.slice(-50).reverse()},[t,o]),[g,u]=T.useState(""),[v,N]=T.useState(""),[f,k]=T.useState(!1),$=T.useRef(r);T.useEffect(()=>{f&&r!==$.current&&m.length>0&&(u(m[0].packet_hash),N("")),$.current=r},[r,f,m]),T.useEffect(()=>{!g&&m.length>0&&!v&&u(m[0].packet_hash)},[g,m,v]);const h=T.useMemo(()=>v.trim()?null:m.find(b=>b.packet_hash===g)??null,[g,m,v]),y=T.useMemo(()=>{const b=v.replace(/\s+/g,"").trim();return b?{packet_hash:"manual-hex-input",timestamp:0,rssi:0,snr:0,transmitted:!1,drop_reason:null,is_duplicate:!1,raw_packet:b}:null},[v]),p=h??y,_=!!v.trim(),H=v.trim().replace(/\s+/g,"")||(p==null?void 0:p.raw_packet),C=wt(p,H,t),D=(C==null?void 0:C.enrichment)??He,L=Ce((p==null?void 0:p.packet_hash)??""),P=T.useRef(0),R=T.useMemo(()=>{if(!p)return null;const b=performance.now(),w=a(p);return P.current=performance.now()-b,w},[p,a]);return e.jsxs("div",{className:"max-w-[960px] mx-auto",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h1",{className:"text-sm font-bold text-fg-primary tracking-wide font-mono",children:"PACKET OBSERVATORY"}),e.jsx("p",{className:"text-[11px] text-fg-muted font-mono",children:"Pipeline introspection — select a packet to trace its journey"})]}),e.jsxs("div",{className:"surface-base rounded-lg border border-edge-subtle p-3 mb-3",children:[e.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[e.jsxs("select",{value:o,onChange:b=>{x(Number(b.target.value)),u("")},className:"surface-input px-2 py-1 rounded text-[11px] font-mono text-fg-primary w-36",children:[e.jsx("option",{value:-1,children:"ALL TYPES"}),Object.entries(it).map(([b,w])=>e.jsxs("option",{value:Number(b),children:["0x",Number(b).toString(16).toUpperCase().padStart(2,"0")," ",w]},b))]}),e.jsxs("select",{value:g,onChange:b=>{u(b.target.value),N("")},className:"surface-input flex-1 min-w-0 px-2 py-1 rounded text-[11px] font-mono text-fg-primary truncate",children:[m.map((b,w)=>e.jsx("option",{value:b.packet_hash,children:js(b)},`${b.packet_hash}-${w}`)),m.length===0&&e.jsxs("option",{value:"",children:["No packets",o!==-1?" matching filter":" loaded"]})]}),e.jsx("button",{onClick:()=>k(b=>!b),className:`px-2 py-1 rounded text-[11px] font-mono transition-colors shrink-0 ${f?"bg-sys-green/20 text-sys-green":"bg-zinc-500/20 text-fg-muted hover:text-fg-primary"}`,children:f?"● LIVE":"○ LIVE"})]}),e.jsxs(G,{children:[e.jsx(K,{className:"text-[10px] text-fg-muted/50 hover:text-fg-muted mt-1.5",children:e.jsx("span",{className:"font-mono",children:"Paste hex…"})}),e.jsx(U,{children:e.jsx("textarea",{value:v,onChange:b=>N(b.target.value),placeholder:"Paste raw packet hex (overrides dropdown)",rows:2,className:"surface-input w-full mt-1 px-2 py-1 rounded text-[11px] font-mono text-fg-primary resize-y"})})]})]}),e.jsxs(G,{children:[e.jsx(K,{className:"text-[11px] mb-3 w-full",children:e.jsxs("span",{className:"flex items-center gap-2 font-mono",children:[e.jsx("span",{className:"text-fg-muted/50",children:"⚙"}),e.jsx("span",{className:"text-fg-muted/50",children:"Pipeline Config & Dev Tools"}),e.jsxs("span",{className:"text-fg-muted/30 text-[10px]",children:["disambig=",n.disambiguationEnabled?"on":"off"," mac=",n.macCorruptedPolicy," decay=",n.recencyDecayHours,"h"]})]})}),e.jsx(U,{children:e.jsxs("div",{className:"space-y-3 mb-4",children:[e.jsxs("div",{className:"surface-base rounded-lg border border-edge-subtle p-3",children:[e.jsx("h2",{className:"text-[10px] text-fg-muted/50 uppercase tracking-widest font-mono mb-2",children:"Pipeline Config"}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-[11px] text-fg-muted w-24 shrink-0",children:"Disambiguation"}),e.jsx("button",{onClick:()=>l({disambiguationEnabled:!n.disambiguationEnabled}),className:`px-2 py-0.5 rounded text-[11px] font-mono transition-colors ${n.disambiguationEnabled?"bg-sys-green/20 text-sys-green":"bg-sys-red/20 text-sys-red"}`,children:n.disambiguationEnabled?"● ON":"○ OFF"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-[11px] text-fg-muted w-24 shrink-0",children:"MAC policy"}),e.jsxs("select",{value:n.macCorruptedPolicy,onChange:b=>l({macCorruptedPolicy:b.target.value}),className:"surface-input px-1.5 py-0.5 rounded text-[11px] font-mono text-fg-primary",children:[e.jsx("option",{value:"strict",children:"strict (drop)"}),e.jsx("option",{value:"name-only",children:"name-only"}),e.jsx("option",{value:"permissive",children:"permissive"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-[11px] text-fg-muted w-24 shrink-0",children:"Recency decay"}),e.jsx("input",{type:"range",min:1,max:48,step:1,value:n.recencyDecayHours,onChange:b=>l({recencyDecayHours:Number(b.target.value)}),className:"flex-1 h-1 accent-sys-blue"}),e.jsxs("span",{className:"text-[11px] font-mono text-fg-primary w-8 text-right",children:[n.recencyDecayHours,"h"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-[11px] text-fg-muted w-24 shrink-0",children:"Zero-hop decay"}),e.jsx("input",{type:"range",min:12,max:168,step:6,value:n.zeroHopDecayHours,onChange:b=>l({zeroHopDecayHours:Number(b.target.value)}),className:"flex-1 h-1 accent-sys-blue"}),e.jsxs("span",{className:"text-[11px] font-mono text-fg-primary w-10 text-right",children:[n.zeroHopDecayHours,"h"]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsx(ys,{packet:p,pipeline:C,resolved:R,decrypted:L??null,isSynthetic:_,liveMode:f}),e.jsx(rs,{})]})]})})]}),p?e.jsxs("div",{className:"space-y-1",children:[e.jsx(kt,{packet:p,isSynthetic:_}),e.jsx(Rt,{packet:p,pipeline:C,rawHex:H,traceTagIndex:(C==null?void 0:C.traceTagIndex)??new Map,neighbors:c}),e.jsx(zt,{packet:p,decrypted:L??void 0,pipeline:C}),e.jsx(Kt,{packet:p,pipeline:C,resolved:R,decrypted:L??void 0,resolveTimeMs:P.current,neighbors:c,advertName:D.advertName})]}):e.jsx("div",{className:"surface-base rounded-lg border border-edge-subtle p-8 text-center",children:e.jsx("p",{className:"text-fg-muted text-xs",children:"Select a packet from the dropdown or paste hex above"})})]})}export{Ss as default}; diff --git a/frontend/dist/assets/PacketObservatory-DhyxQFYe.js b/frontend/dist/assets/PacketObservatory-DhyxQFYe.js deleted file mode 100644 index c1cf46d9..00000000 --- a/frontend/dist/assets/PacketObservatory-DhyxQFYe.js +++ /dev/null @@ -1,5 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/usePipelineStore-B80TA53S.js","assets/index-CeMilrX4.js","assets/node-types-C09ZlzBQ.js","assets/index-CLjIU9sF.css"])))=>i.map(i=>d[i]); -import{bU as O,r as T,eb as Fe,ec as Ee,ed as Oe,ee as ze,bu as Be,ef as Ie,eg as Ge,eh as Ke,ei as Ue,bt as Ne,_ as ue,ej as Ve,ek as we,by as pe,j as e,el as G,em as K,en as U,dQ as xe,eo as qe,x as M,bG as We,bR as Ce,b_ as Ye,ep as Ze,eq as Xe,er as Qe,es as Je,et,eu as J,ev as tt,ew as st,ex as nt,ey as he,ab as me,a6 as Se,e as rt,ez as at,G as lt,K as ot,eA as ct,bg as it,da as dt}from"./index-CeMilrX4.js";import{usePipelineStore as Y}from"./usePipelineStore-B80TA53S.js";import{e as Te,p as ut,a as pt,A as I,S as V,c as se,f as E,K as i,H as A,B as xt,R as F,T as d,P as re,h as ht,i as S,C as _e,s as ee,j as mt}from"./primitives-Dgc86_cp.js";import{m as ke,i as gt}from"./node-types-C09ZlzBQ.js";function ft(t){const s=t.type??t.payload_type,r=t.duplicates??[],c=t.is_duplicate,a=r.length;let n=null,l=null;if(a>0){const x=[t.rssi,...r.map(g=>g.rssi).filter(g=>g!=null)],m=[t.snr,...r.map(g=>g.snr).filter(g=>g!=null)];x.length>1&&(n=[Math.min(...x),Math.max(...x)]),m.length>1&&(l=[Math.min(...m),Math.max(...m)])}const o=s===O.TRACE;return{isDuplicate:c,dupeCount:a,rssiRange:n,snrRange:l,hashIncludesPathLen:o}}function bt(t,s,r){const c={traceTag:null,siblingCount:0,isLocallyOriginated:!1,method:"none",confidence:"none",inferredSrc:null,inferredName:null,evidence:[],thisPathLen:0,minPathLen:0,firstHopPrefix:null};let a=t._traceTag;if(!a&&t.payload&&(a=Te(t.payload)),!a)return{...c,evidence:["no traceTag — cannot correlate"]};const n=s.get(a)??[],l=N=>N.path_length!=null?N.path_length:Array.isArray(N.original_path)?N.original_path.length:0,o=l(t),x=n.length>0?Math.min(...n.map(l)):o,m=t.payload?t.payload.slice(18):"",g=m.length>=2?m.slice(0,2).toUpperCase():null,u=[];if(u.push(`traceTag: ${a}`),u.push(`siblings: ${n.length} observation${n.length!==1?"s":""}`),t.packet_origin==="tx_local")return u.push("packet_origin = tx_local → we initiated this trace"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!0,method:"tx_local",confidence:"certain",inferredSrc:"LOCAL",inferredName:null,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g};const v=n.find(N=>N.packet_origin==="tx_local");if(v)return u.push(`sibling (hash ${v.packet_hash}) has packet_origin = tx_local`),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!0,method:"tx_local",confidence:"certain",inferredSrc:"LOCAL",inferredName:null,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g};if(u.push(`this observation: path_len=${o}, min across siblings: ${x}`),g){if(u.push(`first hop in target path: ${g}`),o===0)return u.push("path_len = 0 → heard directly from initiator (no SNR appended yet)"),u.push("initiator is a direct RF neighbor"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!1,method:"min_path_len",confidence:"speculative",inferredSrc:null,inferredName:null,evidence:[...u,"initiator is within direct RF range (zero forwarding hops)"],thisPathLen:o,minPathLen:x,firstHopPrefix:g};const f=Object.entries(r).filter(([k])=>k.replace(/^0x/i,"").slice(0,2).toUpperCase()===g);if(f.length===1){const[k,$]=f[0],h=$.name||$.node_name||null;return u.push(`first hop ${g} → unique neighbor: ${h??k}`),u.push("initiator is whoever sent TO this first hop"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!1,method:"first_hop_neighbor",confidence:"likely",inferredSrc:g,inferredName:h,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g}}else f.length>1?u.push(`first hop ${g} matches ${f.length} neighbors (ambiguous)`):u.push(`first hop ${g} is not a known neighbor`)}return u.push("insufficient data to identify initiator"),{traceTag:a,siblingCount:n.length,isLocallyOriginated:!1,method:"none",confidence:"none",inferredSrc:null,inferredName:null,evidence:u,thisPathLen:o,minPathLen:x,firstHopPrefix:g}}let ne=null,ce=null;typeof window<"u"&&setTimeout(()=>{ue(()=>import("./usePipelineStore-B80TA53S.js"),__vite__mapDeps([0,1,2,3])).then(t=>{ne=t}),ue(()=>import("./index-CeMilrX4.js").then(t=>t.fH),__vite__mapDeps([1,3])).then(t=>{ce=t})},0);const He={advertSender:null,advertNodeType:null,advertFlags:null,advertHasLocation:null,advertHasName:null,advertName:null,advertLatitude:null,advertLongitude:null,channelHash:null,byteLength:void 0,hopCount:0,isZeroHop:!0,preComputed:!1};function yt(t,s){const r=t.type??t.payload_type,c=Ne(r),a=Be(t.route),n=r===O.ADVERT,l=r===O.TRACE,o=r===O.PATH,x=r===O.GRP_TXT||r===O.GRP_DATA,m=Ie(t.snr,t.rssi),g=(m==null?void 0:m.finalGrade)??"critical",u=Ge(t.route),v=Ke(t.route),N=Ue(t.route),f=t.route==null?"unknown":u?"flood":v?"direct":"unknown",k=N?`transport-${f}`:f,$=!!s.advertSender;let h="none";$?h="pubkey":x?h="encrypted":t.src_hash&&(h="prefix");const y=gt(r),p=s.advertNodeType!=null?ke(s.advertNodeType):"unknown",_=y!=="unknown"?y:p,H=t.packet_origin??"rx",C=Math.floor(Date.now()/1e3)-t.timestamp,D=C<10?"live":C<300?"recent":C<3600?"warm":C<86400?"stale":"historic",L=t.path_length??(Array.isArray(t.original_path)?t.original_path.length:void 0),P=Array.isArray(t.original_path)&&t.original_path.length>0,R=L??0,b=s.byteLength??(t.raw_packet?Math.floor(t.raw_packet.length/2):0),w=ft(t);return{pType:r,payloadTypeName:c,routeTypeName:a,isAdvert:n,isTrace:l,isPath:o,isGrp:x,signalClass:g,routeClass:k,isFlood:u,isDirect:v,hasTransport:N,senderTier:h,hasPubkey:$,inferredType:y,advertType:p,effectiveType:_,origin:H,age:D,pathLen:L,pathAvail:P,pathHopCount:R,byteLen:b,dupeAnalysis:w}}function jt(t){var f,k,$,h,y,p;const s=pt(t);if(!s||s.pathHashes.length===0)return null;const{pathHashes:r,snrValues:c}=s;if(r.length<2||!ne||!ce)return null;const a=ne.usePipelineStore.getState().srcHashResolverMap,n=ne.usePipelineStore.getState().neighborContext,l=(n==null?void 0:n.hashToName)??new Map,o=ce.useStore.getState().stats,x=(o==null?void 0:o.neighbors)??{},m=o==null?void 0:o.local_hash,g=(k=(f=o==null?void 0:o.config)==null?void 0:f.repeater)==null?void 0:k.latitude,u=(h=($=o==null?void 0:o.config)==null?void 0:$.repeater)==null?void 0:h.longitude,v=Object.keys(x).length>0?Ve([],x,m,g,u):null,N=[];for(let _=0;_0?[r[_-1].toUpperCase()]:[]],P=ge(H,_,L,a,v),R=[H,..._+20?N:null}function ge(t,s,r,c,a){if(s===0){const l=c==null?void 0:c.get(t);if(l)return{hash:l,confidence:.8};if(a){const o=pe(a,t,{position:s,adjacentPrefixes:r});if(o.hash)return{hash:o.hash,confidence:o.confidence}}}else{if(a){const o=pe(a,t,{position:s,adjacentPrefixes:r});if(o.hash)return{hash:o.hash,confidence:o.confidence}}const l=c==null?void 0:c.get(t);if(l)return{hash:l,confidence:.6}}return{hash:null,confidence:0}}function vt(t){var l;const s=t.raw_packet;if(!s||s.length<2)return null;const r=s.replace(/\s/g,""),c=Math.floor(r.length/2),a=((l=r.match(/.{1,2}/g))==null?void 0:l.join(" "))??"";let n="";for(let o=0;o=32&&x<=126?String.fromCharCode(x):"·"}return{hexBytes:a,utf8:n,byteCount:c}}function Nt(t){const s=new Map;let r=0,c="";for(const a of t){if((a.type??a.payload_type)!==O.TRACE)continue;r++,c=a.packet_hash;const l=a._traceTag??(a.payload?Te(a.payload):null);if(!l)continue;let o=s.get(l);o||(o=[],s.set(l,o)),o.push(a)}return{index:s,fingerprint:`${r}:${c}`}}function wt(t,s,r){const c=T.useRef({parse:0,decode:0,enrich:0,traceIndex:0,total:0}),a=T.useMemo(()=>t?vt(t):null,[t]),n=T.useMemo(()=>{if(!s||s.length<4)return c.current.parse=0,c.current.decode=0,null;const h=performance.now(),y=ut(s),p=performance.now()-h;return y?(c.current.parse=p,c.current.decode=0,{protocolPacket:y.packet,display:{headerFields:y.headerFields,transportCodesHex:y.transportCodesHex,pathLengthHex:y.pathLengthHex,pathDataHex:y.pathDataHex,payloadHex:y.payloadHex,payloadByteOffset:y.payloadStartByte,pathByteOffset:y.pathByteOffset,pathLenByteOffset:y.pathLenByteOffset},decoded:y.decoded,error:null}):(c.current.parse=p,c.current.decode=0,{protocolPacket:null,display:null,decoded:null,error:"Packet.fromHex() returned failure"})},[s]),l=T.useMemo(()=>{if(!t)return c.current.enrich=0,He;const h=performance.now();if(t._advertSender!==void 0)return c.current.enrich=performance.now()-h,{advertSender:t._advertSender??null,advertNodeType:t._advertNodeType??null,advertFlags:t._advertFlags??null,advertHasLocation:t._advertHasLocation??null,advertHasName:t._advertHasName??null,advertName:t._advertName??null,advertLatitude:t._advertLatitude??null,advertLongitude:t._advertLongitude??null,channelHash:t._channelHash??null,byteLength:t._byteLength,hopCount:t._hopCount??0,isZeroHop:t._isZeroHop??!0,preComputed:!0};const y=t.type??t.payload_type,p=Fe(s,y),_=Ee(s,y),H=Oe(s,t),C=ze(t);return c.current.enrich=performance.now()-h,{...p,channelHash:_,byteLength:H,...C,preComputed:!1}},[t,s]),o=T.useRef({fingerprint:"",index:new Map}),x=T.useMemo(()=>{const h=performance.now(),{index:y,fingerprint:p}=Nt(r);return c.current.traceIndex=performance.now()-h,p===o.current.fingerprint?o.current.index:(o.current={fingerprint:p,index:y},y)},[r]),m=T.useMemo(()=>{const h=c.current;return{parse:h.parse,decode:h.decode,enrich:h.enrich,traceIndex:h.traceIndex,total:h.parse+h.decode+h.enrich+h.traceIndex}},[n,l,x]);if(!t)return null;const g=s?n?n.error:"rawHex too short":"No raw_packet (warm-tier)",u=(n==null?void 0:n.protocolPacket)??null,v=u?u.payloadVersion:null,N=v===0,f=v===1,k=yt(t,l);let $=null;return k.isTrace&&($=jt(t)),{wire:a,display:(n==null?void 0:n.display)??null,parseError:g,protocolPacket:u,decoded:(n==null?void 0:n.decoded)??null,payloadVersion:v,isV1:N,isV2:f,enrichment:l,traceTagIndex:x,analysis:k,traceHopDetail:$,timing:m}}function ae({options:t,nextFn:s}){var n;const r=t.find(l=>l.active),c=(r==null?void 0:r.color)??"green",a=((n=I[c])==null?void 0:n.stem)??"bg-edge-subtle";return e.jsxs("div",{className:"flex flex-col items-start py-1 gap-0 px-2",children:[e.jsx("div",{className:`w-px h-2 ml-4 ${a}`}),e.jsxs("div",{className:"border border-dashed border-edge-subtle rounded-md overflow-hidden w-full",children:[t.map((l,o)=>{const x=I[l.color??"green"]??I.green;return e.jsxs("div",{className:`flex items-center gap-1.5 px-2 py-px font-mono text-[10px] leading-relaxed transition-opacity ${l.active?x.row:"opacity-25"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${l.active?x.dot:"border border-zinc-500/40"}`}),e.jsx("span",{className:`w-16 shrink-0 font-medium ${l.active?"text-fg-primary":"text-fg-muted"}`,children:l.label}),l.detail&&e.jsx("span",{className:l.active?"text-fg-primary/70":"text-fg-muted",children:l.detail})]},o)}),s&&e.jsx("div",{className:"flex items-center px-2 py-0.5 border-t border-edge-subtle",children:e.jsxs("span",{className:"text-[10px] text-fg-muted font-mono",children:["→ ",s]})})]}),e.jsx("div",{className:`w-px h-2 ml-4 ${a}`})]})}function Ct({tokens:t,nextFn:s}){var n;const r=t.find(l=>l.active),c=(r==null?void 0:r.color)??"green",a=((n=I[c])==null?void 0:n.stem)??"bg-edge-subtle";return e.jsxs("div",{className:"flex flex-col items-start py-1 gap-0 px-2",children:[e.jsx("div",{className:`w-px h-2 ml-4 ${a}`}),e.jsxs("div",{className:"border border-dashed border-edge-subtle rounded-md overflow-hidden w-full",children:[t.map((l,o)=>{const x=I[l.color??"green"]??I.green;return e.jsxs("div",{className:`flex items-center gap-1 px-2 py-px font-mono text-[10px] leading-relaxed transition-opacity ${l.active?x.row:"opacity-25"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${l.active?x.dot:"border border-zinc-500/40"}`}),e.jsx("span",{className:"text-fg-muted shrink-0",children:l.fn}),e.jsxs("span",{className:l.active?"text-fg-primary":"text-fg-muted",children:["(",l.value??"",")"]})]},o)}),s&&e.jsx("div",{className:"flex items-center px-2 py-0.5 border-t border-edge-subtle",children:e.jsxs("span",{className:"text-[10px] text-fg-muted font-mono",children:["→ ",s]})})]}),e.jsx("div",{className:`w-px h-2 ml-4 ${a}`})]})}const St={0:"border-l-sys-green",1:"border-l-sys-blue",2:"border-l-sys-teal",3:"border-l-sys-purple"};function le({stage:t,name:s,fn:r,verdict:c,timeMs:a,skipped:n,skipReason:l,children:o}){const x=St[t]??"";return e.jsx(e.Fragment,{children:e.jsx(G,{defaultOpen:!n,children:e.jsxs("div",{className:`surface-base rounded-lg border border-edge-subtle overflow-hidden border-l-2 ${x}`,children:[e.jsxs(K,{className:"px-3 py-2 w-full",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"font-mono text-xs font-bold text-sys-blue shrink-0",children:t}),e.jsx("span",{className:"font-mono text-xs font-medium text-fg-primary truncate",children:s}),r&&!c&&e.jsx("span",{className:"font-mono text-[11px] text-fg-muted truncate hidden sm:inline",children:r}),c&&e.jsx("span",{className:"font-mono text-[11px] text-fg-muted/70 truncate hidden sm:inline",children:c})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[n&&e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-zinc-500/20 text-fg-muted",children:"N/A"}),a!=null&&!n&&e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-sys-green/15 text-sys-green",children:a<1?`${(a*1e3).toFixed(0)}µs`:`${a.toFixed(2)}ms`})]})]}),e.jsx(U,{children:e.jsx("div",{className:"px-3 pb-3 font-mono text-xs",children:n?e.jsx("p",{className:"text-fg-muted italic",children:l??"Not applicable for this packet type"}):o})})]})})})}function Tt(t,s){return s?"manual":t._stripped?"bulk-tier":qe.isConnected()?"ws-push":"rest-poll"}const _t={connected:"green",degraded:"amber",offline:"red"};function kt({packet:t,isSynthetic:s}){const r=xe(g=>g.wsState),c=xe(g=>g.health),a=Tt(t,s),l=!!t._stripped?"WARM":"HOT",o=[{label:"ws-push",detail:"wsConnected && onPacket()",active:a==="ws-push",color:"green"},{label:"rest-poll",detail:"!wsConnected, 3s interval",active:a==="rest-poll",color:"amber"},{label:"catchup",detail:"wsReconnected, delta > 50",active:a==="catchup",color:"amber"},{label:"bulk-tier",detail:"user extends time range → gzip",active:a==="bulk-tier",color:"blue"},{label:"manual",detail:"hex input — no transport",active:a==="manual",color:"zinc"}],x=[{fn:"transport",value:a,group:"transport",color:a==="ws-push"?"green":a==="bulk-tier"?"blue":"amber"},{fn:"tier",value:l,group:"transport",color:"blue"},{fn:"wsState",value:r,group:"transport",color:r==="connected"?"green":"amber"},{fn:"health",value:c,group:"transport",color:_t[c]}],m=s?"manual hex input":`${a} (${c})`;return e.jsx(le,{stage:0,name:"TRANSPORT",fn:"websocketService / useStore.startPolling",verdict:m,children:s?e.jsx("p",{className:"text-fg-muted italic",children:"Manual hex input — no transport context"}):e.jsx(V,{prefix:"transport",children:e.jsxs("div",{className:"space-y-0",children:[e.jsx(ae,{options:o,nextFn:"ingest()"}),e.jsx(se,{tokens:x})]})})})}function q({start:t,end:s}){const r=s!=null&&s!==t?`[${t}..${s}]`:`[${t}]`;return e.jsx("span",{className:"text-fg-muted text-[9px] font-mono mr-1 select-none",children:r})}const Ht={advert:"decodeAdvert()",ack:"decodeAck()",path:"decodePath()",trace:"decodeTraceWithSnr()",txt_msg:"decodeTextMessage()",grp_txt:"decodeGroupText()",grp_data:"decodeGroupData()",multipart:"decodeMultipart()",control:"decodeControl()",req:"decodeRequest()",response:"decodeResponse()",anon_req:"decodeAnonReq()",generic:"decodeGeneric()"};function $t({rawHex:t,display:s,protocolPacket:r,parseError:c,parseTimeMs:a,payloadVersion:n,isV1:l,isV2:o}){return e.jsx("dl",{className:"space-y-0.5",children:s&&r&&t?e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"A. Parse — Packet.fromHex()"}),a>0&&e.jsx("div",{className:"flex justify-end",children:e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-sys-green/15 text-sys-green",children:a<1?`${(a*1e3).toFixed(0)}µs`:`${a.toFixed(2)}ms`})}),e.jsxs(i,{label:"header byte",children:[e.jsx(q,{start:0}),e.jsx(A,{value:t.slice(0,2)})," ",e.jsx(xt,{value:parseInt(t.slice(0,2),16)})]}),s.headerFields.map(x=>e.jsx(i,{label:` ${x.field}`,children:e.jsx(F,{raw:e.jsxs("span",{className:"text-[10px]",children:["bits[",x.bits,"] = ",x.binary]}),children:e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-2 py-0.5 font-mono text-[11px] text-sys-amber",children:x.value})})},x.field)),e.jsx(i,{label:" version",children:n!=null?e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(d,{fn:"payloadVer",value:`${n}`,color:"amber"}),e.jsx(M,{color:l?"green":o?"blue":"zinc",children:l?"v1":o?"v2":`v${n}`}),l&&e.jsx("span",{className:"text-fg-muted text-[10px]",children:"1-byte hashes, 2-byte MAC"}),o&&e.jsx("span",{className:"text-sys-blue text-[10px]",children:"2-byte hashes, 4-byte MAC (speculative)"})]}):e.jsx("span",{className:"text-fg-muted",children:"unknown"})}),e.jsx(E,{title:"Wire Framing"}),e.jsx(i,{label:"transportCodes",children:s.transportCodesHex?e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(q,{start:1,end:4}),e.jsx(d,{fn:"transport",value:s.transportCodesHex,color:"amber"})]}):e.jsx("span",{className:"text-fg-muted",children:"N/A (non-transport route)"})}),e.jsx(i,{label:"pathLen",children:e.jsx(F,{raw:e.jsxs(e.Fragment,{children:[e.jsx(q,{start:s.pathLenByteOffset}),e.jsx(A,{value:s.pathLengthHex})]}),children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(q,{start:s.pathLenByteOffset}),e.jsx(d,{fn:"pathLen",value:`${r.pathLen} hop${r.pathLen!==1?"s":""}`,color:"amber"})]})})}),e.jsx(i,{label:"path",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.pathLen>0&&e.jsx(q,{start:s.pathByteOffset,end:s.pathByteOffset+r.pathLen-1}),e.jsx(re,{hops:r.pathHexArray,hexPrefix:s.pathDataHex||void 0})]})}),e.jsx(i,{label:"payloadLen",children:e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(q,{start:s.payloadByteOffset,end:s.payloadByteOffset+s.payloadHex.length/2-1}),e.jsx(d,{fn:"payloadLen",value:`${s.payloadHex.length/2} bytes`,color:"amber"})]})}),e.jsx(i,{label:"payloadHex",children:e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-2 py-0.5 font-mono text-[11px] text-sys-amber break-all",children:s.payloadHex})})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"A. Parse"}),e.jsxs(i,{label:"result",children:[e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-2 py-0.5 font-mono text-[11px] text-sys-amber",children:"Skipped"}),e.jsx("span",{className:"ml-1 text-fg-muted",children:c??"No raw_packet (warm-tier)"})]})]})})}function Dt({decoded:t,packet:s}){if(!t)return e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"B. Decode"}),e.jsx("p",{className:"text-fg-muted italic text-[10px]",children:"No decoded payload"})]});const r=Ht[t.type]??`decode${t.type}()`;return e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"B. Decode — decodePayload()"}),e.jsx(V,{prefix:"decodePayload",children:e.jsxs("dl",{className:"space-y-0.5",children:[e.jsx(i,{label:"dispatched",children:r}),e.jsx(E,{}),e.jsx(Lt,{decoded:t,packet:s})]})})]})}function Lt({decoded:t,packet:s}){var r;switch(t.type){case"advert":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"publicKey",children:e.jsx(F,{raw:e.jsx("span",{className:"text-[10px] break-all",children:t.publicKey}),children:e.jsx(d,{fn:"publicKey",value:t.publicKey,color:"green"})})}),e.jsx(i,{label:"timestamp",children:e.jsx(d,{fn:"timestamp",value:String(t.timestamp),color:"green"})}),e.jsx(i,{label:"flags",children:e.jsx(F,{raw:e.jsx(A,{value:t.flags}),children:e.jsx(d,{fn:"flags",value:t.flagsDescription,color:"green"})})}),e.jsx(i,{label:"nodeType",children:e.jsx(d,{fn:"nodeType",value:t.nodeType,color:"green"})}),t.latitude!=null&&e.jsx(i,{label:"latitude",children:e.jsx(d,{fn:"lat",value:t.latitude.toFixed(6),color:"green"})}),t.longitude!=null&&e.jsx(i,{label:"longitude",children:e.jsx(d,{fn:"lon",value:t.longitude.toFixed(6),color:"green"})}),t.name&&e.jsx(i,{label:"name",children:e.jsx(d,{fn:"name",value:t.name,color:"green"})})]});case"ack":return e.jsx(i,{label:"crc",children:e.jsx(F,{raw:e.jsx("span",{className:"text-[10px]",children:t.crc}),children:e.jsx(d,{fn:"crc",value:t.crc,color:"green"})})});case"trace":{const c=s!=null&&s.src_hash?s.src_hash.replace(/^0x/i,"").slice(0,2).toUpperCase():null;return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"traceTag",children:e.jsx(d,{fn:"traceTag",value:t.traceTag,color:"green"})}),e.jsx(i,{label:"authCode",children:e.jsx(d,{fn:"authCode",value:String(t.authCode),color:"green"})}),e.jsx(i,{label:"flags",children:e.jsx(A,{value:t.flags})}),e.jsx(i,{label:"target path",children:t.pathHashes.length>0?e.jsx(re,{hops:t.pathHashes.map(a=>a.toUpperCase()),color:"green"}):e.jsx("span",{className:"text-fg-muted italic",children:"∅ empty"})}),e.jsx(i,{label:"complete",children:t.isComplete?e.jsxs("span",{className:"text-sys-green",children:["✓ all ",t.pathHashes.length," hops reported SNR"]}):e.jsxs("span",{className:"text-sys-amber",children:["✗ ",t.snrValues.length,"/",t.pathHashes.length," hops reported"]})}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1 text-[10px]",children:"Directional Edge SNR — per-hop link quality"}),t.snrValues.length===0?e.jsx("p",{className:"text-fg-muted italic text-[11px] ml-2",children:"No SNR values in path field"}):e.jsx("div",{className:"space-y-0.5 ml-2",children:t.snrValues.map((a,n)=>{var g,u,v,N,f;const l=((g=t.pathHashes[n])==null?void 0:g.toUpperCase())??"??",o=n===0?c??"SRC":((u=t.pathHashes[n-1])==null?void 0:u.toUpperCase())??"??",x=(f=(N=(v=Ye.getState().stats)==null?void 0:v.config)==null?void 0:N.radio)==null?void 0:f.spreading_factor,m=we(a,x);return e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-mono",children:[e.jsx("span",{className:"text-fg-muted w-3 text-right",children:n}),e.jsx("span",{className:"text-fg-primary",children:o}),e.jsx("span",{className:"text-fg-muted",children:"→"}),e.jsx("span",{className:"text-fg-primary",children:l}),e.jsx("span",{className:"text-fg-muted",children:"@"}),e.jsxs("span",{className:"font-bold text-sys-green",children:[a>0?"+":"",a.toFixed(1)," dB"]}),e.jsx(M,{color:"green",children:m})]},n)})})]})]})}case"path":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"pathLength",children:e.jsx(d,{fn:"pathLength",value:String(t.pathLength),color:"green"})}),e.jsx(i,{label:"path",children:t.path&&t.path.length>0?e.jsx(re,{hops:t.path.map(c=>c.toUpperCase()),color:"green"}):e.jsx("span",{className:"text-fg-muted italic",children:"∅ empty"})}),t.extraType!=null&&e.jsx(i,{label:"extraType",children:e.jsx(d,{fn:"extraType",value:t.extraTypeName??String(t.extraType),color:"purple"})}),t.extraData&&e.jsxs(i,{label:"extraData",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.extraData}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.extraData.length/2,"B)"]})]})]});case"txt_msg":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"srcHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.srcHash}),children:e.jsx(d,{fn:"srcHash",value:t.srcHash,color:"green"})})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsx(i,{label:"timestamp",children:e.jsx(d,{fn:"timestamp",value:String(t.timestamp),color:"green"})}),e.jsx(i,{label:"text",children:e.jsx(d,{fn:"text",value:t.text,color:"green"})}),e.jsx(i,{label:"encrypted",children:e.jsx(d,{fn:"encrypted",value:String(t.encrypted),color:"green"})})]});case"grp_txt":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channelHash",children:e.jsx(A,{value:t.channelHash})}),t.channelName&&e.jsx(i,{label:"channelName",children:e.jsx(d,{fn:"channel",value:t.channelName,color:"green"})}),e.jsx(i,{label:"decrypted",children:e.jsx(d,{fn:"decrypted",value:String(t.decrypted),color:"green"})}),t.text&&e.jsx(i,{label:"text",children:e.jsx(d,{fn:"text",value:t.text,color:"green"})}),t.senderName&&e.jsx(i,{label:"senderName",children:e.jsx(d,{fn:"sender",value:t.senderName,color:"green"})}),t.macCorrupted&&e.jsx(i,{label:"macCorrupted",children:e.jsx(d,{fn:"macCorrupted",value:"true",color:"green"})})]});case"grp_data":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channelHash",children:e.jsx(A,{value:t.channelHash})}),e.jsx(i,{label:"dataLength",children:t.dataLength}),e.jsx(i,{label:"decrypted",children:String(t.decrypted)})]});case"multipart":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"messageId",children:t.messageId}),e.jsxs(i,{label:"part",children:[t.partNumber+1," / ",t.totalParts]})]});case"control":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"controlType",children:e.jsx(F,{raw:e.jsx(A,{value:t.controlType}),children:e.jsx(d,{fn:"controlType",value:t.subtypeName,color:"green"})})}),e.jsx(i,{label:"subtype",children:e.jsx(d,{fn:"subtype",value:`0x${t.subtype.toString(16).padStart(2,"0")}`,color:"green"})}),t.nodeTypeName&&e.jsxs(i,{label:"nodeType",children:[e.jsx(d,{fn:"nodeType",value:t.nodeTypeName,color:"green"}),e.jsxs("span",{className:"text-fg-muted text-[10px] ml-1",children:["(flags & 0x0F = 0x",(r=t.nodeType)==null?void 0:r.toString(16).padStart(2,"0"),")"]})]}),t.snrDb!=null&&e.jsxs(i,{label:"snr",children:[e.jsxs("span",{className:"font-bold text-sys-green",children:[t.snrDb>0?"+":"",t.snrDb.toFixed(1)," dB"]}),e.jsx(M,{color:"green",children:t.snrDb>=5?"strong":t.snrDb>=0?"fair":"weak"})]}),t.tag&&e.jsx(i,{label:"tag",children:e.jsx(d,{fn:"tag",value:t.tag,color:"green"})}),t.publicKey&&e.jsxs(i,{label:"publicKey",children:[e.jsx("span",{className:"break-all text-[10px] font-mono text-sys-green",children:t.publicKey}),e.jsx(M,{color:t.publicKeyFull?"green":"amber",children:t.publicKeyFull?"32B full":`${t.publicKey.length/2}B prefix`})]}),t.typeFilter!=null&&e.jsx(i,{label:"typeFilter",children:e.jsx(F,{raw:e.jsx(A,{value:t.typeFilter}),children:e.jsx(d,{fn:"typeFilter",value:t.typeFilterDescription??"none",color:"green"})})}),t.prefixOnly!=null&&e.jsx(i,{label:"prefixOnly",children:e.jsx(d,{fn:"prefixOnly",value:String(t.prefixOnly),color:"green"})}),t.since!=null&&e.jsx(i,{label:"since",children:e.jsx(d,{fn:"since",value:t.since===0?"all (0)":String(t.since),color:"green"})}),!t.nodeTypeName&&t.typeFilter==null&&t.dataLength>0&&e.jsxs(i,{label:"data",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.dataHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.dataLength,"B)"]})]})]});case"req":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"srcHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.srcHash}),children:e.jsx(d,{fn:"srcHash",value:t.srcHash,color:"green"})})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsxs(i,{label:"ciphertext",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.ciphertextHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.ciphertextLength,"B)"]})]})]});case"response":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"srcHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.srcHash}),children:e.jsx(d,{fn:"srcHash",value:t.srcHash,color:"green"})})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsxs(i,{label:"ciphertext",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.ciphertextHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.ciphertextLength,"B)"]})]})]});case"anon_req":return e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"destHash",children:e.jsx(F,{raw:e.jsx(A,{value:t.destHash}),children:e.jsx(d,{fn:"destHash",value:t.destHash,color:"green"})})}),e.jsx(i,{label:"senderPubKey",children:e.jsx("span",{className:"break-all text-[10px] font-mono text-sys-green",children:t.senderPublicKey})}),e.jsx(i,{label:"cipherMac",children:e.jsx(d,{fn:"cipherMac",value:t.cipherMac,color:"purple"})}),e.jsxs(i,{label:"ciphertext",children:[e.jsx("span",{className:"break-all text-[10px] font-mono",children:t.ciphertextHex}),e.jsxs("span",{className:"text-fg-muted ml-1",children:["(",t.ciphertextLength,"B)"]})]})]});case"generic":return e.jsxs(e.Fragment,{children:[e.jsxs(i,{label:"payloadType",children:[e.jsx(ht,{value:t.payloadType})," (",t.payloadTypeName,")"]}),e.jsx(i,{label:"length",children:t.length}),e.jsx(i,{label:"rawHex",children:e.jsx("span",{className:"break-all",children:t.rawHex})})]});default:return e.jsx("p",{className:"text-fg-muted",children:"Unknown decoded type"})}}function Pt({protocolPacket:t,packetHash:s}){const r=t==null?void 0:t.payloadType,c=r===Ze||r===Xe,a=T.useMemo(()=>{if(!c||!t)return null;const p=t.payload;return p.length<4?null:{channelHash:p[0],mac:p.slice(1,3),ciphertext:p.slice(3)}},[t,c]),[n,l]=T.useState("pending"),[o,x]=T.useState([]),[m,g]=T.useState(0);T.useEffect(()=>{if(!a){l(null);return}let p=!1;return(async()=>{const H=performance.now(),C=await Qe(a.channelHash,a.mac,a.ciphertext);p||(l(C),g(performance.now()-H));const D=await Je(a.channelHash);p||x(D)})(),()=>{p=!0}},[a]);const[u,v]=T.useState(""),[N,f]=T.useState(null),[k,$]=T.useState(!1),h=T.useCallback(async()=>{if(!(!a||!u.trim())){$(!0);try{const p=await We(u.trim(),a.channelHash,a.mac,a.ciphertext);if(p.success){const _=new TextDecoder("utf-8",{fatal:!1}).decode(p.result.plaintext.slice(5));f({success:!0,text:_})}else f({success:!1,error:p.error})}catch(p){f({success:!1,error:String(p)})}finally{$(!1)}}},[a,u]),y=Ce(s);return!c||!a?null:e.jsxs(e.Fragment,{children:[e.jsx(E,{title:"C. Decrypt — tryDecryptGroupMessage()"}),m>0&&e.jsx("div",{className:"flex justify-end",children:e.jsx("span",{className:"font-mono text-[10px] px-1.5 py-0.5 rounded bg-sys-green/15 text-sys-green",children:m<1?`${(m*1e3).toFixed(0)}µs`:`${m.toFixed(2)}ms`})}),e.jsx(V,{prefix:"tryDecryptGroupMessage",children:e.jsxs("dl",{className:"space-y-0.5",children:[e.jsx(i,{label:"channelHash",children:e.jsx(d,{fn:"channelHash",value:`0x${a.channelHash.toString(16).toUpperCase().padStart(2,"0")}`,color:"teal"})}),e.jsx(i,{label:"mac",children:e.jsx(d,{fn:"mac",value:Array.from(a.mac).map(p=>p.toString(16).padStart(2,"0")).join(""),color:"teal"})}),e.jsx(i,{label:"cipherLen",children:e.jsx(d,{fn:"cipherLen",value:`${a.ciphertext.length}B`,color:"teal"})}),e.jsx(i,{label:"candidates",children:e.jsx(d,{fn:"candidates",value:o.length>0?`${o.length} names`:"0",color:o.length>0?"teal":"zinc"})}),o.length>0&&e.jsxs("details",{className:"mt-1",children:[e.jsx("summary",{className:"text-fg-muted cursor-pointer hover:text-fg-primary text-[10px]",children:"show candidate names"}),e.jsx("div",{className:"mt-1 text-[10px] text-fg-muted break-all max-h-24 overflow-y-auto",children:o.join(", ")})]}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1",children:"Result:"}),n==="pending"?e.jsx("p",{className:"text-fg-muted italic",children:"decrypting…"}):n?e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channel",children:e.jsx(d,{fn:"channel",value:n.channelName,color:"teal"})}),e.jsx(i,{label:"plaintext",children:e.jsx(d,{fn:"plaintext",value:new TextDecoder("utf-8",{fatal:!1}).decode(n.plaintext.slice(5)).trim()||"(empty)",color:"teal"})}),e.jsx(i,{label:"macValid",children:e.jsx(d,{fn:"macValid",value:n.macCorrupted?"false":"true",color:"teal"})})]}):e.jsxs(i,{label:"decrypt",children:[e.jsx(d,{fn:"decrypt",value:"failed",color:"red"}),e.jsx("span",{className:"text-fg-muted ml-1",children:"channel not in known list"})]})]}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1",children:"testChannelName() — manual test:"}),e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("input",{type:"text",value:u,onChange:p=>{v(p.target.value),f(null)},onKeyDown:p=>p.key==="Enter"&&h(),placeholder:"channel name",className:"surface-input px-2 py-1 rounded text-[11px] font-mono text-fg-primary w-40"}),e.jsx("button",{onClick:h,disabled:k||!u.trim(),className:"px-2 py-1 rounded text-[10px] font-mono bg-sys-blue/20 text-sys-blue hover:bg-sys-blue/30 disabled:opacity-40 transition-colors",children:k?"…":"Try"})]}),N&&e.jsx("div",{className:"mt-1",children:N.success?e.jsx(i,{label:"result",children:e.jsx(d,{fn:"plaintext",value:N.text??"(empty)",color:"teal"})}):e.jsx(i,{label:"error",children:e.jsx(d,{fn:"error",value:N.error??"unknown",color:"red"})})})]}),e.jsx(E,{}),e.jsxs("div",{children:[e.jsx("p",{className:"text-fg-muted mb-1",children:"useDecodedMessage() store result:"}),y?y.decoded?e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"channel",children:e.jsx(d,{fn:"channel",value:y.decoded.channelName??"?",color:"teal"})}),e.jsx(i,{label:"text",children:e.jsx(d,{fn:"text",value:y.decoded.text,color:"teal"})})]}):e.jsx(i,{label:"decrypt",children:e.jsx(d,{fn:"decrypt",value:"failed",color:"red"})}):e.jsx(i,{label:"decrypt",children:e.jsx(d,{fn:"decrypt",value:"pending",color:"zinc"})})]})]})})]})}function Mt(t){const{rawHex:s,display:r,protocolPacket:c,decoded:a,parseError:n,parseTimeMs:l,payloadVersion:o,isV1:x,isV2:m,packetHash:g,packet:u}=t,v=!!s&&s.length>=4;return e.jsxs(G,{children:[e.jsx(K,{className:"w-full mt-2 mb-1",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-[10px] font-mono text-fg-muted",children:"🔬"}),e.jsx("span",{className:"text-[10px] font-mono font-medium text-fg-muted",children:"Wire Inspection"}),e.jsx("span",{className:"text-[9px] text-fg-muted/50",children:"observatory diagnostic — not a runtime stage"})]})}),e.jsx(U,{children:e.jsxs("div",{className:"border border-dashed border-edge-subtle rounded-lg p-3 space-y-1 bg-surface/30",children:[e.jsx("p",{className:"text-[9px] text-fg-muted/50 mb-2",children:"The backend parsed these fields server-side. This panel verifies the wire-level encoding client-side."}),v?e.jsxs(e.Fragment,{children:[e.jsx($t,{rawHex:s,display:r,protocolPacket:c,parseError:n,parseTimeMs:l,payloadVersion:o,isV1:x,isV2:m}),e.jsx(Dt,{decoded:a,packet:u}),e.jsx(Pt,{protocolPacket:c,packetHash:g})]}):e.jsx("p",{className:"text-fg-muted italic text-[10px]",children:n??"No raw_packet — wire inspection unavailable (warm-tier packet)"})]})})]})}function fe(t){if(!t)return[{fn:"decode",value:"no raw_packet",group:"decode",color:"zinc"}];switch(t.type){case"advert":{const s=t,r=[{fn:"decode.nodeType",value:s.nodeType,group:"decode",color:"blue"}];return s.name&&r.push({fn:"decode.name",value:s.name,group:"decode",color:"blue"}),s.latitude!=null&&s.longitude!=null&&r.push({fn:"decode.location",value:`${s.latitude.toFixed(4)}, ${s.longitude.toFixed(4)}`,group:"decode",color:"blue"}),r.push({fn:"decode.publicKey",value:s.publicKey,group:"decode",color:"blue"}),r}case"trace":{const s=t;return[{fn:"decode.traceTag",value:s.traceTag,group:"decode",color:"blue"},{fn:"decode.hops",value:s.pathHashes.length>0?s.pathString:"empty",group:"decode",color:"blue"},{fn:"decode.snr",value:s.snrValues.length>0?`${s.snrValues.length} values`:"none",group:"decode",color:s.snrValues.length>0?"blue":"zinc"},{fn:"decode.complete",value:s.isComplete?"yes":"partial",group:"decode",color:s.isComplete?"green":"amber"}]}case"path":{const s=t,r=[{fn:"decode.pathLength",value:String(s.pathLength),group:"decode",color:"blue"},{fn:"decode.path",value:s.path.length>0?s.pathString:"empty",group:"decode",color:"blue"}];return s.extraType!=null&&r.push({fn:"decode.extraType",value:s.extraTypeName??String(s.extraType),group:"decode",color:"purple"}),s.extraData&&r.push({fn:"decode.extraData",value:`${s.extraData.length/2}B`,group:"decode",color:"purple"}),r}case"ack":return[{fn:"decode.crc",value:t.crc,group:"decode",color:"blue"}];case"grp_txt":return[{fn:"decode.channelHash",value:t.channelHash,group:"decode",color:"blue"},{fn:"decode.encrypted",value:"true — decrypt at cascade",group:"decode",color:"zinc"}];case"grp_data":{const s=t;return[{fn:"decode.channelHash",value:s.channelHash,group:"decode",color:"blue"},{fn:"decode.dataLength",value:`${s.dataLength}B`,group:"decode",color:"blue"}]}case"txt_msg":{const s=t;return[{fn:"decode.srcHash",value:s.srcHash,group:"decode",color:"blue"},{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.encrypted",value:s.encrypted?"true":"false",group:"decode",color:s.encrypted?"zinc":"green"},...s.encrypted?[]:[{fn:"decode.text",value:s.text,group:"decode",color:"blue"}]]}case"multipart":{const s=t;return[{fn:"decode.part",value:`${s.partNumber+1}/${s.totalParts}`,group:"decode",color:"blue"},{fn:"decode.msgId",value:s.messageId,group:"decode",color:"blue"}]}case"control":{const s=t,r=[{fn:"decode.subtype",value:s.subtypeName,group:"decode",color:"blue"}];return s.nodeTypeName&&r.push({fn:"decode.nodeType",value:s.nodeTypeName,group:"decode",color:"blue"}),s.snrDb!=null&&r.push({fn:"decode.snr",value:`${s.snrDb>0?"+":""}${s.snrDb.toFixed(1)} dB`,group:"decode",color:"blue"}),s.tag&&r.push({fn:"decode.tag",value:s.tag,group:"decode",color:"blue"}),s.publicKey&&r.push({fn:"decode.publicKey",value:s.publicKey,group:"decode",color:s.publicKeyFull?"green":"blue"}),s.typeFilter!=null&&r.push({fn:"decode.typeFilter",value:s.typeFilterDescription??`0x${s.typeFilter.toString(16)}`,group:"decode",color:"blue"}),s.prefixOnly!=null&&r.push({fn:"decode.prefixOnly",value:String(s.prefixOnly),group:"decode",color:"blue"}),!s.nodeTypeName&&!s.tag&&(r.push({fn:"decode.subtypeFlags",value:`0x${s.subtypeFlags.toString(16)}`,group:"decode",color:"blue"}),r.push({fn:"decode.dataLength",value:`${s.dataLength}B`,group:"decode",color:"blue"})),r}case"req":{const s=t;return[{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.srcHash",value:s.srcHash,group:"decode",color:"blue"},{fn:"decode.cipherMac",value:s.cipherMac,group:"decode",color:"purple"},{fn:"decode.ciphertext",value:`${s.ciphertextLength}B`,group:"decode",color:"zinc"}]}case"response":{const s=t;return[{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.srcHash",value:s.srcHash,group:"decode",color:"blue"},{fn:"decode.cipherMac",value:s.cipherMac,group:"decode",color:"purple"},{fn:"decode.ciphertext",value:`${s.ciphertextLength}B`,group:"decode",color:"zinc"}]}case"anon_req":{const s=t;return[{fn:"decode.destHash",value:s.destHash,group:"decode",color:"blue"},{fn:"decode.senderPubKey",value:s.senderPublicKey,group:"decode",color:"green"},{fn:"decode.cipherMac",value:s.cipherMac,group:"decode",color:"purple"},{fn:"decode.ciphertext",value:`${s.ciphertextLength}B`,group:"decode",color:"zinc"}]}case"generic":return[{fn:"decode.raw",value:`${t.length}B`,group:"decode",color:"zinc"}];default:return[]}}function Rt({packet:t,pipeline:s,rawHex:r,traceTagIndex:c,neighbors:a}){const{enrichment:n,timing:l,display:o,protocolPacket:x,decoded:m,parseError:g,payloadVersion:u,isV1:v,isV2:N,analysis:f}=s,$=(t.type??t.payload_type)===et,h=f.dupeAnalysis,y=T.useRef(0),p=T.useMemo(()=>{if(!$)return null;const D=performance.now(),L=bt(t,c,a);return y.current=performance.now()-D,L},[t,c,a,$]),_=l.enrich+y.current,H=[];f.byteLen&&H.push(`${f.byteLen}B`),H.push(f.payloadTypeName),n.advertName&&H.push(`"${n.advertName}"`),n.isZeroHop?H.push("zero-hop"):f.pathHopCount>0&&H.push(`${f.pathHopCount}h`),H.push(`${t.rssi}dBm`),h.isDuplicate&&H.push("DUPE");const C=H.join(" — ");return e.jsxs(le,{stage:1,name:"INGEST",fn:n.preComputed?"PacketCache.mergePackets()":"extractAdvertData() + extractHopData() + ...",verdict:C,timeMs:_,children:[e.jsx(Mt,{rawHex:r,display:o,protocolPacket:x,decoded:m,parseError:g,parseTimeMs:l.parse,payloadVersion:u,isV1:v,isV2:N,packetHash:t.packet_hash,packet:t}),e.jsx(E,{title:"Cache Enrichment"}),e.jsx(V,{prefix:"packetCache",children:e.jsxs("dl",{className:"space-y-0.5",children:[e.jsxs("div",{className:"mb-1.5",children:[n.preComputed?e.jsx(M,{color:"green",children:"PacketCache"}):e.jsx(M,{color:"amber",children:"computed"}),e.jsx("span",{className:"text-[10px] text-fg-muted ml-1.5",children:n.preComputed?"pre-enriched by real pipeline":"synthetic — computed on the fly"})]}),e.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1 mb-1",children:[e.jsx(d,{fn:"_byteLength",value:n.byteLength!=null?`${n.byteLength}B`:void 0,color:"blue"}),e.jsx(d,{fn:"_hopCount",value:String(n.hopCount),color:"blue"}),e.jsx(d,{fn:"_isZeroHop",value:String(n.isZeroHop),color:n.isZeroHop?"green":"blue"}),n.isZeroHop&&e.jsx(M,{color:"blue",children:"direct"}),n.channelHash!=null&&e.jsx(d,{fn:"_channelHash",value:n.channelHash,color:"blue"}),$&&t._traceTag&&e.jsx(d,{fn:"_traceTag",value:t._traceTag,color:"blue"})]}),n.advertSender||n.advertNodeType!=null||n.advertName!=null?e.jsxs("div",{className:"mt-1 mb-1",children:[e.jsx("p",{className:"text-[10px] text-sys-blue font-medium mb-0.5",children:"ADVERT Enrichment"}),e.jsxs("div",{className:"flex flex-wrap gap-x-2 gap-y-1",children:[n.advertSender&&e.jsx(d,{fn:"_advertSender",value:n.advertSender.slice(0,16)+"…",color:"blue"}),n.advertNodeType!=null&&e.jsx(d,{fn:"_advertNodeType",value:ke(n.advertNodeType),color:"blue"}),n.advertName!=null&&e.jsx(d,{fn:"_advertName",value:n.advertName,color:"blue"}),n.advertFlags!=null&&e.jsx(d,{fn:"_advertFlags",value:`0x${n.advertFlags.toString(16).padStart(2,"0")}`,color:"blue"}),n.advertHasLocation!=null&&e.jsx(d,{fn:"_advertHasLocation",value:String(n.advertHasLocation),color:"blue"}),n.advertHasName!=null&&e.jsx(d,{fn:"_advertHasName",value:String(n.advertHasName),color:"blue"}),n.advertLatitude!=null&&n.advertLongitude!=null&&e.jsx(d,{fn:"location",value:`${n.advertLatitude.toFixed(4)}, ${n.advertLongitude.toFixed(4)}`,color:"blue"})]})]}):e.jsx("p",{className:"text-[10px] text-fg-muted/30 mb-1",children:"ADVERT fields: N/A (non-ADVERT packet)"}),e.jsx(E,{title:"Payload Decode"}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${m?"bg-sys-blue":"bg-zinc-500/40"}`}),e.jsx("span",{className:"font-mono text-[10px] font-medium text-fg-primary",children:"decodePayload()"}),e.jsx("span",{className:"text-[9px] text-fg-muted",children:"sync — wire data only, no crypto"})]}),e.jsx("div",{className:"ml-3",children:m?e.jsx("div",{className:"flex flex-wrap gap-x-1.5 gap-y-1",children:fe(m).map((D,L)=>e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-1.5 py-0.5",children:e.jsx(d,{fn:D.fn,value:D.value,color:D.color})},L))}):e.jsx(S,{children:"no raw_packet — warm-tier packet, decode unavailable"})})]}),e.jsx(E,{}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono",children:[e.jsx("span",{className:"text-fg-muted",children:"dupe:"}),h.isDuplicate?e.jsx(d,{fn:"is_duplicate",value:"true",color:"purple"}):e.jsx(S,{children:"none"}),h.dupeCount>0&&e.jsx(d,{fn:"dupeCount",value:`×${h.dupeCount}`,color:"purple"}),h.rssiRange&&e.jsxs(S,{c:"text-fg-primary",children:["Δ",Math.abs(h.rssiRange[1]-h.rssiRange[0]),"dB RSSI"]})]}),p&&e.jsxs(e.Fragment,{children:[e.jsx(E,{}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono",children:[e.jsx("span",{className:"text-fg-muted",children:"TRACE SRC:"}),p.inferredSrc?e.jsxs(e.Fragment,{children:[e.jsx(d,{fn:"inferredSrc",value:p.inferredSrc,color:"purple"}),p.inferredName&&e.jsx(d,{fn:"name",value:p.inferredName,color:"purple"})]}):e.jsx(S,{children:"unresolvable"}),e.jsx(_e,{color:"purple",children:p.method}),e.jsxs(S,{children:["(",p.confidence,")"]}),e.jsxs(S,{children:["siblings=",p.siblingCount]})]})]}),(()=>{const D=f.pType!=null?`0x${f.pType.toString(16).toUpperCase().padStart(2,"0")}`:void 0,L=t.route!=null?`0x${t.route.toString(16).toUpperCase().padStart(2,"0")}`:void 0,P=fe(m),R=f.signalClass==="excellent"||f.signalClass==="good"?"green":f.signalClass==="fair"?"amber":"red",b=f.senderTier==="pubkey"?"green":f.senderTier==="prefix"?"amber":f.senderTier==="encrypted"?"teal":"zinc",w=[{fn:"type",value:f.payloadTypeName,raw:D,group:"wire",color:"blue"},{fn:"route",value:f.routeTypeName,raw:L,group:"wire",color:"blue"},{fn:"src_hash",value:t.src_hash||void 0,group:"wire",color:"blue"},{fn:"rssi",value:`${t.rssi}dBm`,group:"wire",color:"blue"},{fn:"snr",value:`${t.snr}dB`,group:"wire",color:"blue"},{fn:"_byteLength",value:f.byteLen?`${f.byteLen}B`:void 0,group:"enrichment",color:"blue"},{fn:"_hopCount",value:String(n.hopCount),group:"enrichment",color:"blue"},{fn:"_isZeroHop",value:String(n.isZeroHop),group:"enrichment",color:"blue"},{fn:"_advertSender",value:n.advertSender||void 0,group:"enrichment",color:"blue"},{fn:"_advertNodeType",value:f.advertType!=="unknown"?f.advertType:void 0,group:"enrichment",color:"blue"},{fn:"_advertName",value:n.advertName||void 0,group:"enrichment",color:"blue"},{fn:"_channelHash",value:n.channelHash||void 0,group:"enrichment",color:"blue"},...P,{fn:"is_duplicate",value:String(h.isDuplicate),group:"analysis",color:"purple"},p!=null&&p.inferredSrc?{fn:"traceSrc",value:p.inferredSrc,group:"analysis",color:"purple"}:{fn:"traceSrc"},{fn:"_signalClass",value:f.signalClass,group:"analysis",color:R},{fn:"_routeClass",value:f.routeClass,group:"analysis",color:"purple"},{fn:"_senderTier",value:f.senderTier,group:"analysis",color:b},{fn:"_origin",value:f.origin,group:"analysis",color:f.origin==="tx_local"?"green":f.origin==="tx_forward"?"amber":"purple"},{fn:"_pathAvail",value:f.pathAvail?`${f.pathHopCount} hops`:"none",group:"analysis",color:f.pathAvail?"green":"zinc"},{fn:"_age",value:f.age,group:"analysis",color:f.age==="live"||f.age==="recent"?"green":"zinc"},...h.dupeCount>0?[{fn:"_dupeCount",value:`×${h.dupeCount}`,group:"analysis",color:"purple"},...h.rssiRange?[{fn:"_multipath",value:`Δ${Math.abs(h.rssiRange[1]-h.rssiRange[0])}dB`,group:"analysis",color:Math.abs(h.rssiRange[1]-h.rssiRange[0])>6?"amber":"green"}]:[]]:[],...t.lbt_attempts!=null?[{fn:"_lbt",value:`${t.lbt_attempts} attempt${t.lbt_attempts!==1?"s":""}`,group:"analysis",color:(t.lbt_attempts??0)>1?"amber":"green"}]:[],...t.drop_reason?[{fn:"_dropReason",value:t.drop_reason,group:"analysis",color:"red"}]:[]];return e.jsx(se,{tokens:w})})()]})})]})}function be(t){switch(t){case"excellent":return"green";case"good":return"green";case"fair":return"amber";case"poor":return"red";case"critical":return"red";default:return"zinc"}}function ye(t){return`${Math.round(t*100)}%`}function je(t,s,r){return t||(s?s.slice(0,12):`~${r}`)}function At({hops:t}){return t.length===0?null:e.jsxs("div",{className:"mt-2 pt-2 border-t border-edge-subtle/40",children:[e.jsx("p",{className:"text-[9px] text-fg-muted/40 uppercase tracking-widest font-mono mb-1.5",children:"per-hop trace inspection"}),e.jsx("div",{className:"space-y-1",children:t.map(s=>e.jsx(V,{prefix:`trace.hop[${s.hopIndex}]`,children:e.jsxs("div",{className:"border border-edge-subtle/40 rounded px-2 py-1.5",children:[e.jsxs(i,{label:"link",children:[e.jsx(re,{hops:[s.fromPrefix,s.toPrefix],color:"blue"}),e.jsx("span",{className:"ml-1.5",children:e.jsx(_e,{color:be(s.quality),children:s.quality})})]}),e.jsx(i,{label:"snr",children:e.jsx(F,{raw:e.jsx("span",{className:"text-sys-blue",children:s.snrRaw}),children:e.jsx(d,{fn:"snr",value:`${s.snrRaw.toFixed(1)} dB`,color:be(s.quality)})})}),e.jsxs(i,{label:"from",children:[e.jsx(d,{fn:"resolve",value:je(s.fromName,s.fromHash,s.fromPrefix),color:s.fromHash?s.fromConfidence>=.8?"green":"amber":"purple"}),e.jsx("span",{className:"ml-1",children:e.jsx(d,{fn:"conf",value:ye(s.fromConfidence),color:"zinc"})})]}),e.jsxs(i,{label:"to",children:[e.jsx(d,{fn:"resolve",value:je(s.toName,s.toHash,s.toPrefix),color:s.toHash?s.toConfidence>=.8?"green":"amber":"purple"}),e.jsx("span",{className:"ml-1",children:e.jsx(d,{fn:"conf",value:ye(s.toConfidence),color:"zinc"})})]})]})},s.hopIndex))}),e.jsx(se,{label:"trace contributes",tokens:Ft(t)})]})}function Ft(t){const s=t.reduce((n,l)=>n+(l.fromHash?1:0)+(l.toHash?1:0),0),r=t.length*2,c=r-s,a=t.length>0?t.reduce((n,l)=>n+l.snrRaw,0)/t.length:0;return[{fn:"hops",value:String(t.length),group:"wire",color:"blue"},{fn:"resolved",value:`${s}/${r}`,group:"worker",color:"green"},...c>0?[{fn:"ghosts",value:String(c),group:"worker",color:"purple"}]:[],{fn:"avgSnr",value:`${a.toFixed(1)} dB`,group:"analysis",color:a>=5?"green":a>=0?"amber":"red"}]}function Et(t){if(!t)return"never";const s=Math.floor((Date.now()-t)/1e3);return s<60?`${s}s ago`:s<3600?`${Math.floor(s/60)}m ago`:`${Math.floor(s/3600)}h ago`}function Ot(t){if(!t)return[];const s=t.decoded;if(!s)return[{fn:"decrypt.result",value:"failed",group:"crypto",color:"red"}];if(!s.decrypted)return[{fn:"decrypt.result",value:"no key match",group:"crypto",color:"zinc"}];const r=[];return s.channelName&&r.push({fn:"decrypt.channelName",value:s.channelName,group:"crypto",color:"teal"}),s.senderName&&r.push({fn:"decrypt.senderName",value:s.senderName,group:"crypto",color:"teal"}),s.text&&r.push({fn:"decrypt.text",value:s.text,group:"crypto",color:"teal"}),s.timestamp&&r.push({fn:"decrypt.timestamp",value:new Date(s.timestamp*1e3).toISOString().slice(11,19),group:"crypto",color:"teal"}),s.macCorrupted&&r.push({fn:"decrypt.macCorrupted",value:"true",group:"crypto",color:"amber"}),r}function zt({packet:t,decrypted:s,pipeline:r}){var b;const c=J(w=>w.isComputing),a=J(w=>w.lastUpdated),n=J(w=>w.lastComputeTimeMs),l=J(w=>w.topology.edges.length),o=J(w=>w.topology.discoveredNodes.length),x=tt(),m=st(),g=nt(),u=he(w=>w.isComputing),v=he(w=>w.nodeCount),N=me(w=>w.progress),f=me(w=>w.initialDecodeComplete),k=t.type??t.payload_type,$=k===O.GRP_TXT||k===O.GRP_DATA,h=k===O.TRACE,y=k===O.PATH,p=$,_=[{label:"full",detail:"all GRP_TXT → decryption worker",active:p&&f,color:"teal"},{label:"quick",detail:"100 most recent (initial load)",active:p&&!f,color:"amber"},{label:"skip",detail:"non-GRP or catchup path",active:!p,color:"zinc"}],H=Ot(s),C=((b=s==null?void 0:s.decoded)==null?void 0:b.decrypted)===!0,D=c?"running":`${l}e ${o}g`,L=u?"running":`${v}n`,P=p?C?"decrypted":N.isDecoding?`${N.percent}%`:"pending":"N/A",R=`topo ${c?"○":"✓"} ${D} · spark ${u?"○":"✓"} ${L} · decrypt ${P}`;return e.jsx(le,{stage:2,name:"CASCADE",fn:"hydrateDownstream()",verdict:R,children:e.jsx(V,{prefix:"cascade",children:e.jsxs("div",{className:"space-y-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 py-1.5 text-[11px] font-mono",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${c?"bg-sys-amber animate-pulse":"bg-sys-green"}`}),e.jsx("span",{className:"text-fg-primary",children:"topology"}),e.jsxs("span",{className:"text-fg-muted",children:[l,"e ",o,"g"]}),(h||y)&&e.jsx("span",{className:"text-sys-green text-[9px]",children:"↑signal"})]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${u?"bg-sys-amber animate-pulse":"bg-sys-green"}`}),e.jsx("span",{className:"text-fg-primary",children:"sparkline"}),e.jsxs("span",{className:"text-fg-muted",children:[v,"n"]})]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${N.isDecoding?"bg-sys-amber animate-pulse":p?"bg-sys-teal":"bg-zinc-500/40"}`}),e.jsx("span",{className:"text-fg-primary",children:"decrypt"}),e.jsx("span",{className:p?"text-sys-teal":"text-fg-muted",children:p?C?"decrypted":N.isDecoding?`${N.percent}%`:"pending":"N/A"})]})]}),e.jsxs(G,{defaultOpen:h||y,children:[e.jsx(K,{className:"text-[10px] w-full border-t border-edge-subtle pt-1.5",children:e.jsx("span",{className:"font-mono text-fg-muted/50",children:"topology detail…"})}),e.jsx(U,{children:e.jsxs("div",{className:"ml-3 pb-2",children:[e.jsx(i,{label:"status",children:e.jsx(d,{fn:"isComputing",value:c?"running":"idle",color:c?"amber":"green"})}),e.jsxs(i,{label:"last",children:[e.jsx(d,{fn:"lastUpdated",value:Et(a),color:"zinc"}),n>0&&e.jsxs("span",{className:"ml-2 text-fg-muted text-[10px]",children:["(",n<1e3?`${n.toFixed(0)}ms`:`${(n/1e3).toFixed(1)}s`,")"]})]}),e.jsxs(i,{label:"output",children:[e.jsx(d,{fn:"edges",value:String(l),color:"green"}),e.jsx(d,{fn:"ghostNodes",value:String(o),color:"purple"})]}),m&&e.jsxs(e.Fragment,{children:[e.jsxs(i,{label:"trace links",children:[e.jsx(d,{fn:"directed",value:String(x.totalDirectedLinks),color:"teal"}),e.jsx(d,{fn:"bidir",value:String(x.bidirectionalLinks),color:"teal"}),e.jsx(d,{fn:"traces",value:String(x.totalTraces),color:"zinc"})]}),e.jsxs(i,{label:"trace SNR",children:[e.jsx(d,{fn:"mean",value:`${x.meanSnr.toFixed(1)} dB`,color:x.meanSnr>=5?"green":x.meanSnr>=0?"amber":"red"}),e.jsx(d,{fn:"median",value:`${x.medianSnr.toFixed(1)} dB`,color:"zinc"}),e.jsx(d,{fn:"confidence",value:`${Math.round(x.avgConfidence*100)}%`,color:"zinc"})]}),h&&e.jsxs(i,{label:"quality",children:[e.jsx(d,{fn:"excellent",value:String(x.qualityCounts.excellent),color:"green"}),e.jsx(d,{fn:"good",value:String(x.qualityCounts.good),color:"green"}),e.jsx(d,{fn:"fair",value:String(x.qualityCounts.fair),color:"amber"}),e.jsx(d,{fn:"poor",value:String(x.qualityCounts.poor),color:"red"}),e.jsx(d,{fn:"critical",value:String(x.qualityCounts.critical),color:"red"})]}),g.confirmedResolutions.size>0&&e.jsxs(i,{label:"feedback",children:[e.jsx(d,{fn:"feedback.confirmed",value:String(g.confirmedResolutions.size),color:"teal"}),e.jsx(d,{fn:"feedback.links",value:String(g.confirmedLinks.length),color:"teal"})]})]}),h&&(r==null?void 0:r.traceHopDetail)&&e.jsx(At,{hops:r.traceHopDetail})]})})]}),p&&e.jsx("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:e.jsxs("div",{className:"ml-3",children:[e.jsx(i,{label:"mode",children:e.jsx(ae,{options:_,nextFn:"queueDecryption()"})}),e.jsx(i,{label:"result",children:e.jsx(d,{fn:"decrypt",value:C?"decrypted":s?"failed":"pending",color:C?"teal":s?"red":"zinc"})}),C&&e.jsx("div",{className:"mt-1 flex flex-wrap gap-x-1.5 gap-y-1",children:H.map((w,oe)=>e.jsx("span",{className:"inline-block border border-edge-subtle rounded px-1.5 py-0.5",children:e.jsx(d,{fn:w.fn,value:w.value,color:w.color})},oe))})]})}),(()=>{const w=[{fn:"topology.edges",value:String(l),group:"worker",color:"green"},{fn:"topology.ghostNodes",value:String(o),group:"worker",color:"purple"},{fn:"sparkline.nodes",value:`${v}`,group:"worker",color:"green"},...m?[{fn:"trace.directedLinks",value:String(x.totalDirectedLinks),group:"worker",color:"teal"},{fn:"trace.meanSnr",value:`${x.meanSnr.toFixed(1)} dB`,group:"worker",color:"teal"}]:[],...H];return e.jsx(se,{tokens:w})})()]})})})}function Bt(t,s,r,c){var n;const a=t.src_hash?Se(t.src_hash):"";if(t._advertSender&&s.hash&&s.confident)return{tier:1,label:"_advertSender → pubkey",detail:"ADVERT carried full 32-byte public key — definitive match"};if(c&&s.confident&&((n=s.name)==null?void 0:n.toLowerCase())===c.toLowerCase())return{tier:1.5,label:"decrypt.senderName → nameToHash",detail:`Decrypted sender name “${c}” matched neighbor — high-confidence`};if(a&&r.crossClassPrefixes.has(a))return{tier:2,label:"cross-class prefix",detail:"Prefix has mixed types (repeater + non-repeater); payload type narrows to one class"};if(s.confident){const l=r.prefixIndex.get(a);return(l==null?void 0:l.length)===1?{tier:3,label:"single candidate",detail:"Only one node matches this prefix — unambiguous"}:{tier:3,label:"resolver",detail:"Multi-signal scoring selected best candidate from collision set"}}return{tier:4,label:"ambiguous",detail:"Cannot confidently resolve — multiple same-class candidates, insufficient scoring separation"}}function It(t,s){const r=t.original_path??t.forwarded_path,c=new Set;if(r&&Array.isArray(r))for(const a of r){const n=String(a).toUpperCase().slice(0,2);n.length>=2&&n!==s&&c.add(n)}return c}function Gt(t,s,r,c,a,n,l){const o=Math.floor(Date.now()/1e3),x=new Map(r.map(m=>[m.hash,m]));return t.map(m=>{const g=s[m.hash],u=x.get(m.hash);let v=!0,N="";c!=="unknown"?m.type!=="unknown"&&m.type!==c?(v=!1,N=`${m.type} ≠ required ${c}`):m.type===c?N="type matches":N="type unknown — not ruled out":N="payload ambiguous — all types eligible";const f=!!(g!=null&&g.zero_hop),k=(g==null?void 0:g.last_seen)??0;let $=0;if(f&&k>0){const b=(o-k)/3600;$=50*Math.exp(-b/l)}let h=0;if(k>0){const b=(o-k)/3600;h=Math.exp(-b/n)}const y=h*20,p=!!(g!=null&&g.latitude&&(g!=null&&g.longitude)&&(g.latitude!==0||g.longitude!==0)),_=p?5:0,H=(u==null?void 0:u.advertCount)??0,C=Math.min(H*2,30),D=(u==null?void 0:u.forwarderPrefixes.size)??0,L=Math.min(D*3,15);let P=0;if(u&&u.totalForwarderObservations>0&&a.size>0){let b=0;for(const w of a)u.forwarderPrefixes.has(w)&&b++;P=b/a.size}const R=$+y+_+C+L;return{hash:m.hash,name:m.name,type:m.type,roleCompatible:v,roleReason:N,zeroHop:f,zeroHopScore:$,lastSeen:k,recencyScore:h,recencyPoints:y,hasGps:p,gpsScore:_,advertCount:H,advertScore:C,topoWidth:D,topoScore:L,affinity:P,total:R}}).sort((m,g)=>g.total-m.total)}function Kt({packet:t,pipeline:s,resolved:r,resolveTimeMs:c,advertName:a,neighbors:n,decrypted:l}){var ie,de;const o=Y(j=>j.neighborContext),x=Y(j=>j.topologyProfiles),m=Y(j=>j.config),{analysis:g}=s,u=r??{hash:null,type:"unknown",name:null,confident:!1},v=t.src_hash?Se(t.src_hash):"",N=v?o.prefixIndex.get(v)??[]:[],f=v?x.get(v)??[]:[],k=g.pType??-1,$=k>=0?k.toString(16).toUpperCase().padStart(2,"0"):"??",h=g.inferredType,y=g.advertType,p=g.effectiveType,_=t._advertNodeType!=null?t._advertNodeType.toString(16).padStart(2,"0").toUpperCase():"",H=((ie=l==null?void 0:l.decoded)==null?void 0:ie.senderName)??null,C=Bt(t,u,o,H),D=T.useMemo(()=>It(t,v),[t,v]),L=g.pathLen,P=T.useMemo(()=>Gt(N,n,f,p,D,m.recencyDecayHours,m.zeroHopDecayHours),[N,n,f,p,D,m.recencyDecayHours,m.zeroHopDecayHours]),R=P.filter(j=>!j.roleCompatible),b=P.filter(j=>j.roleCompatible),w=t._advertSender?o.pubKeyMap.get(t._advertSender)??null:null,oe=C.tier===1,De=[{fn:"src_hash",value:v||"",active:!!v,color:"blue"},{fn:"_advertSender",value:t._advertSender?t._advertSender.slice(0,12)+"…":"",active:!!t._advertSender,color:"blue"},{fn:"_advertNodeType",value:_?`0x${_}`:"",active:t._advertNodeType!=null,color:"blue"},{fn:"path_length",value:L!=null?L===0?"zero-hop":String(L):"",active:L!=null,color:"blue"},{fn:"decrypt.senderName",value:H??"",active:!!H,color:"teal"}],Le=[{label:"hit",detail:"pubKeyMap.get(_advertSender) → definitive",active:!!w,color:"green"},{label:"miss",detail:t._advertSender?"pubkey not in neighbor table":"no _advertSender",active:!w,color:"zinc"}],Pe=[{label:"payload",detail:`inferDeviceType(0x${$}) → ${h}`,active:h!=="unknown",color:"amber"},{label:"flags",detail:_?`mapAdvertTypeCode(0x${_}) → ${y}`:"no _advertNodeType",active:h==="unknown"&&y!=="unknown",color:"green"},{label:"ambiguous",detail:"all types eligible",active:p==="unknown",color:"zinc"}],Me=u.name??((de=u.hash)==null?void 0:de.slice(0,12))??"?",Re=u.confident?"confident":"ambiguous",Ae=`→ ${Me} (${Re}, Tier ${C.tier})`;return e.jsx(le,{stage:3,name:"RESOLVE",fn:"usePipelineStore.resolveSource()",verdict:Ae,timeMs:c,children:e.jsx(V,{prefix:"resolvePacketSource",children:e.jsxs("div",{className:"space-y-0",children:[e.jsx("div",{className:"pt-1 pb-1",children:e.jsx(Ct,{tokens:De,nextFn:"resolvePacketSource()"})}),t.src_hash?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"1"})," ","PUBKEY LOOKUP"]}),e.jsx(ae,{options:Le,nextFn:"pubKeyMap.get()"}),e.jsx("div",{className:"ml-3 mt-1",children:w?e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"resolved",children:e.jsx(d,{fn:"hash",value:w,color:"green"})}),a&&e.jsxs(i,{label:"name",children:[e.jsx(d,{fn:"name",value:a,color:"green"}),u.name&&a===u.name&&e.jsx(S,{c:"text-sys-green ml-1",children:"✓ neighbor match"})]}),e.jsxs(i,{label:"result",children:[e.jsx(M,{color:"green",children:"Tier 1"}),e.jsx(S,{c:"text-fg-primary ml-1",children:"definitive — scoring bypassed"})]})]}):t._advertSender?e.jsx(i,{label:"status",children:e.jsx(S,{c:"text-sys-amber",children:"✗ pubkey not in neighbor table"})}):e.jsx(i,{label:"status",children:e.jsx(S,{children:"no _advertSender — skip to prefix resolution"})})})]}),oe?e.jsx("div",{className:"border-t border-edge-subtle py-2",children:e.jsx("p",{className:"text-[11px] text-fg-muted/40 font-mono ml-3",children:"Steps 2–5 bypassed — pubkey definitive"})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"2"})," ","CANDIDATE POOL — ",N.length," node",N.length!==1?"s":"",' match "',v,'"']}),e.jsxs("div",{className:"space-y-0.5 ml-3",children:[P.map(j=>e.jsxs("div",{className:"flex gap-2 items-center text-[11px]",children:[e.jsx("span",{className:"break-all text-[10px]",children:j.hash}),e.jsx(M,{color:"zinc",children:j.type||"unknown"}),j.name&&e.jsx(S,{children:j.name})]},j.hash)),N.length===0&&e.jsx(S,{children:"no known nodes for this prefix"})]})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"3"})," ","TYPE INFERENCE"]}),e.jsx(ae,{options:Pe,nextFn:"effectiveType()"}),e.jsx("div",{className:"ml-3 mt-1",children:e.jsx(i,{label:"effective",children:e.jsx(d,{fn:"effectiveType",value:p,color:p!=="unknown"?h!=="unknown"?"amber":"green":"zinc"})})})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"4"})," ","ROLE-TYPE SCRUB"]}),e.jsx("div",{className:"space-y-0.5 ml-3",children:P.map(j=>e.jsxs("div",{className:"flex gap-2 items-center text-[11px]",children:[e.jsx("span",{className:j.roleCompatible?"text-sys-green":"text-sys-red",children:j.roleCompatible?"✓":"✗"}),e.jsx("span",{className:`break-all text-[10px] ${j.roleCompatible?"":"line-through text-fg-muted"}`,children:j.hash}),e.jsx(M,{color:j.roleCompatible?"zinc":"red",children:j.type||"unknown"}),e.jsx(S,{c:j.roleCompatible?"text-fg-muted":"text-sys-red",children:j.roleReason})]},j.hash))}),R.length>0&&e.jsxs("p",{className:"text-[10px] text-fg-muted mt-1 ml-3",children:[R.length," eliminated, ",b.length," surviving"]})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-blue font-bold",children:"5"})," ","CANDIDATE SCORING"]}),b.length===0?e.jsx("p",{className:"text-fg-muted italic ml-3",children:"No surviving candidates"}):b.length===1?e.jsxs("div",{className:"ml-3 text-[11px]",children:[e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(S,{c:"text-sys-green",children:"→"}),e.jsx("span",{className:"break-all text-[10px]",children:b[0].hash}),b[0].name&&e.jsx(S,{c:"text-fg-muted ml-1",children:b[0].name})]}),e.jsx("p",{className:"text-fg-muted ml-4",children:"single survivor — scoring not needed"})]}):e.jsxs(G,{children:[e.jsx(K,{className:"text-[10px] ml-3",children:e.jsxs("span",{className:"font-mono text-fg-muted/50",children:[b.length," candidates scored…"]})}),e.jsx(U,{children:e.jsx("div",{className:"space-y-2 ml-3 mt-1",children:b.map(j=>{const Q=j.hash===u.hash;return e.jsxs("div",{className:`text-[11px] leading-relaxed rounded px-2 py-1 ${Q?"bg-sys-green/8 border border-sys-green/20":"bg-zinc-500/5"}`,children:[e.jsxs("div",{className:"flex gap-2 items-center mb-0.5",children:[e.jsx(S,{c:Q?"text-sys-green":"text-fg-muted",children:Q?"→":" "}),e.jsx("span",{className:`break-all text-[10px] ${Q?"text-fg-primary":"text-fg-muted"}`,children:j.hash}),e.jsx(M,{color:Q?"green":"zinc",children:j.type||"unknown"}),j.name&&e.jsx(S,{children:j.name})]}),e.jsxs("div",{className:"ml-4 flex flex-wrap gap-x-3 gap-y-0.5",children:[e.jsxs("span",{children:[e.jsx(S,{children:"zero_hop:"})," ",e.jsx(S,{c:j.zeroHop?"text-sys-green":"text-fg-muted",children:j.zeroHop?"✓":"✗"})," ",e.jsxs(M,{color:ee(j.zeroHopScore),children:["+",j.zeroHopScore]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"recency:"})," ",e.jsx(S,{c:"text-fg-primary",children:mt(j.lastSeen)})," ",e.jsxs(M,{color:ee(j.recencyPoints),children:["+",j.recencyPoints.toFixed(1)]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"gps:"})," ",e.jsx(S,{c:j.hasGps?"text-sys-green":"text-fg-muted",children:j.hasGps?"✓":"✗"})," ",e.jsxs(M,{color:ee(j.gpsScore),children:["+",j.gpsScore]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"adverts:"})," ",e.jsx(S,{c:"text-fg-primary",children:j.advertCount})," ",e.jsxs(M,{color:ee(j.advertScore),children:["+",j.advertScore]})]}),e.jsxs("span",{children:[e.jsx(S,{children:"topo:"})," ",e.jsx(S,{c:"text-fg-primary",children:j.topoWidth})," ",e.jsxs(M,{color:ee(j.topoScore),children:["+",j.topoScore]})]})]}),e.jsxs("div",{className:"ml-4 mt-0.5",children:[e.jsx(S,{children:"score ≈"})," ",e.jsx(S,{c:"text-fg-primary font-bold",children:j.total.toFixed(1)})]})]},j.hash)})})})]})]})]}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:[e.jsxs("p",{className:"text-fg-muted mb-1",children:[e.jsx(S,{c:"text-sys-green font-bold",children:"✓"})," ","RESOLUTION"]}),e.jsxs("div",{className:"ml-3",children:[e.jsx(i,{label:"hash",children:u.hash?e.jsx(d,{fn:"resolved.hash",value:u.hash,color:"green"}):e.jsx(S,{children:"null"})}),e.jsx(i,{label:"type",children:e.jsx(d,{fn:"resolved.type",value:u.type,color:u.confident?"green":"zinc"})}),e.jsx(i,{label:"name",children:u.name?e.jsx(d,{fn:"resolved.name",value:u.name,color:u.confident?"green":"amber"}):e.jsx(S,{children:"null"})}),e.jsx(i,{label:"confident",children:e.jsx(S,{c:u.confident?"text-sys-green":"text-sys-red",children:String(u.confident)})}),e.jsxs(i,{label:"tier",children:[e.jsx(M,{color:C.tier<=2?"green":C.tier===3?"amber":"red",children:C.tier}),e.jsx(S,{c:"text-fg-primary ml-1",children:C.label})]})]})]})]}):e.jsx("div",{className:"border-t border-edge-subtle pt-2 pb-2",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] font-mono",children:[e.jsx(S,{c:"text-sys-amber",children:"⚠ no src_hash"}),H&&e.jsx(d,{fn:"decrypt.senderName",value:H,color:"teal"}),u.confident?e.jsxs(S,{c:"text-sys-green",children:["→ resolved via ",C.label]}):e.jsx(S,{c:"text-sys-red",children:"ambiguous"})]})}),(()=>{const j=[{fn:"resolved.hash",value:u.hash??"null",group:"resolution",color:u.confident?"green":"zinc"},{fn:"resolved.type",value:u.type,group:"resolution",color:u.type!=="unknown"?u.confident?"green":"amber":"zinc"},{fn:"resolved.name",value:u.name??"null",group:"resolution",color:u.confident?"green":u.name?"amber":"zinc"},{fn:"resolved.confident",value:String(u.confident),group:"resolution",color:u.confident?"green":"red"}];return e.jsx(se,{tokens:j})})()]})})})}const Ut={id:"packet-parse",label:"Packet Parse",inputs:["rawPacket"],outputs:["parsedPacket","decoded","headerFields"],emits:[{fn:"routeType",group:"wire",color:"blue"},{fn:"payloadType",group:"wire",color:"blue"},{fn:"pathLength",group:"wire",color:"blue"},{fn:"version",group:"wire",color:"blue"}],async:!1,observatoryStage:0},Vt={id:"enrichment",label:"Ingestion Enrichment",inputs:["parsedPacket"],outputs:["advertSender","channelHash","hopData","byteLength"],emits:[{fn:"_advertSender",group:"enrichment",color:"blue"},{fn:"_advertNodeType",group:"enrichment",color:"blue"},{fn:"_channelHash",group:"enrichment",color:"blue"},{fn:"_hopCount",group:"enrichment",color:"blue"},{fn:"_isZeroHop",group:"enrichment",color:"blue"},{fn:"_byteLength",group:"enrichment",color:"blue"}],async:!1,observatoryStage:1},qt={id:"topology",label:"Topology Analysis",inputs:["packets","neighbors","srcHashResolver"],outputs:["edges","nodeMetrics","pathHealth","ghostNodes","centrality","loops"],emits:[{fn:"edges",group:"worker",color:"green"},{fn:"ghostNodes",group:"worker",color:"purple"},{fn:"loops",group:"analysis",color:"amber"},{fn:"nodeMetrics",group:"worker",color:"green"},{fn:"pathHealth",group:"worker",color:"green"},{fn:"centrality",group:"worker",color:"green"}],async:!0,worker:"topology.worker.ts",observatoryStage:2},Wt={id:"trace-enrichment",label:"Trace Link Quality",inputs:["packets","prefixLookup","srcHashResolver","edges","pathHealth","nodeMetrics"],outputs:["traceLinks","traceLinkSummary","traceDisambiguationFeedback"],emits:[{fn:"traceLinks.directed",group:"worker",color:"teal"},{fn:"traceLinks.bidir",group:"worker",color:"teal"},{fn:"traceSummary.meanSnr",group:"analysis",color:"green"},{fn:"traceSummary.medianSnr",group:"analysis",color:"zinc"},{fn:"traceSummary.confidence",group:"analysis",color:"zinc"},{fn:"feedback.confirmed",group:"worker",color:"teal"},{fn:"feedback.links",group:"worker",color:"teal"}],async:!1,observatoryStage:2},Yt={id:"disambiguation",label:"Source Disambiguation",inputs:["packets","neighbors","decodedMessages"],outputs:["srcHashResolverMap","neighborContext"],emits:[{fn:"resolvedHash",group:"resolution",color:"purple"},{fn:"resolvedName",group:"resolution",color:"purple"},{fn:"resolvedType",group:"resolution",color:"purple"},{fn:"confidence",group:"resolution",color:"green"}],async:!1,observatoryStage:3},Zt={id:"sparkline",label:"Sparkline Computation",inputs:["packets","neighbors"],outputs:["sparklineData"],emits:[{fn:"sparklines",group:"worker",color:"blue"}],async:!1},Xt={id:"decryption",label:"Channel Decryption",inputs:["packets","channelKeys"],outputs:["decodedMessages"],emits:[{fn:"decrypt.text",group:"crypto",color:"teal"},{fn:"decrypt.senderName",group:"crypto",color:"teal"},{fn:"decrypt.channelName",group:"crypto",color:"teal"},{fn:"decrypt.macCorrupted",group:"crypto",color:"amber"}],async:!0,worker:"decryption.worker.ts",observatoryStage:2},Qt={id:"decoded-content",label:"Decoded Content Policy",inputs:["decodedMessages","packets"],outputs:["decodedContent","contentInheritance"],emits:[{fn:"content.senderName",group:"crypto",color:"teal"},{fn:"content.text",group:"crypto",color:"teal"},{fn:"content.channelName",group:"crypto",color:"teal"},{fn:"content.corrupted",group:"crypto",color:"amber"},{fn:"content.inherited",group:"analysis",color:"purple"}],async:!1},Z=[Ut,Vt,qt,Wt,Yt,Zt,Xt,Qt],Jt=new Map(Z.map(t=>[t.id,t])),es=new Map;for(const t of Z)for(const s of t.emits)es.set(s.fn,t);const $e=new Map;for(const t of Z)for(const s of t.outputs)$e.set(s,t);function ts(){const t=new Map,s=new Map;for(const a of Z)t.has(a.id)||t.set(a.id,0),s.has(a.id)||s.set(a.id,new Set);for(const a of Z)for(const n of a.inputs){const l=$e.get(n);if(l&&l.id!==a.id){const o=s.get(l.id);o.has(a.id)||(o.add(a.id),t.set(a.id,(t.get(a.id)??0)+1))}}const r=[];for(const[a,n]of t)n===0&&r.push(a);const c=[];for(;r.length>0;){const a=r.shift(),n=Jt.get(a);n&&c.push(n);for(const l of s.get(a)??[]){const o=(t.get(l)??1)-1;t.set(l,o),o===0&&r.push(l)}}for(const a of Z)c.includes(a)||c.push(a);return c}const ss={0:"text-sys-green",1:"text-sys-blue",2:"text-sys-teal",3:"text-sys-purple"};function ns({stage:t,isActive:s,onClick:r}){const c=t.observatoryStage!=null?ss[t.observatoryStage]??"text-fg-muted":"text-fg-muted/40";return e.jsxs("button",{type:"button",onClick:r,className:` - flex items-center gap-1.5 w-full px-1.5 py-1 rounded transition-base text-left - ${s?"bg-sys-blue/10 ring-1 ring-sys-blue/30":"hover:bg-zinc-500/5"} - `,children:[e.jsx("span",{className:`font-mono text-[9px] font-bold w-3 shrink-0 text-center ${c}`,children:t.observatoryStage??"·"}),e.jsx("span",{className:"font-mono text-[9px] text-fg-primary truncate flex-1",children:t.label}),t.async&&e.jsx("span",{className:"font-mono text-[7px] px-1 py-px rounded bg-sys-amber/15 text-sys-amber shrink-0 leading-tight",children:"⚡"}),t.emits.length>0&&e.jsxs("span",{className:"flex items-center gap-px shrink-0",children:[t.emits.slice(0,6).map(a=>{var n;return e.jsx("span",{className:`inline-block w-1 h-1 rounded-full ${((n=I[a.color])==null?void 0:n.dot)??"bg-zinc-500"}`,title:`${a.fn} [${a.group}]`},a.fn)}),t.emits.length>6&&e.jsxs("span",{className:"font-mono text-[7px] text-fg-muted/40 ml-0.5",children:["+",t.emits.length-6]})]})]})}function rs({activeStageId:t,onStageClick:s}){const r=T.useMemo(()=>ts(),[]),c=T.useMemo(()=>{const a=new Map;for(const l of r){const o=l.observatoryStage??"other";let x=a.get(o);x||(x=[],a.set(o,x)),x.push(l)}const n=[];for(const l of[0,1,2,3,"other"]){const o=a.get(l);o!=null&&o.length&&n.push({key:l,stages:o})}return n},[r]);return e.jsxs("div",{className:"surface-base rounded-lg border border-edge-subtle p-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-mono text-[8px] text-fg-muted/40 uppercase tracking-widest",children:"Pipeline DAG"}),e.jsxs("span",{className:"font-mono text-[8px] text-fg-muted/30",children:[r.length," stages"]})]}),e.jsx("div",{className:"space-y-px",children:c.map((a,n)=>e.jsxs("div",{children:[n>0&&e.jsx("div",{className:"flex items-center pl-2.5 py-px",children:e.jsx("svg",{width:"6",height:"8",viewBox:"0 0 6 8",className:"text-fg-muted/20",children:e.jsx("path",{d:"M3 0 L3 6 M1 4 L3 6 L5 4",fill:"none",stroke:"currentColor",strokeWidth:"1"})})}),a.stages.map(l=>e.jsx(ns,{stage:l,isActive:t===l.id,onClick:s?()=>s(l.id):void 0},l.id))]},String(a.key)))})]})}const ve=200,z={status:"idle",lastDurationMs:null,lastTs:null,runCount:0};function as(t,s,r){var c,a,n;switch(t.type){case"transport:ws:state":s.wsState=((c=t.data)==null?void 0:c.state)??r.wsState;break;case"transport:ws:packet":s.wsPacketCount=(s.wsPacketCount??r.wsPacketCount)+1;break;case"transport:ws:stats":s.wsStatsCount=(s.wsStatsCount??r.wsStatsCount)+1;break;case"transport:rest:stats":s.restStatsCount=(s.restStatsCount??r.restStatsCount)+1;break;case"transport:rest:packets":s.restPacketsCount=(s.restPacketsCount??r.restPacketsCount)+1;break;case"store:packets:ws-merge":s.wsMergeCount=(s.wsMergeCount??r.wsMergeCount)+1;break;case"cascade:hydrate":s.lastHydrateTs=t.ts,s.hydrateCount=(s.hydrateCount??r.hydrateCount)+1;break;case"worker:topology:start":case"worker:sparkline:start":{const l=t.type.split(":")[1],o=s.workers??r.workers,x=o[l]??{...z};s.workers={...o,[l]:{...x,status:"running",lastTs:t.ts}}}break;case"worker:topology:done":case"worker:sparkline:done":{const l=t.type.split(":")[1],o=s.workers??r.workers,x=o[l]??{...z},m=((a=t.data)==null?void 0:a.ms)??null;s.workers={...o,[l]:{...x,status:"done",lastDurationMs:m,lastTs:t.ts,runCount:x.runCount+1}}}break;case"worker:decryption:batch":{const l=s.workers??r.workers,o=l.decryption??{...z},x=((n=t.data)==null?void 0:n.ms)??null;s.workers={...l,decryption:{...o,status:"done",lastDurationMs:x,lastTs:t.ts,runCount:o.runCount+1}}}break;case"pipeline:disambig:recompute":s.disambigCount=(s.disambigCount??r.disambigCount)+1;break}}const te=rt(t=>({events:[],eventCount:0,wsState:"disconnected",wsPacketCount:0,wsStatsCount:0,restStatsCount:0,restPacketsCount:0,workers:{topology:{...z},sparkline:{...z},decryption:{...z}},wsMergeCount:0,lastHydrateTs:null,hydrateCount:0,disambigCount:0,lastDisambigMs:null,_pushBatch:s=>t(r=>{if(s.length===0)return r;let c=[...r.events,...s];c.length>ve&&(c=c.slice(c.length-ve));const a={events:c,eventCount:r.eventCount+s.length};for(const n of s)as(n,a,r);return a}),clear:()=>t({events:[],eventCount:0,wsState:"disconnected",wsPacketCount:0,wsStatsCount:0,restStatsCount:0,restPacketsCount:0,workers:{topology:{...z},sparkline:{...z},decryption:{...z}},wsMergeCount:0,lastHydrateTs:null,hydrateCount:0,disambigCount:0,lastDisambigMs:null})}));let W=null,B=[],X=null;function ls(){if(X=null,B.length===0)return;const t=B;B=[],te.getState()._pushBatch(t)}function os(){W||(B=[],W=at.subscribe(t=>{B.push(t),X===null&&(X=requestAnimationFrame(ls))}))}function cs(){if(W==null||W(),W=null,X!==null&&(cancelAnimationFrame(X),X=null),B.length>0){const t=B;B=[],te.getState()._pushBatch(t)}}function is(t){switch(t){case"active":return"●";case"skipped":return"○";case"inferred":return"◌"}}function ds(t){switch(t){case"active":return"text-sys-green";case"skipped":return"text-fg-muted/30";case"inferred":return"text-sys-amber"}}function us(t){switch(t){case"transport":return"text-sys-blue";case"store":return"text-sys-amber";case"worker":return"text-sys-violet";case"pipeline":return"text-sys-green";case"consumer":return"text-sys-teal"}}function ps(t,s,r,c,a){var m,g;const n=[];if(a?n.push({label:"Hex Input",detail:"Manual hex — no transport",status:"skipped",lane:"transport"}):s.age==="live"||s.age==="recent"?n.push({label:"WebSocket",detail:"ws:packet → real-time push",status:"active",lane:"transport"}):n.push({label:"REST Poll",detail:"fetchPackets → packetCache.poll()",status:"inferred",lane:"transport"}),!a){n.push({label:"Cache Merge",detail:"packetCache.mergePacketsDirectly()",status:"active",lane:"store"});const u=s.age==="live"||s.age==="recent";n.push({label:"Flash",detail:u?"flashReceived++ → sidebar blink":"Not newest — no flash",status:u?"active":"skipped",lane:"store"}),n.push({label:"Hydrate Cascade",detail:"hydrateDownstream() → schedule workers",status:"active",lane:"store"})}const l=s.pathAvail||s.pathHopCount>0;n.push({label:"Topology Worker",detail:l?`Path data (${s.pathHopCount} hops) → edge extraction`:"No path data — still included in batch recompute",status:"active",lane:"worker"}),n.push({label:"Sparkline Worker",detail:`Contributes to sparkline for src ${((m=t.src_hash)==null?void 0:m.slice(0,4))??"??"}`,status:"active",lane:"worker"});const o=s.isGrp;n.push({label:"Decryption Worker",detail:o?`GRP_TXT → queued for channel key search${c?" → decrypted ✓":""}`:`${s.payloadTypeName} — not encrypted, skipped`,status:o?"active":"skipped",lane:"worker"}),n.push({label:"Source Disambiguation",detail:r?`→ ${r.name??((g=r.hash)==null?void 0:g.slice(0,8))??"?"} (${r.type}${r.confident?", confident":", ambiguous"})`:"Pending recompute",status:r?"active":"inferred",lane:"pipeline"}),s.isAdvert&&n.push({label:"ADVERT Discovery",detail:"pubkey → extended hash-to-type + name extraction",status:"active",lane:"pipeline"}),o&&(c!=null&&c.decoded)&&n.push({label:"Decoded Content Policy",detail:`macCorrupted=${c.decoded.macCorrupted?"true":"false"} → cross-hash inheritance`,status:"active",lane:"pipeline"});const x=["Packets","Dashboard","Statistics"];return l&&x.push("Map","Graph"),s.isTrace&&x.push("Trace Detail"),n.push({label:"Page Hydration",detail:x.join(", "),status:"active",lane:"consumer"}),n}const xs=[],hs=["transport","store","worker","pipeline","consumer"],ms={transport:"Transport",store:"Store",worker:"Workers",pipeline:"Pipeline",consumer:"Consumers"};function gs(t){return t.replace("transport:","").replace("store:packets:","").replace("cascade:","").replace("worker:","w:").replace("pipeline:","p:").replace("packet","pkt").replace("sparkline","spark").replace("topology","topo").replace("decryption","dec").replace("disambig","dis").replace("recompute","recomp")}function fs(t){return t.startsWith("transport:")?"text-sys-blue":t.startsWith("store:")||t.startsWith("cascade:")?"text-sys-amber":t.startsWith("worker:")?"text-sys-violet":t.startsWith("pipeline:")?"text-sys-green":"text-fg-muted"}const bs=T.memo(function({event:s}){const r=`${(s.ts/1e3).toFixed(1)}s`,c=s.data?Object.entries(s.data).map(([a,n])=>{var l;return`${a}=${typeof n=="number"?((l=n.toFixed)==null?void 0:l.call(n,1))??n:n}`}).join(" "):"";return e.jsxs("div",{className:"flex gap-2 text-[9px] font-mono leading-tight",children:[e.jsx("span",{className:"text-fg-muted/40 w-12 shrink-0 text-right",children:r}),e.jsx("span",{className:`w-20 shrink-0 ${fs(s.type)}`,children:gs(s.type)}),e.jsx("span",{className:"text-fg-muted/60 truncate",children:c})]})});function ys({packet:t,pipeline:s,resolved:r,decrypted:c,isSynthetic:a,liveMode:n}){const[l,o]=T.useState(!1);T.useEffect(()=>{if(l)return os(),()=>{cs()}},[l]);const x=s==null?void 0:s.analysis,m=T.useMemo(()=>!t||!x?null:ps(t,x,r,c,a),[t,x,r,c,a]),g=T.useMemo(()=>{if(!m)return null;const h=new Map;for(const y of m){let p=h.get(y.lane);p||(p=[],h.set(y.lane,p)),p.push(y)}return h},[m]),u=te(h=>l?h.events:xs),v=te(h=>l?h.eventCount:0),N=te(h=>h.clear),f=T.useRef(null);T.useEffect(()=>{l&&f.current&&(f.current.scrollTop=f.current.scrollHeight)},[v,l]);const k=(m==null?void 0:m.filter(h=>h.status==="active").length)??0,$=(m==null?void 0:m.length)??0;return e.jsxs(G,{defaultOpen:!0,children:[e.jsx(K,{className:"text-[10px]",children:e.jsxs("span",{className:"flex items-center gap-2 font-mono",children:[e.jsx("span",{className:"text-sys-green",children:"CFT"}),e.jsx("span",{className:"text-fg-muted/40",children:"Control Flow Trace"}),t&&e.jsxs("span",{className:"text-fg-muted/30",children:["— ",k,"/",$," stages active"]})]})}),e.jsx(U,{children:e.jsxs("div",{className:"surface-base rounded-lg border border-edge-subtle p-3 space-y-3",children:[t?g?e.jsx("div",{className:"space-y-2",children:hs.map(h=>{const y=g.get(h);return y?e.jsxs("div",{children:[e.jsx("div",{className:`text-[8px] uppercase tracking-widest font-mono mb-0.5 ${us(h)}`,children:ms[h]}),y.map((p,_)=>e.jsxs("div",{className:"flex items-start gap-1.5 text-[10px] font-mono leading-snug ml-1",children:[e.jsx("span",{className:`shrink-0 ${ds(p.status)}`,children:is(p.status)}),e.jsx("span",{className:"text-fg-primary",children:p.label}),e.jsx("span",{className:"text-fg-muted/50 truncate",children:p.detail})]},_))]},h):null})}):null:e.jsx("div",{className:"text-[9px] text-fg-muted/30 font-mono py-2 text-center",children:"Select a packet to trace its flow"}),e.jsxs("div",{className:"border-t border-edge-subtle pt-2 flex items-center gap-2",children:[e.jsx("button",{onClick:()=>o(h=>!h),className:`px-2 py-0.5 rounded text-[9px] font-mono transition-colors ${l?"bg-sys-green/20 text-sys-green":"bg-zinc-500/20 text-fg-muted hover:text-fg-primary"}`,children:l?"● LIVE":"○ LIVE"}),e.jsx("span",{className:"text-[9px] text-fg-muted/40 font-mono",children:l?`${v} events`:"Subscribe to all pipeline events"}),l&&e.jsx("button",{onClick:N,className:"text-[9px] text-fg-muted/40 hover:text-fg-muted font-mono transition-colors ml-auto",children:"clear"})]}),l&&e.jsx("div",{ref:f,className:"max-h-32 overflow-y-auto space-y-px",children:u.length===0?e.jsx("div",{className:"text-[9px] text-fg-muted/30 font-mono py-1 text-center",children:"Waiting for events…"}):u.map((h,y)=>e.jsx(bs,{event:h},`${h.ts}-${y}`))})]})})]})}function js(t){const s=Ne(t.type??t.payload_type??-1).padEnd(7),r=t.packet_hash.slice(0,8),c=(t.src_hash??"—").replace(/^0x/i,"").slice(0,4).toUpperCase(),a=t._hopCount!=null?`${t._hopCount}h`:"",n=dt(t.timestamp);return`${r} ${s} ←${c} ${t.rssi}dBm ${a} ${n}`}function Ss(){const t=lt(),s=ot(),r=ct(),c=(s==null?void 0:s.neighbors)??{},a=Y(b=>b.resolveSource),n=Y(b=>b.config),l=Y(b=>b.setConfig),[o,x]=T.useState(-1),m=T.useMemo(()=>{let b=t;return o!==-1&&(b=t.filter(w=>(w.type??w.payload_type)===o)),b.slice(-50).reverse()},[t,o]),[g,u]=T.useState(""),[v,N]=T.useState(""),[f,k]=T.useState(!1),$=T.useRef(r);T.useEffect(()=>{f&&r!==$.current&&m.length>0&&(u(m[0].packet_hash),N("")),$.current=r},[r,f,m]),T.useEffect(()=>{!g&&m.length>0&&!v&&u(m[0].packet_hash)},[g,m,v]);const h=T.useMemo(()=>v.trim()?null:m.find(b=>b.packet_hash===g)??null,[g,m,v]),y=T.useMemo(()=>{const b=v.replace(/\s+/g,"").trim();return b?{packet_hash:"manual-hex-input",timestamp:0,rssi:0,snr:0,transmitted:!1,drop_reason:null,is_duplicate:!1,raw_packet:b}:null},[v]),p=h??y,_=!!v.trim(),H=v.trim().replace(/\s+/g,"")||(p==null?void 0:p.raw_packet),C=wt(p,H,t),D=(C==null?void 0:C.enrichment)??He,L=Ce((p==null?void 0:p.packet_hash)??""),P=T.useRef(0),R=T.useMemo(()=>{if(!p)return null;const b=performance.now(),w=a(p);return P.current=performance.now()-b,w},[p,a]);return e.jsxs("div",{className:"max-w-[960px] mx-auto",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h1",{className:"text-sm font-bold text-fg-primary tracking-wide font-mono",children:"PACKET OBSERVATORY"}),e.jsx("p",{className:"text-[11px] text-fg-muted font-mono",children:"Pipeline introspection — select a packet to trace its journey"})]}),e.jsxs("div",{className:"surface-base rounded-lg border border-edge-subtle p-3 mb-3",children:[e.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[e.jsxs("select",{value:o,onChange:b=>{x(Number(b.target.value)),u("")},className:"surface-input px-2 py-1 rounded text-[11px] font-mono text-fg-primary w-36",children:[e.jsx("option",{value:-1,children:"ALL TYPES"}),Object.entries(it).map(([b,w])=>e.jsxs("option",{value:Number(b),children:["0x",Number(b).toString(16).toUpperCase().padStart(2,"0")," ",w]},b))]}),e.jsxs("select",{value:g,onChange:b=>{u(b.target.value),N("")},className:"surface-input flex-1 min-w-0 px-2 py-1 rounded text-[11px] font-mono text-fg-primary truncate",children:[m.map((b,w)=>e.jsx("option",{value:b.packet_hash,children:js(b)},`${b.packet_hash}-${w}`)),m.length===0&&e.jsxs("option",{value:"",children:["No packets",o!==-1?" matching filter":" loaded"]})]}),e.jsx("button",{onClick:()=>k(b=>!b),className:`px-2 py-1 rounded text-[11px] font-mono transition-colors shrink-0 ${f?"bg-sys-green/20 text-sys-green":"bg-zinc-500/20 text-fg-muted hover:text-fg-primary"}`,children:f?"● LIVE":"○ LIVE"})]}),e.jsxs(G,{children:[e.jsx(K,{className:"text-[10px] text-fg-muted/50 hover:text-fg-muted mt-1.5",children:e.jsx("span",{className:"font-mono",children:"Paste hex…"})}),e.jsx(U,{children:e.jsx("textarea",{value:v,onChange:b=>N(b.target.value),placeholder:"Paste raw packet hex (overrides dropdown)",rows:2,className:"surface-input w-full mt-1 px-2 py-1 rounded text-[11px] font-mono text-fg-primary resize-y"})})]})]}),e.jsxs(G,{children:[e.jsx(K,{className:"text-[11px] mb-3 w-full",children:e.jsxs("span",{className:"flex items-center gap-2 font-mono",children:[e.jsx("span",{className:"text-fg-muted/50",children:"⚙"}),e.jsx("span",{className:"text-fg-muted/50",children:"Pipeline Config & Dev Tools"}),e.jsxs("span",{className:"text-fg-muted/30 text-[10px]",children:["disambig=",n.disambiguationEnabled?"on":"off"," mac=",n.macCorruptedPolicy," decay=",n.recencyDecayHours,"h"]})]})}),e.jsx(U,{children:e.jsxs("div",{className:"space-y-3 mb-4",children:[e.jsxs("div",{className:"surface-base rounded-lg border border-edge-subtle p-3",children:[e.jsx("h2",{className:"text-[10px] text-fg-muted/50 uppercase tracking-widest font-mono mb-2",children:"Pipeline Config"}),e.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-[11px] text-fg-muted w-24 shrink-0",children:"Disambiguation"}),e.jsx("button",{onClick:()=>l({disambiguationEnabled:!n.disambiguationEnabled}),className:`px-2 py-0.5 rounded text-[11px] font-mono transition-colors ${n.disambiguationEnabled?"bg-sys-green/20 text-sys-green":"bg-sys-red/20 text-sys-red"}`,children:n.disambiguationEnabled?"● ON":"○ OFF"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-[11px] text-fg-muted w-24 shrink-0",children:"MAC policy"}),e.jsxs("select",{value:n.macCorruptedPolicy,onChange:b=>l({macCorruptedPolicy:b.target.value}),className:"surface-input px-1.5 py-0.5 rounded text-[11px] font-mono text-fg-primary",children:[e.jsx("option",{value:"strict",children:"strict (drop)"}),e.jsx("option",{value:"name-only",children:"name-only"}),e.jsx("option",{value:"permissive",children:"permissive"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-[11px] text-fg-muted w-24 shrink-0",children:"Recency decay"}),e.jsx("input",{type:"range",min:1,max:48,step:1,value:n.recencyDecayHours,onChange:b=>l({recencyDecayHours:Number(b.target.value)}),className:"flex-1 h-1 accent-sys-blue"}),e.jsxs("span",{className:"text-[11px] font-mono text-fg-primary w-8 text-right",children:[n.recencyDecayHours,"h"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{className:"text-[11px] text-fg-muted w-24 shrink-0",children:"Zero-hop decay"}),e.jsx("input",{type:"range",min:12,max:168,step:6,value:n.zeroHopDecayHours,onChange:b=>l({zeroHopDecayHours:Number(b.target.value)}),className:"flex-1 h-1 accent-sys-blue"}),e.jsxs("span",{className:"text-[11px] font-mono text-fg-primary w-10 text-right",children:[n.zeroHopDecayHours,"h"]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsx(ys,{packet:p,pipeline:C,resolved:R,decrypted:L??null,isSynthetic:_,liveMode:f}),e.jsx(rs,{})]})]})})]}),p?e.jsxs("div",{className:"space-y-1",children:[e.jsx(kt,{packet:p,isSynthetic:_}),e.jsx(Rt,{packet:p,pipeline:C,rawHex:H,traceTagIndex:(C==null?void 0:C.traceTagIndex)??new Map,neighbors:c}),e.jsx(zt,{packet:p,decrypted:L??void 0,pipeline:C}),e.jsx(Kt,{packet:p,pipeline:C,resolved:R,decrypted:L??void 0,resolveTimeMs:P.current,neighbors:c,advertName:D.advertName})]}):e.jsx("div",{className:"surface-base rounded-lg border border-edge-subtle p-8 text-center",children:e.jsx("p",{className:"text-fg-muted text-xs",children:"Select a packet from the dropdown or paste hex above"})})]})}export{Ss as default}; diff --git a/frontend/dist/assets/Packets-JmlGt-gQ.js b/frontend/dist/assets/Packets-BOfGw3jb.js similarity index 96% rename from frontend/dist/assets/Packets-JmlGt-gQ.js rename to frontend/dist/assets/Packets-BOfGw3jb.js index cc7bd2c3..b922145c 100644 --- a/frontend/dist/assets/Packets-JmlGt-gQ.js +++ b/frontend/dist/assets/Packets-BOfGw3jb.js @@ -1,4 +1,4 @@ -import{r as c,aq as _,ar as ut,as as We,at as Te,au as ie,av as dt,aw as pt,ax as ce,ay as Ye,az as mt,aA as bt,aB as ft,aC as ge,aD as vt,aE as xt,aF as Oe,aG as U,aH as gt,aI as ke,aJ as X,aK as re,aL as $e,aM as je,aN as ht,aO as Xe,aP as Qe,aQ as he,aR as Pe,aS as ye,aT as yt,aU as St,aV as Ct,aW as Re,aX as Ot,aY as Nt,aZ as Ce,a_ as wt,a$ as Et,b0 as jt,b1 as Pt,b2 as W,b3 as It,b4 as Tt,b5 as kt,b6 as $t,b7 as Rt,b8 as Mt,b9 as Ft,ba as Dt,bb as _t,bc as At,bd as Vt,be as Me,d as Lt,j as l,c as Q,am as zt,D as Bt,E as Ht,bf as Ut,G as Gt,K as qt,Q as Kt,V as Wt,ai as Yt,ap as Xt,W as Fe,bg as De,bh as _e,bi as Ae,B as we,bj as Ve,N as Le,bk as ze,T as Qt}from"./index-CeMilrX4.js";import{c as Jt}from"./node-types-C09ZlzBQ.js";import{u as Zt,C as eo}from"./circle-x-B6UCLWHM.js";import{c as H,p as to,a as ve,f as Be,b as oo,L as ao,S as me,s as no,u as He,d as so,g as lo,e as io,h as ro}from"./element-movement-zLH7y51p.js";import{F as co,y as uo,R as po,T as mo,w as Ue,A as bo}from"./map-pin-D6_BkIVb.js";import{g as Je,u as fo,R as vo,P as xo}from"./PacketList-BviFr-nL.js";import{useGetDecodedContent as go,useResolveSource as ho}from"./usePipelineStore-B80TA53S.js";import{c as yo,a as So,D as Co,b as Oo}from"./AnalyzerFilterPanel-DoQoJv94.js";import{u as No,r as wo}from"./consumer-registry-Hkh6Dv_i.js";import{A as Eo}from"./arrow-up-C471XgXc.js";import{A as jo}from"./SignalIndicator-CpBGKD5A.js";import{P as Po,a as Io,B as To,C as Ge}from"./PageLayout-Cw_MXmcE.js";import{T as ko,M as $o}from"./MqttModeBadge-C_MEMmDd.js";import{F as qe}from"./funnel-D2SUJQ8o.js";import{S as Ro}from"./search-Bph9xP9G.js";import"./primitives-Dgc86_cp.js";import"./badge-colors-DnsnMXHA.js";import"./chat-utils-BJwCtjDV.js";import"./chevron-right-D3QL4sfa.js";import"./circle-question-mark-Bqc_DPUo.js";import"./triangle-alert-DiFold9L.js";import"./DataBox-Da-5DbUW.js";import"./layers-DVUHhJuY.js";import"./hash-CBEVBQJR.js";import"./activity-BZFnO4kb.js";import"./circle-check-CY6Nl8LU.js";import"./database-D2sIhibw.js";import"./useMapViewStore-DgL-E_Uc.js";import"./index-BK59_Mkt.js";import"./shield-D-fYOAoy.js";import"./zap-09srAnh-.js";import"./monitor-smartphone-DxkmIgui.js";function Ze(e){let o=c.useRef({value:"",selectionStart:null,selectionEnd:null});return ut(e,"blur",t=>{let s=t.target;Te(s)&&(o.current={value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd})}),_(()=>{if(!We(e)&&Te(e)&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==o.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:t,selectionEnd:s}=o.current;t!==null&&s!==null&&e.setSelectionRange(t,s)}o.current={value:"",selectionStart:null,selectionEnd:null}}})}function Mo(e,{container:o,accept:t,walk:s}){let a=c.useRef(t),i=c.useRef(s);c.useEffect(()=>{a.current=t,i.current=s},[t,s]),ie(()=>{if(!o||!e)return;let u=dt(o);if(!u)return;let f=a.current,d=i.current,b=Object.assign(N=>f(N),{acceptNode:f}),h=u.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,b,!1);for(;h.nextNode();)d(h.currentNode)},[o,e,a,i])}var Fo=Object.defineProperty,Do=(e,o,t)=>o in e?Fo(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,Ke=(e,o,t)=>(Do(e,typeof o!="symbol"?o+"":o,t),t),S=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(S||{}),J=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(J||{}),oe=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(oe||{}),et=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.DefaultToFirstOption=6]="DefaultToFirstOption",e[e.SetActivationTrigger=7]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=8]="UpdateVirtualConfiguration",e[e.SetInputElement=9]="SetInputElement",e[e.SetButtonElement=10]="SetButtonElement",e[e.SetOptionsElement=11]="SetOptionsElement",e[e.MarkInputAsMoved=12]="MarkInputAsMoved",e))(et||{});function Ee(e,o=t=>t){let t=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=o(e.options.slice()),a=s.length>0&&s[0].dataRef.current.order!==null?s.sort((u,f)=>u.dataRef.current.order-f.dataRef.current.order):bt(s,u=>u.dataRef.current.domRef.current),i=t?a.indexOf(t):null;return i===-1&&(i=null),{options:a,activeOptionIndex:i}}let _o={1(e){var o;if((o=e.dataRef.current)!=null&&o.disabled||e.comboboxState===1)return e;let t=e.inputElement?ve.Tracked(oo(e.inputElement)):e.inputPositionState;return{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,inputPositionState:t,__demoMode:!1}},0(e){var o,t;if((o=e.dataRef.current)!=null&&o.disabled||e.comboboxState===0)return e;if((t=e.dataRef.current)!=null&&t.value){let s=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(s!==-1)return{...e,activeOptionIndex:s,comboboxState:0,__demoMode:!1,inputPositionState:ve.Idle}}return{...e,comboboxState:0,inputPositionState:ve.Idle,__demoMode:!1}},3(e,o){return e.isTyping===o.isTyping?e:{...e,isTyping:o.isTyping}},2(e,o){var t,s,a,i;if((t=e.dataRef.current)!=null&&t.disabled||e.optionsElement&&!((s=e.dataRef.current)!=null&&s.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:b,disabled:h}=e.virtual,N=o.focus===H.Specific?o.idx:Be(o,{resolveItems:()=>b,resolveActiveIndex:()=>{var v,m;return(m=(v=e.activeOptionIndex)!=null?v:b.findIndex(P=>!h(P)))!=null?m:null},resolveDisabled:h,resolveId(){throw new Error("Function not implemented.")}}),C=(a=o.trigger)!=null?a:2;return e.activeOptionIndex===N&&e.activationTrigger===C?e:{...e,activeOptionIndex:N,activationTrigger:C,isTyping:!1,__demoMode:!1}}let u=Ee(e);if(u.activeOptionIndex===null){let b=u.options.findIndex(h=>!h.dataRef.current.disabled);b!==-1&&(u.activeOptionIndex=b)}let f=o.focus===H.Specific?o.idx:Be(o,{resolveItems:()=>u.options,resolveActiveIndex:()=>u.activeOptionIndex,resolveId:b=>b.id,resolveDisabled:b=>b.dataRef.current.disabled}),d=(i=o.trigger)!=null?i:2;return e.activeOptionIndex===f&&e.activationTrigger===d?e:{...e,...u,isTyping:!1,activeOptionIndex:f,activationTrigger:d,__demoMode:!1}},4:(e,o)=>{var t,s,a,i;if((t=e.dataRef.current)!=null&&t.virtual)return{...e,options:[...e.options,o.payload]};let u=o.payload,f=Ee(e,b=>(b.push(u),b));e.activeOptionIndex===null&&(a=(s=e.dataRef.current).isSelected)!=null&&a.call(s,o.payload.dataRef.current.value)&&(f.activeOptionIndex=f.options.indexOf(u));let d={...e,...f,activationTrigger:2};return(i=e.dataRef.current)!=null&&i.__demoMode&&e.dataRef.current.value===void 0&&(d.activeOptionIndex=0),d},5:(e,o)=>{var t;if((t=e.dataRef.current)!=null&&t.virtual)return{...e,options:e.options.filter(a=>a.id!==o.id)};let s=Ee(e,a=>{let i=a.findIndex(u=>u.id===o.id);return i!==-1&&a.splice(i,1),a});return{...e,...s,activationTrigger:2}},6:(e,o)=>e.defaultToFirstOption===o.value?e:{...e,defaultToFirstOption:o.value},7:(e,o)=>e.activationTrigger===o.trigger?e:{...e,activationTrigger:o.trigger},8:(e,o)=>{var t,s;if(e.virtual===null)return{...e,virtual:{options:o.options,disabled:(t=o.disabled)!=null?t:()=>!1}};if(e.virtual.options===o.options&&e.virtual.disabled===o.disabled)return e;let a=e.activeOptionIndex;if(e.activeOptionIndex!==null){let i=o.options.indexOf(e.virtual.options[e.activeOptionIndex]);i!==-1?a=i:a=null}return{...e,activeOptionIndex:a,virtual:{options:o.options,disabled:(s=o.disabled)!=null?s:()=>!1}}},9:(e,o)=>e.inputElement===o.element?e:{...e,inputElement:o.element},10:(e,o)=>e.buttonElement===o.element?e:{...e,buttonElement:o.element},11:(e,o)=>e.optionsElement===o.element?e:{...e,optionsElement:o.element},12(e){return e.inputPositionState.kind!=="Tracked"?e:{...e,inputPositionState:ve.Moved}}};class Ie extends pt{constructor(o){super(o),Ke(this,"actions",{onChange:t=>{let{onChange:s,compare:a,mode:i,value:u}=this.state.dataRef.current;return ce(i,{0:()=>s==null?void 0:s(t),1:()=>{let f=u.slice(),d=f.findIndex(b=>a(b,t));return d===-1?f.push(t):f.splice(d,1),s==null?void 0:s(f)}})},registerOption:(t,s)=>(this.send({type:4,payload:{id:t,dataRef:s}}),()=>{this.state.activeOptionIndex===this.state.dataRef.current.calculateIndex(s.current.value)&&this.send({type:6,value:!0}),this.send({type:5,id:t})}),goToOption:(t,s)=>(this.send({type:6,value:!1}),this.send({type:2,...t,trigger:s})),setIsTyping:t=>{this.send({type:3,isTyping:t})},closeCombobox:()=>{var t,s;this.send({type:1}),this.send({type:6,value:!1}),(s=(t=this.state.dataRef.current).onClose)==null||s.call(t)},openCombobox:()=>{this.send({type:0}),this.send({type:6,value:!0})},setActivationTrigger:t=>{this.send({type:7,trigger:t})},selectActiveOption:()=>{let t=this.selectors.activeOptionIndex(this.state);if(t!==null){if(this.actions.setIsTyping(!1),this.state.virtual)this.actions.onChange(this.state.virtual.options[t]);else{let{dataRef:s}=this.state.options[t];this.actions.onChange(s.current.value)}this.actions.goToOption({focus:H.Specific,idx:t})}},setInputElement:t=>{this.send({type:9,element:t})},setButtonElement:t=>{this.send({type:10,element:t})},setOptionsElement:t=>{this.send({type:11,element:t})}}),Ke(this,"selectors",{activeDescendantId:t=>{var s,a;let i=this.selectors.activeOptionIndex(t);if(i!==null)return t.virtual?(a=t.options.find(u=>!u.dataRef.current.disabled&&t.dataRef.current.compare(u.dataRef.current.value,t.virtual.options[i])))==null?void 0:a.id:(s=t.options[i])==null?void 0:s.id},activeOptionIndex:t=>{if(t.defaultToFirstOption&&t.activeOptionIndex===null&&(t.virtual?t.virtual.options.length>0:t.options.length>0)){if(t.virtual){let{options:a,disabled:i}=t.virtual,u=a.findIndex(f=>{var d;return!((d=i==null?void 0:i(f))!=null&&d)});if(u!==-1)return u}let s=t.options.findIndex(a=>!a.dataRef.current.disabled);if(s!==-1)return s}return t.activeOptionIndex},activeOption:t=>{var s,a;let i=this.selectors.activeOptionIndex(t);return i===null?null:t.virtual?t.virtual.options[i??0]:(a=(s=t.options[i])==null?void 0:s.dataRef.current.value)!=null?a:null},isActive:(t,s,a)=>{var i;let u=this.selectors.activeOptionIndex(t);return u===null?!1:t.virtual?u===t.dataRef.current.calculateIndex(s):((i=t.options[u])==null?void 0:i.id)===a},shouldScrollIntoView:(t,s,a)=>!(t.virtual||t.__demoMode||t.comboboxState!==0||t.activationTrigger===0||!this.selectors.isActive(t,s,a)),didInputMove(t){return t.inputPositionState.kind==="Moved"}});{let t=this.state.id,s=Ye.get(null);this.disposables.add(s.on(mt.Push,a=>{!s.selectors.isTop(a,t)&&this.state.comboboxState===0&&this.actions.closeCombobox()})),this.on(0,()=>s.actions.push(t)),this.on(1,()=>s.actions.pop(t))}this.disposables.group(t=>{this.on(1,s=>{s.inputElement&&(t.dispose(),t.add(to(s.inputElement,s.inputPositionState,()=>{this.send({type:12})})))})})}static new({id:o,virtual:t=null,__demoMode:s=!1}){var a;return new Ie({id:o,dataRef:{current:{}},comboboxState:s?0:1,isTyping:!1,options:[],virtual:t?{options:t.options,disabled:(a=t.disabled)!=null?a:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:s,inputPositionState:ve.Idle})}reduce(o,t){return ce(t.type,_o,o,t)}}const tt=c.createContext(null);function Se(e){let o=c.useContext(tt);if(o===null){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,ot),t}return o}function ot({id:e,virtual:o=null,__demoMode:t=!1}){let s=c.useMemo(()=>Ie.new({id:e,virtual:o,__demoMode:t}),[]);return ft(()=>s.dispose()),s}let xe=c.createContext(null);xe.displayName="ComboboxDataContext";function ue(e){let o=c.useContext(xe);if(o===null){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,ue),t}return o}let at=c.createContext(null);function Ao(e){let o=Se("VirtualProvider"),t=ue("VirtualProvider"),{options:s}=t.virtual,a=U(o,v=>v.optionsElement),[i,u]=c.useMemo(()=>{let v=a;if(!v)return[0,0];let m=window.getComputedStyle(v);return[parseFloat(m.paddingBlockStart||m.paddingTop),parseFloat(m.paddingBlockEnd||m.paddingBottom)]},[a]),f=Zt({enabled:s.length!==0,scrollPaddingStart:i,scrollPaddingEnd:u,count:s.length,estimateSize(){return 40},getScrollElement(){return o.state.optionsElement},overscan:12}),[d,b]=c.useState(0);ie(()=>{b(v=>v+1)},[s]);let h=f.getVirtualItems(),N=U(o,v=>v.activationTrigger===oe.Pointer),C=U(o,o.selectors.activeOptionIndex);return h.length===0?null:W.createElement(at.Provider,{value:f},W.createElement("div",{style:{position:"relative",width:"100%",height:`${f.getTotalSize()}px`},ref:v=>{v&&(N||C!==null&&s.length>C&&f.scrollToIndex(C))}},h.map(v=>{var m;return W.createElement(c.Fragment,{key:v.key},W.cloneElement((m=e.children)==null?void 0:m.call(e,{...e.slot,option:s[v.index]}),{key:`${d}-${v.key}`,"data-index":v.index,"aria-setsize":s.length,"aria-posinset":v.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${v.start}px)`,overflowAnchor:"none"}}))})))}let Vo=c.Fragment;function Lo(e,o){let t=c.useId(),s=Rt(),{value:a,defaultValue:i,onChange:u,form:f,name:d,by:b,invalid:h=!1,disabled:N=s||!1,onClose:C,__demoMode:v=!1,multiple:m=!1,immediate:P=!1,virtual:p=null,nullable:M,...y}=e,O=Mt(i),[T=m?[]:void 0,L]=Ft(a,u,O),E=ot({id:t,virtual:p,__demoMode:v}),A=c.useRef({static:!1,hold:!1}),$=ro(b),F=_(I=>p?b===null?p.options.indexOf(I):p.options.findIndex(se=>$(se,I)):E.state.options.findIndex(se=>$(se.dataRef.current.value,I))),G=c.useCallback(I=>ce(V.mode,{[J.Multi]:()=>T.some(se=>$(se,I)),[J.Single]:()=>$(T,I)}),[T]),q=U(E,I=>I.virtual),j=_(()=>C==null?void 0:C()),V=c.useMemo(()=>({__demoMode:v,immediate:P,optionsPropsRef:A,value:T,defaultValue:O,disabled:N,invalid:h,mode:m?J.Multi:J.Single,virtual:p?q:null,onChange:L,isSelected:G,calculateIndex:F,compare:$,onClose:j}),[v,P,A,T,O,N,h,m,p,q,L,G,F,$,j]);ie(()=>{var I;p&&E.send({type:et.UpdateVirtualConfiguration,options:p.options,disabled:(I=p.disabled)!=null?I:null})},[p,p==null?void 0:p.options,p==null?void 0:p.disabled]),ie(()=>{E.state.dataRef.current=V},[V]);let[z,w,Y,le]=U(E,I=>[I.comboboxState,I.buttonElement,I.inputElement,I.optionsElement]),Z=Ye.get(null),ee=U(Z,c.useCallback(I=>Z.selectors.isTop(I,t),[Z,t]));Dt(ee,[w,Y,le],()=>E.actions.closeCombobox());let ae=U(E,E.selectors.activeOptionIndex),ne=U(E,E.selectors.activeOption),x=he({open:z===S.Open,disabled:N,invalid:h,activeIndex:ae,activeOption:ne,value:T}),[K,R]=_t(),D=o===null?{}:{ref:o},k=c.useCallback(()=>{if(O!==void 0)return L==null?void 0:L(O)},[L,O]),B=ye();return W.createElement(R,{value:K,props:{htmlFor:Y==null?void 0:Y.id},slot:{open:z===S.Open,disabled:N}},W.createElement(bo,null,W.createElement(xe.Provider,{value:V},W.createElement(tt.Provider,{value:E},W.createElement(At,{value:ce(z,{[S.Open]:Ce.Open,[S.Closed]:Ce.Closed})},d!=null&&W.createElement(Vt,{disabled:N,data:T!=null?{[d]:T}:{},form:f,onReset:k}),B({ourProps:D,theirProps:y,slot:x,defaultTag:Vo,name:"Combobox"}))))))}let zo="input";function Bo(e,o){var t,s;let a=Se("Combobox.Input"),i=ue("Combobox.Input"),u=c.useId(),f=xt(),{id:d=f||`headlessui-combobox-input-${u}`,onChange:b,displayValue:h,disabled:N=i.disabled||!1,autoFocus:C=!1,type:v="text",...m}=e,P=c.useRef(null),p=Oe(P,o,co(),a.actions.setInputElement),[M,y]=U(a,x=>[x.comboboxState,x.isTyping]),O=gt(),T=_(()=>{a.actions.onChange(null),a.state.optionsElement&&(a.state.optionsElement.scrollTop=0),a.actions.goToOption({focus:H.Nothing})}),L=c.useMemo(()=>{var x;return typeof h=="function"&&i.value!==void 0?(x=h(i.value))!=null?x:"":typeof i.value=="string"?i.value:""},[i.value,h]);ke(([x,K],[R,D])=>{if(a.state.isTyping)return;let k=P.current;k&&((D===S.Open&&K===S.Closed||x!==R)&&(k.value=x),requestAnimationFrame(()=>{if(a.state.isTyping||!k||We(k))return;let{selectionStart:B,selectionEnd:I}=k;Math.abs((I??0)-(B??0))===0&&B===0&&k.setSelectionRange(k.value.length,k.value.length)}))},[L,M,y]),ke(([x],[K])=>{if(x===S.Open&&K===S.Closed){if(a.state.isTyping)return;let R=P.current;if(!R)return;let D=R.value,{selectionStart:k,selectionEnd:B,selectionDirection:I}=R;R.value="",R.value=D,I!==null?R.setSelectionRange(k,B,I):R.setSelectionRange(k,B)}},[M]);let E=c.useRef(!1),A=_(()=>{E.current=!0}),$=_(()=>{O.nextFrame(()=>{E.current=!1})}),F=_(x=>{switch(a.actions.setIsTyping(!0),x.key){case X.Enter:if(a.state.comboboxState!==S.Open||E.current)return;if(x.preventDefault(),x.stopPropagation(),a.selectors.activeOptionIndex(a.state)===null){a.actions.closeCombobox();return}a.actions.selectActiveOption(),i.mode===J.Single&&a.actions.closeCombobox();break;case X.ArrowDown:return x.preventDefault(),x.stopPropagation(),ce(a.state.comboboxState,{[S.Open]:()=>a.actions.goToOption({focus:H.Next}),[S.Closed]:()=>a.actions.openCombobox()});case X.ArrowUp:return x.preventDefault(),x.stopPropagation(),ce(a.state.comboboxState,{[S.Open]:()=>a.actions.goToOption({focus:H.Previous}),[S.Closed]:()=>{re.flushSync(()=>a.actions.openCombobox()),i.value||a.actions.goToOption({focus:H.Last})}});case X.Home:if(a.state.comboboxState===S.Closed||x.shiftKey)break;return x.preventDefault(),x.stopPropagation(),a.actions.goToOption({focus:H.First});case X.PageUp:return x.preventDefault(),x.stopPropagation(),a.actions.goToOption({focus:H.First});case X.End:if(a.state.comboboxState===S.Closed||x.shiftKey)break;return x.preventDefault(),x.stopPropagation(),a.actions.goToOption({focus:H.Last});case X.PageDown:return x.preventDefault(),x.stopPropagation(),a.actions.goToOption({focus:H.Last});case X.Escape:return a.state.comboboxState!==S.Open?void 0:(x.preventDefault(),a.state.optionsElement&&!i.optionsPropsRef.current.static&&x.stopPropagation(),i.mode===J.Single&&i.value===null&&T(),a.actions.closeCombobox());case X.Tab:if(a.actions.setIsTyping(!1),a.state.comboboxState!==S.Open)return;i.mode===J.Single&&a.state.activationTrigger!==oe.Focus&&a.actions.selectActiveOption(),a.actions.closeCombobox();break}}),G=_(x=>{b==null||b(x),i.mode===J.Single&&x.target.value===""&&T(),a.actions.openCombobox()}),q=_(x=>{var K,R,D;let k=(K=x.relatedTarget)!=null?K:$e.find(B=>B!==x.currentTarget);if(!((R=a.state.optionsElement)!=null&&R.contains(k))&&!((D=a.state.buttonElement)!=null&&D.contains(k))&&a.state.comboboxState===S.Open)return x.preventDefault(),i.mode===J.Single&&i.value===null&&T(),a.actions.closeCombobox()}),j=_(x=>{var K,R,D;let k=(K=x.relatedTarget)!=null?K:$e.find(B=>B!==x.currentTarget);(R=a.state.buttonElement)!=null&&R.contains(k)||(D=a.state.optionsElement)!=null&&D.contains(k)||i.disabled||i.immediate&&a.state.comboboxState!==S.Open&&O.microTask(()=>{re.flushSync(()=>a.actions.openCombobox()),a.actions.setActivationTrigger(oe.Focus)})}),V=je(),z=ht(),{isFocused:w,focusProps:Y}=Xe({autoFocus:C}),{isHovered:le,hoverProps:Z}=Qe({isDisabled:N}),ee=U(a,x=>x.optionsElement),ae=he({open:M===S.Open,disabled:N,invalid:i.invalid,hover:le,focus:w,autofocus:C}),ne=Pe({ref:p,id:d,role:"combobox",type:v,"aria-controls":ee==null?void 0:ee.id,"aria-expanded":M===S.Open,"aria-activedescendant":U(a,a.selectors.activeDescendantId),"aria-labelledby":V,"aria-describedby":z,"aria-autocomplete":"list",defaultValue:(s=(t=e.defaultValue)!=null?t:i.defaultValue!==void 0?h==null?void 0:h(i.defaultValue):null)!=null?s:i.defaultValue,disabled:N||void 0,autoFocus:C,onCompositionStart:A,onCompositionEnd:$,onKeyDown:F,onChange:G,onFocus:j,onBlur:q},Y,Z);return ye()({ourProps:ne,theirProps:m,slot:ae,defaultTag:zo,name:"Combobox.Input"})}let Ho="button";function Uo(e,o){let t=Se("Combobox.Button"),s=ue("Combobox.Button"),[a,i]=c.useState(null),u=Oe(o,i,t.actions.setButtonElement),f=c.useId(),{id:d=`headlessui-combobox-button-${f}`,disabled:b=s.disabled||!1,autoFocus:h=!1,...N}=e,[C,v,m]=U(t,j=>[j.comboboxState,j.inputElement,j.optionsElement]),P=Ze(v),p=C===S.Open;ao(p,{trigger:a,action:c.useCallback(j=>{if(a!=null&&a.contains(j.target))return me.Ignore;if(v!=null&&v.contains(j.target))return me.Ignore;let V=j.target.closest('[role="option"]:not([data-disabled])');return yt(V)?me.Select(V):m!=null&&m.contains(j.target)?me.Ignore:me.Close},[a,v,m]),close:t.actions.closeCombobox,select:t.actions.selectActiveOption});let M=_(j=>{switch(j.key){case X.Space:case X.Enter:j.preventDefault(),j.stopPropagation(),t.state.comboboxState===S.Closed&&re.flushSync(()=>t.actions.openCombobox()),P();return;case X.ArrowDown:j.preventDefault(),j.stopPropagation(),t.state.comboboxState===S.Closed&&(re.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:H.First})),P();return;case X.ArrowUp:j.preventDefault(),j.stopPropagation(),t.state.comboboxState===S.Closed&&(re.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:H.Last})),P();return;case X.Escape:if(t.state.comboboxState!==S.Open)return;j.preventDefault(),t.state.optionsElement&&!s.optionsPropsRef.current.static&&j.stopPropagation(),re.flushSync(()=>t.actions.closeCombobox()),P();return;default:return}}),y=no(()=>{t.state.comboboxState===S.Open?t.actions.closeCombobox():t.actions.openCombobox(),P()}),O=je([d]),{isFocusVisible:T,focusProps:L}=Xe({autoFocus:h}),{isHovered:E,hoverProps:A}=Qe({isDisabled:b}),{pressed:$,pressProps:F}=St({disabled:b}),G=he({open:C===S.Open,active:$||C===S.Open,disabled:b,invalid:s.invalid,value:s.value,hover:E,focus:T}),q=Pe({ref:u,id:d,type:Ct(e,a),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":m==null?void 0:m.id,"aria-expanded":C===S.Open,"aria-labelledby":O,disabled:b||void 0,autoFocus:h,onKeyDown:M},y,L,A,F);return ye()({ourProps:q,theirProps:N,slot:G,defaultTag:Ho,name:"Combobox.Button"})}let Go="div",qo=Me.RenderStrategy|Me.Static;function Ko(e,o){var t,s,a;let i=c.useId(),{id:u=`headlessui-combobox-options-${i}`,hold:f=!1,anchor:d,portal:b=!1,modal:h=!0,transition:N=!1,...C}=e,v=Se("Combobox.Options"),m=ue("Combobox.Options"),P=uo(d);P&&(b=!0);let[p,M]=po(P),[y,O]=c.useState(null),T=mo(),L=Oe(o,P?p:null,v.actions.setOptionsElement,O),[E,A,$,F,G]=U(v,n=>[n.comboboxState,n.inputElement,n.buttonElement,n.optionsElement,n.activationTrigger]),q=Re(A||$),j=Re(F),V=Ot(),[z,w]=Nt(N,y,V!==null?(V&Ce.Open)===Ce.Open:E===S.Open);wt(z,A,v.actions.closeCombobox);let Y=m.__demoMode?!1:h&&E===S.Open;Et(Y,j);let le=m.__demoMode?!1:h&&E===S.Open;jt(le,{allowed:c.useCallback(()=>[A,$,F],[A,$,F])});let Z=U(v,v.selectors.didInputMove)?!1:z;ie(()=>{var n;m.optionsPropsRef.current.static=(n=e.static)!=null?n:!1},[m.optionsPropsRef,e.static]),ie(()=>{m.optionsPropsRef.current.hold=f},[m.optionsPropsRef,f]),Mo(E===S.Open,{container:F,accept(n){return n.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:n.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(n){n.setAttribute("role","none")}});let ee=je([$==null?void 0:$.id]),ae=he({open:E===S.Open,option:void 0}),ne=_(()=>{v.actions.setActivationTrigger(oe.Pointer)}),x=_(n=>{n.preventDefault(),v.actions.setActivationTrigger(oe.Pointer)}),K=Pe(P?T():{},{"aria-labelledby":ee,role:"listbox","aria-multiselectable":m.mode===J.Multi?!0:void 0,id:u,ref:L,style:{...C.style,...M,"--input-width":Ue(z,A,!0).width,"--button-width":Ue(z,$,!0).width},onWheel:G===oe.Pointer?void 0:ne,onMouseDown:x,...Pt(w)}),R=z&&E===S.Closed&&!e.static,D=He(R,(t=m.virtual)==null?void 0:t.options),k=He(R,m.value),B=c.useCallback(n=>m.compare(k,n),[m.compare,k]),I=c.useMemo(()=>{if(!m.virtual)return m;if(D===void 0)throw new Error("Missing `options` in virtual mode");return D!==m.virtual.options?{...m,virtual:{...m.virtual,options:D}}:m},[m,D,(s=m.virtual)==null?void 0:s.options]);m.virtual&&Object.assign(C,{children:W.createElement(xe.Provider,{value:I},W.createElement(Ao,{slot:ae},C.children))});let se=ye(),Ne=c.useMemo(()=>m.mode===J.Multi?m:{...m,isSelected:B},[m,B]);return W.createElement(It,{enabled:b?e.static||z:!1,ownerDocument:q},W.createElement(xe.Provider,{value:Ne},se({ourProps:K,theirProps:{...C,children:W.createElement(so,{freeze:R},typeof C.children=="function"?(a=C.children)==null?void 0:a.call(C,ae):C.children)},slot:ae,defaultTag:Go,features:qo,visible:Z,name:"Combobox.Options"})))}let Wo="div";function Yo(e,o){var t,s,a;let i=ue("Combobox.Option"),u=Se("Combobox.Option"),f=c.useId(),{id:d=`headlessui-combobox-option-${f}`,value:b,disabled:h=(a=(s=(t=i.virtual)==null?void 0:t.disabled)==null?void 0:s.call(t,b))!=null?a:!1,order:N=null,...C}=e,[v]=U(u,w=>[w.inputElement]),m=Ze(v),P=U(u,c.useCallback(w=>u.selectors.isActive(w,b,d),[b,d])),p=i.isSelected(b),M=c.useRef(null),y=Tt({disabled:h,value:b,domRef:M,order:N}),O=c.useContext(at),T=Oe(o,M,O?O.measureElement:null),L=_(()=>{u.actions.setIsTyping(!1),u.actions.onChange(b)});ie(()=>u.actions.registerOption(d,y),[y,d]);let E=U(u,c.useCallback(w=>u.selectors.shouldScrollIntoView(w,b,d),[b,d]));ie(()=>{if(E)return kt().requestAnimationFrame(()=>{var w,Y;(Y=(w=M.current)==null?void 0:w.scrollIntoView)==null||Y.call(w,{block:"nearest"})})},[E,M]);let A=_(w=>{w.preventDefault(),w.button===lo.Left&&(h||(L(),$t()||requestAnimationFrame(()=>m()),i.mode===J.Single&&u.actions.closeCombobox()))}),$=_(()=>{if(h)return u.actions.goToOption({focus:H.Nothing});let w=i.calculateIndex(b);u.actions.goToOption({focus:H.Specific,idx:w})}),F=io(),G=_(w=>F.update(w)),q=_(w=>{if(!F.wasMoved(w)||h||P&&u.state.activationTrigger===oe.Pointer)return;let Y=i.calculateIndex(b);u.actions.goToOption({focus:H.Specific,idx:Y},oe.Pointer)}),j=_(w=>{F.wasMoved(w)&&(h||P&&(i.optionsPropsRef.current.hold||u.state.activationTrigger===oe.Pointer&&u.actions.goToOption({focus:H.Nothing})))}),V=he({active:P,focus:P,selected:p,disabled:h}),z={id:d,ref:T,role:"option",tabIndex:h===!0?void 0:-1,"aria-disabled":h===!0?!0:void 0,"aria-selected":p,disabled:void 0,onMouseDown:A,onFocus:$,onPointerEnter:G,onMouseEnter:G,onPointerMove:q,onMouseMove:q,onPointerLeave:j,onMouseLeave:j};return ye()({ourProps:z,theirProps:C,slot:V,defaultTag:Wo,name:"Combobox.Option"})}let Xo=ge(Lo),nt=ge(Uo),st=ge(Bo),Qo=vt,lt=ge(Ko),it=ge(Yo),Jo=Object.assign(Xo,{Input:st,Button:nt,Label:Qo,Options:lt,Option:it});/** +import{r as c,aq as _,ar as ut,as as We,at as Te,au as ie,av as dt,aw as pt,ax as ce,ay as Ye,az as mt,aA as bt,aB as ft,aC as ge,aD as vt,aE as xt,aF as Oe,aG as U,aH as gt,aI as ke,aJ as X,aK as re,aL as $e,aM as je,aN as ht,aO as Xe,aP as Qe,aQ as he,aR as Pe,aS as ye,aT as yt,aU as St,aV as Ct,aW as Re,aX as Ot,aY as Nt,aZ as Ce,a_ as wt,a$ as Et,b0 as jt,b1 as Pt,b2 as W,b3 as It,b4 as Tt,b5 as kt,b6 as $t,b7 as Rt,b8 as Mt,b9 as Ft,ba as Dt,bb as _t,bc as At,bd as Vt,be as Me,d as Lt,j as l,c as Q,am as zt,D as Bt,E as Ht,bf as Ut,G as Gt,K as qt,Q as Kt,V as Wt,ai as Yt,ap as Xt,W as Fe,bg as De,bh as _e,bi as Ae,B as we,bj as Ve,N as Le,bk as ze,T as Qt}from"./index-BOwCLZTK.js";import{c as Jt}from"./node-types-C6okL8rE.js";import{u as Zt,C as eo}from"./circle-x-BJVhIbR2.js";import{c as H,p as to,a as ve,f as Be,b as oo,L as ao,S as me,s as no,u as He,d as so,g as lo,e as io,h as ro}from"./element-movement-BLnr83nT.js";import{F as co,y as uo,R as po,T as mo,w as Ue,A as bo}from"./map-pin-C2z_C0J3.js";import{g as Je,u as fo,R as vo,P as xo}from"./PacketList-DquMVCqT.js";import{useGetDecodedContent as go,useResolveSource as ho}from"./usePipelineStore-Cw6U5jyB.js";import{c as yo,a as So,D as Co,b as Oo}from"./AnalyzerFilterPanel-BWsROE43.js";import{u as No,r as wo}from"./consumer-registry-CTjikLma.js";import{A as Eo}from"./arrow-up-BqsZCBBC.js";import{A as jo}from"./SignalIndicator-Calk-LyB.js";import{P as Po,a as Io,B as To,C as Ge}from"./PageLayout-QKntxcnp.js";import{T as ko,M as $o}from"./MqttModeBadge-CSj5wNzF.js";import{F as qe}from"./funnel-CWx99rlN.js";import{S as Ro}from"./search-Ba9CRHru.js";import"./primitives-DEqdAn1G.js";import"./badge-colors-DCbxcv7o.js";import"./chat-utils-D21OFED5.js";import"./chevron-right-DJVm4pVP.js";import"./circle-question-mark-XDnZ1ChV.js";import"./triangle-alert-SO3tIa8w.js";import"./DataBox-BVnEv6Au.js";import"./layers-Dg2mpSl7.js";import"./hash-Dwn2PbMF.js";import"./activity-D5uH2SFx.js";import"./circle-check-CmQaOkab.js";import"./database-C6oOGn9y.js";import"./useMapViewStore-DpXuD1iT.js";import"./index-2RIoVPos.js";import"./shield-DYw72pvS.js";import"./zap-Bd-kARJ1.js";import"./monitor-smartphone-Dd11JEL9.js";function Ze(e){let o=c.useRef({value:"",selectionStart:null,selectionEnd:null});return ut(e,"blur",t=>{let s=t.target;Te(s)&&(o.current={value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd})}),_(()=>{if(!We(e)&&Te(e)&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==o.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:t,selectionEnd:s}=o.current;t!==null&&s!==null&&e.setSelectionRange(t,s)}o.current={value:"",selectionStart:null,selectionEnd:null}}})}function Mo(e,{container:o,accept:t,walk:s}){let a=c.useRef(t),i=c.useRef(s);c.useEffect(()=>{a.current=t,i.current=s},[t,s]),ie(()=>{if(!o||!e)return;let u=dt(o);if(!u)return;let f=a.current,d=i.current,b=Object.assign(N=>f(N),{acceptNode:f}),h=u.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,b,!1);for(;h.nextNode();)d(h.currentNode)},[o,e,a,i])}var Fo=Object.defineProperty,Do=(e,o,t)=>o in e?Fo(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,Ke=(e,o,t)=>(Do(e,typeof o!="symbol"?o+"":o,t),t),S=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(S||{}),J=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(J||{}),oe=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(oe||{}),et=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.DefaultToFirstOption=6]="DefaultToFirstOption",e[e.SetActivationTrigger=7]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=8]="UpdateVirtualConfiguration",e[e.SetInputElement=9]="SetInputElement",e[e.SetButtonElement=10]="SetButtonElement",e[e.SetOptionsElement=11]="SetOptionsElement",e[e.MarkInputAsMoved=12]="MarkInputAsMoved",e))(et||{});function Ee(e,o=t=>t){let t=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=o(e.options.slice()),a=s.length>0&&s[0].dataRef.current.order!==null?s.sort((u,f)=>u.dataRef.current.order-f.dataRef.current.order):bt(s,u=>u.dataRef.current.domRef.current),i=t?a.indexOf(t):null;return i===-1&&(i=null),{options:a,activeOptionIndex:i}}let _o={1(e){var o;if((o=e.dataRef.current)!=null&&o.disabled||e.comboboxState===1)return e;let t=e.inputElement?ve.Tracked(oo(e.inputElement)):e.inputPositionState;return{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,inputPositionState:t,__demoMode:!1}},0(e){var o,t;if((o=e.dataRef.current)!=null&&o.disabled||e.comboboxState===0)return e;if((t=e.dataRef.current)!=null&&t.value){let s=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(s!==-1)return{...e,activeOptionIndex:s,comboboxState:0,__demoMode:!1,inputPositionState:ve.Idle}}return{...e,comboboxState:0,inputPositionState:ve.Idle,__demoMode:!1}},3(e,o){return e.isTyping===o.isTyping?e:{...e,isTyping:o.isTyping}},2(e,o){var t,s,a,i;if((t=e.dataRef.current)!=null&&t.disabled||e.optionsElement&&!((s=e.dataRef.current)!=null&&s.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:b,disabled:h}=e.virtual,N=o.focus===H.Specific?o.idx:Be(o,{resolveItems:()=>b,resolveActiveIndex:()=>{var v,m;return(m=(v=e.activeOptionIndex)!=null?v:b.findIndex(P=>!h(P)))!=null?m:null},resolveDisabled:h,resolveId(){throw new Error("Function not implemented.")}}),C=(a=o.trigger)!=null?a:2;return e.activeOptionIndex===N&&e.activationTrigger===C?e:{...e,activeOptionIndex:N,activationTrigger:C,isTyping:!1,__demoMode:!1}}let u=Ee(e);if(u.activeOptionIndex===null){let b=u.options.findIndex(h=>!h.dataRef.current.disabled);b!==-1&&(u.activeOptionIndex=b)}let f=o.focus===H.Specific?o.idx:Be(o,{resolveItems:()=>u.options,resolveActiveIndex:()=>u.activeOptionIndex,resolveId:b=>b.id,resolveDisabled:b=>b.dataRef.current.disabled}),d=(i=o.trigger)!=null?i:2;return e.activeOptionIndex===f&&e.activationTrigger===d?e:{...e,...u,isTyping:!1,activeOptionIndex:f,activationTrigger:d,__demoMode:!1}},4:(e,o)=>{var t,s,a,i;if((t=e.dataRef.current)!=null&&t.virtual)return{...e,options:[...e.options,o.payload]};let u=o.payload,f=Ee(e,b=>(b.push(u),b));e.activeOptionIndex===null&&(a=(s=e.dataRef.current).isSelected)!=null&&a.call(s,o.payload.dataRef.current.value)&&(f.activeOptionIndex=f.options.indexOf(u));let d={...e,...f,activationTrigger:2};return(i=e.dataRef.current)!=null&&i.__demoMode&&e.dataRef.current.value===void 0&&(d.activeOptionIndex=0),d},5:(e,o)=>{var t;if((t=e.dataRef.current)!=null&&t.virtual)return{...e,options:e.options.filter(a=>a.id!==o.id)};let s=Ee(e,a=>{let i=a.findIndex(u=>u.id===o.id);return i!==-1&&a.splice(i,1),a});return{...e,...s,activationTrigger:2}},6:(e,o)=>e.defaultToFirstOption===o.value?e:{...e,defaultToFirstOption:o.value},7:(e,o)=>e.activationTrigger===o.trigger?e:{...e,activationTrigger:o.trigger},8:(e,o)=>{var t,s;if(e.virtual===null)return{...e,virtual:{options:o.options,disabled:(t=o.disabled)!=null?t:()=>!1}};if(e.virtual.options===o.options&&e.virtual.disabled===o.disabled)return e;let a=e.activeOptionIndex;if(e.activeOptionIndex!==null){let i=o.options.indexOf(e.virtual.options[e.activeOptionIndex]);i!==-1?a=i:a=null}return{...e,activeOptionIndex:a,virtual:{options:o.options,disabled:(s=o.disabled)!=null?s:()=>!1}}},9:(e,o)=>e.inputElement===o.element?e:{...e,inputElement:o.element},10:(e,o)=>e.buttonElement===o.element?e:{...e,buttonElement:o.element},11:(e,o)=>e.optionsElement===o.element?e:{...e,optionsElement:o.element},12(e){return e.inputPositionState.kind!=="Tracked"?e:{...e,inputPositionState:ve.Moved}}};class Ie extends pt{constructor(o){super(o),Ke(this,"actions",{onChange:t=>{let{onChange:s,compare:a,mode:i,value:u}=this.state.dataRef.current;return ce(i,{0:()=>s==null?void 0:s(t),1:()=>{let f=u.slice(),d=f.findIndex(b=>a(b,t));return d===-1?f.push(t):f.splice(d,1),s==null?void 0:s(f)}})},registerOption:(t,s)=>(this.send({type:4,payload:{id:t,dataRef:s}}),()=>{this.state.activeOptionIndex===this.state.dataRef.current.calculateIndex(s.current.value)&&this.send({type:6,value:!0}),this.send({type:5,id:t})}),goToOption:(t,s)=>(this.send({type:6,value:!1}),this.send({type:2,...t,trigger:s})),setIsTyping:t=>{this.send({type:3,isTyping:t})},closeCombobox:()=>{var t,s;this.send({type:1}),this.send({type:6,value:!1}),(s=(t=this.state.dataRef.current).onClose)==null||s.call(t)},openCombobox:()=>{this.send({type:0}),this.send({type:6,value:!0})},setActivationTrigger:t=>{this.send({type:7,trigger:t})},selectActiveOption:()=>{let t=this.selectors.activeOptionIndex(this.state);if(t!==null){if(this.actions.setIsTyping(!1),this.state.virtual)this.actions.onChange(this.state.virtual.options[t]);else{let{dataRef:s}=this.state.options[t];this.actions.onChange(s.current.value)}this.actions.goToOption({focus:H.Specific,idx:t})}},setInputElement:t=>{this.send({type:9,element:t})},setButtonElement:t=>{this.send({type:10,element:t})},setOptionsElement:t=>{this.send({type:11,element:t})}}),Ke(this,"selectors",{activeDescendantId:t=>{var s,a;let i=this.selectors.activeOptionIndex(t);if(i!==null)return t.virtual?(a=t.options.find(u=>!u.dataRef.current.disabled&&t.dataRef.current.compare(u.dataRef.current.value,t.virtual.options[i])))==null?void 0:a.id:(s=t.options[i])==null?void 0:s.id},activeOptionIndex:t=>{if(t.defaultToFirstOption&&t.activeOptionIndex===null&&(t.virtual?t.virtual.options.length>0:t.options.length>0)){if(t.virtual){let{options:a,disabled:i}=t.virtual,u=a.findIndex(f=>{var d;return!((d=i==null?void 0:i(f))!=null&&d)});if(u!==-1)return u}let s=t.options.findIndex(a=>!a.dataRef.current.disabled);if(s!==-1)return s}return t.activeOptionIndex},activeOption:t=>{var s,a;let i=this.selectors.activeOptionIndex(t);return i===null?null:t.virtual?t.virtual.options[i??0]:(a=(s=t.options[i])==null?void 0:s.dataRef.current.value)!=null?a:null},isActive:(t,s,a)=>{var i;let u=this.selectors.activeOptionIndex(t);return u===null?!1:t.virtual?u===t.dataRef.current.calculateIndex(s):((i=t.options[u])==null?void 0:i.id)===a},shouldScrollIntoView:(t,s,a)=>!(t.virtual||t.__demoMode||t.comboboxState!==0||t.activationTrigger===0||!this.selectors.isActive(t,s,a)),didInputMove(t){return t.inputPositionState.kind==="Moved"}});{let t=this.state.id,s=Ye.get(null);this.disposables.add(s.on(mt.Push,a=>{!s.selectors.isTop(a,t)&&this.state.comboboxState===0&&this.actions.closeCombobox()})),this.on(0,()=>s.actions.push(t)),this.on(1,()=>s.actions.pop(t))}this.disposables.group(t=>{this.on(1,s=>{s.inputElement&&(t.dispose(),t.add(to(s.inputElement,s.inputPositionState,()=>{this.send({type:12})})))})})}static new({id:o,virtual:t=null,__demoMode:s=!1}){var a;return new Ie({id:o,dataRef:{current:{}},comboboxState:s?0:1,isTyping:!1,options:[],virtual:t?{options:t.options,disabled:(a=t.disabled)!=null?a:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:s,inputPositionState:ve.Idle})}reduce(o,t){return ce(t.type,_o,o,t)}}const tt=c.createContext(null);function Se(e){let o=c.useContext(tt);if(o===null){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,ot),t}return o}function ot({id:e,virtual:o=null,__demoMode:t=!1}){let s=c.useMemo(()=>Ie.new({id:e,virtual:o,__demoMode:t}),[]);return ft(()=>s.dispose()),s}let xe=c.createContext(null);xe.displayName="ComboboxDataContext";function ue(e){let o=c.useContext(xe);if(o===null){let t=new Error(`<${e} /> is missing a parent component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,ue),t}return o}let at=c.createContext(null);function Ao(e){let o=Se("VirtualProvider"),t=ue("VirtualProvider"),{options:s}=t.virtual,a=U(o,v=>v.optionsElement),[i,u]=c.useMemo(()=>{let v=a;if(!v)return[0,0];let m=window.getComputedStyle(v);return[parseFloat(m.paddingBlockStart||m.paddingTop),parseFloat(m.paddingBlockEnd||m.paddingBottom)]},[a]),f=Zt({enabled:s.length!==0,scrollPaddingStart:i,scrollPaddingEnd:u,count:s.length,estimateSize(){return 40},getScrollElement(){return o.state.optionsElement},overscan:12}),[d,b]=c.useState(0);ie(()=>{b(v=>v+1)},[s]);let h=f.getVirtualItems(),N=U(o,v=>v.activationTrigger===oe.Pointer),C=U(o,o.selectors.activeOptionIndex);return h.length===0?null:W.createElement(at.Provider,{value:f},W.createElement("div",{style:{position:"relative",width:"100%",height:`${f.getTotalSize()}px`},ref:v=>{v&&(N||C!==null&&s.length>C&&f.scrollToIndex(C))}},h.map(v=>{var m;return W.createElement(c.Fragment,{key:v.key},W.cloneElement((m=e.children)==null?void 0:m.call(e,{...e.slot,option:s[v.index]}),{key:`${d}-${v.key}`,"data-index":v.index,"aria-setsize":s.length,"aria-posinset":v.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${v.start}px)`,overflowAnchor:"none"}}))})))}let Vo=c.Fragment;function Lo(e,o){let t=c.useId(),s=Rt(),{value:a,defaultValue:i,onChange:u,form:f,name:d,by:b,invalid:h=!1,disabled:N=s||!1,onClose:C,__demoMode:v=!1,multiple:m=!1,immediate:P=!1,virtual:p=null,nullable:M,...y}=e,O=Mt(i),[T=m?[]:void 0,L]=Ft(a,u,O),E=ot({id:t,virtual:p,__demoMode:v}),A=c.useRef({static:!1,hold:!1}),$=ro(b),F=_(I=>p?b===null?p.options.indexOf(I):p.options.findIndex(se=>$(se,I)):E.state.options.findIndex(se=>$(se.dataRef.current.value,I))),G=c.useCallback(I=>ce(V.mode,{[J.Multi]:()=>T.some(se=>$(se,I)),[J.Single]:()=>$(T,I)}),[T]),q=U(E,I=>I.virtual),j=_(()=>C==null?void 0:C()),V=c.useMemo(()=>({__demoMode:v,immediate:P,optionsPropsRef:A,value:T,defaultValue:O,disabled:N,invalid:h,mode:m?J.Multi:J.Single,virtual:p?q:null,onChange:L,isSelected:G,calculateIndex:F,compare:$,onClose:j}),[v,P,A,T,O,N,h,m,p,q,L,G,F,$,j]);ie(()=>{var I;p&&E.send({type:et.UpdateVirtualConfiguration,options:p.options,disabled:(I=p.disabled)!=null?I:null})},[p,p==null?void 0:p.options,p==null?void 0:p.disabled]),ie(()=>{E.state.dataRef.current=V},[V]);let[z,w,Y,le]=U(E,I=>[I.comboboxState,I.buttonElement,I.inputElement,I.optionsElement]),Z=Ye.get(null),ee=U(Z,c.useCallback(I=>Z.selectors.isTop(I,t),[Z,t]));Dt(ee,[w,Y,le],()=>E.actions.closeCombobox());let ae=U(E,E.selectors.activeOptionIndex),ne=U(E,E.selectors.activeOption),x=he({open:z===S.Open,disabled:N,invalid:h,activeIndex:ae,activeOption:ne,value:T}),[K,R]=_t(),D=o===null?{}:{ref:o},k=c.useCallback(()=>{if(O!==void 0)return L==null?void 0:L(O)},[L,O]),B=ye();return W.createElement(R,{value:K,props:{htmlFor:Y==null?void 0:Y.id},slot:{open:z===S.Open,disabled:N}},W.createElement(bo,null,W.createElement(xe.Provider,{value:V},W.createElement(tt.Provider,{value:E},W.createElement(At,{value:ce(z,{[S.Open]:Ce.Open,[S.Closed]:Ce.Closed})},d!=null&&W.createElement(Vt,{disabled:N,data:T!=null?{[d]:T}:{},form:f,onReset:k}),B({ourProps:D,theirProps:y,slot:x,defaultTag:Vo,name:"Combobox"}))))))}let zo="input";function Bo(e,o){var t,s;let a=Se("Combobox.Input"),i=ue("Combobox.Input"),u=c.useId(),f=xt(),{id:d=f||`headlessui-combobox-input-${u}`,onChange:b,displayValue:h,disabled:N=i.disabled||!1,autoFocus:C=!1,type:v="text",...m}=e,P=c.useRef(null),p=Oe(P,o,co(),a.actions.setInputElement),[M,y]=U(a,x=>[x.comboboxState,x.isTyping]),O=gt(),T=_(()=>{a.actions.onChange(null),a.state.optionsElement&&(a.state.optionsElement.scrollTop=0),a.actions.goToOption({focus:H.Nothing})}),L=c.useMemo(()=>{var x;return typeof h=="function"&&i.value!==void 0?(x=h(i.value))!=null?x:"":typeof i.value=="string"?i.value:""},[i.value,h]);ke(([x,K],[R,D])=>{if(a.state.isTyping)return;let k=P.current;k&&((D===S.Open&&K===S.Closed||x!==R)&&(k.value=x),requestAnimationFrame(()=>{if(a.state.isTyping||!k||We(k))return;let{selectionStart:B,selectionEnd:I}=k;Math.abs((I??0)-(B??0))===0&&B===0&&k.setSelectionRange(k.value.length,k.value.length)}))},[L,M,y]),ke(([x],[K])=>{if(x===S.Open&&K===S.Closed){if(a.state.isTyping)return;let R=P.current;if(!R)return;let D=R.value,{selectionStart:k,selectionEnd:B,selectionDirection:I}=R;R.value="",R.value=D,I!==null?R.setSelectionRange(k,B,I):R.setSelectionRange(k,B)}},[M]);let E=c.useRef(!1),A=_(()=>{E.current=!0}),$=_(()=>{O.nextFrame(()=>{E.current=!1})}),F=_(x=>{switch(a.actions.setIsTyping(!0),x.key){case X.Enter:if(a.state.comboboxState!==S.Open||E.current)return;if(x.preventDefault(),x.stopPropagation(),a.selectors.activeOptionIndex(a.state)===null){a.actions.closeCombobox();return}a.actions.selectActiveOption(),i.mode===J.Single&&a.actions.closeCombobox();break;case X.ArrowDown:return x.preventDefault(),x.stopPropagation(),ce(a.state.comboboxState,{[S.Open]:()=>a.actions.goToOption({focus:H.Next}),[S.Closed]:()=>a.actions.openCombobox()});case X.ArrowUp:return x.preventDefault(),x.stopPropagation(),ce(a.state.comboboxState,{[S.Open]:()=>a.actions.goToOption({focus:H.Previous}),[S.Closed]:()=>{re.flushSync(()=>a.actions.openCombobox()),i.value||a.actions.goToOption({focus:H.Last})}});case X.Home:if(a.state.comboboxState===S.Closed||x.shiftKey)break;return x.preventDefault(),x.stopPropagation(),a.actions.goToOption({focus:H.First});case X.PageUp:return x.preventDefault(),x.stopPropagation(),a.actions.goToOption({focus:H.First});case X.End:if(a.state.comboboxState===S.Closed||x.shiftKey)break;return x.preventDefault(),x.stopPropagation(),a.actions.goToOption({focus:H.Last});case X.PageDown:return x.preventDefault(),x.stopPropagation(),a.actions.goToOption({focus:H.Last});case X.Escape:return a.state.comboboxState!==S.Open?void 0:(x.preventDefault(),a.state.optionsElement&&!i.optionsPropsRef.current.static&&x.stopPropagation(),i.mode===J.Single&&i.value===null&&T(),a.actions.closeCombobox());case X.Tab:if(a.actions.setIsTyping(!1),a.state.comboboxState!==S.Open)return;i.mode===J.Single&&a.state.activationTrigger!==oe.Focus&&a.actions.selectActiveOption(),a.actions.closeCombobox();break}}),G=_(x=>{b==null||b(x),i.mode===J.Single&&x.target.value===""&&T(),a.actions.openCombobox()}),q=_(x=>{var K,R,D;let k=(K=x.relatedTarget)!=null?K:$e.find(B=>B!==x.currentTarget);if(!((R=a.state.optionsElement)!=null&&R.contains(k))&&!((D=a.state.buttonElement)!=null&&D.contains(k))&&a.state.comboboxState===S.Open)return x.preventDefault(),i.mode===J.Single&&i.value===null&&T(),a.actions.closeCombobox()}),j=_(x=>{var K,R,D;let k=(K=x.relatedTarget)!=null?K:$e.find(B=>B!==x.currentTarget);(R=a.state.buttonElement)!=null&&R.contains(k)||(D=a.state.optionsElement)!=null&&D.contains(k)||i.disabled||i.immediate&&a.state.comboboxState!==S.Open&&O.microTask(()=>{re.flushSync(()=>a.actions.openCombobox()),a.actions.setActivationTrigger(oe.Focus)})}),V=je(),z=ht(),{isFocused:w,focusProps:Y}=Xe({autoFocus:C}),{isHovered:le,hoverProps:Z}=Qe({isDisabled:N}),ee=U(a,x=>x.optionsElement),ae=he({open:M===S.Open,disabled:N,invalid:i.invalid,hover:le,focus:w,autofocus:C}),ne=Pe({ref:p,id:d,role:"combobox",type:v,"aria-controls":ee==null?void 0:ee.id,"aria-expanded":M===S.Open,"aria-activedescendant":U(a,a.selectors.activeDescendantId),"aria-labelledby":V,"aria-describedby":z,"aria-autocomplete":"list",defaultValue:(s=(t=e.defaultValue)!=null?t:i.defaultValue!==void 0?h==null?void 0:h(i.defaultValue):null)!=null?s:i.defaultValue,disabled:N||void 0,autoFocus:C,onCompositionStart:A,onCompositionEnd:$,onKeyDown:F,onChange:G,onFocus:j,onBlur:q},Y,Z);return ye()({ourProps:ne,theirProps:m,slot:ae,defaultTag:zo,name:"Combobox.Input"})}let Ho="button";function Uo(e,o){let t=Se("Combobox.Button"),s=ue("Combobox.Button"),[a,i]=c.useState(null),u=Oe(o,i,t.actions.setButtonElement),f=c.useId(),{id:d=`headlessui-combobox-button-${f}`,disabled:b=s.disabled||!1,autoFocus:h=!1,...N}=e,[C,v,m]=U(t,j=>[j.comboboxState,j.inputElement,j.optionsElement]),P=Ze(v),p=C===S.Open;ao(p,{trigger:a,action:c.useCallback(j=>{if(a!=null&&a.contains(j.target))return me.Ignore;if(v!=null&&v.contains(j.target))return me.Ignore;let V=j.target.closest('[role="option"]:not([data-disabled])');return yt(V)?me.Select(V):m!=null&&m.contains(j.target)?me.Ignore:me.Close},[a,v,m]),close:t.actions.closeCombobox,select:t.actions.selectActiveOption});let M=_(j=>{switch(j.key){case X.Space:case X.Enter:j.preventDefault(),j.stopPropagation(),t.state.comboboxState===S.Closed&&re.flushSync(()=>t.actions.openCombobox()),P();return;case X.ArrowDown:j.preventDefault(),j.stopPropagation(),t.state.comboboxState===S.Closed&&(re.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:H.First})),P();return;case X.ArrowUp:j.preventDefault(),j.stopPropagation(),t.state.comboboxState===S.Closed&&(re.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:H.Last})),P();return;case X.Escape:if(t.state.comboboxState!==S.Open)return;j.preventDefault(),t.state.optionsElement&&!s.optionsPropsRef.current.static&&j.stopPropagation(),re.flushSync(()=>t.actions.closeCombobox()),P();return;default:return}}),y=no(()=>{t.state.comboboxState===S.Open?t.actions.closeCombobox():t.actions.openCombobox(),P()}),O=je([d]),{isFocusVisible:T,focusProps:L}=Xe({autoFocus:h}),{isHovered:E,hoverProps:A}=Qe({isDisabled:b}),{pressed:$,pressProps:F}=St({disabled:b}),G=he({open:C===S.Open,active:$||C===S.Open,disabled:b,invalid:s.invalid,value:s.value,hover:E,focus:T}),q=Pe({ref:u,id:d,type:Ct(e,a),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":m==null?void 0:m.id,"aria-expanded":C===S.Open,"aria-labelledby":O,disabled:b||void 0,autoFocus:h,onKeyDown:M},y,L,A,F);return ye()({ourProps:q,theirProps:N,slot:G,defaultTag:Ho,name:"Combobox.Button"})}let Go="div",qo=Me.RenderStrategy|Me.Static;function Ko(e,o){var t,s,a;let i=c.useId(),{id:u=`headlessui-combobox-options-${i}`,hold:f=!1,anchor:d,portal:b=!1,modal:h=!0,transition:N=!1,...C}=e,v=Se("Combobox.Options"),m=ue("Combobox.Options"),P=uo(d);P&&(b=!0);let[p,M]=po(P),[y,O]=c.useState(null),T=mo(),L=Oe(o,P?p:null,v.actions.setOptionsElement,O),[E,A,$,F,G]=U(v,n=>[n.comboboxState,n.inputElement,n.buttonElement,n.optionsElement,n.activationTrigger]),q=Re(A||$),j=Re(F),V=Ot(),[z,w]=Nt(N,y,V!==null?(V&Ce.Open)===Ce.Open:E===S.Open);wt(z,A,v.actions.closeCombobox);let Y=m.__demoMode?!1:h&&E===S.Open;Et(Y,j);let le=m.__demoMode?!1:h&&E===S.Open;jt(le,{allowed:c.useCallback(()=>[A,$,F],[A,$,F])});let Z=U(v,v.selectors.didInputMove)?!1:z;ie(()=>{var n;m.optionsPropsRef.current.static=(n=e.static)!=null?n:!1},[m.optionsPropsRef,e.static]),ie(()=>{m.optionsPropsRef.current.hold=f},[m.optionsPropsRef,f]),Mo(E===S.Open,{container:F,accept(n){return n.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:n.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(n){n.setAttribute("role","none")}});let ee=je([$==null?void 0:$.id]),ae=he({open:E===S.Open,option:void 0}),ne=_(()=>{v.actions.setActivationTrigger(oe.Pointer)}),x=_(n=>{n.preventDefault(),v.actions.setActivationTrigger(oe.Pointer)}),K=Pe(P?T():{},{"aria-labelledby":ee,role:"listbox","aria-multiselectable":m.mode===J.Multi?!0:void 0,id:u,ref:L,style:{...C.style,...M,"--input-width":Ue(z,A,!0).width,"--button-width":Ue(z,$,!0).width},onWheel:G===oe.Pointer?void 0:ne,onMouseDown:x,...Pt(w)}),R=z&&E===S.Closed&&!e.static,D=He(R,(t=m.virtual)==null?void 0:t.options),k=He(R,m.value),B=c.useCallback(n=>m.compare(k,n),[m.compare,k]),I=c.useMemo(()=>{if(!m.virtual)return m;if(D===void 0)throw new Error("Missing `options` in virtual mode");return D!==m.virtual.options?{...m,virtual:{...m.virtual,options:D}}:m},[m,D,(s=m.virtual)==null?void 0:s.options]);m.virtual&&Object.assign(C,{children:W.createElement(xe.Provider,{value:I},W.createElement(Ao,{slot:ae},C.children))});let se=ye(),Ne=c.useMemo(()=>m.mode===J.Multi?m:{...m,isSelected:B},[m,B]);return W.createElement(It,{enabled:b?e.static||z:!1,ownerDocument:q},W.createElement(xe.Provider,{value:Ne},se({ourProps:K,theirProps:{...C,children:W.createElement(so,{freeze:R},typeof C.children=="function"?(a=C.children)==null?void 0:a.call(C,ae):C.children)},slot:ae,defaultTag:Go,features:qo,visible:Z,name:"Combobox.Options"})))}let Wo="div";function Yo(e,o){var t,s,a;let i=ue("Combobox.Option"),u=Se("Combobox.Option"),f=c.useId(),{id:d=`headlessui-combobox-option-${f}`,value:b,disabled:h=(a=(s=(t=i.virtual)==null?void 0:t.disabled)==null?void 0:s.call(t,b))!=null?a:!1,order:N=null,...C}=e,[v]=U(u,w=>[w.inputElement]),m=Ze(v),P=U(u,c.useCallback(w=>u.selectors.isActive(w,b,d),[b,d])),p=i.isSelected(b),M=c.useRef(null),y=Tt({disabled:h,value:b,domRef:M,order:N}),O=c.useContext(at),T=Oe(o,M,O?O.measureElement:null),L=_(()=>{u.actions.setIsTyping(!1),u.actions.onChange(b)});ie(()=>u.actions.registerOption(d,y),[y,d]);let E=U(u,c.useCallback(w=>u.selectors.shouldScrollIntoView(w,b,d),[b,d]));ie(()=>{if(E)return kt().requestAnimationFrame(()=>{var w,Y;(Y=(w=M.current)==null?void 0:w.scrollIntoView)==null||Y.call(w,{block:"nearest"})})},[E,M]);let A=_(w=>{w.preventDefault(),w.button===lo.Left&&(h||(L(),$t()||requestAnimationFrame(()=>m()),i.mode===J.Single&&u.actions.closeCombobox()))}),$=_(()=>{if(h)return u.actions.goToOption({focus:H.Nothing});let w=i.calculateIndex(b);u.actions.goToOption({focus:H.Specific,idx:w})}),F=io(),G=_(w=>F.update(w)),q=_(w=>{if(!F.wasMoved(w)||h||P&&u.state.activationTrigger===oe.Pointer)return;let Y=i.calculateIndex(b);u.actions.goToOption({focus:H.Specific,idx:Y},oe.Pointer)}),j=_(w=>{F.wasMoved(w)&&(h||P&&(i.optionsPropsRef.current.hold||u.state.activationTrigger===oe.Pointer&&u.actions.goToOption({focus:H.Nothing})))}),V=he({active:P,focus:P,selected:p,disabled:h}),z={id:d,ref:T,role:"option",tabIndex:h===!0?void 0:-1,"aria-disabled":h===!0?!0:void 0,"aria-selected":p,disabled:void 0,onMouseDown:A,onFocus:$,onPointerEnter:G,onMouseEnter:G,onPointerMove:q,onMouseMove:q,onPointerLeave:j,onMouseLeave:j};return ye()({ourProps:z,theirProps:C,slot:V,defaultTag:Wo,name:"Combobox.Option"})}let Xo=ge(Lo),nt=ge(Uo),st=ge(Bo),Qo=vt,lt=ge(Ko),it=ge(Yo),Jo=Object.assign(Xo,{Input:st,Button:nt,Label:Qo,Options:lt,Option:it});/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/PageLayout-Cw_MXmcE.js b/frontend/dist/assets/PageLayout-QKntxcnp.js similarity index 89% rename from frontend/dist/assets/PageLayout-Cw_MXmcE.js rename to frontend/dist/assets/PageLayout-QKntxcnp.js index 4f47c370..e3ec8e13 100644 --- a/frontend/dist/assets/PageLayout-Cw_MXmcE.js +++ b/frontend/dist/assets/PageLayout-QKntxcnp.js @@ -1 +1 @@ -import{j as e,v as o,c as x,ao as d,r,eV as f}from"./index-CeMilrX4.js";function p({children:a,className:s}){return e.jsx("div",{className:x("section-gap",s),children:a})}function j({children:a,className:s,ready:t}){const n=d(),i=t??n,[m,c]=r.useState(!1);return r.useEffect(()=>{if(!i){c(!1);return}let l=!1;return requestAnimationFrame(()=>{requestAnimationFrame(()=>{l||r.startTransition(()=>c(!0))})}),()=>{l=!0}},[i]),e.jsx(f.Provider,{value:m,children:e.jsx("div",{className:x("bento-section",s),children:a})})}function g({title:a,icon:s,controls:t,subtitle:n}){return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 min-h-9",children:[e.jsxs("h1",{className:"type-title text-fg-primary flex items-baseline gap-2 sm:gap-3 min-w-0",children:[s&&e.jsx("span",{className:"text-icon-page-title flex-shrink-0 translate-y-[0.1em] [&>svg]:h-[1em] [&>svg]:w-[1em] [&>svg]:stroke-[1.5]",children:s}),e.jsx("span",{className:"truncate",children:a})]}),t&&e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:t})]}),n&&e.jsx("div",{children:n})]})}function h({size:a,...s}){return e.jsx(o,{...s})}export{j as B,h as C,p as P,g as a}; +import{j as e,v as o,c as x,ao as d,r,eW as f}from"./index-BOwCLZTK.js";function p({children:a,className:s}){return e.jsx("div",{className:x("section-gap",s),children:a})}function j({children:a,className:s,ready:t}){const n=d(),i=t??n,[m,c]=r.useState(!1);return r.useEffect(()=>{if(!i){c(!1);return}let l=!1;return requestAnimationFrame(()=>{requestAnimationFrame(()=>{l||r.startTransition(()=>c(!0))})}),()=>{l=!0}},[i]),e.jsx(f.Provider,{value:m,children:e.jsx("div",{className:x("bento-section",s),children:a})})}function g({title:a,icon:s,controls:t,subtitle:n}){return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 min-h-9",children:[e.jsxs("h1",{className:"type-title text-fg-primary flex items-baseline gap-2 sm:gap-3 min-w-0",children:[s&&e.jsx("span",{className:"text-icon-page-title flex-shrink-0 translate-y-[0.1em] [&>svg]:h-[1em] [&>svg]:w-[1em] [&>svg]:stroke-[1.5]",children:s}),e.jsx("span",{className:"truncate",children:a})]}),t&&e.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:t})]}),n&&e.jsx("div",{children:n})]})}function h({size:a,...s}){return e.jsx(o,{...s})}export{j as B,h as C,p as P,g as a}; diff --git a/frontend/dist/assets/PathMapMapLibre-DNuTnT6x.js b/frontend/dist/assets/PathMapMapLibre-BxRhUmZr.js similarity index 92% rename from frontend/dist/assets/PathMapMapLibre-DNuTnT6x.js rename to frontend/dist/assets/PathMapMapLibre-BxRhUmZr.js index e017cbc3..8df450fd 100644 --- a/frontend/dist/assets/PathMapMapLibre-DNuTnT6x.js +++ b/frontend/dist/assets/PathMapMapLibre-BxRhUmZr.js @@ -1,6 +1,6 @@ -import{d as ae,r as a,bI as ie,bz as le,eW as de,Z as q,bL as ce,j as t,x as K,c as z,eX as ue}from"./index-CeMilrX4.js";import{u as pe,M as me,B as fe,S as ge,L as xe,a as Y,P as he}from"./BasemapLayer-CNBmoufo.js";import{H as ye}from"./useMapViewStore-DgL-E_Uc.js";import"./index-BK59_Mkt.js";/** +import{d as ae,r as a,bI as ie,bz as le,eX as de,Z as q,bL as ce,j as t,x as K,c as z,eY as ue}from"./index-BOwCLZTK.js";import{u as pe,M as me,B as fe,S as ge,L as xe,a as Q,P as he}from"./BasemapLayer-B-5TmAfZ.js";import{H as ye}from"./useMapViewStore-DpXuD1iT.js";import"./index-2RIoVPos.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const be=[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]],Ce=ae("car",be),ve={version:8,sources:{},layers:[],glyphs:"https://tiles.basemaps.cartocdn.com/fonts/{fontstack}/{range}.pbf"},h={nodeColor:"#4338CA",localColor:"#4F46E5",hubColor:"#6366F1",edgeColor:"#3B3F4A",ambiguousColor:"#F9D26F",highlightColor:"#B49DFF",sourceColor:"#39D98A",destinationColor:"#B49DFF"};function C(c,r){if(!c)return r;if(c.startsWith("#"))return c;const m=ue(c);return m?`#${m.r.toString(16).padStart(2,"0")}${m.g.toString(16).padStart(2,"0")}${m.b.toString(16).padStart(2,"0")}`:r}function G(){if(typeof document>"u")return h;const c=document.documentElement,r=getComputedStyle(c);return{nodeColor:C(r.getPropertyValue("--map-node-stroke").trim(),h.nodeColor),localColor:C(r.getPropertyValue("--map-local-color").trim(),h.localColor),hubColor:C(r.getPropertyValue("--map-hub-color").trim(),h.hubColor),edgeColor:C(r.getPropertyValue("--map-edge-rest").trim(),h.edgeColor),ambiguousColor:C(r.getPropertyValue("--sys-indigo").trim(),h.ambiguousColor),highlightColor:C(r.getPropertyValue("--sys-blue").trim(),h.highlightColor),sourceColor:C(r.getPropertyValue("--sys-green").trim(),h.sourceColor),destinationColor:C(r.getPropertyValue("--sys-blue").trim(),h.destinationColor)}}function je({prefix:c,isLocal:r,isSource:m,isDestination:W,isLastHop:y,isHighlighted:g,isWardrive:F,candidate:x,onHover:E,onLeave:N,onClick:S}){const[n,k]=a.useState(!1),I=a.useCallback(()=>{k(!0),E()},[E]),v=a.useCallback(()=>{k(!1),N()},[N]),P=()=>F?"orange":r?"amber":m?"green":y?"amber":W?"purple":"blue";return F?t.jsxs("div",{className:z("flex items-center cursor-pointer","transition-all duration-150",g&&"ring-2 ring-sys-blue/50 rounded-full",n&&"relative z-50"),onMouseEnter:I,onMouseLeave:v,onClick:S,style:{pointerEvents:"auto"},children:[t.jsx("div",{className:z("flex items-center justify-center","w-7 h-7 rounded-full","bg-sys-orange text-white","shadow-lg border-2 border-sys-orange/50","transition-transform duration-150",n&&"scale-110"),children:t.jsx(Ce,{className:"w-4 h-4",strokeWidth:2.5})}),n&&t.jsxs(K,{color:"orange",filled:!0,className:"ml-1 type-data-xs shadow-lg",children:[c,x.name&&t.jsx("span",{className:"ml-1 opacity-75",children:x.name})]})]}):t.jsx("div",{className:z("flex items-center cursor-pointer","transition-all duration-150",g&&"ring-2 ring-sys-blue/50 rounded",n&&"relative z-50"),onMouseEnter:I,onMouseLeave:v,onClick:S,style:{pointerEvents:"auto"},children:t.jsxs(K,{color:P(),filled:!0,className:"type-data-xs shadow-lg border border-current/30",children:[r&&t.jsx(ye,{className:"w-2.5 h-2.5 mr-1"}),c,n&&x.name&&t.jsx("span",{className:"ml-1 opacity-75",children:x.name})]})})}function Le({hopNumber:c,snr:r,edgeColor:m}){return t.jsxs("div",{className:"flex flex-col items-center gap-0.5 pointer-events-none",children:[t.jsx("span",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center font-mono font-bold tabular-nums shadow-md",style:{backgroundColor:m||q[500],color:"#fff",fontSize:"8px",lineHeight:1,textShadow:"0 1px 1px rgba(0,0,0,0.4)"},children:c}),r!==void 0&&t.jsx(K,{color:"zinc",compact:!0,className:"!text-[9px] font-mono tabular-nums shadow-sm",children:r.toFixed(1)})]})}function Fe({resolvedPath:c,localNode:r,hubNodes:m=[],hoveredHopIndex:W,onHoverHop:y,traceSnr:g}){const F=g!==void 0&&g.length>0,x=a.useRef(null),E=pe(),N=ie(),S=a.useMemo(()=>new Set(m),[m]),[n,k]=a.useState(null),I=le(),[v,P]=a.useState(!1),[Z,H]=a.useState(0);a.useEffect(()=>{var f;const e=(f=x.current)==null?void 0:f.getMap();if(!e)return;const o=e.getCanvas();if(!o)return;const s=l=>{l.preventDefault(),console.warn("[PathMapMapLibre] WebGL context lost")},i=()=>{console.info("[PathMapMapLibre] WebGL context restored, remounting..."),H(l=>l+1)};return o.addEventListener("webglcontextlost",s),o.addEventListener("webglcontextrestored",i),()=>{o.removeEventListener("webglcontextlost",s),o.removeEventListener("webglcontextrestored",i)}},[Z]);const{positions:j,markers:$,edges:D}=a.useMemo(()=>{const e=[],o=[],s=[],i=[],f=(p,R)=>p!==0||R!==0;let l=0,b=!1;return c.hops.forEach((p,R)=>{const Q=p.candidates.filter(d=>f(d.latitude,d.longitude));if(Q.length===0)return;const V=[...Q].sort((d,w)=>w.probability-d.probability),A=V[0],L=[A.longitude,A.latitude];if(i.push(L),i.length>=2){const d=i[i.length-2],w=i.length-2,M=g==null?void 0:g[w],T=L[0]-d[0],se=L[1]-d[1],ne=Math.atan2(T,se)*(180/Math.PI),re=G();let B;b?B="#F97316":M!==void 0?B=de()[ce(M,N)]||q[500]:B=re.edgeColor,s.push({from:d,to:L,snrFwd:M,midpoint:[(d[0]+L[0])/2,(d[1]+L[1])/2],bearing:ne,color:B,isFromWardrive:b})}const te=p.isSource===!0,oe=p.isDestination===!0;b=A.isWardrive===!0,V.forEach((d,w)=>{const M=[d.latitude,d.longitude];e.push(M);const T=w===0;o.push({position:M,prefix:p.prefix,confidence:p.confidence,candidateCount:V.length,hopIndex:R,candidate:d,isHub:S.has(d.hash),isPrimary:T,isSource:te,isDestination:oe,validIndex:l})}),l++}),{positions:e,markers:o,edges:s}},[c,S,g,N]),J=a.useMemo(()=>D.map(e=>({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e.from,e.to]}}]})),[D]),u=a.useMemo(()=>{const e=$.filter(l=>l.isPrimary&&(l.confidence>=.5||l.isSource||l.isDestination));if(e.length===0)return null;let o=1/0,s=-1/0,i=1/0,f=-1/0;for(const l of e){const[b,p]=l.position;bs&&(s=b),pf&&(f=p)}return[[i,o],[f,s]]},[$]),_=a.useMemo(()=>{if(j.length===0)return r?[r.longitude,r.latitude]:[0,0];let e=0,o=0;for(const[s,i]of j)e+=s,o+=i;return[o/j.length,e/j.length]},[j,r]),U=a.useCallback(()=>{var o;const e=(o=x.current)==null?void 0:o.getMap();if(!e||!u){P(!0);return}e.fitBounds(u,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:0}),setTimeout(()=>{P(!0)},50)},[u]),X=a.useMemo(()=>u?`${u[0][0].toFixed(5)},${u[0][1].toFixed(5)},${u[1][0].toFixed(5)},${u[1][1].toFixed(5)}`:"",[u]);a.useEffect(()=>{var o;if(!v)return;const e=(o=x.current)==null?void 0:o.getMap();!e||!u||e.fitBounds(u,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:300})},[X,v,u]);const O=I&&v,ee=a.useCallback(e=>{k({longitude:e.position[1],latitude:e.position[0],marker:e})},[]);return j.length===0?t.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted text-sm bg-elevated",children:"No mappable path data"}):t.jsxs("div",{className:"h-full w-full relative radius-inner overflow-hidden depth-stroke-inset",children:[!O&&t.jsx("div",{className:"absolute inset-0 bg-elevated flex items-center justify-center pointer-events-none",children:t.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),t.jsx("div",{className:"h-full w-full transition-opacity duration-300 ease-out",style:{opacity:O?1:0},children:t.jsxs(me,{ref:x,initialViewState:{longitude:_[0],latitude:_[1],zoom:10},onLoad:U,style:{height:"100%",width:"100%"},mapStyle:ve,attributionControl:!1,children:[t.jsx(fe,{mode:E}),D.map((e,o)=>t.jsx(ge,{id:`edge-${o}`,type:"geojson",data:J[o],children:t.jsx(xe,{id:`edge-line-${o}`,type:"line",paint:{"line-color":e.color,"line-width":4,"line-opacity":1},layout:{"line-cap":"round","line-join":"round"}})},`edge-${o}`)),D.map((e,o)=>t.jsx(Y,{longitude:e.midpoint[0],latitude:e.midpoint[1],anchor:"center",children:t.jsx(Le,{hopNumber:o+1,snr:F?e.snrFwd:void 0,edgeColor:e.color})},`hop-${o}`)),(()=>{const e=$.filter(s=>s.isPrimary),o=e.length>1?e.length-2:-1;return e.map((s,i)=>{const f=W===s.hopIndex,l=i===o&&!s.candidate.isLocal&&!s.isDestination;return t.jsx(Y,{longitude:s.position[1],latitude:s.position[0],anchor:"center",children:t.jsx(je,{prefix:s.prefix,isLocal:s.candidate.isLocal||!1,isSource:s.isSource,isDestination:s.isDestination,isLastHop:l,isHighlighted:f,isWardrive:s.candidate.isWardrive||!1,candidate:s.candidate,onHover:()=>y==null?void 0:y(s.hopIndex),onLeave:()=>y==null?void 0:y(null),onClick:()=>ee(s)})},`${s.hopIndex}-${s.candidate.hash}`)})})(),n&&t.jsx(he,{longitude:n.longitude,latitude:n.latitude,anchor:"bottom",offset:[0,-12],closeOnClick:!1,onClose:()=>k(null),className:"maplibre-popup",children:t.jsxs("div",{className:"text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"font-semibold",children:n.marker.candidate.name}),(()=>{const e=G();return t.jsxs(t.Fragment,{children:[n.marker.isSource&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.sourceColor,color:"#000"},children:"SRC"}),n.marker.isDestination&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.destinationColor,color:"#000"},children:"DST"}),n.marker.isHub&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.hubColor,color:"#000"},children:"HUB"}),n.marker.candidate.isLocal&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.localColor,color:"#fff"},children:"LOCAL"}),n.marker.candidate.isWardrive&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:"#F97316",color:"#fff"},children:"WARDRIVE"})]})})()]}),t.jsxs("div",{className:"text-fg-muted type-data-xs",children:[n.marker.prefix," • ",n.marker.candidate.hash.slice(0,10),"..."]}),!n.marker.isPrimary&&n.marker.candidateCount>1&&t.jsxs("div",{style:{color:G().ambiguousColor},children:["Alternative (",(n.marker.candidate.probability*100).toFixed(0),"%)"]}),n.marker.isPrimary&&n.marker.candidateCount>1&&t.jsxs("div",{className:"text-fg-muted",children:[n.marker.candidateCount," candidates"]})]})})]},Z)})]})}export{Fe as default}; + */const be=[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]],Ce=ae("car",be),ve={version:8,sources:{},layers:[],glyphs:"https://tiles.basemaps.cartocdn.com/fonts/{fontstack}/{range}.pbf"},h={nodeColor:"#4338CA",localColor:"#4F46E5",hubColor:"#6366F1",edgeColor:"#3B3F4A",ambiguousColor:"#F9D26F",highlightColor:"#B49DFF",sourceColor:"#39D98A",destinationColor:"#B49DFF"};function C(c,r){if(!c)return r;if(c.startsWith("#"))return c;const m=ue(c);return m?`#${m.r.toString(16).padStart(2,"0")}${m.g.toString(16).padStart(2,"0")}${m.b.toString(16).padStart(2,"0")}`:r}function G(){if(typeof document>"u")return h;const c=document.documentElement,r=getComputedStyle(c);return{nodeColor:C(r.getPropertyValue("--map-node-stroke").trim(),h.nodeColor),localColor:C(r.getPropertyValue("--map-local-color").trim(),h.localColor),hubColor:C(r.getPropertyValue("--map-hub-color").trim(),h.hubColor),edgeColor:C(r.getPropertyValue("--map-edge-rest").trim(),h.edgeColor),ambiguousColor:C(r.getPropertyValue("--sys-indigo").trim(),h.ambiguousColor),highlightColor:C(r.getPropertyValue("--sys-blue").trim(),h.highlightColor),sourceColor:C(r.getPropertyValue("--sys-green").trim(),h.sourceColor),destinationColor:C(r.getPropertyValue("--sys-blue").trim(),h.destinationColor)}}function je({prefix:c,isLocal:r,isSource:m,isDestination:W,isLastHop:y,isHighlighted:g,isWardrive:F,candidate:x,onHover:E,onLeave:N,onClick:S}){const[n,k]=a.useState(!1),I=a.useCallback(()=>{k(!0),E()},[E]),v=a.useCallback(()=>{k(!1),N()},[N]),P=()=>F?"orange":r?"amber":m?"green":y?"amber":W?"purple":"blue";return F?t.jsxs("div",{className:z("flex items-center cursor-pointer","transition-all duration-150",g&&"ring-2 ring-sys-blue/50 rounded-full",n&&"relative z-50"),onMouseEnter:I,onMouseLeave:v,onClick:S,style:{pointerEvents:"auto"},children:[t.jsx("div",{className:z("flex items-center justify-center","w-7 h-7 rounded-full","bg-sys-orange text-white","shadow-lg border-2 border-sys-orange/50","transition-transform duration-150",n&&"scale-110"),children:t.jsx(Ce,{className:"w-4 h-4",strokeWidth:2.5})}),n&&t.jsxs(K,{color:"orange",filled:!0,className:"ml-1 type-data-xs shadow-lg",children:[c,x.name&&t.jsx("span",{className:"ml-1 opacity-75",children:x.name})]})]}):t.jsx("div",{className:z("flex items-center cursor-pointer","transition-all duration-150",g&&"ring-2 ring-sys-blue/50 rounded",n&&"relative z-50"),onMouseEnter:I,onMouseLeave:v,onClick:S,style:{pointerEvents:"auto"},children:t.jsxs(K,{color:P(),filled:!0,className:"type-data-xs shadow-lg border border-current/30",children:[r&&t.jsx(ye,{className:"w-2.5 h-2.5 mr-1"}),c,n&&x.name&&t.jsx("span",{className:"ml-1 opacity-75",children:x.name})]})})}function Le({hopNumber:c,snr:r,edgeColor:m}){return t.jsxs("div",{className:"flex flex-col items-center gap-0.5 pointer-events-none",children:[t.jsx("span",{className:"w-3.5 h-3.5 rounded-full flex items-center justify-center font-mono font-bold tabular-nums shadow-md",style:{backgroundColor:m||q[500],color:"#fff",fontSize:"8px",lineHeight:1,textShadow:"0 1px 1px rgba(0,0,0,0.4)"},children:c}),r!==void 0&&t.jsx(K,{color:"zinc",compact:!0,className:"!text-[9px] font-mono tabular-nums shadow-sm",children:r.toFixed(1)})]})}function Fe({resolvedPath:c,localNode:r,hubNodes:m=[],hoveredHopIndex:W,onHoverHop:y,traceSnr:g}){const F=g!==void 0&&g.length>0,x=a.useRef(null),E=pe(),N=ie(),S=a.useMemo(()=>new Set(m),[m]),[n,k]=a.useState(null),I=le(),[v,P]=a.useState(!1),[Z,H]=a.useState(0);a.useEffect(()=>{var f;const e=(f=x.current)==null?void 0:f.getMap();if(!e)return;const o=e.getCanvas();if(!o)return;const s=l=>{l.preventDefault(),console.warn("[PathMapMapLibre] WebGL context lost")},i=()=>{console.info("[PathMapMapLibre] WebGL context restored, remounting..."),H(l=>l+1)};return o.addEventListener("webglcontextlost",s),o.addEventListener("webglcontextrestored",i),()=>{o.removeEventListener("webglcontextlost",s),o.removeEventListener("webglcontextrestored",i)}},[Z]);const{positions:j,markers:$,edges:D}=a.useMemo(()=>{const e=[],o=[],s=[],i=[],f=(p,R)=>p!==0||R!==0;let l=0,b=!1;return c.hops.forEach((p,R)=>{const O=p.candidates.filter(d=>f(d.latitude,d.longitude));if(O.length===0)return;const V=[...O].sort((d,w)=>w.probability-d.probability),A=V[0],L=[A.longitude,A.latitude];if(i.push(L),i.length>=2){const d=i[i.length-2],w=i.length-2,M=g==null?void 0:g[w],T=L[0]-d[0],se=L[1]-d[1],ne=Math.atan2(T,se)*(180/Math.PI),re=G();let B;b?B="#F97316":M!==void 0?B=de()[ce(M,N)]||q[500]:B=re.edgeColor,s.push({from:d,to:L,snrFwd:M,midpoint:[(d[0]+L[0])/2,(d[1]+L[1])/2],bearing:ne,color:B,isFromWardrive:b})}const te=p.isSource===!0,oe=p.isDestination===!0;b=A.isWardrive===!0,V.forEach((d,w)=>{const M=[d.latitude,d.longitude];e.push(M);const T=w===0;o.push({position:M,prefix:p.prefix,confidence:p.confidence,candidateCount:V.length,hopIndex:R,candidate:d,isHub:S.has(d.hash),isPrimary:T,isSource:te,isDestination:oe,validIndex:l})}),l++}),{positions:e,markers:o,edges:s}},[c,S,g,N]),J=a.useMemo(()=>D.map(e=>({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e.from,e.to]}}]})),[D]),u=a.useMemo(()=>{const e=$.filter(l=>l.isPrimary&&(l.confidence>=.5||l.isSource||l.isDestination));if(e.length===0)return null;let o=1/0,s=-1/0,i=1/0,f=-1/0;for(const l of e){const[b,p]=l.position;bs&&(s=b),pf&&(f=p)}return[[i,o],[f,s]]},[$]),_=a.useMemo(()=>{if(j.length===0)return r?[r.longitude,r.latitude]:[0,0];let e=0,o=0;for(const[s,i]of j)e+=s,o+=i;return[o/j.length,e/j.length]},[j,r]),U=a.useCallback(()=>{var o;const e=(o=x.current)==null?void 0:o.getMap();if(!e||!u){P(!0);return}e.fitBounds(u,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:0}),setTimeout(()=>{P(!0)},50)},[u]),X=a.useMemo(()=>u?`${u[0][0].toFixed(5)},${u[0][1].toFixed(5)},${u[1][0].toFixed(5)},${u[1][1].toFixed(5)}`:"",[u]);a.useEffect(()=>{var o;if(!v)return;const e=(o=x.current)==null?void 0:o.getMap();!e||!u||e.fitBounds(u,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:300})},[X,v,u]);const Y=I&&v,ee=a.useCallback(e=>{k({longitude:e.position[1],latitude:e.position[0],marker:e})},[]);return j.length===0?t.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted text-sm bg-elevated",children:"No mappable path data"}):t.jsxs("div",{className:"h-full w-full relative radius-inner overflow-hidden depth-stroke-inset",children:[!Y&&t.jsx("div",{className:"absolute inset-0 bg-elevated flex items-center justify-center pointer-events-none",children:t.jsx("div",{className:"w-5 h-5 border-2 border-text-muted/30 border-t-text-muted rounded-full animate-spin"})}),t.jsx("div",{className:"h-full w-full transition-opacity duration-300 ease-out",style:{opacity:Y?1:0},children:t.jsxs(me,{ref:x,initialViewState:{longitude:_[0],latitude:_[1],zoom:10},onLoad:U,style:{height:"100%",width:"100%"},mapStyle:ve,attributionControl:!1,children:[t.jsx(fe,{mode:E}),D.map((e,o)=>t.jsx(ge,{id:`edge-${o}`,type:"geojson",data:J[o],children:t.jsx(xe,{id:`edge-line-${o}`,type:"line",paint:{"line-color":e.color,"line-width":4,"line-opacity":1},layout:{"line-cap":"round","line-join":"round"}})},`edge-${o}`)),D.map((e,o)=>t.jsx(Q,{longitude:e.midpoint[0],latitude:e.midpoint[1],anchor:"center",children:t.jsx(Le,{hopNumber:o+1,snr:F?e.snrFwd:void 0,edgeColor:e.color})},`hop-${o}`)),(()=>{const e=$.filter(s=>s.isPrimary),o=e.length>1?e.length-2:-1;return e.map((s,i)=>{const f=W===s.hopIndex,l=i===o&&!s.candidate.isLocal&&!s.isDestination;return t.jsx(Q,{longitude:s.position[1],latitude:s.position[0],anchor:"center",children:t.jsx(je,{prefix:s.prefix,isLocal:s.candidate.isLocal||!1,isSource:s.isSource,isDestination:s.isDestination,isLastHop:l,isHighlighted:f,isWardrive:s.candidate.isWardrive||!1,candidate:s.candidate,onHover:()=>y==null?void 0:y(s.hopIndex),onLeave:()=>y==null?void 0:y(null),onClick:()=>ee(s)})},`${s.hopIndex}-${s.candidate.hash}`)})})(),n&&t.jsx(he,{longitude:n.longitude,latitude:n.latitude,anchor:"bottom",offset:[0,-12],closeOnClick:!1,onClose:()=>k(null),className:"maplibre-popup",children:t.jsxs("div",{className:"text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"font-semibold",children:n.marker.candidate.name}),(()=>{const e=G();return t.jsxs(t.Fragment,{children:[n.marker.isSource&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.sourceColor,color:"#000"},children:"SRC"}),n.marker.isDestination&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.destinationColor,color:"#000"},children:"DST"}),n.marker.isHub&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.hubColor,color:"#000"},children:"HUB"}),n.marker.candidate.isLocal&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:e.localColor,color:"#fff"},children:"LOCAL"}),n.marker.candidate.isWardrive&&t.jsx("span",{className:"px-1 py-0.5 text-[8px] font-bold rounded",style:{backgroundColor:"#F97316",color:"#fff"},children:"WARDRIVE"})]})})()]}),t.jsxs("div",{className:"text-fg-muted type-data-xs",children:[n.marker.prefix," • ",n.marker.candidate.hash.slice(0,10),"..."]}),!n.marker.isPrimary&&n.marker.candidateCount>1&&t.jsxs("div",{style:{color:G().ambiguousColor},children:["Alternative (",(n.marker.candidate.probability*100).toFixed(0),"%)"]}),n.marker.isPrimary&&n.marker.candidateCount>1&&t.jsxs("div",{className:"text-fg-muted",children:[n.marker.candidateCount," candidates"]})]})})]},Z)})]})}export{Fe as default}; diff --git a/frontend/dist/assets/RoomServer-CupA42-s.js b/frontend/dist/assets/RoomServer-hAC3CH43.js similarity index 95% rename from frontend/dist/assets/RoomServer-CupA42-s.js rename to frontend/dist/assets/RoomServer-hAC3CH43.js index c1a26e71..8d4b7612 100644 --- a/frontend/dist/assets/RoomServer-CupA42-s.js +++ b/frontend/dist/assets/RoomServer-hAC3CH43.js @@ -1,4 +1,4 @@ -import{d as U,j as e,db as Fe,c as L,aD as Oe,d$ as Be,r as o,bY as Y,R as qe,ak as ze,dI as He,al as Ge,x as V,I as q,e0 as Ue,B as F,bH as Me,am as ue,d6 as Ve,N as se,F as Re,D as W,E as We,e1 as Te,e2 as Ye,bf as Le,e3 as Ie,e4 as Xe,e5 as Ze,e6 as Je,e7 as Qe,e8 as es,e9 as ss,ea as ts,K as as,G as ns,dW as rs,b_ as xe}from"./index-CeMilrX4.js";import{C as G,P as pe,a as he,B as ls}from"./PageLayout-Cw_MXmcE.js";import{R as os,C as ge}from"./Grid-BuDgMX1I.js";import{c as is,m as cs}from"./node-types-C09ZlzBQ.js";import{L as ds,a as ms,b as us}from"./listbox-CGIGCOya.js";import{P as xs}from"./plus-D-z0bUE_.js";import{M as J}from"./map-pin-D6_BkIVb.js";import{T as Ee}from"./trash-2-Bu7BoH4P.js";import{S as Q,K as I}from"./KeycapButton-BFRxj00q.js";import{C as fe}from"./ConfirmModal-BF449Kzb.js";import{S as ps,C as hs,M as gs}from"./ChatBubble-D4uyE1Zh.js";import{e as fs,g as js,a as vs}from"./chat-utils-BJwCtjDV.js";import{W as ee}from"./wifi-DjxkOZ88.js";import{K as ys}from"./key-round-Dkqq4aT0.js";import"./element-movement-zLH7y51p.js";import"./keycap-sfx-ByZp-njj.js";import"./triangle-alert-DiFold9L.js";/** +import{d as U,j as e,dc as Fe,c as L,aD as Oe,e0 as Be,r as o,bY as Y,R as qe,ak as ze,dJ as He,al as Ge,x as V,I as q,e1 as Ue,B as F,bH as Me,am as ue,d7 as Ve,N as se,F as Re,D as W,E as We,e2 as Te,e3 as Ye,bf as Le,e4 as Ie,e5 as Xe,e6 as Je,e7 as Ze,e8 as Qe,e9 as es,ea as ss,eb as ts,K as as,G as ns,dX as rs,b_ as xe}from"./index-BOwCLZTK.js";import{C as G,P as pe,a as he,B as ls}from"./PageLayout-QKntxcnp.js";import{R as os,C as ge}from"./Grid-eFMUBxsw.js";import{c as is,m as cs}from"./node-types-C6okL8rE.js";import{L as ds,a as ms,b as us}from"./listbox-C1tUi7YC.js";import{P as xs}from"./plus-ClrHVFhr.js";import{M as Z}from"./map-pin-C2z_C0J3.js";import{T as Ee}from"./trash-2-qMD09ppP.js";import{S as Q,K as I}from"./KeycapButton-uJlkDPOC.js";import{C as fe}from"./ConfirmModal-DpSKXZ01.js";import{S as ps,C as hs,M as gs}from"./ChatBubble-CCVYaLOe.js";import{e as fs,g as js,a as vs}from"./chat-utils-D21OFED5.js";import{W as ee}from"./wifi-CI57D5A3.js";import{K as ys}from"./key-round-Cv6ASKpS.js";import"./element-movement-BLnr83nT.js";import"./keycap-sfx-ByZp-njj.js";import"./triangle-alert-SO3tIa8w.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -23,4 +23,4 @@ import{d as U,j as e,db as Fe,c as L,aD as Oe,d$ as Be,r as o,bY as Y,R as qe,ak * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _s=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]],Ms=U("user-x",_s);function z({disabled:s,className:t,children:l}){return e.jsx(Fe,{disabled:s,className:L("flex flex-col gap-2",t),children:l})}function H({required:s,className:t,children:l,...a}){return e.jsxs(Oe,{className:L("text-sm font-medium text-fg-primary select-none","data-[disabled]:opacity-50",a.title&&"cursor-help",t),...a,children:[l,s&&e.jsx("span",{className:"text-sys-red ml-0.5","aria-hidden":"true",children:"*"})]})}function Rs({className:s,children:t,...l}){return e.jsx(Be,{className:L("text-sm text-fg-muted","data-[disabled]:opacity-50",s),...l,children:t})}function Ts(s,t){return o.useMemo(()=>{const a=new Map;for(const[n,c]of Object.entries(s)){const m=c.name||c.node_name||null,{type:d}=is(c);a.set(n.toLowerCase(),{name:m,type:d})}const r=new Map;for(let n=t.length-1;n>=0;n--){const c=t[n];if(!c._advertSender)continue;const m=c._advertSender.toLowerCase();if(r.has(m))continue;const d=c._advertName??null,i=c._advertNodeType!=null?cs(c._advertNodeType):"companion";r.set(m,{name:d,type:i})}return function(c){const m=c.toLowerCase(),d=a.get(m);if(d!=null&&d.name)return d;const i=r.get(m);return i!=null&&i.name?i:d||i||{name:null,type:"companion"}}},[s,t])}function ve({icon:s,title:t,description:l,onClick:a,accent:r}){return e.jsxs("button",{onClick:a,className:L("flex flex-col items-center gap-3 p-6 rounded-2xl text-center","ring-1 ring-edge-subtle hover:ring-2 transition-all duration-150","w-full max-w-[260px]",r==="primary"?"hover:ring-sys-blue hover:bg-sys-blue/5":"hover:ring-sys-indigo hover:bg-sys-indigo/5"),children:[e.jsx("div",{className:L("p-3 rounded-xl",r==="primary"?"bg-sys-blue/10 text-sys-blue":"bg-sys-indigo/10 text-sys-indigo"),children:s}),e.jsx("p",{className:"type-body-sm font-medium text-fg-primary",children:t}),e.jsx("p",{className:"type-data-xs text-fg-muted leading-relaxed",children:l})]})}function Ls({onCreateRoom:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4",children:[e.jsx(Y,{className:"w-12 h-12 text-fg-muted opacity-30 mb-4"}),e.jsx("p",{className:"type-subheading text-fg-secondary mb-1",children:"Add a Room Server"}),e.jsx("p",{className:"type-body-sm text-fg-muted mb-8",children:"Choose how this device should operate."}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[e.jsx(ve,{icon:e.jsx(Cs,{className:"w-6 h-6"}),title:"Repeater + Room Server",description:"Keep forwarding packets and add group messaging.",onClick:()=>s("hybrid"),accent:"primary"}),e.jsx(ve,{icon:e.jsx(qe,{className:"w-6 h-6"}),title:"Dedicated Room Server",description:"Stop repeating. Focus entirely on room server duties.",onClick:()=>s("dedicated"),accent:"secondary"})]})]})}function Es({rooms:s,selected:t,onSelect:l,onAdd:a}){const r=a?e.jsx("button",{onClick:a,className:L("flex items-center justify-center px-2 py-1 rounded-md","text-fg-muted hover:text-fg-primary hover:bg-surface/60","transition-all duration-150"),title:"Add room server",children:e.jsx(xs,{className:"w-4 h-4"})}):null;return s.length<=1?r:s.length<=3?e.jsxs("div",{className:"flex items-center gap-0.5 p-0.5 rounded-lg bg-subtle-fill",children:[s.map(n=>e.jsx("button",{onClick:()=>l(n.room_name),className:L("px-3 py-1 rounded-md text-sm font-medium transition-all duration-150",n.room_name===t?"bg-surface text-fg-primary shadow-sm":"text-fg-muted hover:text-fg-secondary"),children:n.room_name},n.room_name)),r]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ds,{value:t??"",onChange:l,children:s.map(n=>e.jsx(ms,{value:n.room_name,children:e.jsx(us,{children:n.room_name})},n.room_name))}),r]})}function Ds(s){if(!s)return"";const t=s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return t?`${t}-room`:""}function ye({open:s,onClose:t,mode:l,identity:a,repeaterConfig:r,onCreate:n,onUpdate:c,onDelete:m,onSendAdvert:d}){var te,ae,ne,re,le,oe,ie,ce,de;const i=l==="edit"&&a,u=`${s}-${(a==null?void 0:a.name)??""}-${l}`,[x,f]=o.useState(""),[j,y]=o.useState(""),[g,E]=o.useState(!1),[C,S]=o.useState(""),[b,_]=o.useState(""),[N,M]=o.useState(""),[k,R]=o.useState(""),[w,D]=o.useState(!1),[P,A]=o.useState(!1),[O,$]=o.useState(!1),[K,T]=o.useState(null),[B,h]=o.useState(u);if(u!==B)if(h(u),T(null),D(!1),A(!1),$(!1),i)f(((te=a.settings)==null?void 0:te.node_name)??a.name),y(a.identity_key??""),E(!1),S(((ae=a.settings)==null?void 0:ae.admin_password)??""),_(((ne=a.settings)==null?void 0:ne.guest_password)??""),M(((le=(re=a.settings)==null?void 0:re.latitude)==null?void 0:le.toString())??""),R(((ie=(oe=a.settings)==null?void 0:oe.longitude)==null?void 0:ie.toString())??"");else{const p=r;f(""),y(""),E(!1),S(""),_(""),M(((ce=p==null?void 0:p.repeater)==null?void 0:ce.latitude)!=null?p.repeater.latitude.toString():""),R(((de=p==null?void 0:p.repeater)==null?void 0:de.longitude)!=null?p.repeater.longitude.toString():"")}const v=o.useCallback(()=>{const p={};return x&&(p.node_name=x),C&&(p.admin_password=C),b&&(p.guest_password=b),N!==""&&(p.latitude=parseFloat(N)),k!==""&&(p.longitude=parseFloat(k)),p},[x,C,b,N,k]),Ae=o.useCallback(async()=>{if(!x.trim()){T("Room name is required");return}D(!0),T(null);const p=i?a.name:Ds(x);let Z;if(i)Z=await c({name:a.name,settings:v()});else{const me={name:p,type:"room_server",settings:v()};j.trim()&&(me.identity_key=j.trim()),Z=await n(me)}D(!1),Z?t():T("Failed to save. Check that the name is unique and passwords differ.")},[x,i,a,v,n,c,t]),$e=o.useCallback(async()=>{if(!i)return;A(!0);const p=await m(a.name);A(!1),p&&t()},[i,a,m,t]),Ke=o.useCallback(async()=>{i&&($(!0),await d(a.name),$(!1))},[i,a,d]);return e.jsxs(ze,{open:s,onClose:t,size:"md",children:[e.jsx(He,{icon:i?void 0:e.jsx(ks,{className:"w-5 h-5"}),title:i?"Edit Room Server":"Add Room Server",onClose:t}),e.jsx(Ge,{children:e.jsxs("div",{className:"space-y-5",children:[i&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{color:a.registered?"green":"red",children:a.registered?"Active":"Inactive"}),a.identity_key&&e.jsxs("span",{className:"type-data-xs text-fg-muted truncate",title:a.identity_key,children:["Key: ",a.identity_key.slice(0,16),"…"]})]}),e.jsxs(z,{children:[e.jsx(H,{title:"What people see on the mesh",children:"Room Name"}),e.jsx(q,{value:x,onChange:p=>f(p.target.value),placeholder:"Room Name"})]}),!i&&e.jsxs(z,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(H,{title:"The unique hex public ID",children:["Identity Key ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx("button",{type:"button",onClick:()=>E(p=>!p),className:"type-data-xs text-fg-muted underline hover:text-fg-secondary",children:g?"Hide":"Show"})]}),g&&e.jsxs(e.Fragment,{children:[e.jsx(q,{value:j,onChange:p=>y(p.target.value),placeholder:"Leave empty to auto-generate"}),e.jsx(Rs,{children:"Leave empty to automatically generate a secure key"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(z,{children:[e.jsxs(H,{children:[e.jsx(J,{className:"inline w-3.5 h-3.5 -mt-0.5 mr-1 text-fg-muted"}),"Latitude"]}),e.jsx(q,{type:"number",step:"any",value:N,onChange:p=>M(p.target.value),placeholder:"0"})]}),e.jsxs(z,{children:[e.jsxs(H,{children:[e.jsx(J,{className:"inline w-3.5 h-3.5 -mt-0.5 mr-1 text-fg-muted"}),"Longitude"]}),e.jsx(q,{type:"number",step:"any",value:k,onChange:p=>R(p.target.value),placeholder:"0"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(z,{children:[e.jsxs(H,{title:"Full access to room server",children:["Admin Password ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx(q,{type:"password",value:C,onChange:p=>S(p.target.value),placeholder:"None Set"})]}),e.jsxs(z,{children:[e.jsxs(H,{title:"Can post and read, but not administer the room",children:["Guest Password ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx(q,{type:"password",value:b,onChange:p=>_(p.target.value),placeholder:"None Set"})]})]}),K&&e.jsx("p",{className:"type-data-xs text-sys-red",children:K})]})}),e.jsxs(Ue,{children:[i&&e.jsxs("div",{className:"flex items-center gap-2 mr-auto",children:[e.jsxs(F,{color:"danger",plain:!0,onClick:$e,disabled:P,children:[e.jsx(Ee,{"data-slot":"icon"}),P?"Deleting…":"Delete"]}),e.jsxs(F,{color:"primary",plain:!0,onClick:Ke,disabled:O,children:[e.jsx(Me,{"data-slot":"icon"}),O?"Sending…":"Send Advert"]})]}),e.jsx(F,{plain:!0,onClick:t,children:"Cancel"}),e.jsx(F,{color:"primary",onClick:Ae,disabled:w,children:w?"Saving…":i?"Save Changes":"Create"})]})]})}const Pe=o.createContext(null),Ne="room-tui";function be({children:s}){const[t,l]=o.useState(()=>localStorage.getItem(Ne)!=="0"),a=o.useCallback(()=>{l(r=>{const n=!r;return localStorage.setItem(Ne,n?"1":"0"),n})},[]);return e.jsx(Pe.Provider,{value:{terminalMode:t,toggleTerminalMode:a},children:s})}function X(){const s=o.useContext(Pe);if(!s)throw new Error("useTerminalMode must be used within RoomTerminalProvider");return s}const ke=s=>s.author_pubkey==="server"||s.author_pubkey==="system";function we({messages:s,onDelete:t,terminalMode:l,serverName:a}){const r=o.useRef(null),[n,c]=o.useState(!1),m=o.useMemo(()=>[...s].sort((u,x)=>u.post_timestamp-x.post_timestamp),[s]);o.useEffect(()=>{!n&&r.current&&(r.current.scrollTop=0)},[m.length,n]);const d=o.useCallback(()=>{r.current&&c(r.current.scrollTop<-100)},[]),i=o.useCallback(()=>{r.current&&r.current.scrollTo({top:0,behavior:"smooth"}),c(!1)},[]);return m.length===0?e.jsx("div",{className:`flex-1 flex flex-col items-center justify-center py-12 min-h-0${l?" font-mono":""}`,children:l?e.jsx("p",{className:"text-sm font-mono",style:{color:"var(--tui-accent)",opacity:.4},children:"> no messages in buffer_"}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"w-10 h-10 text-fg-muted opacity-20 mb-2"}),e.jsx("p",{className:"type-data-sm text-fg-muted",children:"No messages yet"})]})}):l?e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:r,onScroll:d,className:"h-full overflow-y-auto scroll-smooth p-4 font-mono text-sm leading-relaxed flex flex-col-reverse",children:e.jsx("div",{children:m.map(u=>{const x=ke(u),f=new Date(u.post_timestamp*1e3).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),j=x?"SYS":u.author_name||u.author_prefix,y=!x&&a&&j===a;return e.jsxs("div",{className:"group flex items-start gap-0 -mx-4 px-4 py-px",style:{"--tw-hover-bg":"var(--tui-hover-bg)"},onMouseEnter:g=>g.currentTarget.style.background="var(--tui-hover-bg)",onMouseLeave:g=>g.currentTarget.style.background="",children:[e.jsxs("span",{className:"select-none shrink-0",style:{color:"var(--tui-muted)"},children:["[",f,"]"]}),e.jsxs("span",{className:"mx-1.5 shrink-0",style:{color:y?"var(--tui-accent-local)":"var(--tui-accent)"},children:["<",j,">"]}),e.jsx("span",{style:{color:x?"var(--tui-system)":y?"var(--tui-body)":"var(--tui-accent)"},className:x?"italic":"",children:u.message_text}),e.jsx("button",{onClick:()=>t(u.id),className:"opacity-0 group-hover:opacity-100 ml-auto pl-2 shrink-0 transition-colors",style:{color:"var(--tui-muted)"},onMouseEnter:g=>g.currentTarget.style.color="var(--tui-danger)",onMouseLeave:g=>g.currentTarget.style.color="var(--tui-muted)",title:"Delete",children:"×"})]},u.id)})})}),n&&e.jsxs("button",{onClick:i,className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1.5 px-3 py-1 font-mono text-xs transition-colors duration-150",style:{background:"var(--tui-hover-bg)",border:"1px solid var(--tui-muted)",color:"var(--tui-accent)"},children:[e.jsx(ue,{className:"w-3 h-3"}),"↓ scroll"]})]}):e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:r,onScroll:d,className:"h-full overflow-y-auto scroll-smooth flex flex-col-reverse",children:e.jsx("div",{className:"space-y-3 p-4",children:m.map(u=>ke(u)?e.jsx(ps,{text:u.message_text},u.id):e.jsx(hs,{senderName:u.author_name||u.author_prefix,text:u.message_text,timestamp:u.post_timestamp,bubbleAccessory:e.jsx("button",{onClick:()=>t(u.id),className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150 p-1 text-fg-muted hover:text-sys-red flex-shrink-0",title:"Delete message",children:e.jsx(Ee,{className:"w-3.5 h-3.5"})})},u.id))})}),n&&e.jsxs("button",{onClick:i,className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-surface/90 backdrop-blur-sm ring-1 ring-edge-subtle shadow-md text-fg-secondary hover:text-fg-primary transition-colors duration-150",children:[e.jsx(ue,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs",children:"New messages"})]})]})}function Ce({roomName:s,onSend:t,disabled:l,terminalMode:a}){const[r,n]=o.useState(""),[c,m]=o.useState(!1),d=o.useRef(null),i=o.useCallback(async()=>{var j;const x=r.trim();if(!x||c)return;m(!0);const f=await t(x);m(!1),f&&(n(""),(j=d.current)==null||j.focus())},[r,c,t]),u=o.useCallback(x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),i())},[i]);return a?e.jsxs("div",{className:"flex items-center gap-0 px-4 py-2 type-data-sm",children:[e.jsx("input",{ref:d,type:"text",value:r,onChange:x=>n(x.target.value),onKeyDown:u,placeholder:"type message...",disabled:l||c,className:"flex-1 bg-transparent outline-none ring-0 shadow-none border-none focus:outline-none focus:ring-0 font-mono tui-input",style:{color:"var(--tui-body)"}}),e.jsx("button",{onClick:i,disabled:!r.trim()||c||l,className:"transition-colors duration-100 px-1 font-mono text-xs disabled:opacity-30",style:{color:"var(--tui-accent)"},title:"Send",children:"[↵]"})]}):e.jsxs("div",{className:"flex items-center gap-2 p-3 border-t border-edge-subtle",children:[e.jsx("input",{ref:d,type:"text",value:r,onChange:x=>n(x.target.value),onKeyDown:u,placeholder:`Message ${s}…`,disabled:l||c,className:"flex-1 surface-input radius-inner px-3 py-2 type-body-sm text-fg-primary placeholder:text-fg-muted outline-none ring-focus"}),e.jsx("button",{onClick:i,disabled:!r.trim()||c||l,className:"p-2 rounded-lg text-sys-blue hover:bg-sys-blue/10 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150",title:"Send message",children:e.jsx(Me,{className:"w-4.5 h-4.5"})})]})}function Ps({selectedName:s,selectedIdentity:t,messages:l,onSend:a,onDelete:r,onClear:n}){var f;const{terminalMode:c,toggleTerminalMode:m}=X(),[d,i]=o.useState(!1),u=((f=t==null?void 0:t.settings)==null?void 0:f.node_name)??s??void 0,x=o.useCallback(()=>{i(!1),n()},[n]);return c?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col h-full gap-1.5",children:[e.jsxs("div",{className:"card-terminal-header flex-shrink-0",children:[e.jsx("span",{className:"seven-seg-panel",children:e.jsx(Q,{text:"chat",minChars:7,size:24})}),e.jsx("div",{className:"card-terminal-ridge flex-1"}),e.jsxs("div",{className:"header-well",children:[e.jsx(I,{icon:e.jsx(je,{className:"!w-5.5 !h-5.5 translate-y-px"}),onClick:m,title:"Exit terminal mode"}),l.length>0&&e.jsx(I,{icon:e.jsx("span",{className:"text-[13px] font-bold font-mono leading-none translate-y-px",children:"DEL"}),onClick:()=>i(!0),title:"Clear all messages",variant:"red",iconActiveColor:Ve.red})]})]}),e.jsx(G,{noPadding:!0,className:"flex flex-col flex-1 min-h-0 overflow-hidden card-terminal",children:e.jsxs("div",{className:"card-terminal-well flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsx(we,{messages:l,onDelete:r,terminalMode:!0,serverName:u}),e.jsx("div",{className:"card-terminal-divider"}),s&&e.jsx(Ce,{roomName:s,onSend:a,disabled:!(t!=null&&t.registered),terminalMode:!0})]})})]}),e.jsx(fe,{isOpen:d,title:"Clear All Messages",message:`This will permanently delete all ${l.length} message${l.length===1?"":"s"} from this room. This cannot be undone.`,confirmLabel:"Clear Messages",variant:"danger",onConfirm:x,onCancel:()=>i(!1)})]}):e.jsxs(e.Fragment,{children:[e.jsxs(G,{noPadding:!0,className:"flex flex-col h-full overflow-hidden",children:[e.jsx(se,{listHeader:!0,icon:e.jsx(De,{className:"icon-sm"}),title:"Messages",actions:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(F,{plain:!0,onClick:m,title:"Terminal mode",children:e.jsx(je,{"data-slot":"icon",className:"!w-5 !h-5 translate-y-px"})}),l.length>0&&e.jsx(F,{plain:!0,onClick:()=>i(!0),title:"Clear all messages",children:e.jsx("span",{"data-slot":"icon",className:"text-[12px] font-bold font-mono leading-none translate-y-px text-sys-red",children:"DEL"})})]})}),e.jsx(we,{messages:l,onDelete:r,terminalMode:!1,serverName:u}),s&&e.jsx(Ce,{roomName:s,onSend:a,disabled:!(t!=null&&t.registered),terminalMode:!1})]}),e.jsx(fe,{isOpen:d,title:"Clear All Messages",message:`This will permanently delete all ${l.length} message${l.length===1?"":"s"} from this room. This cannot be undone.`,confirmLabel:"Clear Messages",variant:"danger",onConfirm:x,onCancel:()=>i(!1)})]})}function As({pubkey:s,className:t}){const[l,a]=o.useState(!1),r=o.useCallback(async()=>{await Re(s),a(!0),setTimeout(()=>a(!1),1500)},[s]);return e.jsxs("button",{onClick:r,title:l?"Copied!":"Copy public key",className:`inline-flex items-center gap-1 type-data-xs leading-tight text-fg-muted hover:text-fg-secondary transition-colors duration-150 cursor-copy ${t??""}`,children:[e.jsx("span",{className:"truncate min-w-0",children:s.slice(0,8)}),l&&e.jsx(W,{className:"w-2.5 h-2.5 text-sys-green flex-shrink-0"})]})}const $s=o.memo(function({client:t,resolvedName:l,onRemove:a}){const r=t.name||l,n=t.unsynced_count===0,c=t.last_activity?new Date(t.last_activity*1e3).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"Never",{emoji:m,cleanName:d}=r?fs(r):{emoji:null,cleanName:t.pubkey_prefix},i=r?js(d):void 0,u=r?vs(r):t.pubkey_prefix.slice(0,2).toUpperCase();return e.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2.5 radius-inner row-hover transition-base",children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx("div",{className:L("w-8 h-8 rounded-full flex items-center justify-center",!i&&"bg-sys-blue/12"),style:i?{backgroundColor:i}:void 0,children:m?e.jsx("span",{className:"text-base leading-none",children:m}):e.jsx("span",{className:L("leading-none",i?"text-white text-[11px] font-bold tracking-tight":"text-sys-blue font-mono text-[11px]"),children:u})}),e.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-sm ring-2 ring-surface ${n?"bg-sys-green":"bg-sys-indigo"}`})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[r?e.jsx("p",{className:"text-[13px] font-medium leading-tight text-fg-primary truncate",children:r}):e.jsx("p",{className:"font-mono text-[13px] leading-tight text-fg-primary truncate",children:t.pubkey_prefix}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[r&&e.jsx(As,{pubkey:t.pubkey}),r&&e.jsx("span",{className:"text-xs text-fg-muted/40",children:"·"}),e.jsxs("span",{className:"text-xs leading-tight text-fg-muted truncate",children:[!n&&e.jsxs("span",{className:"text-sys-indigo",children:[t.unsynced_count," unsynced · "]}),c]})]})]}),e.jsx("button",{onClick:()=>a(t.pubkey),className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150 p-1.5 -mr-1 rounded-md text-fg-muted hover:text-sys-red hover:bg-sys-red/8",title:"Remove client",children:e.jsx(Ms,{className:"w-3.5 h-3.5"})})]})});function Se({clients:s,onRemove:t,messages:l,terminalMode:a}){const r=o.useMemo(()=>{const n=new Map;if(!l)return n;for(let c=l.length-1;c>=0;c--){const m=l[c];m.author_name&&m.author_pubkey&&m.author_pubkey!=="server"&&m.author_pubkey!=="system"&&n.set(m.author_pubkey,m.author_name)}return n},[l]);return s.length===0?a?e.jsx("p",{className:"type-data-sm text-left px-4 py-4",style:{color:"var(--tui-accent)"},children:"< NO CLIENTS CONNECTED >"}):e.jsx("p",{className:"type-data-xs text-fg-muted text-center py-4",children:"No clients connected"}):a?e.jsx("div",{className:"type-data-sm pt-2",children:s.map(n=>{const c=n.name||r.get(n.pubkey),m=n.unsynced_count===0,d=n.pubkey_prefix;return e.jsxs("div",{className:"group flex items-center gap-0 -mx-0 px-4 py-0.5",onMouseEnter:i=>i.currentTarget.style.background="var(--tui-hover-bg)",onMouseLeave:i=>i.currentTarget.style.background="",children:[e.jsx("span",{style:{color:m?"var(--tui-accent)":"var(--tui-warn)"},children:"■"}),e.jsx("span",{className:"ml-2 shrink-0",style:{color:"var(--tui-accent)"},children:c||d}),c&&e.jsxs("span",{className:"ml-1.5 shrink-0",style:{color:"var(--tui-accent)"},children:["[",d,"]"]}),!m&&e.jsxs("span",{className:"ml-1.5",style:{color:"var(--tui-warn)"},children:[n.unsynced_count,"unsync"]}),e.jsx("button",{onClick:()=>t(n.pubkey),className:"opacity-0 group-hover:opacity-100 ml-auto pl-2 shrink-0 transition-colors",style:{color:"var(--tui-muted)"},onMouseEnter:i=>i.currentTarget.style.color="var(--tui-danger)",onMouseLeave:i=>i.currentTarget.style.color="var(--tui-muted)",title:"Remove",children:"×"})]},n.pubkey)})}):e.jsx("div",{className:"space-y-0.5 pt-1",children:s.map(n=>e.jsx($s,{client:n,resolvedName:r.get(n.pubkey),onRemove:t},n.pubkey))})}function Ks({name:s,onSend:t}){const{terminalMode:l}=X(),[a,r]=o.useState("idle"),n=o.useRef(),c=o.useCallback(async()=>{if(a==="sending")return;r("sending");const m=await t(s);r(m?"sent":"idle"),m&&(n.current=setTimeout(()=>r("idle"),2e3))},[s,t,a]);return o.useEffect(()=>()=>clearTimeout(n.current),[]),l?e.jsxs("button",{className:"btn-terminal",onClick:c,disabled:a==="sending",children:[a==="idle"&&"[ send_advert ]",a==="sending"&&"[ broadcasting... ]",a==="sent"&&"[ sent ✓ ]"]}):e.jsxs(F,{color:a==="sent"?"success":"primary",className:"w-full",onClick:c,disabled:a==="sending",children:[e.jsx(ee,{"data-slot":"icon"}),a==="idle"&&"Send Advert",a==="sending"&&"Broadcasting…",a==="sent"&&"Advert Sent"]})}function _e({identity:s,onSendAdvert:t}){var c,m,d,i,u,x,f,j,y,g,E,C,S,b,_,N,M,k,R,w,D,P,A,O,$,K,T,B,h,v;const{terminalMode:l}=X(),[a,r]=o.useState(!1),n=o.useCallback(async()=>{s!=null&&s.identity_key&&(await Re(s.identity_key),r(!0),setTimeout(()=>r(!1),1500))},[s==null?void 0:s.identity_key]);return l?s?e.jsxs("div",{className:"space-y-1",children:[((c=s.settings)==null?void 0:c.node_name)&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"node"}),e.jsx("span",{style:{color:"var(--tui-accent)"},children:s.settings.node_name})]}),(s.address||((m=s.runtime)==null?void 0:m.address))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"addr"}),e.jsx("span",{style:{color:"var(--tui-accent)"},children:s.address||((d=s.runtime)==null?void 0:d.address)})]}),s.identity_key&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"key"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"truncate max-w-[140px]",style:{color:"var(--tui-accent)"},title:s.identity_key,children:[s.identity_key.slice(0,16),"…"]}),e.jsx("button",{type:"button",onClick:n,className:"text-xs",style:{color:"var(--tui-muted)"},children:a?"[copied ✓]":"[copy]"})]})]}),(((i=s.settings)==null?void 0:i.latitude)!=null||((u=s.settings)==null?void 0:u.longitude)!=null)&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"loc"}),e.jsxs("span",{style:{color:"var(--tui-accent)"},title:`${((x=s.settings)==null?void 0:x.latitude)??"—"}, ${((f=s.settings)==null?void 0:f.longitude)??"—"}`,children:[((y=(j=s.settings)==null?void 0:j.latitude)==null?void 0:y.toFixed(4))??"—",", ",((E=(g=s.settings)==null?void 0:g.longitude)==null?void 0:E.toFixed(4))??"—"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"pass"}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{style:{color:(C=s.settings)!=null&&C.admin_password?"var(--tui-accent)":"var(--tui-muted)"},children:(S=s.settings)!=null&&S.admin_password?"[✓ admin]":"[— admin]"}),e.jsx("span",{style:{color:(b=s.settings)!=null&&b.guest_password?"var(--tui-accent)":"var(--tui-muted)"},children:(_=s.settings)!=null&&_.guest_password?"[✓ guest]":"[— guest]"})]})]})]}):e.jsx("span",{style:{color:"var(--tui-muted)"},children:"no identity configured"}):e.jsxs("div",{className:"flex-shrink-0 border-t border-edge-subtle",children:[e.jsx(se,{listHeader:!0,icon:e.jsx(gs,{className:"icon-sm"}),title:"Room Info"}),s?e.jsxs("div",{className:"space-y-2 px-4 py-3",children:[((N=s.settings)==null?void 0:N.node_name)&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-fg-muted",children:"Node"}),e.jsx("span",{className:"type-data-sm text-fg-primary",children:s.settings.node_name})]}),(s.address||((M=s.runtime)==null?void 0:M.address))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-fg-muted",children:"Address"}),e.jsx("span",{className:"type-data-sm font-mono text-fg-primary",children:s.address||((k=s.runtime)==null?void 0:k.address)})]}),s.identity_key&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"type-data-xs text-fg-muted flex items-center gap-1",title:"The unique hex public ID",children:[e.jsx(ys,{className:"w-3 h-3"}),"Key"]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"type-data-sm font-mono text-fg-primary truncate max-w-[140px]",title:s.identity_key,children:[s.identity_key.slice(0,16),"…"]}),e.jsx("button",{type:"button",onClick:n,className:"inline-flex items-center gap-0.5",children:e.jsx(V,{color:a?"green":"zinc",children:a?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-3 h-3"}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(We,{className:"w-3 h-3"}),"Copy"]})})})]})]}),(((R=s.settings)==null?void 0:R.latitude)!=null||((w=s.settings)==null?void 0:w.longitude)!=null)&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"type-data-xs text-fg-muted flex items-center gap-1",children:[e.jsx(J,{className:"w-3 h-3"}),"Location"]}),e.jsxs("span",{className:"type-data-sm font-mono text-fg-primary",title:`${((D=s.settings)==null?void 0:D.latitude)??"—"}, ${((P=s.settings)==null?void 0:P.longitude)??"—"}`,children:[((O=(A=s.settings)==null?void 0:A.latitude)==null?void 0:O.toFixed(4))??"—",", ",((K=($=s.settings)==null?void 0:$.longitude)==null?void 0:K.toFixed(4))??"—"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-fg-muted",children:"Passwords"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs(V,{color:(T=s.settings)!=null&&T.admin_password?"green":"zinc",children:[((B=s.settings)==null?void 0:B.admin_password)&&e.jsx(W,{className:"w-3 h-3"}),"Admin"]}),e.jsxs(V,{color:(h=s.settings)!=null&&h.guest_password?"green":"zinc",children:[((v=s.settings)==null?void 0:v.guest_password)&&e.jsx(W,{className:"w-3 h-3"}),"Guest"]})]})]}),e.jsx("div",{className:"pt-3",children:e.jsx(Ks,{name:s.name,onSend:t})})]}):e.jsx("p",{className:"type-data-xs text-fg-muted text-center py-3",children:"No identity configured"})]})}function Fs({selectedIdentity:s,clients:t,messages:l,onSendAdvert:a}){const{terminalMode:r}=X(),n=o.useCallback(async c=>{Te.setState(m=>({clients:m.clients.filter(d=>d.pubkey!==c)})),await Ye({public_key:c})},[]);return r?e.jsxs("div",{className:"flex flex-col h-full gap-1.5",children:[s&&e.jsx("div",{className:"hidden lg:block",children:e.jsx("div",{className:"card-terminal-header flex-shrink-0",children:e.jsx("div",{className:"header-well flex-1",children:e.jsx(I,{icon:e.jsx(ee,{}),onPress:()=>a(s.name),title:"Send room server advert",indicators:[{label:"ADVERTISE",trackPress:!0},{label:"ACTIVE",active:s.registered}]})})})}),e.jsxs("div",{className:"flex flex-col flex-1 min-h-0 gap-1.5",children:[e.jsx("div",{className:"card-terminal-header flex-shrink-0",children:e.jsx("span",{className:"seven-seg-panel",children:e.jsx(Q,{text:`OnLInE ${String(t.length).padStart(3,"0")}`,size:24})})}),e.jsx(G,{noPadding:!0,className:"!h-auto flex flex-col flex-1 min-h-0 overflow-hidden card-terminal",children:e.jsx("div",{className:"card-terminal-well flex-1 min-h-0 overflow-y-auto",children:e.jsx(Se,{clients:t,onRemove:n,messages:l,terminalMode:!0})})}),e.jsxs("div",{className:"card-terminal-header flex-shrink-0",children:[e.jsx("span",{className:"seven-seg-panel",children:e.jsx(Q,{text:`StAtUS ${s!=null&&s.registered?"On":"OFF"}`,size:24})}),s&&e.jsx("div",{className:"lg:hidden flex-1 flex min-w-0",children:e.jsx("div",{className:"header-well flex-1 !flex-shrink",children:e.jsx(I,{icon:e.jsx(ee,{}),onPress:()=>a(s.name),title:"Send room server advert",className:"flex-row-reverse",indicators:[{label:"ACTIVE",active:s.registered},{label:"ADVERTISE",trackPress:!0}]})})})]}),e.jsx(G,{noPadding:!0,className:"!h-auto flex-shrink-0 overflow-hidden card-terminal",children:e.jsx("div",{className:"card-terminal-well px-4 py-3 type-data-sm",children:e.jsx(_e,{identity:s,onSendAdvert:a})})})]})]}):e.jsxs(G,{compact:!0,className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsx(se,{listHeader:!0,icon:e.jsx(Le,{className:"icon-sm"}),title:"Clients",actions:t.length>0?e.jsx("span",{className:"type-data-xs text-fg-muted",children:t.length}):void 0}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsx(Se,{clients:t,onRemove:n,messages:l,terminalMode:!1})}),e.jsx(_e,{identity:s,onSendAdvert:a})]})}function tt(){const s=Ie(),t=Xe(),l=Ze(),a=Je(),r=Qe(),n=es(),c=ss(),m=ts(),d=as(),i=ns(),u=o.useMemo(()=>(d==null?void 0:d.neighbors)??{},[d==null?void 0:d.neighbors]),x=Ts(u,i),f=o.useMemo(()=>n.map(h=>{if(h.name)return h;const v=x(h.pubkey);return v.name?{...h,name:v.name}:h}),[n,x]),j=o.useMemo(()=>r.map(h=>{if(h.author_name||h.author_pubkey==="server"||h.author_pubkey==="system")return h;const v=x(h.author_pubkey);return v.name?{...h,author_name:v.name}:h}),[r,x]),{selectRoom:y,postMessage:g,deleteMessage:E,clearMessages:C,createRoom:S,updateRoom:b,deleteRoom:_,sendAdvert:N,markAsRead:M,startActivePolling:k}=Te.getState(),[R,w]=o.useState(!1),[D,P]=o.useState("create"),[A,O]=o.useState("hybrid");o.useEffect(()=>{M()},[t,M]),o.useEffect(()=>k(),[k]);const $=o.useCallback(async h=>t?g({room_name:t,message:h,author_pubkey:"server"}):!1,[t,g]),K=o.useCallback((h="hybrid")=>{O(h),P("create"),w(!0)},[]),T=o.useCallback(()=>{P("edit"),w(!0)},[]),B=e.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 flex-shrink-0",children:[l&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${l.total_messages} message${l.total_messages!==1?"s":""} in this room`,children:[e.jsx(De,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:l.total_messages})]}),e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${l.total_clients} client${l.total_clients!==1?"s":""} connected`,children:[e.jsx(Le,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:l.total_clients})]})]}),e.jsx(Es,{rooms:s,selected:t,onSelect:y,onAdd:()=>K("hybrid")}),s.length>0&&e.jsx(F,{plain:!0,onClick:T,title:"Manage room server",children:e.jsx(rs,{"data-slot":"icon"})})]});return s.length===0&&c.length===0&&!m?e.jsx(be,{children:e.jsxs(pe,{children:[e.jsx(he,{title:"Room Server",icon:e.jsx(Y,{})}),e.jsx(Ls,{onCreateRoom:h=>K(h)}),e.jsx(ye,{open:R,onClose:()=>w(!1),mode:"create",repeaterConfig:d==null?void 0:d.config,onCreate:async h=>{const v=await S(h);return v&&A==="dedicated"&&(await xe.getState().setMode("monitor"),xe.getState().clearModeMutation()),v},onUpdate:b,onDelete:_,onSendAdvert:N})]})}):e.jsx(be,{children:e.jsxs(pe,{children:[e.jsx(he,{title:"Room Server",icon:e.jsx(Y,{}),controls:B}),e.jsx(ls,{children:e.jsxs(os,{template:"hero-tall",className:"!h-[calc(100vh-11rem)] !min-h-[400px]",children:[e.jsx(ge,{span:12,lg:8,className:"h-full",children:e.jsx(Ps,{selectedName:t,selectedIdentity:a,messages:j,onSend:$,onDelete:E,onClear:C})}),e.jsx(ge,{span:12,lg:4,className:"h-full",children:e.jsx(Fs,{selectedIdentity:a,clients:f,messages:j,onSendAdvert:N})})]})}),e.jsx(ye,{open:R,onClose:()=>w(!1),mode:D,identity:a,repeaterConfig:d==null?void 0:d.config,onCreate:S,onUpdate:b,onDelete:_,onSendAdvert:N})]})})}export{tt as default}; + */const _s=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]],Ms=U("user-x",_s);function z({disabled:s,className:t,children:l}){return e.jsx(Fe,{disabled:s,className:L("flex flex-col gap-2",t),children:l})}function H({required:s,className:t,children:l,...a}){return e.jsxs(Oe,{className:L("text-sm font-medium text-fg-primary select-none","data-[disabled]:opacity-50",a.title&&"cursor-help",t),...a,children:[l,s&&e.jsx("span",{className:"text-sys-red ml-0.5","aria-hidden":"true",children:"*"})]})}function Rs({className:s,children:t,...l}){return e.jsx(Be,{className:L("text-sm text-fg-muted","data-[disabled]:opacity-50",s),...l,children:t})}function Ts(s,t){return o.useMemo(()=>{const a=new Map;for(const[n,c]of Object.entries(s)){const m=c.name||c.node_name||null,{type:d}=is(c);a.set(n.toLowerCase(),{name:m,type:d})}const r=new Map;for(let n=t.length-1;n>=0;n--){const c=t[n];if(!c._advertSender)continue;const m=c._advertSender.toLowerCase();if(r.has(m))continue;const d=c._advertName??null,i=c._advertNodeType!=null?cs(c._advertNodeType):"companion";r.set(m,{name:d,type:i})}return function(c){const m=c.toLowerCase(),d=a.get(m);if(d!=null&&d.name)return d;const i=r.get(m);return i!=null&&i.name?i:d||i||{name:null,type:"companion"}}},[s,t])}function ve({icon:s,title:t,description:l,onClick:a,accent:r}){return e.jsxs("button",{onClick:a,className:L("flex flex-col items-center gap-3 p-6 rounded-2xl text-center","ring-1 ring-edge-subtle hover:ring-2 transition-all duration-150","w-full max-w-[260px]",r==="primary"?"hover:ring-sys-blue hover:bg-sys-blue/5":"hover:ring-sys-indigo hover:bg-sys-indigo/5"),children:[e.jsx("div",{className:L("p-3 rounded-xl",r==="primary"?"bg-sys-blue/10 text-sys-blue":"bg-sys-indigo/10 text-sys-indigo"),children:s}),e.jsx("p",{className:"type-body-sm font-medium text-fg-primary",children:t}),e.jsx("p",{className:"type-data-xs text-fg-muted leading-relaxed",children:l})]})}function Ls({onCreateRoom:s}){return e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 px-4",children:[e.jsx(Y,{className:"w-12 h-12 text-fg-muted opacity-30 mb-4"}),e.jsx("p",{className:"type-subheading text-fg-secondary mb-1",children:"Add a Room Server"}),e.jsx("p",{className:"type-body-sm text-fg-muted mb-8",children:"Choose how this device should operate."}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[e.jsx(ve,{icon:e.jsx(Cs,{className:"w-6 h-6"}),title:"Repeater + Room Server",description:"Keep forwarding packets and add group messaging.",onClick:()=>s("hybrid"),accent:"primary"}),e.jsx(ve,{icon:e.jsx(qe,{className:"w-6 h-6"}),title:"Dedicated Room Server",description:"Stop repeating. Focus entirely on room server duties.",onClick:()=>s("dedicated"),accent:"secondary"})]})]})}function Es({rooms:s,selected:t,onSelect:l,onAdd:a}){const r=a?e.jsx("button",{onClick:a,className:L("flex items-center justify-center px-2 py-1 rounded-md","text-fg-muted hover:text-fg-primary hover:bg-surface/60","transition-all duration-150"),title:"Add room server",children:e.jsx(xs,{className:"w-4 h-4"})}):null;return s.length<=1?r:s.length<=3?e.jsxs("div",{className:"flex items-center gap-0.5 p-0.5 rounded-lg bg-subtle-fill",children:[s.map(n=>e.jsx("button",{onClick:()=>l(n.room_name),className:L("px-3 py-1 rounded-md text-sm font-medium transition-all duration-150",n.room_name===t?"bg-surface text-fg-primary shadow-sm":"text-fg-muted hover:text-fg-secondary"),children:n.room_name},n.room_name)),r]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ds,{value:t??"",onChange:l,children:s.map(n=>e.jsx(ms,{value:n.room_name,children:e.jsx(us,{children:n.room_name})},n.room_name))}),r]})}function Ds(s){if(!s)return"";const t=s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return t?`${t}-room`:""}function ye({open:s,onClose:t,mode:l,identity:a,repeaterConfig:r,onCreate:n,onUpdate:c,onDelete:m,onSendAdvert:d}){var te,ae,ne,re,le,oe,ie,ce,de;const i=l==="edit"&&a,u=`${s}-${(a==null?void 0:a.name)??""}-${l}`,[x,f]=o.useState(""),[j,y]=o.useState(""),[g,E]=o.useState(!1),[C,S]=o.useState(""),[b,_]=o.useState(""),[N,M]=o.useState(""),[k,R]=o.useState(""),[w,D]=o.useState(!1),[P,A]=o.useState(!1),[O,$]=o.useState(!1),[K,T]=o.useState(null),[B,h]=o.useState(u);if(u!==B)if(h(u),T(null),D(!1),A(!1),$(!1),i)f(((te=a.settings)==null?void 0:te.node_name)??a.name),y(a.identity_key??""),E(!1),S(((ae=a.settings)==null?void 0:ae.admin_password)??""),_(((ne=a.settings)==null?void 0:ne.guest_password)??""),M(((le=(re=a.settings)==null?void 0:re.latitude)==null?void 0:le.toString())??""),R(((ie=(oe=a.settings)==null?void 0:oe.longitude)==null?void 0:ie.toString())??"");else{const p=r;f(""),y(""),E(!1),S(""),_(""),M(((ce=p==null?void 0:p.repeater)==null?void 0:ce.latitude)!=null?p.repeater.latitude.toString():""),R(((de=p==null?void 0:p.repeater)==null?void 0:de.longitude)!=null?p.repeater.longitude.toString():"")}const v=o.useCallback(()=>{const p={};return x&&(p.node_name=x),C&&(p.admin_password=C),b&&(p.guest_password=b),N!==""&&(p.latitude=parseFloat(N)),k!==""&&(p.longitude=parseFloat(k)),p},[x,C,b,N,k]),Ae=o.useCallback(async()=>{if(!x.trim()){T("Room name is required");return}D(!0),T(null);const p=i?a.name:Ds(x);let J;if(i)J=await c({name:a.name,settings:v()});else{const me={name:p,type:"room_server",settings:v()};j.trim()&&(me.identity_key=j.trim()),J=await n(me)}D(!1),J?t():T("Failed to save. Check that the name is unique and passwords differ.")},[x,i,a,v,n,c,t]),$e=o.useCallback(async()=>{if(!i)return;A(!0);const p=await m(a.name);A(!1),p&&t()},[i,a,m,t]),Ke=o.useCallback(async()=>{i&&($(!0),await d(a.name),$(!1))},[i,a,d]);return e.jsxs(ze,{open:s,onClose:t,size:"md",children:[e.jsx(He,{icon:i?void 0:e.jsx(ks,{className:"w-5 h-5"}),title:i?"Edit Room Server":"Add Room Server",onClose:t}),e.jsx(Ge,{children:e.jsxs("div",{className:"space-y-5",children:[i&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{color:a.registered?"green":"red",children:a.registered?"Active":"Inactive"}),a.identity_key&&e.jsxs("span",{className:"type-data-xs text-fg-muted truncate",title:a.identity_key,children:["Key: ",a.identity_key.slice(0,16),"…"]})]}),e.jsxs(z,{children:[e.jsx(H,{title:"What people see on the mesh",children:"Room Name"}),e.jsx(q,{value:x,onChange:p=>f(p.target.value),placeholder:"Room Name"})]}),!i&&e.jsxs(z,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(H,{title:"The unique hex public ID",children:["Identity Key ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx("button",{type:"button",onClick:()=>E(p=>!p),className:"type-data-xs text-fg-muted underline hover:text-fg-secondary",children:g?"Hide":"Show"})]}),g&&e.jsxs(e.Fragment,{children:[e.jsx(q,{value:j,onChange:p=>y(p.target.value),placeholder:"Leave empty to auto-generate"}),e.jsx(Rs,{children:"Leave empty to automatically generate a secure key"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(z,{children:[e.jsxs(H,{children:[e.jsx(Z,{className:"inline w-3.5 h-3.5 -mt-0.5 mr-1 text-fg-muted"}),"Latitude"]}),e.jsx(q,{type:"number",step:"any",value:N,onChange:p=>M(p.target.value),placeholder:"0"})]}),e.jsxs(z,{children:[e.jsxs(H,{children:[e.jsx(Z,{className:"inline w-3.5 h-3.5 -mt-0.5 mr-1 text-fg-muted"}),"Longitude"]}),e.jsx(q,{type:"number",step:"any",value:k,onChange:p=>R(p.target.value),placeholder:"0"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs(z,{children:[e.jsxs(H,{title:"Full access to room server",children:["Admin Password ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx(q,{type:"password",value:C,onChange:p=>S(p.target.value),placeholder:"None Set"})]}),e.jsxs(z,{children:[e.jsxs(H,{title:"Can post and read, but not administer the room",children:["Guest Password ",e.jsx("span",{className:"text-fg-muted font-normal",children:"(Optional)"})]}),e.jsx(q,{type:"password",value:b,onChange:p=>_(p.target.value),placeholder:"None Set"})]})]}),K&&e.jsx("p",{className:"type-data-xs text-sys-red",children:K})]})}),e.jsxs(Ue,{children:[i&&e.jsxs("div",{className:"flex items-center gap-2 mr-auto",children:[e.jsxs(F,{color:"danger",plain:!0,onClick:$e,disabled:P,children:[e.jsx(Ee,{"data-slot":"icon"}),P?"Deleting…":"Delete"]}),e.jsxs(F,{color:"primary",plain:!0,onClick:Ke,disabled:O,children:[e.jsx(Me,{"data-slot":"icon"}),O?"Sending…":"Send Advert"]})]}),e.jsx(F,{plain:!0,onClick:t,children:"Cancel"}),e.jsx(F,{color:"primary",onClick:Ae,disabled:w,children:w?"Saving…":i?"Save Changes":"Create"})]})]})}const Pe=o.createContext(null),Ne="room-tui";function be({children:s}){const[t,l]=o.useState(()=>localStorage.getItem(Ne)!=="0"),a=o.useCallback(()=>{l(r=>{const n=!r;return localStorage.setItem(Ne,n?"1":"0"),n})},[]);return e.jsx(Pe.Provider,{value:{terminalMode:t,toggleTerminalMode:a},children:s})}function X(){const s=o.useContext(Pe);if(!s)throw new Error("useTerminalMode must be used within RoomTerminalProvider");return s}const ke=s=>s.author_pubkey==="server"||s.author_pubkey==="system";function we({messages:s,onDelete:t,terminalMode:l,serverName:a}){const r=o.useRef(null),[n,c]=o.useState(!1),m=o.useMemo(()=>[...s].sort((u,x)=>u.post_timestamp-x.post_timestamp),[s]);o.useEffect(()=>{!n&&r.current&&(r.current.scrollTop=0)},[m.length,n]);const d=o.useCallback(()=>{r.current&&c(r.current.scrollTop<-100)},[]),i=o.useCallback(()=>{r.current&&r.current.scrollTo({top:0,behavior:"smooth"}),c(!1)},[]);return m.length===0?e.jsx("div",{className:`flex-1 flex flex-col items-center justify-center py-12 min-h-0${l?" font-mono":""}`,children:l?e.jsx("p",{className:"text-sm font-mono",style:{color:"var(--tui-accent)",opacity:.4},children:"> no messages in buffer_"}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"w-10 h-10 text-fg-muted opacity-20 mb-2"}),e.jsx("p",{className:"type-data-sm text-fg-muted",children:"No messages yet"})]})}):l?e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:r,onScroll:d,className:"h-full overflow-y-auto scroll-smooth p-4 font-mono text-sm leading-relaxed flex flex-col-reverse",children:e.jsx("div",{children:m.map(u=>{const x=ke(u),f=new Date(u.post_timestamp*1e3).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),j=x?"SYS":u.author_name||u.author_prefix,y=!x&&a&&j===a;return e.jsxs("div",{className:"group flex items-start gap-0 -mx-4 px-4 py-px",style:{"--tw-hover-bg":"var(--tui-hover-bg)"},onMouseEnter:g=>g.currentTarget.style.background="var(--tui-hover-bg)",onMouseLeave:g=>g.currentTarget.style.background="",children:[e.jsxs("span",{className:"select-none shrink-0",style:{color:"var(--tui-muted)"},children:["[",f,"]"]}),e.jsxs("span",{className:"mx-1.5 shrink-0",style:{color:y?"var(--tui-accent-local)":"var(--tui-accent)"},children:["<",j,">"]}),e.jsx("span",{style:{color:x?"var(--tui-system)":y?"var(--tui-body)":"var(--tui-accent)"},className:x?"italic":"",children:u.message_text}),e.jsx("button",{onClick:()=>t(u.id),className:"opacity-0 group-hover:opacity-100 ml-auto pl-2 shrink-0 transition-colors",style:{color:"var(--tui-muted)"},onMouseEnter:g=>g.currentTarget.style.color="var(--tui-danger)",onMouseLeave:g=>g.currentTarget.style.color="var(--tui-muted)",title:"Delete",children:"×"})]},u.id)})})}),n&&e.jsxs("button",{onClick:i,className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1.5 px-3 py-1 font-mono text-xs transition-colors duration-150",style:{background:"var(--tui-hover-bg)",border:"1px solid var(--tui-muted)",color:"var(--tui-accent)"},children:[e.jsx(ue,{className:"w-3 h-3"}),"↓ scroll"]})]}):e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:r,onScroll:d,className:"h-full overflow-y-auto scroll-smooth flex flex-col-reverse",children:e.jsx("div",{className:"space-y-3 p-4",children:m.map(u=>ke(u)?e.jsx(ps,{text:u.message_text},u.id):e.jsx(hs,{senderName:u.author_name||u.author_prefix,text:u.message_text,timestamp:u.post_timestamp,bubbleAccessory:e.jsx("button",{onClick:()=>t(u.id),className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150 p-1 text-fg-muted hover:text-sys-red flex-shrink-0",title:"Delete message",children:e.jsx(Ee,{className:"w-3.5 h-3.5"})})},u.id))})}),n&&e.jsxs("button",{onClick:i,className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-surface/90 backdrop-blur-sm ring-1 ring-edge-subtle shadow-md text-fg-secondary hover:text-fg-primary transition-colors duration-150",children:[e.jsx(ue,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"type-data-xs",children:"New messages"})]})]})}function Ce({roomName:s,onSend:t,disabled:l,terminalMode:a}){const[r,n]=o.useState(""),[c,m]=o.useState(!1),d=o.useRef(null),i=o.useCallback(async()=>{var j;const x=r.trim();if(!x||c)return;m(!0);const f=await t(x);m(!1),f&&(n(""),(j=d.current)==null||j.focus())},[r,c,t]),u=o.useCallback(x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),i())},[i]);return a?e.jsxs("div",{className:"flex items-center gap-0 px-4 py-2 type-data-sm",children:[e.jsx("input",{ref:d,type:"text",value:r,onChange:x=>n(x.target.value),onKeyDown:u,placeholder:"type message...",disabled:l||c,className:"flex-1 bg-transparent outline-none ring-0 shadow-none border-none focus:outline-none focus:ring-0 font-mono tui-input",style:{color:"var(--tui-body)"}}),e.jsx("button",{onClick:i,disabled:!r.trim()||c||l,className:"transition-colors duration-100 px-1 font-mono text-xs disabled:opacity-30",style:{color:"var(--tui-accent)"},title:"Send",children:"[↵]"})]}):e.jsxs("div",{className:"flex items-center gap-2 p-3 border-t border-edge-subtle",children:[e.jsx("input",{ref:d,type:"text",value:r,onChange:x=>n(x.target.value),onKeyDown:u,placeholder:`Message ${s}…`,disabled:l||c,className:"flex-1 surface-input radius-inner px-3 py-2 type-body-sm text-fg-primary placeholder:text-fg-muted outline-none ring-focus"}),e.jsx("button",{onClick:i,disabled:!r.trim()||c||l,className:"p-2 rounded-lg text-sys-blue hover:bg-sys-blue/10 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150",title:"Send message",children:e.jsx(Me,{className:"w-4.5 h-4.5"})})]})}function Ps({selectedName:s,selectedIdentity:t,messages:l,onSend:a,onDelete:r,onClear:n}){var f;const{terminalMode:c,toggleTerminalMode:m}=X(),[d,i]=o.useState(!1),u=((f=t==null?void 0:t.settings)==null?void 0:f.node_name)??s??void 0,x=o.useCallback(()=>{i(!1),n()},[n]);return c?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col h-full gap-1.5",children:[e.jsxs("div",{className:"card-terminal-header flex-shrink-0",children:[e.jsx("span",{className:"seven-seg-panel",children:e.jsx(Q,{text:"chat",minChars:7,size:24})}),e.jsx("div",{className:"card-terminal-ridge flex-1"}),e.jsxs("div",{className:"header-well",children:[e.jsx(I,{icon:e.jsx(je,{className:"!w-5.5 !h-5.5 translate-y-px"}),onClick:m,title:"Exit terminal mode"}),l.length>0&&e.jsx(I,{icon:e.jsx("span",{className:"text-[13px] font-bold font-mono leading-none translate-y-px",children:"DEL"}),onClick:()=>i(!0),title:"Clear all messages",variant:"red",iconActiveColor:Ve.red})]})]}),e.jsx(G,{noPadding:!0,className:"flex flex-col flex-1 min-h-0 overflow-hidden card-terminal",children:e.jsxs("div",{className:"card-terminal-well flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsx(we,{messages:l,onDelete:r,terminalMode:!0,serverName:u}),e.jsx("div",{className:"card-terminal-divider"}),s&&e.jsx(Ce,{roomName:s,onSend:a,disabled:!(t!=null&&t.registered),terminalMode:!0})]})})]}),e.jsx(fe,{isOpen:d,title:"Clear All Messages",message:`This will permanently delete all ${l.length} message${l.length===1?"":"s"} from this room. This cannot be undone.`,confirmLabel:"Clear Messages",variant:"danger",onConfirm:x,onCancel:()=>i(!1)})]}):e.jsxs(e.Fragment,{children:[e.jsxs(G,{noPadding:!0,className:"flex flex-col h-full overflow-hidden",children:[e.jsx(se,{listHeader:!0,icon:e.jsx(De,{className:"icon-sm"}),title:"Messages",actions:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(F,{plain:!0,onClick:m,title:"Terminal mode",children:e.jsx(je,{"data-slot":"icon",className:"!w-5 !h-5 translate-y-px"})}),l.length>0&&e.jsx(F,{plain:!0,onClick:()=>i(!0),title:"Clear all messages",children:e.jsx("span",{"data-slot":"icon",className:"text-[12px] font-bold font-mono leading-none translate-y-px text-sys-red",children:"DEL"})})]})}),e.jsx(we,{messages:l,onDelete:r,terminalMode:!1,serverName:u}),s&&e.jsx(Ce,{roomName:s,onSend:a,disabled:!(t!=null&&t.registered),terminalMode:!1})]}),e.jsx(fe,{isOpen:d,title:"Clear All Messages",message:`This will permanently delete all ${l.length} message${l.length===1?"":"s"} from this room. This cannot be undone.`,confirmLabel:"Clear Messages",variant:"danger",onConfirm:x,onCancel:()=>i(!1)})]})}function As({pubkey:s,className:t}){const[l,a]=o.useState(!1),r=o.useCallback(async()=>{await Re(s),a(!0),setTimeout(()=>a(!1),1500)},[s]);return e.jsxs("button",{onClick:r,title:l?"Copied!":"Copy public key",className:`inline-flex items-center gap-1 type-data-xs leading-tight text-fg-muted hover:text-fg-secondary transition-colors duration-150 cursor-copy ${t??""}`,children:[e.jsx("span",{className:"truncate min-w-0",children:s.slice(0,8)}),l&&e.jsx(W,{className:"w-2.5 h-2.5 text-sys-green flex-shrink-0"})]})}const $s=o.memo(function({client:t,resolvedName:l,onRemove:a}){const r=t.name||l,n=t.unsynced_count===0,c=t.last_activity?new Date(t.last_activity*1e3).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"Never",{emoji:m,cleanName:d}=r?fs(r):{emoji:null,cleanName:t.pubkey_prefix},i=r?js(d):void 0,u=r?vs(r):t.pubkey_prefix.slice(0,2).toUpperCase();return e.jsxs("div",{className:"group flex items-center gap-3 px-3 py-2.5 radius-inner row-hover transition-base",children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx("div",{className:L("w-8 h-8 rounded-full flex items-center justify-center",!i&&"bg-sys-blue/12"),style:i?{backgroundColor:i}:void 0,children:m?e.jsx("span",{className:"text-base leading-none",children:m}):e.jsx("span",{className:L("leading-none",i?"text-white text-[11px] font-bold tracking-tight":"text-sys-blue font-mono text-[11px]"),children:u})}),e.jsx("span",{className:`absolute -bottom-0.5 -right-0.5 w-2.5 h-2.5 rounded-sm ring-2 ring-surface ${n?"bg-sys-green":"bg-sys-indigo"}`})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[r?e.jsx("p",{className:"text-[13px] font-medium leading-tight text-fg-primary truncate",children:r}):e.jsx("p",{className:"font-mono text-[13px] leading-tight text-fg-primary truncate",children:t.pubkey_prefix}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[r&&e.jsx(As,{pubkey:t.pubkey}),r&&e.jsx("span",{className:"text-xs text-fg-muted/40",children:"·"}),e.jsxs("span",{className:"text-xs leading-tight text-fg-muted truncate",children:[!n&&e.jsxs("span",{className:"text-sys-indigo",children:[t.unsynced_count," unsynced · "]}),c]})]})]}),e.jsx("button",{onClick:()=>a(t.pubkey),className:"opacity-0 group-hover:opacity-100 transition-opacity duration-150 p-1.5 -mr-1 rounded-md text-fg-muted hover:text-sys-red hover:bg-sys-red/8",title:"Remove client",children:e.jsx(Ms,{className:"w-3.5 h-3.5"})})]})});function Se({clients:s,onRemove:t,messages:l,terminalMode:a}){const r=o.useMemo(()=>{const n=new Map;if(!l)return n;for(let c=l.length-1;c>=0;c--){const m=l[c];m.author_name&&m.author_pubkey&&m.author_pubkey!=="server"&&m.author_pubkey!=="system"&&n.set(m.author_pubkey,m.author_name)}return n},[l]);return s.length===0?a?e.jsx("p",{className:"type-data-sm text-left px-4 py-4",style:{color:"var(--tui-accent)"},children:"< NO CLIENTS CONNECTED >"}):e.jsx("p",{className:"type-data-xs text-fg-muted text-center py-4",children:"No clients connected"}):a?e.jsx("div",{className:"type-data-sm pt-2",children:s.map(n=>{const c=n.name||r.get(n.pubkey),m=n.unsynced_count===0,d=n.pubkey_prefix;return e.jsxs("div",{className:"group flex items-center gap-0 -mx-0 px-4 py-0.5",onMouseEnter:i=>i.currentTarget.style.background="var(--tui-hover-bg)",onMouseLeave:i=>i.currentTarget.style.background="",children:[e.jsx("span",{style:{color:m?"var(--tui-accent)":"var(--tui-warn)"},children:"■"}),e.jsx("span",{className:"ml-2 shrink-0",style:{color:"var(--tui-accent)"},children:c||d}),c&&e.jsxs("span",{className:"ml-1.5 shrink-0",style:{color:"var(--tui-accent)"},children:["[",d,"]"]}),!m&&e.jsxs("span",{className:"ml-1.5",style:{color:"var(--tui-warn)"},children:[n.unsynced_count,"unsync"]}),e.jsx("button",{onClick:()=>t(n.pubkey),className:"opacity-0 group-hover:opacity-100 ml-auto pl-2 shrink-0 transition-colors",style:{color:"var(--tui-muted)"},onMouseEnter:i=>i.currentTarget.style.color="var(--tui-danger)",onMouseLeave:i=>i.currentTarget.style.color="var(--tui-muted)",title:"Remove",children:"×"})]},n.pubkey)})}):e.jsx("div",{className:"space-y-0.5 pt-1",children:s.map(n=>e.jsx($s,{client:n,resolvedName:r.get(n.pubkey),onRemove:t},n.pubkey))})}function Ks({name:s,onSend:t}){const{terminalMode:l}=X(),[a,r]=o.useState("idle"),n=o.useRef(),c=o.useCallback(async()=>{if(a==="sending")return;r("sending");const m=await t(s);r(m?"sent":"idle"),m&&(n.current=setTimeout(()=>r("idle"),2e3))},[s,t,a]);return o.useEffect(()=>()=>clearTimeout(n.current),[]),l?e.jsxs("button",{className:"btn-terminal",onClick:c,disabled:a==="sending",children:[a==="idle"&&"[ send_advert ]",a==="sending"&&"[ broadcasting... ]",a==="sent"&&"[ sent ✓ ]"]}):e.jsxs(F,{color:a==="sent"?"success":"primary",className:"w-full",onClick:c,disabled:a==="sending",children:[e.jsx(ee,{"data-slot":"icon"}),a==="idle"&&"Send Advert",a==="sending"&&"Broadcasting…",a==="sent"&&"Advert Sent"]})}function _e({identity:s,onSendAdvert:t}){var c,m,d,i,u,x,f,j,y,g,E,C,S,b,_,N,M,k,R,w,D,P,A,O,$,K,T,B,h,v;const{terminalMode:l}=X(),[a,r]=o.useState(!1),n=o.useCallback(async()=>{s!=null&&s.identity_key&&(await Re(s.identity_key),r(!0),setTimeout(()=>r(!1),1500))},[s==null?void 0:s.identity_key]);return l?s?e.jsxs("div",{className:"space-y-1",children:[((c=s.settings)==null?void 0:c.node_name)&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"node"}),e.jsx("span",{style:{color:"var(--tui-accent)"},children:s.settings.node_name})]}),(s.address||((m=s.runtime)==null?void 0:m.address))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"addr"}),e.jsx("span",{style:{color:"var(--tui-accent)"},children:s.address||((d=s.runtime)==null?void 0:d.address)})]}),s.identity_key&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"key"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"truncate max-w-[140px]",style:{color:"var(--tui-accent)"},title:s.identity_key,children:[s.identity_key.slice(0,16),"…"]}),e.jsx("button",{type:"button",onClick:n,className:"text-xs",style:{color:"var(--tui-muted)"},children:a?"[copied ✓]":"[copy]"})]})]}),(((i=s.settings)==null?void 0:i.latitude)!=null||((u=s.settings)==null?void 0:u.longitude)!=null)&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"loc"}),e.jsxs("span",{style:{color:"var(--tui-accent)"},title:`${((x=s.settings)==null?void 0:x.latitude)??"—"}, ${((f=s.settings)==null?void 0:f.longitude)??"—"}`,children:[((y=(j=s.settings)==null?void 0:j.latitude)==null?void 0:y.toFixed(4))??"—",", ",((E=(g=s.settings)==null?void 0:g.longitude)==null?void 0:E.toFixed(4))??"—"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{style:{color:"var(--tui-muted)"},children:"pass"}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{style:{color:(C=s.settings)!=null&&C.admin_password?"var(--tui-accent)":"var(--tui-muted)"},children:(S=s.settings)!=null&&S.admin_password?"[✓ admin]":"[— admin]"}),e.jsx("span",{style:{color:(b=s.settings)!=null&&b.guest_password?"var(--tui-accent)":"var(--tui-muted)"},children:(_=s.settings)!=null&&_.guest_password?"[✓ guest]":"[— guest]"})]})]})]}):e.jsx("span",{style:{color:"var(--tui-muted)"},children:"no identity configured"}):e.jsxs("div",{className:"flex-shrink-0 border-t border-edge-subtle",children:[e.jsx(se,{listHeader:!0,icon:e.jsx(gs,{className:"icon-sm"}),title:"Room Info"}),s?e.jsxs("div",{className:"space-y-2 px-4 py-3",children:[((N=s.settings)==null?void 0:N.node_name)&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-fg-muted",children:"Node"}),e.jsx("span",{className:"type-data-sm text-fg-primary",children:s.settings.node_name})]}),(s.address||((M=s.runtime)==null?void 0:M.address))&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-fg-muted",children:"Address"}),e.jsx("span",{className:"type-data-sm font-mono text-fg-primary",children:s.address||((k=s.runtime)==null?void 0:k.address)})]}),s.identity_key&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"type-data-xs text-fg-muted flex items-center gap-1",title:"The unique hex public ID",children:[e.jsx(ys,{className:"w-3 h-3"}),"Key"]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("span",{className:"type-data-sm font-mono text-fg-primary truncate max-w-[140px]",title:s.identity_key,children:[s.identity_key.slice(0,16),"…"]}),e.jsx("button",{type:"button",onClick:n,className:"inline-flex items-center gap-0.5",children:e.jsx(V,{color:a?"green":"zinc",children:a?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-3 h-3"}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(We,{className:"w-3 h-3"}),"Copy"]})})})]})]}),(((R=s.settings)==null?void 0:R.latitude)!=null||((w=s.settings)==null?void 0:w.longitude)!=null)&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"type-data-xs text-fg-muted flex items-center gap-1",children:[e.jsx(Z,{className:"w-3 h-3"}),"Location"]}),e.jsxs("span",{className:"type-data-sm font-mono text-fg-primary",title:`${((D=s.settings)==null?void 0:D.latitude)??"—"}, ${((P=s.settings)==null?void 0:P.longitude)??"—"}`,children:[((O=(A=s.settings)==null?void 0:A.latitude)==null?void 0:O.toFixed(4))??"—",", ",((K=($=s.settings)==null?void 0:$.longitude)==null?void 0:K.toFixed(4))??"—"]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-xs text-fg-muted",children:"Passwords"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs(V,{color:(T=s.settings)!=null&&T.admin_password?"green":"zinc",children:[((B=s.settings)==null?void 0:B.admin_password)&&e.jsx(W,{className:"w-3 h-3"}),"Admin"]}),e.jsxs(V,{color:(h=s.settings)!=null&&h.guest_password?"green":"zinc",children:[((v=s.settings)==null?void 0:v.guest_password)&&e.jsx(W,{className:"w-3 h-3"}),"Guest"]})]})]}),e.jsx("div",{className:"pt-3",children:e.jsx(Ks,{name:s.name,onSend:t})})]}):e.jsx("p",{className:"type-data-xs text-fg-muted text-center py-3",children:"No identity configured"})]})}function Fs({selectedIdentity:s,clients:t,messages:l,onSendAdvert:a}){const{terminalMode:r}=X(),n=o.useCallback(async c=>{Te.setState(m=>({clients:m.clients.filter(d=>d.pubkey!==c)})),await Ye({public_key:c})},[]);return r?e.jsxs("div",{className:"flex flex-col h-full gap-1.5",children:[s&&e.jsx("div",{className:"hidden lg:block",children:e.jsx("div",{className:"card-terminal-header flex-shrink-0",children:e.jsx("div",{className:"header-well flex-1",children:e.jsx(I,{icon:e.jsx(ee,{}),onPress:()=>a(s.name),title:"Send room server advert",indicators:[{label:"ADVERTISE",trackPress:!0},{label:"ACTIVE",active:s.registered}]})})})}),e.jsxs("div",{className:"flex flex-col flex-1 min-h-0 gap-1.5",children:[e.jsx("div",{className:"card-terminal-header flex-shrink-0",children:e.jsx("span",{className:"seven-seg-panel",children:e.jsx(Q,{text:`OnLInE ${String(t.length).padStart(3,"0")}`,size:24})})}),e.jsx(G,{noPadding:!0,className:"!h-auto flex flex-col flex-1 min-h-0 overflow-hidden card-terminal",children:e.jsx("div",{className:"card-terminal-well flex-1 min-h-0 overflow-y-auto",children:e.jsx(Se,{clients:t,onRemove:n,messages:l,terminalMode:!0})})}),e.jsxs("div",{className:"card-terminal-header flex-shrink-0",children:[e.jsx("span",{className:"seven-seg-panel",children:e.jsx(Q,{text:`StAtUS ${s!=null&&s.registered?"On":"OFF"}`,size:24})}),s&&e.jsx("div",{className:"lg:hidden flex-1 flex min-w-0",children:e.jsx("div",{className:"header-well flex-1 !flex-shrink",children:e.jsx(I,{icon:e.jsx(ee,{}),onPress:()=>a(s.name),title:"Send room server advert",className:"flex-row-reverse",indicators:[{label:"ACTIVE",active:s.registered},{label:"ADVERTISE",trackPress:!0}]})})})]}),e.jsx(G,{noPadding:!0,className:"!h-auto flex-shrink-0 overflow-hidden card-terminal",children:e.jsx("div",{className:"card-terminal-well px-4 py-3 type-data-sm",children:e.jsx(_e,{identity:s,onSendAdvert:a})})})]})]}):e.jsxs(G,{compact:!0,className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[e.jsx(se,{listHeader:!0,icon:e.jsx(Le,{className:"icon-sm"}),title:"Clients",actions:t.length>0?e.jsx("span",{className:"type-data-xs text-fg-muted",children:t.length}):void 0}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsx(Se,{clients:t,onRemove:n,messages:l,terminalMode:!1})}),e.jsx(_e,{identity:s,onSendAdvert:a})]})}function tt(){const s=Ie(),t=Xe(),l=Je(),a=Ze(),r=Qe(),n=es(),c=ss(),m=ts(),d=as(),i=ns(),u=o.useMemo(()=>(d==null?void 0:d.neighbors)??{},[d==null?void 0:d.neighbors]),x=Ts(u,i),f=o.useMemo(()=>n.map(h=>{if(h.name)return h;const v=x(h.pubkey);return v.name?{...h,name:v.name}:h}),[n,x]),j=o.useMemo(()=>r.map(h=>{if(h.author_name||h.author_pubkey==="server"||h.author_pubkey==="system")return h;const v=x(h.author_pubkey);return v.name?{...h,author_name:v.name}:h}),[r,x]),{selectRoom:y,postMessage:g,deleteMessage:E,clearMessages:C,createRoom:S,updateRoom:b,deleteRoom:_,sendAdvert:N,markAsRead:M,startActivePolling:k}=Te.getState(),[R,w]=o.useState(!1),[D,P]=o.useState("create"),[A,O]=o.useState("hybrid");o.useEffect(()=>{M()},[t,M]),o.useEffect(()=>k(),[k]);const $=o.useCallback(async h=>t?g({room_name:t,message:h,author_pubkey:"server"}):!1,[t,g]),K=o.useCallback((h="hybrid")=>{O(h),P("create"),w(!0)},[]),T=o.useCallback(()=>{P("edit"),w(!0)},[]),B=e.jsxs("div",{className:"flex items-center gap-2 sm:gap-4 flex-shrink-0",children:[l&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${l.total_messages} message${l.total_messages!==1?"s":""} in this room`,children:[e.jsx(De,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:l.total_messages})]}),e.jsxs("span",{className:"data-box flex items-center gap-1.5 cursor-default",title:`${l.total_clients} client${l.total_clients!==1?"s":""} connected`,children:[e.jsx(Le,{className:"w-3.5 h-3.5 text-fg-secondary"}),e.jsx("span",{children:l.total_clients})]})]}),e.jsx(Es,{rooms:s,selected:t,onSelect:y,onAdd:()=>K("hybrid")}),s.length>0&&e.jsx(F,{plain:!0,onClick:T,title:"Manage room server",children:e.jsx(rs,{"data-slot":"icon"})})]});return s.length===0&&c.length===0&&!m?e.jsx(be,{children:e.jsxs(pe,{children:[e.jsx(he,{title:"Room Server",icon:e.jsx(Y,{})}),e.jsx(Ls,{onCreateRoom:h=>K(h)}),e.jsx(ye,{open:R,onClose:()=>w(!1),mode:"create",repeaterConfig:d==null?void 0:d.config,onCreate:async h=>{const v=await S(h);return v&&A==="dedicated"&&(await xe.getState().setMode("monitor"),xe.getState().clearModeMutation()),v},onUpdate:b,onDelete:_,onSendAdvert:N})]})}):e.jsx(be,{children:e.jsxs(pe,{children:[e.jsx(he,{title:"Room Server",icon:e.jsx(Y,{}),controls:B}),e.jsx(ls,{children:e.jsxs(os,{template:"hero-tall",className:"!h-[calc(100vh-11rem)] !min-h-[400px]",children:[e.jsx(ge,{span:12,lg:8,className:"h-full",children:e.jsx(Ps,{selectedName:t,selectedIdentity:a,messages:j,onSend:$,onDelete:E,onClear:C})}),e.jsx(ge,{span:12,lg:4,className:"h-full",children:e.jsx(Fs,{selectedIdentity:a,clients:f,messages:j,onSendAdvert:N})})]})}),e.jsx(ye,{open:R,onClose:()=>w(!1),mode:D,identity:a,repeaterConfig:d==null?void 0:d.config,onCreate:S,onUpdate:b,onDelete:_,onSendAdvert:N})]})})}export{tt as default}; diff --git a/frontend/dist/assets/Sessions-DFCPAfFS.js b/frontend/dist/assets/Sessions-hz3-5yQ9.js similarity index 92% rename from frontend/dist/assets/Sessions-DFCPAfFS.js rename to frontend/dist/assets/Sessions-hz3-5yQ9.js index d5b67609..b20dc19b 100644 --- a/frontend/dist/assets/Sessions-DFCPAfFS.js +++ b/frontend/dist/assets/Sessions-hz3-5yQ9.js @@ -1,4 +1,4 @@ -import{d as x,r as l,eI as G,eJ as O,dF as J,j as e,B as g,L as M,D as U,bf as C,c as N,e2 as V,cp as Q,bY as Y}from"./index-CeMilrX4.js";import{C as Z}from"./ConfirmModal-BF449Kzb.js";import{D as W}from"./DataBox-Da-5DbUW.js";import{P as X,a as ee,B as se,C as D}from"./PageLayout-Cw_MXmcE.js";import{R as ae}from"./refresh-cw-DqhcBXAw.js";import{R as T,C as j}from"./Grid-BuDgMX1I.js";import{C as te}from"./circle-question-mark-Bqc_DPUo.js";import{T as le}from"./triangle-alert-DiFold9L.js";import{S as ie}from"./shield-D-fYOAoy.js";import{A as ne}from"./antenna-DhdWQ_ro.js";import{T as P}from"./trash-2-Bu7BoH4P.js";/** +import{d as x,r as l,eJ as G,eK as O,dG as J,j as e,B as g,L as M,D as U,bf as C,c as N,e3 as V,cq as Q,bY as Y}from"./index-BOwCLZTK.js";import{C as Z}from"./ConfirmModal-DpSKXZ01.js";import{D as W}from"./DataBox-BVnEv6Au.js";import{P as X,a as ee,B as se,C as D}from"./PageLayout-QKntxcnp.js";import{R as ae}from"./refresh-cw-C9txhqc9.js";import{R as T,C as j}from"./Grid-eFMUBxsw.js";import{C as te}from"./circle-question-mark-XDnZ1ChV.js";import{T as le}from"./triangle-alert-SO3tIa8w.js";import{S as ie}from"./shield-DYw72pvS.js";import{A as ne}from"./antenna-rYsqNluv.js";import{T as K}from"./trash-2-qMD09ppP.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -23,4 +23,4 @@ import{d as x,r as l,eI as G,eJ as O,dF as J,j as e,B as g,L as M,D as U,bf as C * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ue=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],pe=x("user-check",ue),fe=[{id:"overview",label:"Overview",icon:oe},{id:"clients",label:"Authenticated Clients",icon:pe},{id:"identities",label:"By Identity",icon:de}];function B(s){return s?new Date(s*1e3).toLocaleString():"Never"}function ye(s){if(!s)return"Never";const t=Date.now()-s*1e3,i=Math.floor(t/6e4),h=Math.floor(t/36e5),d=Math.floor(t/864e5);return i<1?"Just now":i<60?`${i}m ago`:h<24?`${h}h ago`:d<365?`${d}d ago`:`${Math.floor(d/365)}y ago`}function b({label:s,value:t,icon:i}){return e.jsxs(D,{neomorphic:!0,children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[i&&e.jsx("span",{className:"icon-sm text-icon-card-title",children:i}),e.jsx("span",{className:"type-micro",children:s})]}),e.jsx(Q,{centered:!0,children:e.jsx("span",{className:"type-data-xl text-fg-primary font-mono font-normal tabular-nums",children:t})})]})}function je({identity:s}){const t=s.type==="repeater";return e.jsxs("div",{className:"bg-subtle-fill/80 radius-inner depth-stroke-raised p-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-3",children:[e.jsx("span",{className:"icon-sm text-icon-card-title",children:t?e.jsx(ne,{className:"w-4 h-4"}):e.jsx(Y,{className:"w-4 h-4"})}),e.jsx("span",{className:"type-micro",children:s.name}),e.jsx(W,{copy:!0,size:"compact",truncate:[8,6],color:"text-fg-muted",children:s.hash}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined ml-auto",style:{"--data-box-accent":t?"var(--sys-blue)":"var(--sys-pink)"},children:s.type})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Max Clients"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:s.max_clients})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Authenticated"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:s.authenticated_clients})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Admin Password"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",style:{"--data-box-color":s.has_admin_password?"var(--sys-green)":"var(--sys-red)"},children:s.has_admin_password?"✓ Set":"✗ Not Set"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Guest Password"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",style:{"--data-box-color":s.has_guest_password?"var(--sys-green)":"var(--sys-red)"},children:s.has_guest_password?"✓ Set":"✗ Not Set"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Read-Only Access"}),e.jsx("div",{className:N("data-box data-box-fill data-box-left",s.allow_read_only?"text-sys-green":"text-sys-red"),children:s.allow_read_only?"Allowed":"Disabled"})]})]})]})}function be({client:s,onRemove:t}){return e.jsx("div",{className:"bg-subtle-fill/80 radius-inner depth-stroke-raised p-4 transition-base hover:bg-subtle-fill-strong",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0 grid grid-cols-1 sm:grid-cols-5 gap-2 sm:gap-4 items-center",children:[e.jsxs("div",{className:"sm:col-span-1",children:[e.jsx("span",{className:"type-data-xs text-fg-muted block sm:hidden mb-0.5",children:"Client"}),e.jsx("span",{className:"type-data-sm text-fg-primary font-mono truncate block",children:s.public_key})]}),e.jsxs("div",{className:"sm:col-span-1",children:[e.jsx("span",{className:"type-data-xs text-fg-muted block sm:hidden mb-0.5",children:"Address"}),e.jsx("span",{className:"type-data-xs text-fg-muted font-mono truncate block",children:s.address})]}),e.jsxs("div",{className:"sm:col-span-1",children:[e.jsx("span",{className:"type-data-xs text-fg-muted block sm:hidden mb-0.5",children:"Identity"}),e.jsx("span",{className:"type-data-sm text-fg-primary block truncate",children:s.identity_name}),e.jsx("span",{className:"type-data-xs text-fg-muted block truncate",children:s.identity_hash})]}),e.jsxs("div",{className:"sm:col-span-1",children:[e.jsx("span",{className:"type-data-xs text-fg-muted block sm:hidden mb-0.5",children:"Permissions"}),e.jsx("span",{className:N("type-data-xs px-2 py-0.5 rounded-full font-medium inline-block",s.permissions==="admin"?"bg-sys-green/15 text-sys-green":"bg-sys-amber/15 text-sys-amber"),children:s.permissions})]}),e.jsxs("div",{className:"sm:col-span-1",children:[e.jsx("span",{className:"type-data-xs text-fg-muted block sm:hidden mb-0.5",children:"Last Activity"}),e.jsx("span",{className:"type-data-xs text-fg-muted",children:ye(s.last_activity)})]})]}),e.jsxs(g,{color:"danger",outline:!0,onClick:t,className:"flex-shrink-0",children:[e.jsx(P,{"data-slot":"icon"}),"Remove"]})]})})}function ge({client:s,onRemove:t}){return e.jsx("div",{className:"bg-subtle-fill/80 radius-inner depth-stroke-raised p-4 transition-base hover:bg-subtle-fill-strong",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:N("type-data-xs px-2 py-0.5 rounded-full font-medium",s.permissions==="admin"?"bg-sys-green/15 text-sys-green":"bg-sys-amber/15 text-sys-amber"),children:s.permissions}),e.jsx("span",{className:"type-data-sm text-fg-primary font-mono truncate",children:s.public_key})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-muted",children:"Address: "}),e.jsx("span",{className:"text-fg-primary/90 font-mono",children:s.address})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-muted",children:"Identity: "}),e.jsxs("span",{className:"text-fg-primary/90",children:[s.identity_name," (",s.identity_hash,")"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-muted",children:"Last Activity: "}),e.jsx("span",{className:"text-fg-primary/90",children:B(s.last_activity)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-muted",children:"Last Login: "}),e.jsx("span",{className:"text-fg-primary/90",children:B(s.last_login_success)})]})]})]}),e.jsx(g,{color:"danger",outline:!0,onClick:t,className:"flex-shrink-0",children:e.jsx(P,{"data-slot":"icon"})})]})})}function Me(){const[s,t]=l.useState("overview"),[i,h]=l.useState(!0),[d,S]=l.useState(!1),[u,v]=l.useState("idle"),[A,p]=l.useState(null),[w,F]=l.useState(null),[c,K]=l.useState([]),[r,E]=l.useState(null),[o,H]=l.useState(null),[n,f]=l.useState(null),[q,R]=l.useState(!1),k=(w==null?void 0:w.acls)??[],L=l.useMemo(()=>o?c.filter(a=>a.identity_name===o):c,[c,o]),y=l.useCallback(async()=>{p(null);try{const[a,m,_]=await Promise.all([G(),O(),J()]);a.success&&a.data&&F(a.data),m.success&&m.data&&K(m.data.clients||[]),_.success&&_.data&&E(_.data)}catch(a){p(a instanceof Error?a.message:"Failed to load session data")}},[]);l.useEffect(()=>{y().finally(()=>h(!1))},[y]);const I=async()=>{S(!0),v("loading"),await y(),S(!1),v("success"),setTimeout(()=>v("idle"),1500)},z=async()=>{if(n){R(!0);try{const a=await V({public_key:n.publicKey,identity_hash:n.identityHash});a.success?await y():p(`Failed to remove client: ${a.error}`)}catch(a){p(a instanceof Error?a.message:"Failed to remove client")}finally{R(!1),f(null)}}};return e.jsxs(X,{children:[e.jsx(ee,{title:"Sessions",icon:e.jsx(C,{}),controls:e.jsxs(g,{color:u==="success"?"success":"primary",outline:!0,onClick:I,disabled:d,children:[u==="loading"?e.jsx(M,{"data-slot":"icon",className:"animate-spin"}):u==="success"?e.jsx(U,{"data-slot":"icon"}):e.jsx(ae,{"data-slot":"icon"}),u==="success"?"Done":"Refresh"]}),subtitle:e.jsx("p",{className:"type-body-sm text-fg-muted",children:"Manage authenticated clients and access control lists"})}),e.jsxs(se,{children:[r&&e.jsxs(T,{template:"widget",children:[e.jsx(j,{span:6,md:3,children:e.jsx(b,{label:"Identities",value:r.total_identities,icon:e.jsx(C,{className:"w-4 h-4"})})}),e.jsx(j,{span:6,md:3,children:e.jsx(b,{label:"Authenticated",value:r.total_clients,icon:e.jsx(xe,{className:"w-4 h-4"})})}),e.jsx(j,{span:6,md:3,children:e.jsx(b,{label:"Admin",value:r.admin_clients,icon:e.jsx($,{className:"w-4 h-4"})})}),e.jsx(j,{span:6,md:3,children:e.jsx(b,{label:"Guest",value:r.guest_clients,icon:e.jsx(te,{className:"w-4 h-4"})})})]}),e.jsx(T,{template:"auto",children:e.jsxs(D,{neomorphic:!0,children:[e.jsx("div",{className:"flex flex-wrap gap-1 mb-5",children:e.jsx("div",{className:"toggle-group",children:fe.map(a=>{const m=s===a.id;return e.jsxs("button",{onClick:()=>t(a.id),className:N("toggle-group-item flex items-center gap-1.5",m&&"active"),children:[e.jsx(a.icon,{className:"w-3.5 h-3.5"}),a.label]},a.id)})})}),e.jsx("div",{className:"min-h-[300px]",children:i?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(M,{className:"w-6 h-6 animate-spin text-sys-blue mr-3"}),e.jsx("span",{className:"type-body text-fg-muted",children:"Loading session data..."})]}):A?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-sys-red/10 mx-auto mb-3 flex items-center justify-center",children:e.jsx(le,{className:"w-6 h-6 text-sys-red"})}),e.jsx("p",{className:"type-body text-sys-red mb-2",children:"Failed to load session data"}),e.jsx("p",{className:"type-body-sm text-fg-muted mb-4",children:A}),e.jsx(g,{color:"primary",outline:!0,onClick:I,children:"Retry"})]}):e.jsxs(e.Fragment,{children:[s==="overview"&&e.jsx("div",{className:"space-y-4",children:k.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:e.jsx($,{className:"w-7 h-7 text-fg-muted/50"})}),e.jsx("p",{className:"type-body text-fg-muted",children:"No identities configured"})]}):k.map(a=>e.jsx(je,{identity:a},a.hash))}),s==="clients"&&e.jsxs("div",{className:"space-y-3",children:[c.length>0&&e.jsxs("div",{className:"hidden sm:grid grid-cols-5 gap-4 px-4 pb-2 border-b border-edge-subtle",children:[e.jsx("span",{className:"type-data-xs text-fg-muted font-medium",children:"Client"}),e.jsx("span",{className:"type-data-xs text-fg-muted font-medium",children:"Address"}),e.jsx("span",{className:"type-data-xs text-fg-muted font-medium",children:"Identity"}),e.jsx("span",{className:"type-data-xs text-fg-muted font-medium",children:"Permissions"}),e.jsx("span",{className:"type-data-xs text-fg-muted font-medium",children:"Last Activity"})]}),c.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:e.jsx(C,{className:"w-7 h-7 text-fg-muted/50"})}),e.jsx("p",{className:"type-body text-fg-muted",children:"No authenticated clients"})]}):c.map(a=>e.jsx(be,{client:a,onRemove:()=>f({publicKey:a.public_key_full,identityHash:a.identity_hash,displayKey:a.public_key})},a.public_key_full))]}),s==="identities"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Filter by Identity"}),e.jsxs("select",{value:o??"",onChange:a=>H(a.target.value||null),className:"w-full sm:w-auto bg-subtle-fill border border-edge-subtle radius-inner px-4 py-2 type-data text-fg-primary focus:outline-none focus:border-sys-blue/50 transition-colors",children:[e.jsx("option",{value:"",children:"All Identities"}),k.map(a=>e.jsxs("option",{value:a.name,children:[a.name," (",a.authenticated_clients," clients)"]},a.name))]})]}),L.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:e.jsx(ie,{className:"w-7 h-7 text-fg-muted/50"})}),e.jsx("p",{className:"type-body text-fg-muted",children:o?"No clients for selected identity":"No clients found"})]}):e.jsx("div",{className:"space-y-3",children:L.map(a=>e.jsx(ge,{client:a,onRemove:()=>f({publicKey:a.public_key_full,identityHash:a.identity_hash,displayKey:a.public_key})},a.public_key_full))})]})]})})]})})]}),e.jsx(Z,{isOpen:!!n,title:"Remove Client",message:`Are you sure you want to remove client '${n==null?void 0:n.displayKey}' from the ACL? This will disconnect the client.`,confirmLabel:q?"Removing...":"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:z,onCancel:()=>f(null)})]})}export{Me as default}; + */const ue=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],pe=x("user-check",ue),fe=[{id:"overview",label:"Overview",icon:oe},{id:"clients",label:"Authenticated Clients",icon:pe},{id:"identities",label:"By Identity",icon:de}];function B(s){return s?new Date(s*1e3).toLocaleString():"Never"}function ye(s){if(!s)return"Never";const t=Date.now()-s*1e3,i=Math.floor(t/6e4),h=Math.floor(t/36e5),d=Math.floor(t/864e5);return i<1?"Just now":i<60?`${i}m ago`:h<24?`${h}h ago`:d<365?`${d}d ago`:`${Math.floor(d/365)}y ago`}function b({label:s,value:t,icon:i}){return e.jsxs(D,{neomorphic:!0,children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-2 sm:mb-3",children:[i&&e.jsx("span",{className:"icon-sm text-icon-card-title",children:i}),e.jsx("span",{className:"type-micro",children:s})]}),e.jsx(Q,{centered:!0,children:e.jsx("span",{className:"type-data-xl text-fg-primary font-mono font-normal tabular-nums",children:t})})]})}function je({identity:s}){const t=s.type==="repeater";return e.jsxs("div",{className:"bg-subtle-fill/80 radius-inner depth-stroke-raised p-4",children:[e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 mb-3",children:[e.jsx("span",{className:"icon-sm text-icon-card-title",children:t?e.jsx(ne,{className:"w-4 h-4"}):e.jsx(Y,{className:"w-4 h-4"})}),e.jsx("span",{className:"type-micro",children:s.name}),e.jsx(W,{copy:!0,size:"compact",truncate:[8,6],color:"text-fg-muted",children:s.hash}),e.jsx("span",{className:"data-box data-box-compact data-box-outlined ml-auto",style:{"--data-box-accent":t?"var(--sys-blue)":"var(--sys-pink)"},children:s.type})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Max Clients"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:s.max_clients})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Authenticated"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:s.authenticated_clients})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Admin Password"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",style:{"--data-box-color":s.has_admin_password?"var(--sys-green)":"var(--sys-red)"},children:s.has_admin_password?"✓ Set":"✗ Not Set"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Guest Password"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",style:{"--data-box-color":s.has_guest_password?"var(--sys-green)":"var(--sys-red)"},children:s.has_guest_password?"✓ Set":"✗ Not Set"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Read-Only Access"}),e.jsx("div",{className:N("data-box data-box-fill data-box-left",s.allow_read_only?"text-sys-green":"text-sys-red"),children:s.allow_read_only?"Allowed":"Disabled"})]})]})]})}function be({client:s,onRemove:t}){return e.jsx("div",{className:"bg-subtle-fill/80 radius-inner depth-stroke-raised p-4 transition-base hover:bg-subtle-fill-strong",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0 grid grid-cols-1 sm:grid-cols-5 gap-2 sm:gap-4 items-center",children:[e.jsxs("div",{className:"sm:col-span-1",children:[e.jsx("span",{className:"type-data-xs text-fg-muted block sm:hidden mb-0.5",children:"Client"}),e.jsx("span",{className:"type-data-sm text-fg-primary font-mono truncate block",children:s.public_key})]}),e.jsxs("div",{className:"sm:col-span-1",children:[e.jsx("span",{className:"type-data-xs text-fg-muted block sm:hidden mb-0.5",children:"Address"}),e.jsx("span",{className:"type-data-xs text-fg-muted font-mono truncate block",children:s.address})]}),e.jsxs("div",{className:"sm:col-span-1",children:[e.jsx("span",{className:"type-data-xs text-fg-muted block sm:hidden mb-0.5",children:"Identity"}),e.jsx("span",{className:"type-data-sm text-fg-primary block truncate",children:s.identity_name}),e.jsx("span",{className:"type-data-xs text-fg-muted block truncate",children:s.identity_hash})]}),e.jsxs("div",{className:"sm:col-span-1",children:[e.jsx("span",{className:"type-data-xs text-fg-muted block sm:hidden mb-0.5",children:"Permissions"}),e.jsx("span",{className:N("type-data-xs px-2 py-0.5 rounded-full font-medium inline-block",s.permissions==="admin"?"bg-sys-green/15 text-sys-green":"bg-sys-amber/15 text-sys-amber"),children:s.permissions})]}),e.jsxs("div",{className:"sm:col-span-1",children:[e.jsx("span",{className:"type-data-xs text-fg-muted block sm:hidden mb-0.5",children:"Last Activity"}),e.jsx("span",{className:"type-data-xs text-fg-muted",children:ye(s.last_activity)})]})]}),e.jsxs(g,{color:"danger",outline:!0,onClick:t,className:"flex-shrink-0",children:[e.jsx(K,{"data-slot":"icon"}),"Remove"]})]})})}function ge({client:s,onRemove:t}){return e.jsx("div",{className:"bg-subtle-fill/80 radius-inner depth-stroke-raised p-4 transition-base hover:bg-subtle-fill-strong",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:N("type-data-xs px-2 py-0.5 rounded-full font-medium",s.permissions==="admin"?"bg-sys-green/15 text-sys-green":"bg-sys-amber/15 text-sys-amber"),children:s.permissions}),e.jsx("span",{className:"type-data-sm text-fg-primary font-mono truncate",children:s.public_key})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-muted",children:"Address: "}),e.jsx("span",{className:"text-fg-primary/90 font-mono",children:s.address})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-muted",children:"Identity: "}),e.jsxs("span",{className:"text-fg-primary/90",children:[s.identity_name," (",s.identity_hash,")"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-muted",children:"Last Activity: "}),e.jsx("span",{className:"text-fg-primary/90",children:B(s.last_activity)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-fg-muted",children:"Last Login: "}),e.jsx("span",{className:"text-fg-primary/90",children:B(s.last_login_success)})]})]})]}),e.jsx(g,{color:"danger",outline:!0,onClick:t,className:"flex-shrink-0",children:e.jsx(K,{"data-slot":"icon"})})]})})}function Me(){const[s,t]=l.useState("overview"),[i,h]=l.useState(!0),[d,S]=l.useState(!1),[u,v]=l.useState("idle"),[A,p]=l.useState(null),[w,P]=l.useState(null),[c,E]=l.useState([]),[r,F]=l.useState(null),[o,q]=l.useState(null),[n,f]=l.useState(null),[H,R]=l.useState(!1),k=(w==null?void 0:w.acls)??[],L=l.useMemo(()=>o?c.filter(a=>a.identity_name===o):c,[c,o]),y=l.useCallback(async()=>{p(null);try{const[a,m,_]=await Promise.all([G(),O(),J()]);a.success&&a.data&&P(a.data),m.success&&m.data&&E(m.data.clients||[]),_.success&&_.data&&F(_.data)}catch(a){p(a instanceof Error?a.message:"Failed to load session data")}},[]);l.useEffect(()=>{y().finally(()=>h(!1))},[y]);const I=async()=>{S(!0),v("loading"),await y(),S(!1),v("success"),setTimeout(()=>v("idle"),1500)},z=async()=>{if(n){R(!0);try{const a=await V({public_key:n.publicKey,identity_hash:n.identityHash});a.success?await y():p(`Failed to remove client: ${a.error}`)}catch(a){p(a instanceof Error?a.message:"Failed to remove client")}finally{R(!1),f(null)}}};return e.jsxs(X,{children:[e.jsx(ee,{title:"Sessions",icon:e.jsx(C,{}),controls:e.jsxs(g,{color:u==="success"?"success":"primary",outline:!0,onClick:I,disabled:d,children:[u==="loading"?e.jsx(M,{"data-slot":"icon",className:"animate-spin"}):u==="success"?e.jsx(U,{"data-slot":"icon"}):e.jsx(ae,{"data-slot":"icon"}),u==="success"?"Done":"Refresh"]}),subtitle:e.jsx("p",{className:"type-body-sm text-fg-muted",children:"Manage authenticated clients and access control lists"})}),e.jsxs(se,{children:[r&&e.jsxs(T,{template:"widget",children:[e.jsx(j,{span:6,md:3,children:e.jsx(b,{label:"Identities",value:r.total_identities,icon:e.jsx(C,{className:"w-4 h-4"})})}),e.jsx(j,{span:6,md:3,children:e.jsx(b,{label:"Authenticated",value:r.total_clients,icon:e.jsx(xe,{className:"w-4 h-4"})})}),e.jsx(j,{span:6,md:3,children:e.jsx(b,{label:"Admin",value:r.admin_clients,icon:e.jsx($,{className:"w-4 h-4"})})}),e.jsx(j,{span:6,md:3,children:e.jsx(b,{label:"Guest",value:r.guest_clients,icon:e.jsx(te,{className:"w-4 h-4"})})})]}),e.jsx(T,{template:"auto",children:e.jsxs(D,{neomorphic:!0,children:[e.jsx("div",{className:"flex flex-wrap gap-1 mb-5",children:e.jsx("div",{className:"toggle-group",children:fe.map(a=>{const m=s===a.id;return e.jsxs("button",{onClick:()=>t(a.id),className:N("toggle-group-item flex items-center gap-1.5",m&&"active"),children:[e.jsx(a.icon,{className:"w-3.5 h-3.5"}),a.label]},a.id)})})}),e.jsx("div",{className:"min-h-[300px]",children:i?e.jsxs("div",{className:"flex items-center justify-center py-12",children:[e.jsx(M,{className:"w-6 h-6 animate-spin text-sys-blue mr-3"}),e.jsx("span",{className:"type-body text-fg-muted",children:"Loading session data..."})]}):A?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-sys-red/10 mx-auto mb-3 flex items-center justify-center",children:e.jsx(le,{className:"w-6 h-6 text-sys-red"})}),e.jsx("p",{className:"type-body text-sys-red mb-2",children:"Failed to load session data"}),e.jsx("p",{className:"type-body-sm text-fg-muted mb-4",children:A}),e.jsx(g,{color:"primary",outline:!0,onClick:I,children:"Retry"})]}):e.jsxs(e.Fragment,{children:[s==="overview"&&e.jsx("div",{className:"space-y-4",children:k.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:e.jsx($,{className:"w-7 h-7 text-fg-muted/50"})}),e.jsx("p",{className:"type-body text-fg-muted",children:"No identities configured"})]}):k.map(a=>e.jsx(je,{identity:a},a.hash))}),s==="clients"&&e.jsxs("div",{className:"space-y-3",children:[c.length>0&&e.jsxs("div",{className:"hidden sm:grid grid-cols-5 gap-4 px-4 pb-2 border-b border-edge-subtle",children:[e.jsx("span",{className:"type-data-xs text-fg-muted font-medium",children:"Client"}),e.jsx("span",{className:"type-data-xs text-fg-muted font-medium",children:"Address"}),e.jsx("span",{className:"type-data-xs text-fg-muted font-medium",children:"Identity"}),e.jsx("span",{className:"type-data-xs text-fg-muted font-medium",children:"Permissions"}),e.jsx("span",{className:"type-data-xs text-fg-muted font-medium",children:"Last Activity"})]}),c.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:e.jsx(C,{className:"w-7 h-7 text-fg-muted/50"})}),e.jsx("p",{className:"type-body text-fg-muted",children:"No authenticated clients"})]}):c.map(a=>e.jsx(be,{client:a,onRemove:()=>f({publicKey:a.public_key_full,identityHash:a.identity_hash,displayKey:a.public_key})},a.public_key_full))]}),s==="identities"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"type-label text-fg-muted block mb-2",children:"Filter by Identity"}),e.jsxs("select",{value:o??"",onChange:a=>q(a.target.value||null),className:"w-full sm:w-auto bg-subtle-fill border border-edge-subtle radius-inner px-4 py-2 type-data text-fg-primary focus:outline-none focus:border-sys-blue/50 transition-colors",children:[e.jsx("option",{value:"",children:"All Identities"}),k.map(a=>e.jsxs("option",{value:a.name,children:[a.name," (",a.authenticated_clients," clients)"]},a.name))]})]}),L.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-subtle-fill mx-auto mb-4 flex items-center justify-center",children:e.jsx(ie,{className:"w-7 h-7 text-fg-muted/50"})}),e.jsx("p",{className:"type-body text-fg-muted",children:o?"No clients for selected identity":"No clients found"})]}):e.jsx("div",{className:"space-y-3",children:L.map(a=>e.jsx(ge,{client:a,onRemove:()=>f({publicKey:a.public_key_full,identityHash:a.identity_hash,displayKey:a.public_key})},a.public_key_full))})]})]})})]})})]}),e.jsx(Z,{isOpen:!!n,title:"Remove Client",message:`Are you sure you want to remove client '${n==null?void 0:n.displayKey}' from the ACL? This will disconnect the client.`,confirmLabel:H?"Removing...":"Remove",cancelLabel:"Cancel",variant:"danger",onConfirm:z,onCancel:()=>f(null)})]})}export{Me as default}; diff --git a/frontend/dist/assets/SignalIndicator-CpBGKD5A.js b/frontend/dist/assets/SignalIndicator-Calk-LyB.js similarity index 99% rename from frontend/dist/assets/SignalIndicator-CpBGKD5A.js rename to frontend/dist/assets/SignalIndicator-Calk-LyB.js index b0997421..fb4d0cbb 100644 --- a/frontend/dist/assets/SignalIndicator-CpBGKD5A.js +++ b/frontend/dist/assets/SignalIndicator-Calk-LyB.js @@ -1,4 +1,4 @@ -import{d as i,r as m,c as l,j as r,c6 as j,c7 as _,c8 as k}from"./index-CeMilrX4.js";/** +import{d as i,r as m,c as l,j as r,c6 as j,c7 as _,c8 as k}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/Statistics-DeWhSfD2.js b/frontend/dist/assets/Statistics-DeWhSfD2.js new file mode 100644 index 00000000..cf1352ad --- /dev/null +++ b/frontend/dist/assets/Statistics-DeWhSfD2.js @@ -0,0 +1,36 @@ +var _t=Object.defineProperty;var Rt=(t,s,n)=>s in t?_t(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var pe=(t,s,n)=>Rt(t,typeof s!="symbol"?s+"":s,n);import{d as He,r as o,j as e,t as Ce,c as at,bg as Nt,c9 as vt,ca as et,h as ke,cb as Tt,x as Ae,cc as Dt,cd as Lt,ce as Et,k as It,cf as Pt,cg as Ot,ch as Ft,ci as Ht,cj as Bt,bI as $t,ck as $e,bL as zt,cl as Wt,cm as Ut,N as ve,cn as Gt,co as Vt,cp as qt,cq as Kt,bi as Yt,K as Xt,Q as Zt,P as Qt,G as Jt,ao as es,ap as ts,V as ss,ai as ns,cr as as,cs as ze,ct as it,aa as is,R as rs,a4 as ls}from"./index-BOwCLZTK.js";import{L as we}from"./layers-Dg2mpSl7.js";import{u as tt,h as os,r as st}from"./consumer-registry-CTjikLma.js";import{C as We,e as cs}from"./easing-CsgXD0uy.js";import{T as ms,M as ds}from"./MqttModeBadge-CSj5wNzF.js";import{C as ue,P as us,a as hs,B as xs}from"./PageLayout-QKntxcnp.js";import{D as ps}from"./DataBox-BVnEv6Au.js";import{E as fs,A as Ue,D as Pe}from"./DataValue-x_TMPgMk.js";import{C as gs}from"./CollisionExplorerModal-Cudk5ace.js";import{H as rt}from"./hash-Dwn2PbMF.js";import{T as lt}from"./triangle-alert-SO3tIa8w.js";import{L as Oe}from"./LightSparkline-C68RXWon.js";import{A as bs}from"./activity-D5uH2SFx.js";import{c as ys,a as js,A as Ns}from"./AnalyzerFilterPanel-BWsROE43.js";import{useResolveSource as vs}from"./usePipelineStore-Cw6U5jyB.js";import{R as ye,C as Me}from"./Grid-eFMUBxsw.js";import{S as ks}from"./settings-2-CXNfSapN.js";import{N as ws}from"./network-D0Fgg1y-.js";import"./chevron-right-DJVm4pVP.js";import"./map-pin-C2z_C0J3.js";import"./index-2RIoVPos.js";import"./BasemapLayer-B-5TmAfZ.js";import"./monitor-smartphone-Dd11JEL9.js";import"./node-types-C6okL8rE.js";import"./circle-question-mark-XDnZ1ChV.js";import"./funnel-CWx99rlN.js";import"./search-Ba9CRHru.js";/** + * @license lucide-react v0.559.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ss=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],Ms=He("chart-line",Ss);/** + * @license lucide-react v0.559.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Cs=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ot=He("circle-check-big",Cs);/** + * @license lucide-react v0.559.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const As=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],_s=He("grid-3x3",As);/** + * @license lucide-react v0.559.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Rs=[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]],Ts=He("grip",Rs),kt={useAbsoluteThresholds:!0,baselinePercentile:6,spikePercentile:50,baselineDbm:-107,spikeDbm:-100,mergeGapSeconds:45,minSequenceLength:16,similarityToleranceDbm:5};function Ne(t,s){if(t.length===0)return 0;const n=s/100*(t.length-1),a=Math.floor(n),i=Math.ceil(n);return a===i?t[a]:t[a]+(t[i]-t[a])*(n-a)}function ct(t){if(t.length===0)return{median:0,p90:0,p95:0,p99:0,max:0,min:0};const s=[...t].sort((n,a)=>n-a);return{median:Ne(s,50),p90:Ne(s,90),p95:Ne(s,95),p99:Ne(s,99),max:s[s.length-1],min:s[0]}}function Ds(t,s={}){const n={...kt,...s};if(t.length<10)return{anomalies:[],thresholds:ct([]),totalSamples:t.length,anomalySamples:0};const a=t.map(b=>b.noise_floor_dbm),i=ct(a),l=[...a].sort((b,w)=>b-w);let r,u;n.useAbsoluteThresholds?(r=n.baselineDbm,u=n.spikeDbm):(r=Ne(l,n.baselinePercentile),u=Ne(l,n.spikePercentile));const c=[...t].sort((b,w)=>b.timestamp-w.timestamp),p=[];let d=null,x=0;for(const b of c)if(b.noise_floor_dbm>r&&b.noise_floor_dbmO+z,0)/d.values.length):(d.values.length>=n.minSequenceLength&&p.push(d),d={startTs:b.timestamp,endTs:b.timestamp,values:[b.noise_floor_dbm],timestamps:[b.timestamp],rollingAvg:b.noise_floor_dbm})}else d&&d.values.length>=n.minSequenceLength&&p.push(d),d=null;return d&&d.values.length>=n.minSequenceLength&&p.push(d),p.length===0?{anomalies:[],thresholds:i,totalSamples:t.length,anomalySamples:x,debug:{baselineCutoff:r,spikeCutoff:u,midBandSamples:x}}:{anomalies:p.map(b=>{const w=Math.max(...b.values),N=b.values.reduce((k,T)=>k+T,0)/b.values.length;return{startTs:b.startTs,endTs:b.endTs,peakValue:w,avgValue:N,severity:Ls(N,r,u),sampleCount:b.values.length}}),thresholds:i,totalSamples:t.length,anomalySamples:x,debug:{baselineCutoff:r,spikeCutoff:u,midBandSamples:x}}}function Ls(t,s,n){const a=n-s;if(a===0)return"moderate";const i=(t-s)/a;return i>.66?"critical":i>.33?"severe":"moderate"}const Es=Object.entries(Nt).map(([t,s])=>{const n=parseInt(t,10);return{typeNum:n,key:`TYPE_${n}`,label:s}});function nt({sortedTypes:t,highlightedType:s,onTypeHover:n,aggregateShares:a,hoverData:i}){const l=o.useMemo(()=>{if(!i)return null;const c=new Map;for(const p of i.items)c.set(p.key,p.value);return c},[i]),r=l!==null,u=o.useMemo(()=>{const c=new Set(t.map(x=>x.key)),p=t.map(x=>({typeNum:x.typeNum,key:x.key,label:x.label})),d=Es.filter(x=>!c.has(x.key));return[...p,...d]},[t]);return e.jsxs("div",{className:"flex-shrink-0 pt-2 sm:pt-3 mt-1 sm:mt-2 px-0 sm:pr-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mx-0 sm:ml-9 sm:mr-0 mb-1 sm:mb-1.5 type-data-xs",children:[e.jsx("span",{className:"text-fg-muted",children:"Packet Types"}),r&&(i==null?void 0:i.timeLabel)&&e.jsx("span",{className:"text-sys-indigo tabular-nums",children:i.timeLabel})]}),e.jsx("div",{className:"flex flex-wrap gap-x-3 sm:gap-x-4 gap-y-1 type-data-xs mx-0 sm:ml-9 sm:mr-0",onMouseLeave:()=>n(null),children:u.map(c=>{const p=Ce(c.typeNum),d=(l==null?void 0:l.get(c.key))??0,x=a.get(c.key)??0,v=r?d:x,b=v>1e-4,w=a.has(c.key),N=s===c.key,k=s&&!N||r&&d<=1e-4||!r&&!s&&!w;return e.jsxs("div",{className:at("flex items-center gap-1.5 transition-opacity cursor-pointer hover:opacity-80",k&&"opacity-30"),onMouseEnter:()=>n(c.key),children:[e.jsx("div",{className:"shrink-0 w-3 h-3 rounded-xs",style:{backgroundColor:p}}),e.jsx("span",{className:"text-fg-secondary whitespace-nowrap",children:c.label}),b&&e.jsxs("span",{className:at("tabular-nums",r?"text-fg-primary":"text-fg-muted"),children:[(v*100).toFixed(1),"%"]})]},c.key)})})]})}const mt='ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',Is=2,Ps=3,Os=32,Fs=20,Hs=80;function dt(t,s,n,a,i){const l=t.reduce((p,d)=>p+d,0);if(l<=0||t.length===0)return[];const r=t.map((p,d)=>d).sort((p,d)=>t[d]-t[p]),u=r.map(p=>t[p]),c=new Array(t.length);return Je(u,r,l,s,n,a,i,c),c}function Je(t,s,n,a,i,l,r,u){if(t.length===0)return;if(t.length===1){u[s[0]]={x:a,y:i,w:l,h:r,index:s[0]};return}const c=l*r/n,p=l>=r,d=p?r:l;let x=0,v=1/0,b=0;for(let z=0;zV?I/V:V/I,y>V?y/V:V/y);if(m<=v)v=m,b=z+1,x=F;else break}const w=d>0?x*c/d:0;let N=0;for(let z=0;z0?t[z]/x:0)*d;p?u[s[z]]={x:a,y:i+N,w,h:V,index:s[z]}:u[s[z]]={x:a+N,y:i,w:V,h:w,index:s[z]},N+=V}const k=t.slice(b),T=s.slice(b),O=n-x;p?Je(k,T,O,a+w,i,l-w,r,u):Je(k,T,O,a,i+w,l,r-w,u)}function ut(t,s,n,a,i,l){for(const r of s){const u=n[r.index];if(!u)continue;const c=Is*l,p=r.x*l+c/2,d=r.y*l+c/2,x=r.w*l-c,v=r.h*l-c;if(x<=0||v<=0)continue;const b=Ce(u.typeNum),w=i!==null&&i!==r.index;t.save(),t.globalAlpha=w?.4:1;const N=Ps*l;t.beginPath(),t.moveTo(p+N,d),t.lineTo(p+x-N,d),t.quadraticCurveTo(p+x,d,p+x,d+N),t.lineTo(p+x,d+v-N),t.quadraticCurveTo(p+x,d+v,p+x-N,d+v),t.lineTo(p+N,d+v),t.quadraticCurveTo(p,d+v,p,d+v-N),t.lineTo(p,d+N),t.quadraticCurveTo(p,d,p+N,d),t.closePath(),t.fillStyle=b,t.fill(),t.strokeStyle="rgba(0,0,0,0.2)",t.lineWidth=1*l,t.stroke();const k=4*l,T=r.w>36&&r.h>20,O=r.w>36&&r.h>32;if(T){const z=11*l;if(O){const F=a>0?u.size/a*100:0;t.font=`500 ${8*l}px ${mt}`,t.fillStyle="rgba(0,0,0,0.6)",t.textBaseline="alphabetic",t.textAlign="left",t.fillText(`${F.toFixed(1)}%`,p+k,d+v-k-z)}t.font=`600 ${9*l}px ${mt}`,t.fillStyle="rgba(0,0,0,0.85)",t.textBaseline="alphabetic",t.textAlign="left",t.fillText(u.name,p+k,d+v-k)}t.restore()}}function Bs(t,s,n){for(const a of t)if(s>=a.x&&s<=a.x+a.w&&n>=a.y&&n<=a.y+a.h)return a.index;return null}function $s({data:t,total:s,color:n,position:a,containerWidth:i,isAirtime:l}){if(!t||!a)return null;const r=(t.value/s*100).toFixed(1),u=160,d=i-a.x=6e4?`${(t/6e4).toFixed(1)}m`:t>=1e3?`${(t/1e3).toFixed(1)}s`:`${Math.round(t)}ms`}function zs({sortedTypes:t,aggregateShares:s,mode:n="share"}){var I,y,m;const[a,i]=o.useState(null),[l,r]=o.useState(null),[u,c]=o.useState(0),[p,d]=o.useState(null),x=o.useRef(null),v=o.useRef(null),b=o.useRef([]),w=n==="airtime",N=o.useMemo(()=>t.reduce((f,S)=>f+(w?S.totalAirtime:S.totalCount),0),[t,w]),k=o.useMemo(()=>t.map((f,S)=>({name:f.label,size:w?f.totalAirtime:f.totalCount,index:S,typeNum:f.typeNum,key:f.key})),[t,w]);o.useEffect(()=>{const f=v.current;if(!f)return;const S=f.parentElement;if(!S)return;const E=S.getBoundingClientRect(),W=E.width,g=E.height;if(W<=0||g<=0)return;const _=window.devicePixelRatio||1;f.width=Math.floor(W*_),f.height=Math.floor(g*_),f.style.width=`${W}px`,f.style.height=`${g}px`;const U=k.map(H=>H.size),Q=dt(U,0,0,W,g);b.current=Q;const ee=f.getContext("2d");ee&&(ee.clearRect(0,0,f.width,f.height),ut(ee,Q,k,N,a,_))},[k,N,a]),o.useEffect(()=>{const f=x.current;if(!f)return;const S=new ResizeObserver(()=>{const E=v.current;if(!E)return;const W=f.getBoundingClientRect(),g=W.width,_=W.height;if(g<=0||_<=0)return;const U=window.devicePixelRatio||1;E.width=Math.floor(g*U),E.height=Math.floor(_*U),E.style.width=`${g}px`,E.style.height=`${_}px`;const Q=k.map(R=>R.size),ee=dt(Q,0,0,g,_);b.current=ee;const H=E.getContext("2d");H&&(H.clearRect(0,0,E.width,E.height),ut(H,ee,k,N,a,U))});return S.observe(f),()=>S.disconnect()},[k,N]);const T=o.useCallback(f=>{const S=x.current;if(!S)return;const E=S.getBoundingClientRect(),W=f.clientX-E.left,g=f.clientY-E.top,_=Bs(b.current,W,g);i(_),_!==null?(c(E.width),r({x:W,y:g})):r(null)},[]),O=o.useCallback(()=>{i(null),r(null)},[]),z=o.useCallback(f=>{if(d(f),f){const S=k.findIndex(E=>E.key===f);i(S>=0?S:null)}else i(null)},[k]),F=a!==null?{name:((I=k[a])==null?void 0:I.name)??"",value:((y=k[a])==null?void 0:y.size)??0}:null,V=a!==null?Ce((m=k[a])==null?void 0:m.typeNum):"";return t.length===0||N===0?e.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[e.jsx(we,{className:"w-6 h-6 mr-2 opacity-50"}),e.jsx("span",{children:"No packet type data available"})]}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"flex-1 min-h-0 relative",children:e.jsxs("div",{className:"absolute overflow-hidden radius-inner depth-stroke-inset bg-chart-inner",style:{left:Os,right:0,top:0,bottom:Fs},ref:x,onMouseMove:T,onMouseLeave:O,children:[e.jsx("canvas",{ref:v,className:"absolute inset-0",style:{cursor:"default"}}),e.jsx($s,{data:F,total:N,color:V,position:l,containerWidth:u,isAirtime:w})]})}),e.jsx("div",{style:{minHeight:Hs},children:e.jsx(nt,{sortedTypes:t,highlightedType:p,onTypeHover:z,aggregateShares:s})})]})}const Ge=32,Ve=20,Ws=300;function je(t){return t>=1e9?`${(t/1e9).toFixed(1)} Gb`:t>=1e6?`${(t/1e6).toFixed(1)} Mb`:t>=1e3?`${(t/1e3).toFixed(1)} Kb`:`${t.toFixed(0)} B`}function Us({packets:t,mode:s,startTs:n,endTs:a,radioConfig:i,bucketCount:l,lockedYMax:r,legendMinH:u}){const c=o.useMemo(()=>vt(),[]),p=c.blue,d=c.red,x=c.yellow,[v,b]=o.useState(null),{trendData:w,totals:N}=o.useMemo(()=>{if(t.length===0)return{trendData:[],totals:{rxBytes:0,txBytes:0,rxAirtime:0,txAirtime:0}};const y=a-n,m=Math.min(Math.ceil(y/Ws),l),f=y/m,S=[];let E=0,W=0,g=0,_=0;for(const G of t){const j=G.timestamp;if(j=a)continue;const M=et(G),A=ke(G,{spreadingFactor:i.sf,bandwidthHz:i.bw,codingRate:i.cr,preambleLength:i.preamble}),B={timestamp:j,rxAirtime:0,txAirtime:0,rxBytes:0,txBytes:0};G.transmitted?(B.txAirtime=A,B.txBytes=M,W+=M,_+=A):(B.rxAirtime=A,B.rxBytes=M,E+=M,g+=A),S.push(B)}S.sort((G,j)=>G.timestamp-j.timestamp);const U=new Float64Array(S.length+1),Q=new Float64Array(S.length+1),ee=new Float64Array(S.length+1),H=new Float64Array(S.length+1),R=new Float64Array(S.length);for(let G=0;G{let j=0,M=R.length;for(;j>>1;R[A]0?Z:null,tx:he>0?he:null})}else{const Z=U[B]-U[A],he=Q[B]-Q[A],fe=Z/ie*100,ge=he/ie*100;te.push({timestamp:j,rx:fe>0?fe:null,tx:ge>0?ge:null})}}const ae=2/31;let se=null;return{trendData:te.map(G=>{const j=G.rx;return j!==null&&j>0&&(se===null?se=j:se=ae*j+(1-ae)*se),{...G,rxSmooth:se!==null&&se>0?se:null}}),totals:{rxBytes:E,txBytes:W,rxAirtime:g,txAirtime:_}}},[t,n,a,l,s,i]),k=o.useMemo(()=>{if(w.length===0)return s==="share"?100:10;let y=0;for(const f of w){const S=f.rx??0,E=f.tx??0;S>y&&(y=S),E>y&&(y=E)}const m=y*1.1;return s==="share"?m<=100?100:m<=500?Math.ceil(m/100)*100:m<=1e3?Math.ceil(m/200)*200:m<=5e3?Math.ceil(m/500)*500:m<=1e4?Math.ceil(m/1e3)*1e3:Math.ceil(m/5e3)*5e3:Math.max(1,Math.ceil(m))},[w,s]),T=r??k,O=o.useMemo(()=>{if(v!==null&&w[v]){const y=w[v],m=y.rx??0,f=y.tx??0;return s==="share"?{rx:je(m),tx:je(f),total:je(m+f),isHovered:!0}:{rx:`${m.toFixed(2)}%`,tx:`${f.toFixed(2)}%`,total:`${(m+f).toFixed(2)}%`,isHovered:!0}}if(s==="share")return{rx:je(N.rxBytes),tx:je(N.txBytes),total:je(N.rxBytes+N.txBytes),isHovered:!1};{let y=0,m=0,f=0;for(const W of w)(W.rx!==null||W.tx!==null)&&(y+=W.rx??0,m+=W.tx??0,f++);const S=f>0?y/f:0,E=f>0?m/f:0;return{rx:`${S.toFixed(2)}%`,tx:`${E.toFixed(2)}%`,total:`${(S+E).toFixed(2)}%`,isHovered:!1}}},[v,w,N,s]),z=o.useMemo(()=>{const y=a-n,m=y/3600;return[0,.25,.5,.75,1].map(S=>{const E=n+y*S,W=new Date(E*1e3),g=W.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),_=W.toLocaleDateString([],{weekday:"short"}),U=S===.25||S===.75;return{pct:S,label:m>=24?`${_} ${g}`:g,mobileHidden:U}})},[n,a]),F=o.useCallback(y=>{b(y)},[]);if(w.length===0)return e.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[e.jsx(we,{className:"w-6 h-6 mr-2 opacity-50"}),e.jsx("span",{children:"No packet data available"})]});const V=o.useMemo(()=>s==="airtime"?T<=5?1:T<=10?2:T<=20?5:Math.ceil(T/5):T<=100?25:T<=500?100:T<=1e3?200:T<=5e3?1e3:T<=1e4?2e3:Math.ceil(T/5e3)*1e3,[T,s]),I=o.useMemo(()=>{const y=[];for(let m=0;m<=T;m+=V){const f=(1-m/T)*100;let S;s==="airtime"?S=`${m}%`:m>=1e6?S=`${(m/1e6).toFixed(1)}M`:m>=1e3?S=`${(m/1e3).toFixed(0)}K`:S=`${m}`,y.push({pos:f,label:S})}return y},[T,V,s]);return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex-1 min-h-0 relative",children:[e.jsx("div",{className:"absolute top-0 left-0 flex flex-col justify-between",style:{width:Ge,bottom:Ve},children:I.map((y,m)=>e.jsx("span",{className:"type-data-xs text-fg-secondary text-right pr-1.5",style:{position:"absolute",top:`${y.pos}%`,transform:m===0?"translateY(-100%)":m===I.length-1?"none":"translateY(-50%)",right:0},children:y.label},m))}),e.jsx("div",{className:"absolute overflow-hidden radius-inner depth-stroke-inset bg-chart-inner",style:{left:Ge,right:0,top:0,bottom:Ve},children:e.jsx(Tt,{data:w,yAxisMode:s==="share"?"share":"airtime",yMax:T,onHover:F,startTs:n,endTs:a,externalAxes:!0})}),e.jsx("div",{className:"absolute left-0 right-0 bottom-0 flex items-center pointer-events-none",style:{left:Ge,height:Ve,paddingTop:4},children:z.map((y,m)=>e.jsx("span",{className:`absolute type-data-xs text-fg-muted/60 tabular-nums ${y.mobileHidden?"hidden sm:inline":""}`,style:{left:`${y.pct*100}%`,transform:y.pct===0?"translateX(0)":y.pct===1?"translateX(-100%)":"translateX(-50%)"},children:y.label},m))})]}),e.jsxs("div",{className:"flex items-end justify-between pb-1",style:{minHeight:u},children:[e.jsxs("div",{className:"flex items-center gap-3 sm:gap-5 type-data-sm pl-2 sm:pl-11",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-4 sm:w-5 h-[2px] rounded-full",style:{backgroundColor:p}}),e.jsx("span",{className:"text-fg-secondary",children:"RX"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-4 sm:w-5 h-[2px] rounded-full",style:{backgroundColor:d}}),e.jsx("span",{className:"text-fg-secondary",children:"TX"})]}),e.jsxs("div",{className:"hidden sm:flex items-center gap-1.5",children:[e.jsx("div",{className:"w-5 h-[2px] rounded-full",style:{backgroundColor:x}}),e.jsx("span",{className:"text-fg-secondary",children:"Avg"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 sm:gap-8",children:[e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("div",{className:"type-data-xl text-fg-primary",children:O.rx}),e.jsx(Ae,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"RX"})]}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("div",{className:"type-data-xl text-fg-primary",children:O.tx}),e.jsx(Ae,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"TX"})]})]})]})]})}const xt=Dt;class Gs{constructor(){pe(this,"worker",null);pe(this,"listeners",new Set);pe(this,"currentResult",null);pe(this,"isComputing",!1);pe(this,"debounceTimer",null);pe(this,"debounceMs",250);pe(this,"lastCacheKey",null)}ensureWorker(){if(this.worker)return this.worker;if(typeof window>"u")return null;try{this.worker=new Worker(new URL("/assets/bucketing.worker-D0TT0k8y.js",import.meta.url),{type:"module"}),this.worker.onmessage=s=>{this.handleWorkerMessage(s.data)},this.worker.onerror=s=>{console.error("[BucketingService] Worker error:",s),this.isComputing=!1,this.notifyListeners()}}catch(s){console.error("[BucketingService] Failed to initialize worker:",s)}return this.worker}handleWorkerMessage(s){if(this.isComputing=!1,s.type==="error"){this.currentResult=null,this.notifyListeners();return}const n=s.payload;this.currentResult={points:n.points,rawValues:n.rawValues,packetTypes:n.packetTypes,timestamps:n.timestamps,count:n.count,minTime:n.minTime,maxTime:n.maxTime,minValue:n.minValue,maxValue:n.maxValue,rawMinValue:n.rawMinValue,rawMaxValue:n.rawMaxValue,unit:"%",stats:{p5:n.p5,p50:n.p50,p95:n.p95,uniqueValues:n.uniqueValues,topValues:n.topValues}},this.notifyListeners()}notifyListeners(){for(const s of this.listeners)try{s(this.currentResult,this.isComputing)}catch(n){console.error("[BucketingService] Listener error:",n)}}isCacheHit(s){return!this.lastCacheKey||!this.currentResult?!1:this.lastCacheKey.startTs===s.startTs&&this.lastCacheKey.endTs===s.endTs&&this.lastCacheKey.mode===s.mode&&this.lastCacheKey.packetCount===s.packetCount}compute(s,n,a,i,l){if(s.length===0||!l){this.currentResult=null,this.notifyListeners();return}const r={startTs:n,endTs:a,mode:i,packetCount:s.length};this.isCacheHit(r)||(this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.computeInternal(s,n,a,i,l,r)},this.debounceMs))}computeInternal(s,n,a,i,l,r){const u=this.ensureWorker();if(!u)return;const c=s.length,p=new Float64Array(c),d=new Float64Array(c),x=new Uint16Array(c),v=new Uint8Array(c),b={spreadingFactor:l.sf,bandwidthHz:l.bw,codingRate:l.cr,preambleLength:l.preamble};for(let N=0;N{this.listeners.delete(s)}}clear(){this.currentResult=null,this.lastCacheKey=null,this.notifyListeners()}terminate(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.worker&&(this.worker.terminate(),this.worker=null),this.listeners.clear()}}const qe=new Gs;function Vs(t,s,n,a,i){const[l,r]=o.useState(()=>qe.getResult());return o.useEffect(()=>qe.subscribe(u=>{r(u)}),[]),o.useEffect(()=>{qe.compute(t,s,n,a,i)},[t,s,n,a,i]),l}function qs({mode:t,packets:s,startTs:n,endTs:a,radioConfig:i,sortedTypes:l,aggregateShares:r,noiseFloorAnomalies:u,showNoiseFloorOverlay:c,overlayOpacity:p=.5,startLabel:d,endLabel:x,lockedYMax:v,legendMinH:b,dotSize:w,dotOpacity:N}){const[k,T]=o.useState(null),[O,z]=o.useState(null),F=o.useMemo(()=>(a-n)/3600,[n,a]),V=o.useCallback(H=>{z(H)},[]),y=Vs(s,n,a,t==="share"?"share":"airtime",i),[m,f]=o.useState(null),S=o.useCallback((H,R)=>{T(H),f(R??null)},[]),E=o.useMemo(()=>{if(m===null||!y||y.count===0)return null;const H=n+m*(a-n);let R;F>=168?R=75:F>=72?R=35:F>=24?R=15:F>=3?R=10:R=5;const K=R*60/2;return{start:H-K,end:H+K}},[m,y,n,a,F]),W=o.useMemo(()=>E?new Date((E.start+E.end)/2*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}):null,[E]),g=o.useMemo(()=>{if(k===null||!E)return null;const H=W??"",{start:R,end:K}=E,te=s.filter(j=>j.timestamp>=R&&j.timestamp({key:j.key,label:j.label,value:0,color:xt(j.typeNum)}))};const ie=new Map,ae=new Map;let se=0,ce=0;for(const j of te){const A=`TYPE_${j.type??j.payload_type??-1}`;if(ie.set(A,(ie.get(A)??0)+1),se++,i){const B=ke(j,{spreadingFactor:i.sf,bandwidthHz:i.bw,codingRate:i.cr,preambleLength:i.preamble});ae.set(A,(ae.get(A)??0)+B),ce+=B}}const G=l.map(j=>{let M;return t==="airtime"?M=ce>0?(ae.get(j.key)??0)/ce:0:M=se>0?(ie.get(j.key)??0)/se:0,{key:j.key,label:j.label,value:M,color:xt(j.typeNum)}});return{timestamp:(R+K)/2,timeLabel:H,items:G}},[k,E,W,s,l,t,i]),_=t==="share",U=v??(y==null?void 0:y.maxValue)??(_?240:10),Q=o.useMemo(()=>{if(!_)return 5;const H=[10,20,25,50,100,200,250,500,1e3],R=U/4.5;for(const K of H)if(K>=R)return K;return U>5e3?Math.ceil(R/1e3)*1e3:Math.ceil(R/100)*100},[U,_]),ee=o.useMemo(()=>{const H=[];for(let R=0;R<=U;R+=Q){const K=(1-R/U)*100;H.push({pos:K,label:_?`${R}B`:`${R}%`})}return H},[U,Q,_]);return!y||y.count===0?e.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[e.jsx(we,{className:"w-6 h-6 mr-2 opacity-50"}),e.jsx("span",{children:"No packet data available"})]}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex-1 min-h-0 relative",children:[e.jsx("div",{className:"absolute top-0 left-0 flex flex-col justify-between",style:{width:32,bottom:20},children:ee.map((H,R)=>e.jsx("span",{className:"type-data-xs text-fg-secondary text-right pr-1.5",style:{position:"absolute",top:`${H.pos}%`,transform:R===0?"translateY(-100%)":R===ee.length-1?"none":"translateY(-50%)",right:0},children:H.label},R))}),e.jsxs("div",{className:"absolute overflow-hidden radius-inner depth-stroke-inset bg-chart-inner",style:{left:32,right:0,top:0,bottom:20},children:[e.jsx(Lt,{scatterData:y,yAxisMode:t==="share"?"share":"airtime",onHover:S,noiseFloorAnomalies:u,showNoiseFloorOverlay:c,overlayOpacity:p,highlightedType:O,timeRangeHours:F,yAxisMaxOverride:v,dotSize:w,dotOpacity:N,startTs:n,endTs:a,externalAxes:!0}),W&&e.jsx("div",{className:"absolute top-1 right-1 px-2 py-0.5 bg-elevated/90 rounded type-data-xs text-sys-indigo pointer-events-none z-10",children:W})]}),d&&x&&e.jsxs("div",{className:"absolute left-0 right-0 bottom-0 flex justify-between pointer-events-none type-data-xs text-fg-muted/60",style:{left:32,height:20,paddingTop:4},children:[e.jsx("span",{children:d}),e.jsx("span",{children:x})]})]}),e.jsx("div",{style:{minHeight:b},children:e.jsx(nt,{sortedTypes:l,highlightedType:O,onTypeHover:V,aggregateShares:r,hoverData:g})})]})}function Ks({mode:t,onChange:s}){return e.jsxs("div",{className:"toggle-group toggle-group-sm",children:[e.jsx("button",{onClick:()=>s("share"),className:`toggle-group-item ${t==="share"?"active":""}`,children:"Total"}),e.jsx("button",{onClick:()=>s("airtime"),className:`toggle-group-item ${t==="airtime"?"active":""}`,children:"Airtime"})]})}function Ys({smoothing:t,onChange:s}){return e.jsxs("div",{className:"toggle-group toggle-group-sm",children:[e.jsx("button",{onClick:()=>s("stats"),className:`toggle-group-item ${t==="stats"?"active":""}`,title:"Statistics view (scatter plot)",children:e.jsx(Ts,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>s("trend"),className:`toggle-group-item ${t==="trend"?"active":""}`,title:"Trend line chart",children:e.jsx(Ms,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>s("ema"),className:`toggle-group-item ${t==="ema"?"active":""}`,title:"Stacked area (moderate smoothing)",children:e.jsx(we,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>s("ultra"),className:`toggle-group-item ${t==="ultra"?"active":""}`,title:"Stacked area (heavy smoothing)",children:e.jsx(Et,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>s("mosaic"),className:`toggle-group-item ${t==="mosaic"?"active":""}`,title:"Mosaic view (treemap)",children:e.jsx(_s,{className:"w-3.5 h-3.5"})})]})}function Xs({enabled:t,onChange:s,anomalyCount:n=0,showTuning:a=!1,onTuningChange:i}){return e.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[t&&i&&e.jsx("button",{onClick:()=>i(!a),className:`toggle-group toggle-group-sm ${a?"active":""}`,title:a?"Hide tuning panel":"Show tuning panel",children:e.jsx("span",{className:`toggle-group-item ${a?"active":""}`,children:e.jsx(ks,{className:"w-3.5 h-3.5"})})}),e.jsx("button",{onClick:()=>s(!t),className:`toggle-group toggle-group-sm ${t?"active":""}`,title:t?"Hide noise floor anomalies":"Show noise floor anomalies",children:e.jsx("span",{className:`toggle-group-item ${t?"active":""}`,children:e.jsx(fs,{className:"w-3.5 h-3.5"})})}),n>0&&e.jsx("span",{className:"absolute -top-2 -right-2 min-w-[18px] h-[18px] px-1 rounded-full bg-sys-red text-white text-xs font-bold flex items-center justify-center pointer-events-none z-10",children:n>99?"99+":n})]})}const wt=[{target:"PacketAnalyzer",fn:"type",minStage:1},{target:"PacketAnalyzer",fn:"airtime",minStage:1,when:os}];st(wt);const pt=360,Zs=500,Qs={sf:10,bw:25e4,cr:5,preamble:8},Ke=32;function ft(t,s){const n=new Date(t*1e3),a=r=>r.toString().padStart(2,"0"),i=`${a(n.getHours())}:${a(n.getMinutes())}`;return s<24?i:`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][n.getMonth()]} ${n.getDate()} ${i}`}function Js(t){return Nt[t]??`TYPE_${t.toString(16).toUpperCase()}`}function en(t,s){const n=new Map;for(const i of t){const l=i.type??i.payload_type??-1,r=ke(i,{spreadingFactor:s.sf,bandwidthHz:s.bw,codingRate:s.cr,preambleLength:s.preamble}),u=n.get(l)??{count:0,airtime:0};n.set(l,{count:u.count+1,airtime:u.airtime+r})}const a=[];for(const[i,l]of n)a.push({typeNum:i,key:`TYPE_${i}`,label:Js(i),totalCount:l.count,totalAirtime:l.airtime});return a.sort((i,l)=>l.totalCount-i.totalCount)}function tn(t,s,n,a,i,l,r=0){const u=n-s,c=u/a,p=c*1e3,d=u/3600,x=s-r*c,v=n+r*c,b=a+2*r,w=[];for(let N=0;N=24?T.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}):T.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),z={timestamp:k,time:O,counts:{},shares:{},airtimes:{},total:0,totalAirtime:0,bucketDurationMs:p};for(const F of l)z.counts[F.key]=0,z.airtimes[F.key]=0;w.push(z)}for(const N of t){const k=N.timestamp;if(k=v)continue;const T=Math.min(Math.floor((k-x)/c),b-1),O=`TYPE_${N.type??N.payload_type??-1}`;w[T].counts[O]=(w[T].counts[O]??0)+1,w[T].total++;const z=ke(N,{spreadingFactor:i.sf,bandwidthHz:i.bw,codingRate:i.cr,preambleLength:i.preamble});w[T].airtimes[O]=(w[T].airtimes[O]??0)+z,w[T].totalAirtime+=z}for(const N of w)for(const k of l)N.shares[k.key]=N.total>0?N.counts[k.key]/N.total*100:0;return{buckets:w,visibleStart:r,visibleEnd:r+a}}function sn(t,s){const n=t.length;if(n===0)return[];if(s<.5)return[...t];const a=Math.sqrt(12*s*s/3+1);let i=Math.floor(a);i%2===0&&i--;const l=i+2,r=(12*s*s-3*i*i-12*i-9)/(-4*i-4),u=Math.round(r),c=[u>0?i:l,u>1?i:l,u>2?i:l];let p=new Float32Array(t);const d=new Float32Array(n);for(const x of c){const v=(x-1)/2;nn(p,d,n,v);const b=p;p=d,d.set(b)}return Array.from(p)}function nn(t,s,n,a){const i=a*2+1;let l=0;for(let r=0;r<=a;r++)l+=t[Math.min(r,n-1)];for(let r=0;r=0&&(l-=t[c],r--),pnew Array(d).fill(0));for(let I=0;I0)for(let m=0;m0)for(let f=0;f0?T=w.map(I=>sn(I,N)):T=w.map(I=>an(I,k));for(let I=0;I0){const m=1/y;for(let f=0;fpt?Math.ceil(v/pt):1,z=Math.ceil(v/O),F=[];for(let I=0;I0){const g=1/E;for(let _=0;_=n)continue;const v=Math.min(Math.floor((x-s)/300),u-1);c[v]+=ke(d,{spreadingFactor:i.sf,bandwidthHz:i.bw,codingRate:i.cr,preambleLength:i.preamble})}let p=0;for(let d=0;dp&&(p=x)}return Math.max(1,Math.ceil(p*1.1))}else{let c=0;for(const p of t){const d=p.timestamp;if(d=n)continue;const x=et(p);x>c&&(c=x)}return c<=240?240:Math.ceil(c*1.1/50)*50}}function mn({packets:t,allPackets:s,startTs:n,endTs:a,parentStartTs:i,parentEndTs:l,bucketCount:r,radioConfig:u=Qs,mode:c="share",smoothing:p="stats",noiseFloorAnomalies:d=null,showNoiseFloorOverlay:x=!1,overlayOpacity:v=.5,dotSize:b,dotOpacity:w}){tt(wt);const N=It(),[k,T]=o.useState(null),[O,z]=o.useState(null),[F,V]=o.useState([]),I=o.useRef(null),y=o.useRef(0);o.useEffect(()=>{const j=Math.abs(t.length-y.current);if(j===0&&F.length>0)return;I.current&&clearTimeout(I.current);const M=j>100?50:Zs;return I.current=setTimeout(()=>{y.current=t.length,V(t)},M),()=>{I.current&&clearTimeout(I.current)}},[t,F.length]);const m=o.useMemo(()=>en(F,u),[F,u]),f=o.useMemo(()=>{if(p!=="ema"&&p!=="ultra")return 0;const M=(a-n)/r,{handleSize:A}=St(p,M,r);return A},[p,n,a,r]),S=o.useMemo(()=>tn(F,n,a,r,u,m,f),[F,n,a,r,u,m,f]),E=o.useMemo(()=>m.reduce((j,M)=>j+M.totalCount,0),[m]),W=o.useMemo(()=>m.reduce((j,M)=>j+M.totalAirtime,0),[m]),{sortedTypes:g,aggregateShares:_}=o.useMemo(()=>{const j=new Map,M=c==="share"?E:W;if(M>0)for(const B of m){const Z=c==="share"?B.totalCount:B.totalAirtime;j.set(B.key,Z/M)}return{sortedTypes:[...m].sort((B,Z)=>(j.get(Z.key)??0)-(j.get(B.key)??0)),aggregateShares:j}},[m,E,W,c]),U=o.useMemo(()=>on(S,c,g,p,n,a,r),[S,c,g,p,n,a,r]),Q=o.useCallback(j=>T(j),[]),ee=o.useCallback(j=>z(j),[]),H=o.useCallback(j=>T(j),[]),R=o.useMemo(()=>{if(O===null||!U[O])return null;const j=U[O];return{timestamp:j.timestamp,timeLabel:j.time,items:g.map(M=>({key:M.key,label:M.label,value:j[M.key]??0,color:Ce(M.typeNum)}))}},[O,U,g]),K=o.useMemo(()=>{const j=U.map(A=>A.timestamp),M=g.map(A=>({key:A.key,label:A.label,color:Ce(A.typeNum),values:U.map(B=>B[A.key]??0)}));return{timestamps:j,series:M}},[U,g]),te=null,ie=s&&i!==void 0&&l!==void 0&&(n!==i||a!==l),ae=o.useMemo(()=>{if(!(!ie||!s||i===void 0||l===void 0))return cn(s,i,l,c,u)},[ie,s,i,l,c,u]);if(F.length===0)return t.length===0?e.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[e.jsx(we,{className:"w-6 h-6 mr-2 opacity-50"}),e.jsx("span",{children:"No packet data available"})]}):null;if(p==="mosaic")return e.jsx(zs,{sortedTypes:g,aggregateShares:_,mode:c});const se=(a-n)/3600,ce=ft(n,se),G=ft(a,se);return p==="stats"?e.jsx(qs,{mode:c,packets:F,startTs:n,endTs:a,radioConfig:u,sortedTypes:g,aggregateShares:_,noiseFloorAnomalies:d,showNoiseFloorOverlay:x,overlayOpacity:v,startLabel:ce,endLabel:G,lockedYMax:ae,legendMinH:Ye,dotSize:b,dotOpacity:w}):p==="trend"?e.jsx(Us,{packets:F,mode:c,startTs:n,endTs:a,radioConfig:u,bucketCount:r,lockedYMax:ae,legendMinH:Ye}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex-1 min-h-0 relative",children:[e.jsx("div",{className:"absolute top-0 left-0 flex flex-col justify-between",style:{width:Ke,bottom:20},children:[0,20,40,60,80,100].map((j,M,A)=>e.jsxs("span",{className:"type-data-xs text-fg-secondary text-right pr-1.5",style:{position:"absolute",top:`${(1-j/100)*100}%`,transform:M===0?"translateY(-100%)":M===A.length-1?"none":"translateY(-50%)",right:0},children:[j,"%"]},j))}),e.jsx("div",{className:"absolute overflow-hidden radius-inner depth-stroke-inset bg-chart-inner",style:{left:Ke,right:0,top:0,bottom:20},children:e.jsx(Pt,{timestamps:K.timestamps,series:K.series,highlightedKey:k,cursorColor:N.cursor,onHover:ee,onSeriesHover:H,overlayLine:te,startTs:n,endTs:a,externalAxes:!0})}),e.jsxs("div",{className:"absolute left-0 right-0 bottom-0 flex justify-between pointer-events-none type-data-xs text-fg-muted/60",style:{left:Ke,height:20,paddingTop:4},children:[e.jsx("span",{children:ce}),e.jsx("span",{children:G})]})]}),e.jsx("div",{style:{minHeight:Ye},children:e.jsx(nt,{sortedTypes:g,highlightedType:k,onTypeHover:Q,aggregateShares:_,hoverData:R})})]})}const dn=o.memo(mn),Xe={ZOOM_DURATION:400,BLINK_DURATION:600},le={PADDING:6,DOT_RADIUS:5,DOT_RADIUS_HOVERED:7,LOCAL_DOT_RADIUS:5,CARDINAL_FONT_SIZE:10,INTERCARDINAL_FONT_SIZE:9,LABEL_INSET:8,DATA_HEADROOM:1.08},un={"1x":1,"2x":2,"4x":4,"8x":8,"16x":16,"36x":36},gt=[1,5,10,25,50,100,150],hn=22.5,Mt=hn*Math.PI/180,bt=Math.sin(Mt),yt=Math.cos(Mt);function xn(t,s,n,a){const i=Math.PI/180,l=(a-s)*i,r=t*i,u=n*i,c=Math.sin(l)*Math.cos(u),p=Math.cos(r)*Math.sin(u)-Math.sin(r)*Math.cos(u)*Math.cos(l);return(Math.atan2(c,p)*180/Math.PI+360)%360}function pn(t,s,n,a){const l=Math.PI/180,r=(n-t)*l,u=(a-s)*l,c=Math.sin(r/2)**2+Math.cos(t*l)*Math.cos(n*l)*Math.sin(u/2)**2;return 6371*2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))}const fn=[{min:10,label:"Excellent"},{min:7,label:"Very Good"},{min:4,label:"Good"},{min:1,label:"Fair+"},{min:-2,label:"Fair"},{min:-5,label:"Fair-"},{min:-8,label:"Poor"},{min:-11,label:"Bad"},{min:-1/0,label:"Critical"}];function gn(t){var s;return((s=fn.find(n=>t>=n.min))==null?void 0:s.label)??"Critical"}function jt(t,s,n){const a=zt(t,n);return s[a]||"#808080"}function bn({neighbors:t,quickNeighbors:s,localLat:n,localLon:a,onStatsChange:i,title:l,badge:r,stats:u}){const[c,p]=o.useState(null),[d,x]=o.useState(new Set),[v,b]=o.useState({width:0,height:0}),[w,N]=o.useState("1x"),[k,T]=o.useState(1),O=o.useRef(null),z=o.useRef({}),F=o.useRef(null),V=o.useRef(k);V.current=k;const I=Ot(),y=Ft(),m=Ht(),f=Bt(),S=vt(),E=$t(),W=f?m.primary:m.secondary,g=f?.15:.4,_=f?.08:.25,U=f?S.blue:m.primary;o.useEffect(()=>{const h=F.current;if(!h)return;const P=new ResizeObserver(L=>{for(const $ of L){const{width:Y,height:J}=$.contentRect;Y>0&&J>0&&b({width:Y,height:J})}});P.observe(h);const D=h.getBoundingClientRect();return D.width>0&&D.height>0&&b({width:D.width,height:D.height}),()=>P.disconnect()},[]);const Q=o.useMemo(()=>{const h=new Set;if(s)for(const P of s)h.add(P.hash);return h},[s]),ee=o.useMemo(()=>{const h=new Map;if(s)for(const P of s)h.set(P.hash,{snr:P.avgSnr,rssi:P.avgRssi});return h},[s]),{processedNeighbors:H,maxDistance:R,totalNeighbors:K,zeroHopCount:te}=o.useMemo(()=>{const h=[];for(const[L,$]of Object.entries(t)){if(!$.latitude||!$.longitude||$.latitude===0||$.longitude===0||!Q.has(L))continue;const J=xn(n,a,$.latitude,$.longitude),ne=pn(n,a,$.latitude,$.longitude),X=ee.get(L);h.push({hash:L.slice(0,8),name:$.node_name||$.name||"Unknown",snr:(X==null?void 0:X.snr)??$.snr??null,rssi:(X==null?void 0:X.rssi)??$.rssi??null,bearing:J,distance:ne,normalizedDistance:0,lastSeen:$.last_seen,isZeroHop:!0})}const D=(h.length>0?Math.max(...h.map(L=>L.distance)):0)*le.DATA_HEADROOM;return h.sort((L,$)=>(L.snr??-1/0)-($.snr??-1/0)),{processedNeighbors:h,maxDistance:D,totalNeighbors:h.length,zeroHopCount:h.length}},[t,n,a,Q,ee]);o.useEffect(()=>{i==null||i({zeroHopCount:te,totalCount:K,maxDistanceKm:R})},[te,K,R]),o.useEffect(()=>{const h=un[w],P=V.current;O.current&&cancelAnimationFrame(O.current);const D=performance.now(),L=$=>{const Y=$-D,J=Math.min(Y/Xe.ZOOM_DURATION,1),ne=cs(J),X=P+(h-P)*ne;T(X),J<1?O.current=requestAnimationFrame(L):O.current=null};return O.current=requestAnimationFrame(L),()=>{O.current&&cancelAnimationFrame(O.current)}},[w]);const ie=R/k,ae=o.useMemo(()=>gt.filter(h=>h<=ie*1.1),[ie]);o.useEffect(()=>{const h=[];for(const D of H){const L=z.current[D.hash];L!==void 0&&L!==D.lastSeen&&h.push(D.hash),z.current[D.hash]=D.lastSeen}if(h.length===0)return;queueMicrotask(()=>{x(D=>new Set([...D,...h]))});const P=setTimeout(()=>{x(D=>{const L=new Set(D);return h.forEach($=>L.delete($)),L})},Xe.BLINK_DURATION);return()=>clearTimeout(P)},[H]);const se=n!==0&&a!==0,ce=o.useMemo(()=>{const{width:h,height:P}=v,D=h/2,L=P/2,$=Math.min(h,P),Y=Math.max(10,$/2-le.PADDING),J=Math.max(10,Y-le.LABEL_INSET);return{width:h,height:P,centerX:D,centerY:L,radius:J,labelRadius:Y}},[v]),{width:G,height:j,centerX:M,centerY:A,radius:B,labelRadius:Z}=ce,he=o.useId(),fe=o.useCallback((h,P)=>{const D=h*Math.PI/180;return{x:M+B*P*Math.sin(D),y:A-B*P*Math.cos(D)}},[M,A,B]),ge=o.useCallback(h=>{const D={N:0,NE:45,E:90,SE:135,S:180,SW:225,W:270,NW:315}[h]*Math.PI/180;return{x:M+Z*Math.sin(D),y:A-Z*Math.cos(D)}},[M,A,Z]),_e=o.useCallback(h=>{p(h)},[]),Re=o.useCallback(h=>{N(h)},[]),Te=o.useCallback(h=>R<=0?0:h/R*k,[R,k]),De=h=>`${h}km`,Se=28,Le=o.useMemo(()=>{const h=[{x:M,y:A-Z},{x:M+Z*Math.SQRT1_2,y:A-Z*Math.SQRT1_2}],P=ae.map(L=>{const $=L/R*k,Y=M+B*$*bt,J=A-B*$*yt;return{km:L,scale:$,lx:Y,ly:J}}).filter(L=>L.scale>=.02).sort((L,$)=>$.km-L.km),D=[];for(const L of P){const $=D.some(J=>{const ne=J.lx-L.lx,X=J.ly-L.ly;return Math.sqrt(ne*ne+X*X){const ne=J.x-L.lx,X=J.y-L.ly;return Math.sqrt(ne*ne+X*X)0&&v.height>0;return se?K===0?e.jsxs("div",{ref:F,className:"flex flex-col items-center justify-center h-full text-fg-secondary",children:[e.jsx(We,{className:"w-8 h-8 mb-2 opacity-50"}),e.jsx("p",{children:"No nodes with location data"})]}):e.jsxs("div",{className:"flex h-full w-full overflow-visible",children:[e.jsxs("div",{ref:F,className:"relative flex-1 min-w-0 h-full overflow-visible -ml-4 sm:-ml-5",children:[Ee&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute depth-stroke-inset",style:{left:M-B-le.LABEL_INSET-4,top:A-B-le.LABEL_INSET-4,width:(B+le.LABEL_INSET)*2+8,height:(B+le.LABEL_INSET)*2+8,borderRadius:"50%",padding:4,boxSizing:"border-box",backgroundColor:f?"var(--zinc-925)":"var(--zinc-75)"}}),e.jsxs("svg",{width:G,height:j,className:"absolute inset-0 z-0",style:{overflow:"visible"},children:[e.jsxs("defs",{children:[e.jsx("style",{children:` + @keyframes neighbor-blink-scale { + 0%, 100% { + transform: scale(1); + opacity: 0; + } + 50% { + transform: scale(1.3); + opacity: 0.8; + } + } + .neighbor-blink-ring { + transform-origin: center; + animation: neighbor-blink-scale ${Xe.BLINK_DURATION}ms ease-out forwards; + } + `}),e.jsx("clipPath",{id:he,children:e.jsx("circle",{cx:M,cy:A,r:B})})]}),(()=>{const h=B+le.LABEL_INSET+12,P=f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.15)",D=f?"rgba(59, 130, 246, 0.4)":"rgba(59, 130, 246, 0.5)",L=6,$=16,Y=4,J=[0,90,180,270],ne=[45,135,225,315];return e.jsxs("g",{className:"radar-frame","aria-hidden":"true",children:[e.jsx("circle",{cx:M,cy:A,r:h,fill:"none",stroke:P,strokeWidth:1,strokeDasharray:"2 6"}),ne.map(X=>{const re=X*Math.PI/180,me=Math.cos(re),de=Math.sin(re),xe=h+Y,C=h+Y+$,q=M+xe*de,be=A-xe*me,Ie=M+C*de,Be=A-C*me;return e.jsxs("g",{children:[e.jsx("line",{x1:q,y1:be,x2:Ie,y2:Be,stroke:D,strokeWidth:1}),e.jsx("line",{x1:Ie-4*me,y1:Be-4*de,x2:Ie+4*me,y2:Be+4*de,stroke:D,strokeWidth:1})]},`corner-${X}`)}),J.map(X=>{const re=X*Math.PI/180,me=M+(h-L)*Math.sin(re),de=A-(h-L)*Math.cos(re),xe=M+(h+2)*Math.sin(re),C=A-(h+2)*Math.cos(re);return e.jsx("line",{x1:me,y1:de,x2:xe,y2:C,stroke:P,strokeWidth:1},`tick-cardinal-${X}`)}),ne.map(X=>{const re=X*Math.PI/180,me=M+(h-4)*Math.sin(re),de=A-(h-4)*Math.cos(re),xe=M+(h+1)*Math.sin(re),C=A-(h+1)*Math.cos(re);return e.jsx("line",{x1:me,y1:de,x2:xe,y2:C,stroke:P,strokeWidth:1},`tick-intercardinal-${X}`)})]})})(),(()=>{const h=B+le.LABEL_INSET+4,P=[0,...gt.map(D=>{const L=Te(D);return L<=0?0:Math.min(B*L,h)}),h];return P.slice(0,-1).map((D,L)=>{const $=P[L+1],Y=$-D;return Y<.5||L%2!==0?null:e.jsx("circle",{cx:M,cy:A,r:($+D)/2,fill:"none",stroke:"var(--subtle-fill)",strokeWidth:Y},`band-${L}`)})})(),ae.map(h=>{const P=Te(h);if(P<.02)return null;const D=Le.some(Y=>Y.km===h),L=M+B*P*bt,$=A-B*P*yt;return e.jsx("g",{children:D&&e.jsx("text",{x:L+4,y:$-2,textAnchor:"start",dominantBaseline:"auto",fill:m.secondary,fontSize:10,fontFamily:$e,children:De(h)})},`ring-${h}`)}),["N","E","S","W"].map(h=>{const D={N:0,E:90,S:180,W:270}[h]*Math.PI/180;return e.jsx("line",{x1:M,y1:A,x2:M+B*Math.sin(D),y2:A-B*Math.cos(D),stroke:W,strokeOpacity:g,strokeWidth:1,strokeDasharray:"4 4"},h)}),["NE","SE","SW","NW"].map(h=>{const D={NE:45,SE:135,SW:225,NW:315}[h]*Math.PI/180;return e.jsx("line",{x1:M,y1:A,x2:M+B*Math.sin(D),y2:A-B*Math.cos(D),stroke:W,strokeOpacity:_,strokeWidth:1,strokeDasharray:"4 4"},`diag-${h}`)}),["N","E","S","W"].map(h=>{const P=ge(h),D=h==="E"?"end":h==="W"?"start":"middle",L=h==="N"?"hanging":h==="S"?"auto":"middle";return e.jsx("text",{x:P.x,y:P.y,textAnchor:D,dominantBaseline:L,fill:U,fontSize:le.CARDINAL_FONT_SIZE,fontWeight:700,fontFamily:$e,"aria-hidden":"true",children:h},h)}),["NE","SE","SW","NW"].map(h=>{const P=ge(h),D=h==="NE"||h==="SE"?"end":"start",L=h==="NE"||h==="NW"?"hanging":"auto";return e.jsx("text",{x:P.x,y:P.y,textAnchor:D,dominantBaseline:L,fill:U,fontSize:le.INTERCARDINAL_FONT_SIZE,fontWeight:600,fontFamily:$e,"aria-hidden":"true",children:h},h)}),e.jsx("circle",{cx:M,cy:A,r:le.LOCAL_DOT_RADIUS,fill:y.chart6,stroke:f?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.2)",strokeWidth:1,role:"img","aria-label":"Local node"}),e.jsx("g",{clipPath:`url(#${he})`,children:H.map(h=>{const P=R>0?h.distance/R*k:0;if(P>1)return null;const{x:D,y:L}=fe(h.bearing,P),$=h.snr!==null?jt(h.snr,I,E):"#808080",Y=(c==null?void 0:c.hash)===h.hash,J=d.has(h.hash),ne=le.DOT_RADIUS_HOVERED*1.5;return e.jsxs("g",{role:"img","aria-label":`${h.name}: ${h.distance.toFixed(1)}km ${h.bearing.toFixed(0)}°`,children:[J&&e.jsx("circle",{cx:D,cy:L,r:ne,fill:"none",stroke:f?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.7)",strokeWidth:2,className:"neighbor-blink-ring"}),Y&&e.jsx("circle",{cx:D,cy:L,r:ne,fill:$,opacity:.3}),e.jsx("circle",{cx:D,cy:L,r:Y?le.DOT_RADIUS_HOVERED:le.DOT_RADIUS,fill:$,stroke:f?"rgba(0,0,0,0.5)":"rgba(0,0,0,0.25)",strokeWidth:1,style:{cursor:"pointer",transition:"r 0.15s"},onMouseEnter:()=>_e(h),onMouseLeave:()=>_e(null)})]},h.hash)})})]})]}),c&&e.jsxs("div",{className:"absolute bg-tooltip-bg border border-edge-subtle rounded-lg px-3 py-2 text-sm pointer-events-none z-10 shadow-xl",style:{left:"50%",bottom:8,transform:"translateX(-50%)"},children:[e.jsx("div",{className:"font-medium text-fg-primary",children:c.name}),e.jsx("div",{className:"type-data-xs text-fg-secondary",children:c.hash}),c.snr!==null?e.jsx("div",{className:"flex gap-3 mt-1 text-xs",children:e.jsxs("span",{children:[e.jsx("span",{className:"text-fg-secondary",children:"SNR:"})," ",e.jsxs("span",{className:"tabular-nums",style:{color:jt(c.snr,I,E)},children:[c.snr.toFixed(1)," dB"]}),e.jsxs("span",{className:"text-fg-secondary ml-1",children:["(",gn(c.snr),")"]})]})}):e.jsx("div",{className:"text-xs text-fg-secondary mt-1",children:"No SNR data"}),e.jsxs("div",{className:"flex gap-3 text-xs",children:[e.jsxs("span",{children:[e.jsx("span",{className:"text-fg-secondary",children:"Distance:"})," ",e.jsxs("span",{className:"tabular-nums text-fg-primary",children:[c.distance.toFixed(2)," km"]})]}),e.jsxs("span",{children:[e.jsx("span",{className:"text-fg-secondary",children:"Bearing:"})," ",e.jsxs("span",{className:"tabular-nums text-fg-primary",children:[c.bearing.toFixed(0),"°"]})]})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 px-1.5 pt-4 sm:pt-5 pb-2 flex-shrink-0 depth-raised radius-inset self-stretch",style:{width:"calc(100% / 6)"},children:[l&&e.jsxs("div",{className:"flex flex-col items-start gap-1 pb-2 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"icon-md flex items-center justify-center text-icon-card-title",children:e.jsx(We,{className:"w-3.5 h-3.5"})}),r&&e.jsx(Ae,{color:"zinc",children:r})]}),e.jsx("span",{className:"type-micro text-left text-[10px] leading-tight px-1",children:l})]}),e.jsx("div",{className:"flex flex-col gap-1 flex-1",role:"group","aria-label":"Zoom level",children:["1x","2x","4x","8x","16x","36x"].map(h=>e.jsx("button",{onClick:()=>Re(h),"aria-pressed":w===h,className:`flex flex-1 items-center justify-center min-w-[44px] sm:min-w-[32px] text-xs font-medium radius-inner depth-stroke-raised transition-colors ${w===h?"bg-sys-blue/20 text-sys-blue":"bg-subtle-fill/80 text-fg-secondary hover:bg-subtle-fill-strong hover:text-fg-primary"}`,children:h},h))})]})]}):e.jsxs("div",{ref:F,className:"flex flex-col items-center justify-center h-full text-fg-secondary",children:[e.jsx(We,{className:"w-8 h-8 mb-2 opacity-50"}),e.jsx("p",{children:"Local node coordinates not configured"}),e.jsx("p",{className:"text-xs mt-1",children:"Set latitude/longitude in config to enable"})]})}const yn=o.memo(bn),Ze={repeater:"var(--sys-blue)",companion:"var(--sys-cyan)",room_server:"var(--sys-indigo)"};function jn(t){if(t.contact_type){const s=t.contact_type.toLowerCase();if(s==="repeater"||s==="rep")return"repeater";if(s==="room server"||s==="room_server"||s==="room"||s==="server")return"room_server";if(s==="companion"||s==="client"||s==="cli")return"companion"}return t.is_repeater?"repeater":"companion"}function Nn({neighbors:t,timeRangeLabel:s}){const n=o.useMemo(()=>{const a={repeater:0,companion:0,room_server:0};for(const r of Object.values(t)){const u=jn(r);a[u]=(a[u]||0)+1}const i=Object.values(a).reduce((r,u)=>r+u,0);return{items:[{label:"Repeaters",count:a.repeater,percent:0,color:Ze.repeater},{label:"Companions",count:a.companion,percent:0,color:Ze.companion},{label:"Room Servers",count:a.room_server,percent:0,color:Ze.room_server}].map(r=>({...r,percent:i>0?r.count/i*100:0})).filter(r=>r.count>0).sort((r,u)=>u.count-r.count),total:i}},[t]);return n.total===0?e.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted type-body-sm",children:"No neighbors discovered yet"}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx("div",{className:"flex-1 flex flex-col justify-evenly",children:n.items.map(a=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-sm text-fg-secondary",children:a.label}),e.jsxs("span",{className:"type-data-sm text-fg-secondary tabular-nums",children:[a.count," ",e.jsxs("span",{className:"text-fg-secondary/60",children:["(",a.percent.toFixed(0),"%)"]})]})]}),e.jsx("div",{className:"h-2.5 bg-subtle-fill/80 overflow-hidden rounded-full depth-stroke-inset",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-500 ease-out",style:{width:`${a.percent}%`,backgroundColor:a.color,minWidth:a.count>0?"4px":"0"}})})]},a.label))}),e.jsxs("div",{className:"mt-auto pt-2",children:[e.jsxs("div",{className:"data-box-label flex items-center gap-1.5",children:["Total Nodes",s&&e.jsx(Ae,{color:"zinc",children:s})]}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:n.total})]})]})}const vn=o.memo(Nn);function Qe({children:t,minHeight:s="100%",rootMargin:n="200px 0px",keepMounted:a=!0,className:i=""}){const l=o.useRef(null),[r,u]=o.useState(!1),[c,p]=o.useState(!1);o.useEffect(()=>{const x=l.current;if(!x)return;const v=new IntersectionObserver(([b])=>{const w=b.isIntersecting;p(w),w&&u(!0)},{rootMargin:n,threshold:0});return v.observe(x),()=>{v.disconnect()}},[n]);const d=c||a&&r;return e.jsx("div",{ref:l,className:`h-full w-full ${i}`,style:{minHeight:s},children:d?t:e.jsx("div",{className:"h-full w-full flex items-center justify-center text-fg-muted/50",children:e.jsx("div",{className:"animate-pulse text-xs",children:"Loading chart..."})})})}const Ct=[{target:"DisambiguationCard",fn:"disambiguation.collisions",minStage:2}];st(Ct);const kn=.9,wn=.7,Sn=.5,Mn=10,Cn=25,Fe={excellent:"text-signal-excellent",good:"text-signal-good",fair:"text-signal-fair",poor:"text-sys-blue"},An={excellent:"bg-signal-excellent/10",good:"bg-signal-good/10",fair:"bg-signal-fair/10",poor:"bg-sys-blue/10"};function _n(t){return t>=kn?"excellent":t>=wn?"good":t>=Sn?"fair":"poor"}function Rn(t){return t<=Mn?"excellent":t<=Cn?"good":"poor"}function Tn(){tt(Ct);const t=Wt(),s=Ut(),[n,a]=o.useState(null),i=o.useCallback((d,x)=>{a({prefix:d,candidateHashes:x})},[]),l=o.useCallback(()=>{a(null)},[]);if(!s)return e.jsxs(ue,{neomorphic:!0,children:[e.jsx(ve,{icon:e.jsx(rt,{}),title:"Prefix Conflicts"}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-fg-secondary",children:[e.jsx(Gt,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"type-data-xs",children:"No topology data available"}),e.jsx("p",{className:"type-data-xs opacity-70",children:"Run deep analysis to see stats"})]})})]});const r=_n(t.avgConfidence),u=Rn(t.collisionRate),c=r==="poor"||u==="poor"?"poor":r==="fair"||u==="fair"?"fair":r==="good"||u==="good"?"good":"excellent",p=c==="excellent"||c==="good"?ot:lt;return e.jsxs(ue,{neomorphic:!0,className:"flex flex-col overflow-hidden",children:[e.jsx(ve,{icon:e.jsx(rt,{}),title:"Prefix Conflicts",badgeColor:"zinc",actions:c==="poor"?e.jsxs(Ae,{color:"red",children:[e.jsx(lt,{className:"w-3 h-3"}),"Needs Attention"]}):e.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${An[c]}`,children:[e.jsx(p,{className:`w-3.5 h-3.5 ${Fe[c]}`}),e.jsx("span",{className:`type-data-xs font-medium ${Fe[c]}`,children:c==="excellent"?"Excellent":c==="good"?"Good":"Fair"})]})}),e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[e.jsxs("div",{className:"flex-1 flex flex-col radius-inner depth-stroke-inset px-3 py-2.5 sm:py-3 cursor-help",title:"Total unique 2-character prefixes observed in packet paths.",children:[e.jsx("span",{className:"type-data-xl text-fg-primary",children:e.jsx(Ue,{value:t.totalPrefixes,priority:"low"})}),e.jsx("span",{className:"type-micro text-fg-muted mt-0.5 sm:mt-1",children:"Prefixes"})]}),e.jsxs("div",{className:"flex-1 flex flex-col radius-inner depth-stroke-inset px-3 py-2.5 sm:py-3 cursor-help",title:"Prefixes that map to exactly one known node. No disambiguation needed.",children:[e.jsx("span",{className:"type-data-xl text-fg-primary",children:e.jsx(Ue,{value:t.unambiguousPrefixes,priority:"low"})}),e.jsx("span",{className:"type-micro text-fg-muted mt-0.5 sm:mt-1",children:"Unique"})]}),e.jsxs("div",{className:"flex-1 flex flex-col radius-inner depth-stroke-inset px-3 py-2.5 sm:py-3 cursor-help",title:"Prefixes matching multiple known nodes. Click a prefix below to explore candidates.",children:[e.jsx("span",{className:`type-data-xl ${t.collisionPrefixes>0?"text-sys-blue":"text-fg-primary"}`,children:e.jsx(Ue,{value:t.collisionPrefixes,priority:"low"})}),e.jsx("span",{className:`type-micro mt-0.5 sm:mt-1 ${t.collisionPrefixes>0?"text-sys-blue":"text-fg-muted"}`,children:"Conflicts"})]})]}),t.highCollisionPrefixes.length>0&&e.jsxs("div",{className:"pt-3",children:[e.jsx("div",{className:"data-box-label",children:"Problem Prefixes"}),e.jsx("div",{className:"flex flex-wrap gap-1.5 content-start",children:t.highCollisionPrefixes.map(({prefix:d,candidateCount:x,candidateHashes:v})=>e.jsxs("button",{type:"button",onClick:()=>i(d,v),className:"inline-flex items-center gap-0.5 group",title:`${x} candidates - click to explore`,children:[e.jsx(ps,{children:d}),e.jsxs("span",{className:"text-fg-muted type-data-xs group-hover:text-fg-secondary transition-colors",children:["×",x]})]},d))})]}),t.lowConfidencePrefixes.length===0&&t.collisionPrefixes===0&&e.jsx("div",{className:"flex-1 flex items-center",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ot,{className:"w-3.5 h-3.5 text-signal-excellent"}),e.jsx("span",{className:"type-data-xs text-signal-excellent",children:"All prefixes uniquely identified"})]})}),e.jsxs("div",{className:"flex gap-2 sm:gap-3 mt-auto pt-3",children:[e.jsxs("div",{className:"flex-1 min-w-0 cursor-help",title:"Average confidence score across all disambiguated prefixes. Higher = more certain node identification.",children:[e.jsx("div",{className:"data-box-label",children:"Confidence"}),e.jsxs("div",{className:`data-box data-box-fill data-box-left ${Fe[r]}`,children:[(t.avgConfidence*100).toFixed(1),"%"]})]}),e.jsxs("div",{className:"flex-1 min-w-0 cursor-help",title:"Percentage of 2-character prefixes that match multiple known nodes. Lower is better.",children:[e.jsx("div",{className:"data-box-label",children:"Collisions"}),e.jsxs("div",{className:`data-box data-box-fill data-box-left ${Fe[u]}`,children:[t.collisionRate.toFixed(1),"%"]})]})]})]}),e.jsx(gs,{isOpen:!!n,prefix:(n==null?void 0:n.prefix)||"",candidateHashes:(n==null?void 0:n.candidateHashes)||[],onClose:l})]})}const At=[{target:"PacketHealth",fn:"type",minStage:1},{target:"PacketHealth",fn:"duplicates",minStage:1}];st(At);const oe=24;function Dn(t,s,n,a){const i=Date.now()/1e3,l=s*60,r=i-l,u=l/oe,c=new Array(oe).fill(0),p=new Array(oe).fill(0),d=new Array(oe).fill(0),x=new Array(oe).fill(0),v=new Array(oe).fill(0),b=new Array(oe).fill(0);let w=0,N=0,k=0,T=0,O=0,z=0,F=0;if(a&&a.length>0)for(const g of a){const _=g.timestamp;if(_i)continue;F++;const U=Math.min(oe-1,Math.floor((_-r)/u));U>=0&&v[U]++}else if(n!=null&&n>0){F=n;const g=n/oe;for(let _=0;_i)continue;w++;const U=Math.min(oe-1,Math.floor((_-r)/u));p[U]++,g.transmitted||g.packet_origin==="tx_forward"?(N++,c[U]++):g.is_duplicate||g.drop_reason==="Duplicate"?k++:g.drop_reason&&(T++,b[U]++),Yt(g.route??g.route_type)&&(O++,d[U]++),g._packetVersion===1&&(z++,x[U]++)}const V=F,I=w+V,y=[],m=[],f=[],S=[],E=[];for(let g=0;g0?U/R*100:0,timestamp:H}),m.push({count:R>0?(ee+Q)/R*100:0,timestamp:H}),f.push({count:R>0?Q/R*100:0,timestamp:H}),S.push({count:_>0?d[g]/_*100:0,timestamp:H}),E.push({count:_>0?x[g]/_*100:0,timestamp:H})}const W=w-k;return{totalRx:w,uniqueRx:W,forwarded:N,duplicates:k,waste:T,efficiency:I>0?N/I*100:0,duplicateRate:I>0?k/I*100:0,wasteRate:I>0?(T+V)/I*100:0,sparkline:y,wasteSparkline:m,crcSparkline:f,transport:O,v2:z,transportSparkline:S,v2Sparkline:E}}function Ln({packets:t,rangeMinutes:s,rangeHours:n,timeRangeLabel:a,isLoaded:i=!0}){tt(At);const[l,r]=o.useState(null),[u,c]=o.useState(null),p=o.useCallback(async()=>{try{const v=await Vt(n);if(v.success&&v.data){r(v.data.count??v.data.history.length),c(v.data.history);return}const b=await qt(n);b.success&&b.data&&(r(b.data.count),c(null))}catch{}},[n]);o.useEffect(()=>{p()},[p]);const d=o.useMemo(()=>Dn(t,s,l,u),[t,s,l,u]),x=d.totalRx>0;return e.jsx(ue,{neomorphic:!0,isLoaded:i,skeletonType:"chart",children:i&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{icon:e.jsx(bs,{}),title:"Packet Health",badge:a,badgeColor:"zinc"}),e.jsx(Kt,{children:e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex gap-2 sm:gap-3 mb-2",children:[e.jsxs("div",{className:"flex-1 min-w-0 radius-inner depth-stroke-inset p-2 flex flex-col h-full cursor-help",title:"Total useless traffic: Software drops (e.g. empty, crypto) + Hardware CRC errors. Excludes duplicates.",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("div",{className:"data-box-label",children:"Discarded"}),e.jsx("div",{className:"data-box data-box-compact shrink-0 text-sys-indigo",children:x?`${d.wasteRate.toFixed(1)}%`:"—"})]}),e.jsx("div",{className:"flex-1 min-h-[20px] max-h-[28px] w-full",children:e.jsx(Oe,{data:d.wasteSparkline,width:9999,height:24,className:"w-full",color:"var(--sys-indigo)",invertScale:!0})})]}),e.jsxs("div",{className:"flex-1 min-w-0 radius-inner depth-stroke-inset p-2 flex flex-col h-full cursor-help",title:"Packets lost at the radio hardware level due to corruption or interference.",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("div",{className:"data-box-label flex items-center gap-1",children:"CRC Errors"}),e.jsx("div",{className:"data-box data-box-compact shrink-0 text-status-warning",children:l!==null?l:"—"})]}),e.jsx("div",{className:"flex-1 min-h-[20px] max-h-[28px] w-full",children:e.jsx(Oe,{data:d.crcSparkline,width:9999,height:24,className:"w-full",color:"var(--status-warning)",invertScale:!0})})]})]}),e.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0 radius-inner depth-stroke-inset p-2 flex flex-col h-full cursor-help",title:"Packets with Transport headers (reliable messaging)",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("div",{className:"data-box-label",children:"Transport"}),e.jsx("div",{className:"data-box data-box-compact shrink-0 text-sys-amber",children:x?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{children:d.transport}),e.jsx("span",{className:"punc-slash",children:"/"}),e.jsx(Pe,{children:d.uniqueRx})]}):"—"})]}),e.jsx("div",{className:"flex-1 min-h-[20px] max-h-[28px] w-full",children:e.jsx(Oe,{data:d.transportSparkline,width:9999,height:24,className:"w-full",color:"var(--sys-amber)"})})]}),e.jsxs("div",{className:"flex-1 min-w-0 radius-inner depth-stroke-inset p-2 flex flex-col h-full cursor-help",title:"Packets using V2 protocol format",children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("div",{className:"data-box-label",children:"V2"}),e.jsx("div",{className:"data-box data-box-compact shrink-0 text-sys-teal",children:x?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{children:d.v2}),e.jsx("span",{className:"punc-slash",children:"/"}),e.jsx(Pe,{children:d.uniqueRx})]}):"—"})]}),e.jsx("div",{className:"flex-1 min-h-[20px] max-h-[28px] w-full",children:e.jsx(Oe,{data:d.v2Sparkline,width:9999,height:24,className:"w-full",color:"var(--sys-teal)"})})]})]}),e.jsxs("div",{className:"flex gap-2 sm:gap-3 mt-auto",children:[e.jsxs("div",{className:"flex-1 min-w-0 cursor-help",title:"Redundant packets dropped because they were already received",children:[e.jsx("div",{className:"data-box-label",children:"Dupes"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:x?`${d.duplicateRate.toFixed(1)}%`:"—"})]}),e.jsxs("div",{className:"flex-1 min-w-0 cursor-help",title:"Packets successfully retransmitted to extend the mesh",children:[e.jsx("div",{className:"data-box-label",children:"Forwarded"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:x?`${d.efficiency.toFixed(1)}%`:"—"})]})]})]})})]})})}function oa(){var De,Se,Le,Ee,h,P,D,L,$,Y,J,ne,X,re,me,de,xe;const t=Xt(),s=Zt(),n=Qt(),a=Jt(),i=es(),l=ts(),r=t!==null&&i,u=o.useRef(!1);r&&!u.current&&(u.current=!0);const c=u.current,p=ss(),d=ns(),x=as(),[v,b]=o.useState(null),[,w]=o.useState(null),[N]=o.useState(null),[k,T]=o.useState(()=>{const C=localStorage.getItem("statistics-view-mode");return C==="share"||C==="airtime"?C:"airtime"});o.useEffect(()=>{localStorage.setItem("statistics-view-mode",k)},[k]);const[O,z]=o.useState(()=>{const C=localStorage.getItem("statistics-smoothing-mode");return["ema","ultra","mosaic","stats","trend"].includes(C)?C:"stats"});o.useEffect(()=>{localStorage.setItem("statistics-smoothing-mode",O)},[O]);const[F,V]=o.useState(!1),[I,y]=o.useState(!1),[m,f]=o.useState(kt),[S,E]=o.useState(.5),[W,g]=o.useState(ys),[_,U]=o.useState(.5),[Q,ee]=o.useState(85),H=o.useMemo(()=>({0:0,1:0,2:1,3:2,4:3,5:4,6:5,7:6,8:7,9:8,10:9})[p]??3,[p]),R=ze[H].hours,K=R*60,te=ze[H],ie=it(R),ae=l.isBackgroundLoading,se=o.useCallback(C=>{const be={0:1,1:2,2:3,3:4,4:5,5:6,6:7,7:8,8:9,9:10}[C]??4;d(be)},[d]),ce=o.useMemo(()=>{var q;if(!((q=t==null?void 0:t.config)!=null&&q.radio))return null;const C=t.config.radio;return{sf:C.spreading_factor??10,bw:C.bandwidth??25e4,cr:C.coding_rate??5,preamble:C.preamble_length??8}},[(Se=(De=t==null?void 0:t.config)==null?void 0:De.radio)==null?void 0:Se.spreading_factor,(Ee=(Le=t==null?void 0:t.config)==null?void 0:Le.radio)==null?void 0:Ee.bandwidth,(P=(h=t==null?void 0:t.config)==null?void 0:h.radio)==null?void 0:P.coding_rate,(L=(D=t==null?void 0:t.config)==null?void 0:D.radio)==null?void 0:L.preamble_length]),G=o.useMemo(()=>x.length===0?{timestamps:[],values:[]}:{timestamps:x.map(C=>C.timestamp),values:x.map(C=>C.noise_floor_dbm)},[x]),j=o.useMemo(()=>{if(x.length<10)return{anomalies:[],debug:void 0};const C=Ds(x,m);return{anomalies:C.anomalies,debug:C.debug}},[x,m]),M=j.anomalies,A=o.useMemo(()=>{const C=(t==null?void 0:t.neighbors)??{};return Object.fromEntries(Object.entries(C).filter(([q])=>!s.has(q)))},[t==null?void 0:t.neighbors,s]),B=o.useMemo(()=>{const C=Date.now()/1e3-R*3600;return Object.fromEntries(Object.entries(A).filter(([,q])=>q.last_seen>=C))},[A,R]),Z=o.useMemo(()=>{const C=K*60/ie,q=Math.floor(Date.now()/1e3),be=Math.floor(q/C)*C;return{start:be-K*60,end:be}},[K,ie]),he=W.timeStart??Z.start,fe=W.timeEnd??Z.end,ge=(fe-he)/3600,_e=it(ge),Re=vs(),Te=o.useMemo(()=>js(a,W,Re,Z),[a,W,Re,Z]);return e.jsxs(us,{children:[e.jsx(hs,{title:"Statistics",icon:e.jsx(is,{}),subtitle:e.jsx(ds,{}),controls:e.jsx(ms,{ranges:ze,selectedIndex:H,onSelect:se,isPending:ae})}),N&&e.jsx(ue,{className:"border border-sys-red/50 bg-sys-red/10",children:e.jsx("p",{className:"text-sys-red",children:N})}),F&&I&&e.jsxs(ue,{className:"border border-sys-indigo/30 bg-surface/50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"type-label",children:"Anomaly Detection Tuning"}),e.jsxs("span",{className:"type-data-xs text-fg-muted",children:["(",te.label,")"]})]}),e.jsx("button",{onClick:()=>f(C=>({...C,useAbsoluteThresholds:!C.useAbsoluteThresholds})),className:`type-data-xs px-2 py-1 rounded transition-colors ${m.useAbsoluteThresholds?"bg-sys-indigo/30 text-sys-indigo":"bg-elevated text-fg-muted hover:text-fg-secondary"}`,children:m.useAbsoluteThresholds?"Absolute dBm":"Percentile"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"type-micro",children:"Baseline"}),e.jsxs("span",{className:"ml-2 type-data-sm text-status-warning",children:[((Y=($=j.debug)==null?void 0:$.baselineCutoff)==null?void 0:Y.toFixed(1))??"—"," dBm"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"type-micro",children:"Spike"}),e.jsxs("span",{className:"ml-2 type-data-sm text-status-warning",children:[((ne=(J=j.debug)==null?void 0:J.spikeCutoff)==null?void 0:ne.toFixed(1))??"—"," dBm"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"type-micro",children:"Mid-band"}),e.jsx("span",{className:"ml-2 type-data-sm text-sys-indigo",children:((X=j.debug)==null?void 0:X.midBandSamples)??0})]}),e.jsxs("div",{children:[e.jsx("span",{className:"type-micro",children:"Anomalies"}),e.jsx("span",{className:"ml-2 type-data-sm text-status-danger",children:M.length})]})]}),e.jsxs("div",{className:"mt-4 pt-4 border-t border-edge-subtle space-y-4",children:[m.useAbsoluteThresholds?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Baseline (",m.baselineDbm," dBm)"]}),e.jsx("input",{type:"range",min:"-120",max:"-60",value:m.baselineDbm,onChange:C=>f(q=>({...q,baselineDbm:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Spike (",m.spikeDbm," dBm)"]}),e.jsx("input",{type:"range",min:"-100",max:"-20",value:m.spikeDbm,onChange:C=>f(q=>({...q,spikeDbm:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",m.mergeGapSeconds,"s)"]}),e.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:m.mergeGapSeconds,onChange:C=>f(q=>({...q,mergeGapSeconds:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Min Sequence (",m.minSequenceLength,")"]}),e.jsx("input",{type:"range",min:"2",max:"20",value:m.minSequenceLength,onChange:C=>f(q=>({...q,minSequenceLength:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",m.similarityToleranceDbm," dBm)"]}),e.jsx("input",{type:"range",min:"1",max:"15",value:m.similarityToleranceDbm,onChange:C=>f(q=>({...q,similarityToleranceDbm:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(S*100),"%)"]}),e.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:S,onChange:C=>E(Number(C.target.value)),className:"w-full accent-sys-indigo"})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Baseline (P",m.baselinePercentile,")"]}),e.jsx("input",{type:"range",min:"1",max:"50",value:m.baselinePercentile,onChange:C=>f(q=>({...q,baselinePercentile:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Spike (P",m.spikePercentile,")"]}),e.jsx("input",{type:"range",min:"50",max:"99",value:m.spikePercentile,onChange:C=>f(q=>({...q,spikePercentile:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",m.mergeGapSeconds,"s)"]}),e.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:m.mergeGapSeconds,onChange:C=>f(q=>({...q,mergeGapSeconds:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Min Sequence (",m.minSequenceLength,")"]}),e.jsx("input",{type:"range",min:"2",max:"20",value:m.minSequenceLength,onChange:C=>f(q=>({...q,minSequenceLength:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",m.similarityToleranceDbm," dBm)"]}),e.jsx("input",{type:"range",min:"1",max:"15",value:m.similarityToleranceDbm,onChange:C=>f(q=>({...q,similarityToleranceDbm:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(S*100),"%)"]}),e.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:S,onChange:C=>E(Number(C.target.value)),className:"w-full accent-sys-indigo"})]})]})]}),e.jsxs("div",{className:"mt-4 p-3 bg-elevated radius-inner",children:[e.jsx("div",{className:"type-micro mb-1",children:"Config output"}),e.jsxs("div",{className:"type-data-sm text-status-success",children:[m.useAbsoluteThresholds?`useAbsoluteThresholds: true, baselineDbm: ${m.baselineDbm}, spikeDbm: ${m.spikeDbm}`:`useAbsoluteThresholds: false, baselinePercentile: ${m.baselinePercentile}, spikePercentile: ${m.spikePercentile}`,", mergeGapSeconds: ",m.mergeGapSeconds,", minSequenceLength: ",m.minSequenceLength,", similarityToleranceDbm: ",m.similarityToleranceDbm]})]})]})]}),e.jsxs(xs,{ready:c,children:[e.jsx("div",{className:"sm:hidden",children:ae&&e.jsx(ye,{template:"auto",children:e.jsx(ue,{className:"border border-sys-blue/30 bg-sys-blue/5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative flex h-3 w-3",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-sys-blue opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-sys-blue"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"type-body-sm text-fg-primary",children:["Loading ",te.label," data..."]}),l.loadProgress&&e.jsxs("p",{className:"type-data-xs text-fg-muted mt-0.5",children:[l.loadProgress.loaded.toLocaleString()," packets (",l.loadProgress.percent,"%)"]})]})]})})})}),e.jsxs(e.Fragment,{children:[e.jsx(ye,{template:"hero-auto",children:e.jsx(ue,{neomorphic:!0,skeletonType:"chart",children:c&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{icon:e.jsx(we,{}),title:"Packet Analyzer",badge:te.label,badgeColor:"zinc",stackActionsOnMobile:!0,actions:e.jsxs("div",{className:"flex flex-wrap items-center gap-2 justify-end",children:[O==="stats"&&e.jsx(Xs,{enabled:F,onChange:V,anomalyCount:M.length,showTuning:I,onTuningChange:y}),e.jsx(Ys,{smoothing:O,onChange:z}),e.jsx(Ks,{mode:k,onChange:T})]})}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(dn,{packets:Te,allPackets:a,startTs:he,endTs:fe,parentStartTs:Z.start,parentEndTs:Z.end,bucketCount:_e,radioConfig:ce??void 0,mode:k,smoothing:O,noiseFloorAnomalies:M,showNoiseFloorOverlay:F,overlayOpacity:S,dotSize:_,dotOpacity:Q/100})})]})})}),e.jsx(ye,{template:"auto",className:"relative z-10",children:e.jsx(ue,{neomorphic:!0,noPadding:!0,className:"overflow-visible",children:c&&e.jsx(Ns,{parentStartTs:Z.start,parentEndTs:Z.end,neighbors:A,filter:W,onChange:g,...O==="stats"?{scatterDotSize:_,onScatterDotSizeChange:U,scatterOpacity:Q,onScatterOpacityChange:ee}:{}})})}),e.jsxs(ye,{template:"panel",children:[e.jsx(Me,{span:12,md:6,children:e.jsx(ue,{neomorphic:!1,skeletonType:"chart",noPadding:c,className:"!bg-transparent !ring-0 !shadow-none !overflow-visible -mx-4 sm:mx-0 !px-0 !pr-0",children:c&&e.jsx(Qe,{children:e.jsx(yn,{neighbors:B,quickNeighbors:n,localLat:((me=(re=t==null?void 0:t.config)==null?void 0:re.repeater)==null?void 0:me.latitude)??0,localLon:((xe=(de=t==null?void 0:t.config)==null?void 0:de.repeater)==null?void 0:xe.longitude)??0,onStatsChange:w,title:"Link Quality",badge:te.label})})})}),e.jsx(Me,{span:12,md:6,children:e.jsx(ue,{neomorphic:!0,skeletonType:"chart",children:c&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{icon:e.jsx(ws,{}),title:"Network Composition",badge:te.label,badgeColor:"zinc"}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Qe,{children:e.jsx(vn,{neighbors:B,timeRangeLabel:te.label})})})]})})})]}),e.jsxs(ye,{template:"panel",children:[e.jsx(Me,{span:12,md:6,children:e.jsx(Tn,{})}),e.jsx(Me,{span:12,md:6,children:e.jsx(Ln,{packets:a,rangeMinutes:K,rangeHours:R,timeRangeLabel:te.label})})]}),e.jsx(ye,{template:"panel",children:e.jsx(Me,{span:12,children:e.jsx(ue,{neomorphic:!0,skeletonType:"chart",children:c&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{icon:e.jsx(rs,{}),title:"NOISE FLOOR dBm",stackActionsOnMobile:!0,actions:v?e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsxs("span",{className:"type-data-xs text-fg-muted whitespace-nowrap",children:["min ",e.jsx("span",{className:"data-box",children:v.min.toFixed(0)})]}),e.jsxs("span",{className:"type-data-xs text-fg-muted whitespace-nowrap",children:["avg ",e.jsx("span",{className:"data-box",children:v.avg.toFixed(0)})]}),e.jsxs("span",{className:"type-data-xs text-fg-muted whitespace-nowrap",children:["max ",e.jsx("span",{className:"data-box",children:v.max.toFixed(0)})]})]}):null}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Qe,{children:e.jsx(ls,{timestamps:G.timestamps,values:G.values,onStatsChange:b})})})]})})})})]})]})]})}export{oa as default}; diff --git a/frontend/dist/assets/Statistics-rEwwTJX9.js b/frontend/dist/assets/Statistics-rEwwTJX9.js deleted file mode 100644 index bf74c571..00000000 --- a/frontend/dist/assets/Statistics-rEwwTJX9.js +++ /dev/null @@ -1,36 +0,0 @@ -var _t=Object.defineProperty;var Rt=(t,s,n)=>s in t?_t(t,s,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[s]=n;var xe=(t,s,n)=>Rt(t,typeof s!="symbol"?s+"":s,n);import{d as He,r as c,j as e,t as Ce,c as it,bg as Nt,c9 as vt,ca as tt,h as ke,cb as Tt,x as Ae,cc as Dt,cd as Et,ce as Lt,k as It,cf as Pt,cg as Ot,ch as Ft,ci as Ht,cj as Bt,bI as $t,ck as $e,bL as zt,cl as Wt,cm as Ut,N as ve,cn as Gt,co as Vt,cp as qt,bi as Kt,K as Yt,Q as Xt,P as Zt,G as Qt,ao as Jt,ap as es,V as ts,ai as ss,cq as ns,cr as ze,cs as rt,aa as as,R as is,a4 as rs}from"./index-CeMilrX4.js";import{L as Se}from"./layers-DVUHhJuY.js";import{u as st,h as ls,r as nt}from"./consumer-registry-Hkh6Dv_i.js";import{C as We,e as os}from"./easing-CFZ7-xae.js";import{T as cs,M as ms}from"./MqttModeBadge-C_MEMmDd.js";import{C as de,P as ds,a as us,B as hs}from"./PageLayout-Cw_MXmcE.js";import{D as xs}from"./DataBox-Da-5DbUW.js";import{E as ps,A as Fe,D as Pe}from"./DataValue-BDllMDjE.js";import{C as fs}from"./CollisionExplorerModal-Cvw_f8a6.js";import{H as lt}from"./hash-CBEVBQJR.js";import{T as Je}from"./triangle-alert-DiFold9L.js";import{L as Ue}from"./LightSparkline-D652BQd5.js";import{A as gs}from"./activity-BZFnO4kb.js";import{c as bs,a as ys,A as js}from"./AnalyzerFilterPanel-DoQoJv94.js";import{useResolveSource as Ns}from"./usePipelineStore-B80TA53S.js";import{R as ye,C as Me}from"./Grid-BuDgMX1I.js";import{S as vs}from"./settings-2-97rHsI_C.js";import{N as ks}from"./network-c_XxfhAX.js";import"./chevron-right-D3QL4sfa.js";import"./map-pin-D6_BkIVb.js";import"./index-BK59_Mkt.js";import"./BasemapLayer-CNBmoufo.js";import"./monitor-smartphone-DxkmIgui.js";import"./node-types-C09ZlzBQ.js";import"./circle-question-mark-Bqc_DPUo.js";import"./funnel-D2SUJQ8o.js";import"./search-Bph9xP9G.js";/** - * @license lucide-react v0.559.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ss=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],ws=He("chart-line",Ss);/** - * @license lucide-react v0.559.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ms=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],ot=He("circle-check-big",Ms);/** - * @license lucide-react v0.559.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Cs=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],As=He("grid-3x3",Cs);/** - * @license lucide-react v0.559.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _s=[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]],Rs=He("grip",_s),kt={useAbsoluteThresholds:!0,baselinePercentile:6,spikePercentile:50,baselineDbm:-107,spikeDbm:-100,mergeGapSeconds:45,minSequenceLength:16,similarityToleranceDbm:5};function Ne(t,s){if(t.length===0)return 0;const n=s/100*(t.length-1),a=Math.floor(n),i=Math.ceil(n);return a===i?t[a]:t[a]+(t[i]-t[a])*(n-a)}function ct(t){if(t.length===0)return{median:0,p90:0,p95:0,p99:0,max:0,min:0};const s=[...t].sort((n,a)=>n-a);return{median:Ne(s,50),p90:Ne(s,90),p95:Ne(s,95),p99:Ne(s,99),max:s[s.length-1],min:s[0]}}function Ts(t,s={}){const n={...kt,...s};if(t.length<10)return{anomalies:[],thresholds:ct([]),totalSamples:t.length,anomalySamples:0};const a=t.map(y=>y.noise_floor_dbm),i=ct(a),r=[...a].sort((y,v)=>y-v);let l,u;n.useAbsoluteThresholds?(l=n.baselineDbm,u=n.spikeDbm):(l=Ne(r,n.baselinePercentile),u=Ne(r,n.spikePercentile));const o=[...t].sort((y,v)=>y.timestamp-v.timestamp),p=[];let m=null,x=0;for(const y of o)if(y.noise_floor_dbm>l&&y.noise_floor_dbmO+B,0)/m.values.length):(m.values.length>=n.minSequenceLength&&p.push(m),m={startTs:y.timestamp,endTs:y.timestamp,values:[y.noise_floor_dbm],timestamps:[y.timestamp],rollingAvg:y.noise_floor_dbm})}else m&&m.values.length>=n.minSequenceLength&&p.push(m),m=null;return m&&m.values.length>=n.minSequenceLength&&p.push(m),p.length===0?{anomalies:[],thresholds:i,totalSamples:t.length,anomalySamples:x,debug:{baselineCutoff:l,spikeCutoff:u,midBandSamples:x}}:{anomalies:p.map(y=>{const v=Math.max(...y.values),j=y.values.reduce((N,R)=>N+R,0)/y.values.length;return{startTs:y.startTs,endTs:y.endTs,peakValue:v,avgValue:j,severity:Ds(j,l,u),sampleCount:y.values.length}}),thresholds:i,totalSamples:t.length,anomalySamples:x,debug:{baselineCutoff:l,spikeCutoff:u,midBandSamples:x}}}function Ds(t,s,n){const a=n-s;if(a===0)return"moderate";const i=(t-s)/a;return i>.66?"critical":i>.33?"severe":"moderate"}const Es=Object.entries(Nt).map(([t,s])=>{const n=parseInt(t,10);return{typeNum:n,key:`TYPE_${n}`,label:s}});function at({sortedTypes:t,highlightedType:s,onTypeHover:n,aggregateShares:a,hoverData:i}){const r=c.useMemo(()=>{if(!i)return null;const o=new Map;for(const p of i.items)o.set(p.key,p.value);return o},[i]),l=r!==null,u=c.useMemo(()=>{const o=new Set(t.map(x=>x.key)),p=t.map(x=>({typeNum:x.typeNum,key:x.key,label:x.label})),m=Es.filter(x=>!o.has(x.key));return[...p,...m]},[t]);return e.jsxs("div",{className:"flex-shrink-0 pt-2 sm:pt-3 mt-1 sm:mt-2 px-0 sm:pr-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mx-0 sm:ml-9 sm:mr-0 mb-1 sm:mb-1.5 type-data-xs",children:[e.jsx("span",{className:"text-fg-muted",children:"Packet Types"}),l&&(i==null?void 0:i.timeLabel)&&e.jsx("span",{className:"text-sys-indigo tabular-nums",children:i.timeLabel})]}),e.jsx("div",{className:"flex flex-wrap gap-x-3 sm:gap-x-4 gap-y-1 type-data-xs mx-0 sm:ml-9 sm:mr-0",onMouseLeave:()=>n(null),children:u.map(o=>{const p=Ce(o.typeNum),m=(r==null?void 0:r.get(o.key))??0,x=a.get(o.key)??0,S=l?m:x,y=S>1e-4,v=a.has(o.key),j=s===o.key,N=s&&!j||l&&m<=1e-4||!l&&!s&&!v;return e.jsxs("div",{className:it("flex items-center gap-1.5 transition-opacity cursor-pointer hover:opacity-80",N&&"opacity-30"),onMouseEnter:()=>n(o.key),children:[e.jsx("div",{className:"shrink-0 w-3 h-3 rounded-xs",style:{backgroundColor:p}}),e.jsx("span",{className:"text-fg-secondary whitespace-nowrap",children:o.label}),y&&e.jsxs("span",{className:it("tabular-nums",l?"text-fg-primary":"text-fg-muted"),children:[(S*100).toFixed(1),"%"]})]},o.key)})})]})}const mt='ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',Ls=2,Is=3,Ps=32,Os=20,Fs=80;function dt(t,s,n,a,i){const r=t.reduce((p,m)=>p+m,0);if(r<=0||t.length===0)return[];const l=t.map((p,m)=>m).sort((p,m)=>t[m]-t[p]),u=l.map(p=>t[p]),o=new Array(t.length);return et(u,l,r,s,n,a,i,o),o}function et(t,s,n,a,i,r,l,u){if(t.length===0)return;if(t.length===1){u[s[0]]={x:a,y:i,w:r,h:l,index:s[0]};return}const o=r*l/n,p=r>=l,m=p?l:r;let x=0,S=1/0,y=0;for(let B=0;Bz?E/z:z/E,g>z?g/z:z/g);if(d<=S)S=d,y=B+1,x=M;else break}const v=m>0?x*o/m:0;let j=0;for(let B=0;B0?t[B]/x:0)*m;p?u[s[B]]={x:a,y:i+j,w:v,h:z,index:s[B]}:u[s[B]]={x:a+j,y:i,w:z,h:v,index:s[B]},j+=z}const N=t.slice(y),R=s.slice(y),O=n-x;p?et(N,R,O,a+v,i,r-v,l,u):et(N,R,O,a,i+v,r,l-v,u)}function ut(t,s,n,a,i,r){for(const l of s){const u=n[l.index];if(!u)continue;const o=Ls*r,p=l.x*r+o/2,m=l.y*r+o/2,x=l.w*r-o,S=l.h*r-o;if(x<=0||S<=0)continue;const y=Ce(u.typeNum),v=i!==null&&i!==l.index;t.save(),t.globalAlpha=v?.4:1;const j=Is*r;t.beginPath(),t.moveTo(p+j,m),t.lineTo(p+x-j,m),t.quadraticCurveTo(p+x,m,p+x,m+j),t.lineTo(p+x,m+S-j),t.quadraticCurveTo(p+x,m+S,p+x-j,m+S),t.lineTo(p+j,m+S),t.quadraticCurveTo(p,m+S,p,m+S-j),t.lineTo(p,m+j),t.quadraticCurveTo(p,m,p+j,m),t.closePath(),t.fillStyle=y,t.fill(),t.strokeStyle="rgba(0,0,0,0.2)",t.lineWidth=1*r,t.stroke();const N=4*r,R=l.w>36&&l.h>20,O=l.w>36&&l.h>32;if(R){const B=11*r;if(O){const M=a>0?u.size/a*100:0;t.font=`500 ${8*r}px ${mt}`,t.fillStyle="rgba(0,0,0,0.6)",t.textBaseline="alphabetic",t.textAlign="left",t.fillText(`${M.toFixed(1)}%`,p+N,m+S-N-B)}t.font=`600 ${9*r}px ${mt}`,t.fillStyle="rgba(0,0,0,0.85)",t.textBaseline="alphabetic",t.textAlign="left",t.fillText(u.name,p+N,m+S-N)}t.restore()}}function Hs(t,s,n){for(const a of t)if(s>=a.x&&s<=a.x+a.w&&n>=a.y&&n<=a.y+a.h)return a.index;return null}function Bs({data:t,total:s,color:n,position:a,containerWidth:i,isAirtime:r}){if(!t||!a)return null;const l=(t.value/s*100).toFixed(1),u=160,m=i-a.x=6e4?`${(t/6e4).toFixed(1)}m`:t>=1e3?`${(t/1e3).toFixed(1)}s`:`${Math.round(t)}ms`}function $s({sortedTypes:t,aggregateShares:s,mode:n="share"}){var E,g,d;const[a,i]=c.useState(null),[r,l]=c.useState(null),[u,o]=c.useState(0),[p,m]=c.useState(null),x=c.useRef(null),S=c.useRef(null),y=c.useRef([]),v=n==="airtime",j=c.useMemo(()=>t.reduce((f,k)=>f+(v?k.totalAirtime:k.totalCount),0),[t,v]),N=c.useMemo(()=>t.map((f,k)=>({name:f.label,size:v?f.totalAirtime:f.totalCount,index:k,typeNum:f.typeNum,key:f.key})),[t,v]);c.useEffect(()=>{const f=S.current;if(!f)return;const k=f.parentElement;if(!k)return;const I=k.getBoundingClientRect(),W=I.width,D=I.height;if(W<=0||D<=0)return;const U=window.devicePixelRatio||1;f.width=Math.floor(W*U),f.height=Math.floor(D*U),f.style.width=`${W}px`,f.style.height=`${D}px`;const q=N.map(G=>G.size),ee=dt(q,0,0,W,D);y.current=ee;const J=f.getContext("2d");J&&(J.clearRect(0,0,f.width,f.height),ut(J,ee,N,j,a,U))},[N,j,a]),c.useEffect(()=>{const f=x.current;if(!f)return;const k=new ResizeObserver(()=>{const I=S.current;if(!I)return;const W=f.getBoundingClientRect(),D=W.width,U=W.height;if(D<=0||U<=0)return;const q=window.devicePixelRatio||1;I.width=Math.floor(D*q),I.height=Math.floor(U*q),I.style.width=`${D}px`,I.style.height=`${U}px`;const ee=N.map(L=>L.size),J=dt(ee,0,0,D,U);y.current=J;const G=I.getContext("2d");G&&(G.clearRect(0,0,I.width,I.height),ut(G,J,N,j,a,q))});return k.observe(f),()=>k.disconnect()},[N,j]);const R=c.useCallback(f=>{const k=x.current;if(!k)return;const I=k.getBoundingClientRect(),W=f.clientX-I.left,D=f.clientY-I.top,U=Hs(y.current,W,D);i(U),U!==null?(o(I.width),l({x:W,y:D})):l(null)},[]),O=c.useCallback(()=>{i(null),l(null)},[]),B=c.useCallback(f=>{if(m(f),f){const k=N.findIndex(I=>I.key===f);i(k>=0?k:null)}else i(null)},[N]),M=a!==null?{name:((E=N[a])==null?void 0:E.name)??"",value:((g=N[a])==null?void 0:g.size)??0}:null,z=a!==null?Ce((d=N[a])==null?void 0:d.typeNum):"";return t.length===0||j===0?e.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[e.jsx(Se,{className:"w-6 h-6 mr-2 opacity-50"}),e.jsx("span",{children:"No packet type data available"})]}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"flex-1 min-h-0 relative",children:e.jsxs("div",{className:"absolute overflow-hidden radius-inner depth-stroke-inset bg-chart-inner",style:{left:Ps,right:0,top:0,bottom:Os},ref:x,onMouseMove:R,onMouseLeave:O,children:[e.jsx("canvas",{ref:S,className:"absolute inset-0",style:{cursor:"default"}}),e.jsx(Bs,{data:M,total:j,color:z,position:r,containerWidth:u,isAirtime:v})]})}),e.jsx("div",{style:{minHeight:Fs},children:e.jsx(at,{sortedTypes:t,highlightedType:p,onTypeHover:B,aggregateShares:s})})]})}const Ge=32,Ve=20,zs=300;function je(t){return t>=1e9?`${(t/1e9).toFixed(1)} Gb`:t>=1e6?`${(t/1e6).toFixed(1)} Mb`:t>=1e3?`${(t/1e3).toFixed(1)} Kb`:`${t.toFixed(0)} B`}function Ws({packets:t,mode:s,startTs:n,endTs:a,radioConfig:i,bucketCount:r,lockedYMax:l,legendMinH:u}){const o=c.useMemo(()=>vt(),[]),p=o.blue,m=o.red,x=o.yellow,[S,y]=c.useState(null),{trendData:v,totals:j}=c.useMemo(()=>{if(t.length===0)return{trendData:[],totals:{rxBytes:0,txBytes:0,rxAirtime:0,txAirtime:0}};const g=a-n,d=Math.min(Math.ceil(g/zs),r),f=g/d,k=[];let I=0,W=0,D=0,U=0;for(const $ of t){const b=$.timestamp;if(b=a)continue;const w=tt($),A=ke($,{spreadingFactor:i.sf,bandwidthHz:i.bw,codingRate:i.cr,preambleLength:i.preamble}),F={timestamp:b,rxAirtime:0,txAirtime:0,rxBytes:0,txBytes:0};$.transmitted?(F.txAirtime=A,F.txBytes=w,W+=w,U+=A):(F.rxAirtime=A,F.rxBytes=w,I+=w,D+=A),k.push(F)}k.sort(($,b)=>$.timestamp-b.timestamp);const q=new Float64Array(k.length+1),ee=new Float64Array(k.length+1),J=new Float64Array(k.length+1),G=new Float64Array(k.length+1),L=new Float64Array(k.length);for(let $=0;${let b=0,w=L.length;for(;b>>1;L[A]<$?b=A+1:w=A}return b},te=[],ie=f*1e3;for(let $=0;$0?Z:null,tx:ue>0?ue:null})}else{const Z=q[F]-q[A],ue=ee[F]-ee[A],pe=Z/ie*100,fe=ue/ie*100;te.push({timestamp:b,rx:pe>0?pe:null,tx:fe>0?fe:null})}}const ae=2/31;let se=null;return{trendData:te.map($=>{const b=$.rx;return b!==null&&b>0&&(se===null?se=b:se=ae*b+(1-ae)*se),{...$,rxSmooth:se!==null&&se>0?se:null}}),totals:{rxBytes:I,txBytes:W,rxAirtime:D,txAirtime:U}}},[t,n,a,r,s,i]),N=c.useMemo(()=>{if(v.length===0)return s==="share"?100:10;let g=0;for(const f of v){const k=f.rx??0,I=f.tx??0;k>g&&(g=k),I>g&&(g=I)}const d=g*1.1;return s==="share"?d<=100?100:d<=500?Math.ceil(d/100)*100:d<=1e3?Math.ceil(d/200)*200:d<=5e3?Math.ceil(d/500)*500:d<=1e4?Math.ceil(d/1e3)*1e3:Math.ceil(d/5e3)*5e3:Math.max(1,Math.ceil(d))},[v,s]),R=l??N,O=c.useMemo(()=>{if(S!==null&&v[S]){const g=v[S],d=g.rx??0,f=g.tx??0;return s==="share"?{rx:je(d),tx:je(f),total:je(d+f),isHovered:!0}:{rx:`${d.toFixed(2)}%`,tx:`${f.toFixed(2)}%`,total:`${(d+f).toFixed(2)}%`,isHovered:!0}}if(s==="share")return{rx:je(j.rxBytes),tx:je(j.txBytes),total:je(j.rxBytes+j.txBytes),isHovered:!1};{let g=0,d=0,f=0;for(const W of v)(W.rx!==null||W.tx!==null)&&(g+=W.rx??0,d+=W.tx??0,f++);const k=f>0?g/f:0,I=f>0?d/f:0;return{rx:`${k.toFixed(2)}%`,tx:`${I.toFixed(2)}%`,total:`${(k+I).toFixed(2)}%`,isHovered:!1}}},[S,v,j,s]),B=c.useMemo(()=>{const g=a-n,d=g/3600;return[0,.25,.5,.75,1].map(k=>{const I=n+g*k,W=new Date(I*1e3),D=W.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),U=W.toLocaleDateString([],{weekday:"short"}),q=k===.25||k===.75;return{pct:k,label:d>=24?`${U} ${D}`:D,mobileHidden:q}})},[n,a]),M=c.useCallback(g=>{y(g)},[]);if(v.length===0)return e.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[e.jsx(Se,{className:"w-6 h-6 mr-2 opacity-50"}),e.jsx("span",{children:"No packet data available"})]});const z=c.useMemo(()=>s==="airtime"?R<=5?1:R<=10?2:R<=20?5:Math.ceil(R/5):R<=100?25:R<=500?100:R<=1e3?200:R<=5e3?1e3:R<=1e4?2e3:Math.ceil(R/5e3)*1e3,[R,s]),E=c.useMemo(()=>{const g=[];for(let d=0;d<=R;d+=z){const f=(1-d/R)*100;let k;s==="airtime"?k=`${d}%`:d>=1e6?k=`${(d/1e6).toFixed(1)}M`:d>=1e3?k=`${(d/1e3).toFixed(0)}K`:k=`${d}`,g.push({pos:f,label:k})}return g},[R,z,s]);return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex-1 min-h-0 relative",children:[e.jsx("div",{className:"absolute top-0 left-0 flex flex-col justify-between",style:{width:Ge,bottom:Ve},children:E.map((g,d)=>e.jsx("span",{className:"type-data-xs text-fg-secondary text-right pr-1.5",style:{position:"absolute",top:`${g.pos}%`,transform:d===0?"translateY(-100%)":d===E.length-1?"none":"translateY(-50%)",right:0},children:g.label},d))}),e.jsx("div",{className:"absolute overflow-hidden radius-inner depth-stroke-inset bg-chart-inner",style:{left:Ge,right:0,top:0,bottom:Ve},children:e.jsx(Tt,{data:v,yAxisMode:s==="share"?"share":"airtime",yMax:R,onHover:M,startTs:n,endTs:a,externalAxes:!0})}),e.jsx("div",{className:"absolute left-0 right-0 bottom-0 flex items-center pointer-events-none",style:{left:Ge,height:Ve,paddingTop:4},children:B.map((g,d)=>e.jsx("span",{className:`absolute type-data-xs text-fg-muted/60 tabular-nums ${g.mobileHidden?"hidden sm:inline":""}`,style:{left:`${g.pct*100}%`,transform:g.pct===0?"translateX(0)":g.pct===1?"translateX(-100%)":"translateX(-50%)"},children:g.label},d))})]}),e.jsxs("div",{className:"flex items-end justify-between pb-1",style:{minHeight:u},children:[e.jsxs("div",{className:"flex items-center gap-3 sm:gap-5 type-data-sm pl-2 sm:pl-11",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-4 sm:w-5 h-[2px] rounded-full",style:{backgroundColor:p}}),e.jsx("span",{className:"text-fg-secondary",children:"RX"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-4 sm:w-5 h-[2px] rounded-full",style:{backgroundColor:m}}),e.jsx("span",{className:"text-fg-secondary",children:"TX"})]}),e.jsxs("div",{className:"hidden sm:flex items-center gap-1.5",children:[e.jsx("div",{className:"w-5 h-[2px] rounded-full",style:{backgroundColor:x}}),e.jsx("span",{className:"text-fg-secondary",children:"Avg"})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 sm:gap-8",children:[e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("div",{className:"type-data-xl text-fg-primary",children:O.rx}),e.jsx(Ae,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"RX"})]}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("div",{className:"type-data-xl text-fg-primary",children:O.tx}),e.jsx(Ae,{color:"zinc",className:"mb-0.5 sm:mb-1",children:"TX"})]})]})]})]})}const xt=Dt;class Us{constructor(){xe(this,"worker",null);xe(this,"listeners",new Set);xe(this,"currentResult",null);xe(this,"isComputing",!1);xe(this,"debounceTimer",null);xe(this,"debounceMs",250);xe(this,"lastCacheKey",null)}ensureWorker(){if(this.worker)return this.worker;if(typeof window>"u")return null;try{this.worker=new Worker(new URL("/assets/bucketing.worker-D0TT0k8y.js",import.meta.url),{type:"module"}),this.worker.onmessage=s=>{this.handleWorkerMessage(s.data)},this.worker.onerror=s=>{console.error("[BucketingService] Worker error:",s),this.isComputing=!1,this.notifyListeners()}}catch(s){console.error("[BucketingService] Failed to initialize worker:",s)}return this.worker}handleWorkerMessage(s){if(this.isComputing=!1,s.type==="error"){this.currentResult=null,this.notifyListeners();return}const n=s.payload;this.currentResult={points:n.points,rawValues:n.rawValues,packetTypes:n.packetTypes,timestamps:n.timestamps,count:n.count,minTime:n.minTime,maxTime:n.maxTime,minValue:n.minValue,maxValue:n.maxValue,rawMinValue:n.rawMinValue,rawMaxValue:n.rawMaxValue,unit:"%",stats:{p5:n.p5,p50:n.p50,p95:n.p95,uniqueValues:n.uniqueValues,topValues:n.topValues}},this.notifyListeners()}notifyListeners(){for(const s of this.listeners)try{s(this.currentResult,this.isComputing)}catch(n){console.error("[BucketingService] Listener error:",n)}}isCacheHit(s){return!this.lastCacheKey||!this.currentResult?!1:this.lastCacheKey.startTs===s.startTs&&this.lastCacheKey.endTs===s.endTs&&this.lastCacheKey.mode===s.mode&&this.lastCacheKey.packetCount===s.packetCount}compute(s,n,a,i,r){if(s.length===0||!r){this.currentResult=null,this.notifyListeners();return}const l={startTs:n,endTs:a,mode:i,packetCount:s.length};this.isCacheHit(l)||(this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.computeInternal(s,n,a,i,r,l)},this.debounceMs))}computeInternal(s,n,a,i,r,l){const u=this.ensureWorker();if(!u)return;const o=s.length,p=new Float64Array(o),m=new Float64Array(o),x=new Uint16Array(o),S=new Uint8Array(o),y={spreadingFactor:r.sf,bandwidthHz:r.bw,codingRate:r.cr,preambleLength:r.preamble};for(let j=0;j{this.listeners.delete(s)}}clear(){this.currentResult=null,this.lastCacheKey=null,this.notifyListeners()}terminate(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.worker&&(this.worker.terminate(),this.worker=null),this.listeners.clear()}}const qe=new Us;function Gs(t,s,n,a,i){const[r,l]=c.useState(()=>qe.getResult());return c.useEffect(()=>qe.subscribe(u=>{l(u)}),[]),c.useEffect(()=>{qe.compute(t,s,n,a,i)},[t,s,n,a,i]),r}function Vs({mode:t,packets:s,startTs:n,endTs:a,radioConfig:i,sortedTypes:r,aggregateShares:l,noiseFloorAnomalies:u,showNoiseFloorOverlay:o,overlayOpacity:p=.5,startLabel:m,endLabel:x,lockedYMax:S,legendMinH:y,dotSize:v,dotOpacity:j}){const[N,R]=c.useState(null),[O,B]=c.useState(null),M=c.useMemo(()=>(a-n)/3600,[n,a]),z=c.useCallback(G=>{B(G)},[]),g=Gs(s,n,a,t==="share"?"share":"airtime",i),[d,f]=c.useState(null),k=c.useCallback((G,L)=>{R(G),f(L??null)},[]),I=c.useMemo(()=>{if(d===null||!g||g.count===0)return null;const G=n+d*(a-n);let L;M>=168?L=75:M>=72?L=35:M>=24?L=15:M>=3?L=10:L=5;const K=L*60/2;return{start:G-K,end:G+K}},[d,g,n,a,M]),W=c.useMemo(()=>I?new Date((I.start+I.end)/2*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}):null,[I]),D=c.useMemo(()=>{if(N===null||!I)return null;const G=W??"",{start:L,end:K}=I,te=s.filter(b=>b.timestamp>=L&&b.timestamp({key:b.key,label:b.label,value:0,color:xt(b.typeNum)}))};const ie=new Map,ae=new Map;let se=0,oe=0;for(const b of te){const A=`TYPE_${b.type??b.payload_type??-1}`;if(ie.set(A,(ie.get(A)??0)+1),se++,i){const F=ke(b,{spreadingFactor:i.sf,bandwidthHz:i.bw,codingRate:i.cr,preambleLength:i.preamble});ae.set(A,(ae.get(A)??0)+F),oe+=F}}const $=r.map(b=>{let w;return t==="airtime"?w=oe>0?(ae.get(b.key)??0)/oe:0:w=se>0?(ie.get(b.key)??0)/se:0,{key:b.key,label:b.label,value:w,color:xt(b.typeNum)}});return{timestamp:(L+K)/2,timeLabel:G,items:$}},[N,I,W,s,r,t,i]),U=t==="share",q=S??(g==null?void 0:g.maxValue)??(U?240:10),ee=c.useMemo(()=>{if(!U)return 5;const G=[10,20,25,50,100,200,250,500,1e3],L=q/4.5;for(const K of G)if(K>=L)return K;return q>5e3?Math.ceil(L/1e3)*1e3:Math.ceil(L/100)*100},[q,U]),J=c.useMemo(()=>{const G=[];for(let L=0;L<=q;L+=ee){const K=(1-L/q)*100;G.push({pos:K,label:U?`${L}B`:`${L}%`})}return G},[q,ee,U]);return!g||g.count===0?e.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[e.jsx(Se,{className:"w-6 h-6 mr-2 opacity-50"}),e.jsx("span",{children:"No packet data available"})]}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex-1 min-h-0 relative",children:[e.jsx("div",{className:"absolute top-0 left-0 flex flex-col justify-between",style:{width:32,bottom:20},children:J.map((G,L)=>e.jsx("span",{className:"type-data-xs text-fg-secondary text-right pr-1.5",style:{position:"absolute",top:`${G.pos}%`,transform:L===0?"translateY(-100%)":L===J.length-1?"none":"translateY(-50%)",right:0},children:G.label},L))}),e.jsxs("div",{className:"absolute overflow-hidden radius-inner depth-stroke-inset bg-chart-inner",style:{left:32,right:0,top:0,bottom:20},children:[e.jsx(Et,{scatterData:g,yAxisMode:t==="share"?"share":"airtime",onHover:k,noiseFloorAnomalies:u,showNoiseFloorOverlay:o,overlayOpacity:p,highlightedType:O,timeRangeHours:M,yAxisMaxOverride:S,dotSize:v,dotOpacity:j,startTs:n,endTs:a,externalAxes:!0}),W&&e.jsx("div",{className:"absolute top-1 right-1 px-2 py-0.5 bg-elevated/90 rounded type-data-xs text-sys-indigo pointer-events-none z-10",children:W})]}),m&&x&&e.jsxs("div",{className:"absolute left-0 right-0 bottom-0 flex justify-between pointer-events-none type-data-xs text-fg-muted/60",style:{left:32,height:20,paddingTop:4},children:[e.jsx("span",{children:m}),e.jsx("span",{children:x})]})]}),e.jsx("div",{style:{minHeight:y},children:e.jsx(at,{sortedTypes:r,highlightedType:O,onTypeHover:z,aggregateShares:l,hoverData:D})})]})}function qs({mode:t,onChange:s}){return e.jsxs("div",{className:"toggle-group toggle-group-sm",children:[e.jsx("button",{onClick:()=>s("share"),className:`toggle-group-item ${t==="share"?"active":""}`,children:"Total"}),e.jsx("button",{onClick:()=>s("airtime"),className:`toggle-group-item ${t==="airtime"?"active":""}`,children:"Airtime"})]})}function Ks({smoothing:t,onChange:s}){return e.jsxs("div",{className:"toggle-group toggle-group-sm",children:[e.jsx("button",{onClick:()=>s("stats"),className:`toggle-group-item ${t==="stats"?"active":""}`,title:"Statistics view (scatter plot)",children:e.jsx(Rs,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>s("trend"),className:`toggle-group-item ${t==="trend"?"active":""}`,title:"Trend line chart",children:e.jsx(ws,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>s("ema"),className:`toggle-group-item ${t==="ema"?"active":""}`,title:"Stacked area (moderate smoothing)",children:e.jsx(Se,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>s("ultra"),className:`toggle-group-item ${t==="ultra"?"active":""}`,title:"Stacked area (heavy smoothing)",children:e.jsx(Lt,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>s("mosaic"),className:`toggle-group-item ${t==="mosaic"?"active":""}`,title:"Mosaic view (treemap)",children:e.jsx(As,{className:"w-3.5 h-3.5"})})]})}function Ys({enabled:t,onChange:s,anomalyCount:n=0,showTuning:a=!1,onTuningChange:i}){return e.jsxs("div",{className:"relative inline-flex items-center gap-1",children:[t&&i&&e.jsx("button",{onClick:()=>i(!a),className:`toggle-group toggle-group-sm ${a?"active":""}`,title:a?"Hide tuning panel":"Show tuning panel",children:e.jsx("span",{className:`toggle-group-item ${a?"active":""}`,children:e.jsx(vs,{className:"w-3.5 h-3.5"})})}),e.jsx("button",{onClick:()=>s(!t),className:`toggle-group toggle-group-sm ${t?"active":""}`,title:t?"Hide noise floor anomalies":"Show noise floor anomalies",children:e.jsx("span",{className:`toggle-group-item ${t?"active":""}`,children:e.jsx(ps,{className:"w-3.5 h-3.5"})})}),n>0&&e.jsx("span",{className:"absolute -top-2 -right-2 min-w-[18px] h-[18px] px-1 rounded-full bg-sys-red text-white text-xs font-bold flex items-center justify-center pointer-events-none z-10",children:n>99?"99+":n})]})}const St=[{target:"PacketAnalyzer",fn:"type",minStage:1},{target:"PacketAnalyzer",fn:"airtime",minStage:1,when:ls}];nt(St);const pt=360,Xs=500,Zs={sf:10,bw:25e4,cr:5,preamble:8},Ke=32;function ft(t,s){const n=new Date(t*1e3),a=l=>l.toString().padStart(2,"0"),i=`${a(n.getHours())}:${a(n.getMinutes())}`;return s<24?i:`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][n.getMonth()]} ${n.getDate()} ${i}`}function Qs(t){return Nt[t]??`TYPE_${t.toString(16).toUpperCase()}`}function Js(t,s){const n=new Map;for(const i of t){const r=i.type??i.payload_type??-1,l=ke(i,{spreadingFactor:s.sf,bandwidthHz:s.bw,codingRate:s.cr,preambleLength:s.preamble}),u=n.get(r)??{count:0,airtime:0};n.set(r,{count:u.count+1,airtime:u.airtime+l})}const a=[];for(const[i,r]of n)a.push({typeNum:i,key:`TYPE_${i}`,label:Qs(i),totalCount:r.count,totalAirtime:r.airtime});return a.sort((i,r)=>r.totalCount-i.totalCount)}function en(t,s,n,a,i,r,l=0){const u=n-s,o=u/a,p=o*1e3,m=u/3600,x=s-l*o,S=n+l*o,y=a+2*l,v=[];for(let j=0;j=24?R.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit",hour12:!1}):R.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1}),B={timestamp:N,time:O,counts:{},shares:{},airtimes:{},total:0,totalAirtime:0,bucketDurationMs:p};for(const M of r)B.counts[M.key]=0,B.airtimes[M.key]=0;v.push(B)}for(const j of t){const N=j.timestamp;if(N=S)continue;const R=Math.min(Math.floor((N-x)/o),y-1),O=`TYPE_${j.type??j.payload_type??-1}`;v[R].counts[O]=(v[R].counts[O]??0)+1,v[R].total++;const B=ke(j,{spreadingFactor:i.sf,bandwidthHz:i.bw,codingRate:i.cr,preambleLength:i.preamble});v[R].airtimes[O]=(v[R].airtimes[O]??0)+B,v[R].totalAirtime+=B}for(const j of v)for(const N of r)j.shares[N.key]=j.total>0?j.counts[N.key]/j.total*100:0;return{buckets:v,visibleStart:l,visibleEnd:l+a}}function tn(t,s){const n=t.length;if(n===0)return[];if(s<.5)return[...t];const a=Math.sqrt(12*s*s/3+1);let i=Math.floor(a);i%2===0&&i--;const r=i+2,l=(12*s*s-3*i*i-12*i-9)/(-4*i-4),u=Math.round(l),o=[u>0?i:r,u>1?i:r,u>2?i:r];let p=new Float32Array(t);const m=new Float32Array(n);for(const x of o){const S=(x-1)/2;sn(p,m,n,S);const y=p;p=m,m.set(y)}return Array.from(p)}function sn(t,s,n,a){const i=a*2+1;let r=0;for(let l=0;l<=a;l++)r+=t[Math.min(l,n-1)];for(let l=0;l=0&&(r-=t[o],l--),pnew Array(m).fill(0));for(let E=0;E0)for(let d=0;d0)for(let f=0;f0?R=v.map(E=>tn(E,j)):R=v.map(E=>nn(E,N));for(let E=0;E0){const d=1/g;for(let f=0;fpt?Math.ceil(S/pt):1,B=Math.ceil(S/O),M=[];for(let E=0;E0){const D=1/I;for(let U=0;U=n)continue;const S=Math.min(Math.floor((x-s)/300),u-1);o[S]+=ke(m,{spreadingFactor:i.sf,bandwidthHz:i.bw,codingRate:i.cr,preambleLength:i.preamble})}let p=0;for(let m=0;mp&&(p=x)}return Math.max(1,Math.ceil(p*1.1))}else{let o=0;for(const p of t){const m=p.timestamp;if(m=n)continue;const x=tt(p);x>o&&(o=x)}return o<=240?240:Math.ceil(o*1.1/50)*50}}function cn({packets:t,allPackets:s,startTs:n,endTs:a,parentStartTs:i,parentEndTs:r,bucketCount:l,radioConfig:u=Zs,mode:o="share",smoothing:p="stats",noiseFloorAnomalies:m=null,showNoiseFloorOverlay:x=!1,overlayOpacity:S=.5,dotSize:y,dotOpacity:v}){st(St);const j=It(),[N,R]=c.useState(null),[O,B]=c.useState(null),[M,z]=c.useState([]),E=c.useRef(null),g=c.useRef(0);c.useEffect(()=>{const b=Math.abs(t.length-g.current);if(b===0&&M.length>0)return;E.current&&clearTimeout(E.current);const w=b>100?50:Xs;return E.current=setTimeout(()=>{g.current=t.length,z(t)},w),()=>{E.current&&clearTimeout(E.current)}},[t,M.length]);const d=c.useMemo(()=>Js(M,u),[M,u]),f=c.useMemo(()=>{if(p!=="ema"&&p!=="ultra")return 0;const w=(a-n)/l,{handleSize:A}=wt(p,w,l);return A},[p,n,a,l]),k=c.useMemo(()=>en(M,n,a,l,u,d,f),[M,n,a,l,u,d,f]),I=c.useMemo(()=>d.reduce((b,w)=>b+w.totalCount,0),[d]),W=c.useMemo(()=>d.reduce((b,w)=>b+w.totalAirtime,0),[d]),{sortedTypes:D,aggregateShares:U}=c.useMemo(()=>{const b=new Map,w=o==="share"?I:W;if(w>0)for(const F of d){const Z=o==="share"?F.totalCount:F.totalAirtime;b.set(F.key,Z/w)}return{sortedTypes:[...d].sort((F,Z)=>(b.get(Z.key)??0)-(b.get(F.key)??0)),aggregateShares:b}},[d,I,W,o]),q=c.useMemo(()=>ln(k,o,D,p,n,a,l),[k,o,D,p,n,a,l]),ee=c.useCallback(b=>R(b),[]),J=c.useCallback(b=>B(b),[]),G=c.useCallback(b=>R(b),[]),L=c.useMemo(()=>{if(O===null||!q[O])return null;const b=q[O];return{timestamp:b.timestamp,timeLabel:b.time,items:D.map(w=>({key:w.key,label:w.label,value:b[w.key]??0,color:Ce(w.typeNum)}))}},[O,q,D]),K=c.useMemo(()=>{const b=q.map(A=>A.timestamp),w=D.map(A=>({key:A.key,label:A.label,color:Ce(A.typeNum),values:q.map(F=>F[A.key]??0)}));return{timestamps:b,series:w}},[q,D]),te=null,ie=s&&i!==void 0&&r!==void 0&&(n!==i||a!==r),ae=c.useMemo(()=>{if(!(!ie||!s||i===void 0||r===void 0))return on(s,i,r,o,u)},[ie,s,i,r,o,u]);if(M.length===0)return t.length===0?e.jsxs("div",{className:"h-full flex items-center justify-center text-fg-muted",children:[e.jsx(Se,{className:"w-6 h-6 mr-2 opacity-50"}),e.jsx("span",{children:"No packet data available"})]}):null;if(p==="mosaic")return e.jsx($s,{sortedTypes:D,aggregateShares:U,mode:o});const se=(a-n)/3600,oe=ft(n,se),$=ft(a,se);return p==="stats"?e.jsx(Vs,{mode:o,packets:M,startTs:n,endTs:a,radioConfig:u,sortedTypes:D,aggregateShares:U,noiseFloorAnomalies:m,showNoiseFloorOverlay:x,overlayOpacity:S,startLabel:oe,endLabel:$,lockedYMax:ae,legendMinH:Ye,dotSize:y,dotOpacity:v}):p==="trend"?e.jsx(Ws,{packets:M,mode:o,startTs:n,endTs:a,radioConfig:u,bucketCount:l,lockedYMax:ae,legendMinH:Ye}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex-1 min-h-0 relative",children:[e.jsx("div",{className:"absolute top-0 left-0 flex flex-col justify-between",style:{width:Ke,bottom:20},children:[0,20,40,60,80,100].map((b,w,A)=>e.jsxs("span",{className:"type-data-xs text-fg-secondary text-right pr-1.5",style:{position:"absolute",top:`${(1-b/100)*100}%`,transform:w===0?"translateY(-100%)":w===A.length-1?"none":"translateY(-50%)",right:0},children:[b,"%"]},b))}),e.jsx("div",{className:"absolute overflow-hidden radius-inner depth-stroke-inset bg-chart-inner",style:{left:Ke,right:0,top:0,bottom:20},children:e.jsx(Pt,{timestamps:K.timestamps,series:K.series,highlightedKey:N,cursorColor:j.cursor,onHover:J,onSeriesHover:G,overlayLine:te,startTs:n,endTs:a,externalAxes:!0})}),e.jsxs("div",{className:"absolute left-0 right-0 bottom-0 flex justify-between pointer-events-none type-data-xs text-fg-muted/60",style:{left:Ke,height:20,paddingTop:4},children:[e.jsx("span",{children:oe}),e.jsx("span",{children:$})]})]}),e.jsx("div",{style:{minHeight:Ye},children:e.jsx(at,{sortedTypes:D,highlightedType:N,onTypeHover:ee,aggregateShares:U,hoverData:L})})]})}const mn=c.memo(cn),Xe={ZOOM_DURATION:400,BLINK_DURATION:600},le={PADDING:6,DOT_RADIUS:5,DOT_RADIUS_HOVERED:7,LOCAL_DOT_RADIUS:5,CARDINAL_FONT_SIZE:10,INTERCARDINAL_FONT_SIZE:9,LABEL_INSET:8,DATA_HEADROOM:1.08},dn={"1x":1,"2x":2,"4x":4,"8x":8,"16x":16,"36x":36},gt=[1,5,10,25,50,100,150],un=22.5,Mt=un*Math.PI/180,bt=Math.sin(Mt),yt=Math.cos(Mt);function hn(t,s,n,a){const i=Math.PI/180,r=(a-s)*i,l=t*i,u=n*i,o=Math.sin(r)*Math.cos(u),p=Math.cos(l)*Math.sin(u)-Math.sin(l)*Math.cos(u)*Math.cos(r);return(Math.atan2(o,p)*180/Math.PI+360)%360}function xn(t,s,n,a){const r=Math.PI/180,l=(n-t)*r,u=(a-s)*r,o=Math.sin(l/2)**2+Math.cos(t*r)*Math.cos(n*r)*Math.sin(u/2)**2;return 6371*2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o))}const pn=[{min:10,label:"Excellent"},{min:7,label:"Very Good"},{min:4,label:"Good"},{min:1,label:"Fair+"},{min:-2,label:"Fair"},{min:-5,label:"Fair-"},{min:-8,label:"Poor"},{min:-11,label:"Bad"},{min:-1/0,label:"Critical"}];function fn(t){var s;return((s=pn.find(n=>t>=n.min))==null?void 0:s.label)??"Critical"}function jt(t,s,n){const a=zt(t,n);return s[a]||"#808080"}function gn({neighbors:t,quickNeighbors:s,localLat:n,localLon:a,onStatsChange:i,title:r,badge:l,stats:u}){const[o,p]=c.useState(null),[m,x]=c.useState(new Set),[S,y]=c.useState({width:0,height:0}),[v,j]=c.useState("1x"),[N,R]=c.useState(1),O=c.useRef(null),B=c.useRef({}),M=c.useRef(null),z=c.useRef(N);z.current=N;const E=Ot(),g=Ft(),d=Ht(),f=Bt(),k=vt(),I=$t(),W=f?d.primary:d.secondary,D=f?.15:.4,U=f?.08:.25,q=f?k.blue:d.primary;c.useEffect(()=>{const h=M.current;if(!h)return;const P=new ResizeObserver(T=>{for(const H of T){const{width:Y,height:Q}=H.contentRect;Y>0&&Q>0&&y({width:Y,height:Q})}});P.observe(h);const _=h.getBoundingClientRect();return _.width>0&&_.height>0&&y({width:_.width,height:_.height}),()=>P.disconnect()},[]);const ee=c.useMemo(()=>{const h=new Set;if(s)for(const P of s)h.add(P.hash);return h},[s]),J=c.useMemo(()=>{const h=new Map;if(s)for(const P of s)h.set(P.hash,{snr:P.avgSnr,rssi:P.avgRssi});return h},[s]),{processedNeighbors:G,maxDistance:L,totalNeighbors:K,zeroHopCount:te}=c.useMemo(()=>{const h=[];for(const[T,H]of Object.entries(t)){if(!H.latitude||!H.longitude||H.latitude===0||H.longitude===0||!ee.has(T))continue;const Q=hn(n,a,H.latitude,H.longitude),ne=xn(n,a,H.latitude,H.longitude),X=J.get(T);h.push({hash:T.slice(0,8),name:H.node_name||H.name||"Unknown",snr:(X==null?void 0:X.snr)??H.snr??null,rssi:(X==null?void 0:X.rssi)??H.rssi??null,bearing:Q,distance:ne,normalizedDistance:0,lastSeen:H.last_seen,isZeroHop:!0})}const _=(h.length>0?Math.max(...h.map(T=>T.distance)):0)*le.DATA_HEADROOM;return h.sort((T,H)=>(T.snr??-1/0)-(H.snr??-1/0)),{processedNeighbors:h,maxDistance:_,totalNeighbors:h.length,zeroHopCount:h.length}},[t,n,a,ee,J]);c.useEffect(()=>{i==null||i({zeroHopCount:te,totalCount:K,maxDistanceKm:L})},[te,K,L]),c.useEffect(()=>{const h=dn[v],P=z.current;O.current&&cancelAnimationFrame(O.current);const _=performance.now(),T=H=>{const Y=H-_,Q=Math.min(Y/Xe.ZOOM_DURATION,1),ne=os(Q),X=P+(h-P)*ne;R(X),Q<1?O.current=requestAnimationFrame(T):O.current=null};return O.current=requestAnimationFrame(T),()=>{O.current&&cancelAnimationFrame(O.current)}},[v]);const ie=L/N,ae=c.useMemo(()=>gt.filter(h=>h<=ie*1.1),[ie]);c.useEffect(()=>{const h=[];for(const _ of G){const T=B.current[_.hash];T!==void 0&&T!==_.lastSeen&&h.push(_.hash),B.current[_.hash]=_.lastSeen}if(h.length===0)return;queueMicrotask(()=>{x(_=>new Set([..._,...h]))});const P=setTimeout(()=>{x(_=>{const T=new Set(_);return h.forEach(H=>T.delete(H)),T})},Xe.BLINK_DURATION);return()=>clearTimeout(P)},[G]);const se=n!==0&&a!==0,oe=c.useMemo(()=>{const{width:h,height:P}=S,_=h/2,T=P/2,H=Math.min(h,P),Y=Math.max(10,H/2-le.PADDING),Q=Math.max(10,Y-le.LABEL_INSET);return{width:h,height:P,centerX:_,centerY:T,radius:Q,labelRadius:Y}},[S]),{width:$,height:b,centerX:w,centerY:A,radius:F,labelRadius:Z}=oe,ue=c.useId(),pe=c.useCallback((h,P)=>{const _=h*Math.PI/180;return{x:w+F*P*Math.sin(_),y:A-F*P*Math.cos(_)}},[w,A,F]),fe=c.useCallback(h=>{const _={N:0,NE:45,E:90,SE:135,S:180,SW:225,W:270,NW:315}[h]*Math.PI/180;return{x:w+Z*Math.sin(_),y:A-Z*Math.cos(_)}},[w,A,Z]),_e=c.useCallback(h=>{p(h)},[]),Re=c.useCallback(h=>{j(h)},[]),Te=c.useCallback(h=>L<=0?0:h/L*N,[L,N]),De=h=>`${h}km`,we=28,Ee=c.useMemo(()=>{const h=[{x:w,y:A-Z},{x:w+Z*Math.SQRT1_2,y:A-Z*Math.SQRT1_2}],P=ae.map(T=>{const H=T/L*N,Y=w+F*H*bt,Q=A-F*H*yt;return{km:T,scale:H,lx:Y,ly:Q}}).filter(T=>T.scale>=.02).sort((T,H)=>H.km-T.km),_=[];for(const T of P){const H=_.some(Q=>{const ne=Q.lx-T.lx,X=Q.ly-T.ly;return Math.sqrt(ne*ne+X*X){const ne=Q.x-T.lx,X=Q.y-T.ly;return Math.sqrt(ne*ne+X*X)0&&S.height>0;return se?K===0?e.jsxs("div",{ref:M,className:"flex flex-col items-center justify-center h-full text-fg-secondary",children:[e.jsx(We,{className:"w-8 h-8 mb-2 opacity-50"}),e.jsx("p",{children:"No nodes with location data"})]}):e.jsxs("div",{className:"flex h-full w-full overflow-visible",children:[e.jsxs("div",{ref:M,className:"relative flex-1 min-w-0 h-full overflow-visible -ml-4 sm:-ml-5",children:[Le&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute depth-stroke-inset",style:{left:w-F-le.LABEL_INSET-4,top:A-F-le.LABEL_INSET-4,width:(F+le.LABEL_INSET)*2+8,height:(F+le.LABEL_INSET)*2+8,borderRadius:"50%",padding:4,boxSizing:"border-box",backgroundColor:f?"var(--zinc-925)":"var(--zinc-75)"}}),e.jsxs("svg",{width:$,height:b,className:"absolute inset-0 z-0",style:{overflow:"visible"},children:[e.jsxs("defs",{children:[e.jsx("style",{children:` - @keyframes neighbor-blink-scale { - 0%, 100% { - transform: scale(1); - opacity: 0; - } - 50% { - transform: scale(1.3); - opacity: 0.8; - } - } - .neighbor-blink-ring { - transform-origin: center; - animation: neighbor-blink-scale ${Xe.BLINK_DURATION}ms ease-out forwards; - } - `}),e.jsx("clipPath",{id:ue,children:e.jsx("circle",{cx:w,cy:A,r:F})})]}),(()=>{const h=F+le.LABEL_INSET+12,P=f?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.15)",_=f?"rgba(59, 130, 246, 0.4)":"rgba(59, 130, 246, 0.5)",T=6,H=16,Y=4,Q=[0,90,180,270],ne=[45,135,225,315];return e.jsxs("g",{className:"radar-frame","aria-hidden":"true",children:[e.jsx("circle",{cx:w,cy:A,r:h,fill:"none",stroke:P,strokeWidth:1,strokeDasharray:"2 6"}),ne.map(X=>{const re=X*Math.PI/180,ce=Math.cos(re),me=Math.sin(re),he=h+Y,C=h+Y+H,V=w+he*me,be=A-he*ce,Ie=w+C*me,Be=A-C*ce;return e.jsxs("g",{children:[e.jsx("line",{x1:V,y1:be,x2:Ie,y2:Be,stroke:_,strokeWidth:1}),e.jsx("line",{x1:Ie-4*ce,y1:Be-4*me,x2:Ie+4*ce,y2:Be+4*me,stroke:_,strokeWidth:1})]},`corner-${X}`)}),Q.map(X=>{const re=X*Math.PI/180,ce=w+(h-T)*Math.sin(re),me=A-(h-T)*Math.cos(re),he=w+(h+2)*Math.sin(re),C=A-(h+2)*Math.cos(re);return e.jsx("line",{x1:ce,y1:me,x2:he,y2:C,stroke:P,strokeWidth:1},`tick-cardinal-${X}`)}),ne.map(X=>{const re=X*Math.PI/180,ce=w+(h-4)*Math.sin(re),me=A-(h-4)*Math.cos(re),he=w+(h+1)*Math.sin(re),C=A-(h+1)*Math.cos(re);return e.jsx("line",{x1:ce,y1:me,x2:he,y2:C,stroke:P,strokeWidth:1},`tick-intercardinal-${X}`)})]})})(),(()=>{const h=F+le.LABEL_INSET+4,P=[0,...gt.map(_=>{const T=Te(_);return T<=0?0:Math.min(F*T,h)}),h];return P.slice(0,-1).map((_,T)=>{const H=P[T+1],Y=H-_;return Y<.5||T%2!==0?null:e.jsx("circle",{cx:w,cy:A,r:(H+_)/2,fill:"none",stroke:"var(--subtle-fill)",strokeWidth:Y},`band-${T}`)})})(),ae.map(h=>{const P=Te(h);if(P<.02)return null;const _=Ee.some(Y=>Y.km===h),T=w+F*P*bt,H=A-F*P*yt;return e.jsx("g",{children:_&&e.jsx("text",{x:T+4,y:H-2,textAnchor:"start",dominantBaseline:"auto",fill:d.secondary,fontSize:10,fontFamily:$e,children:De(h)})},`ring-${h}`)}),["N","E","S","W"].map(h=>{const _={N:0,E:90,S:180,W:270}[h]*Math.PI/180;return e.jsx("line",{x1:w,y1:A,x2:w+F*Math.sin(_),y2:A-F*Math.cos(_),stroke:W,strokeOpacity:D,strokeWidth:1,strokeDasharray:"4 4"},h)}),["NE","SE","SW","NW"].map(h=>{const _={NE:45,SE:135,SW:225,NW:315}[h]*Math.PI/180;return e.jsx("line",{x1:w,y1:A,x2:w+F*Math.sin(_),y2:A-F*Math.cos(_),stroke:W,strokeOpacity:U,strokeWidth:1,strokeDasharray:"4 4"},`diag-${h}`)}),["N","E","S","W"].map(h=>{const P=fe(h),_=h==="E"?"end":h==="W"?"start":"middle",T=h==="N"?"hanging":h==="S"?"auto":"middle";return e.jsx("text",{x:P.x,y:P.y,textAnchor:_,dominantBaseline:T,fill:q,fontSize:le.CARDINAL_FONT_SIZE,fontWeight:700,fontFamily:$e,"aria-hidden":"true",children:h},h)}),["NE","SE","SW","NW"].map(h=>{const P=fe(h),_=h==="NE"||h==="SE"?"end":"start",T=h==="NE"||h==="NW"?"hanging":"auto";return e.jsx("text",{x:P.x,y:P.y,textAnchor:_,dominantBaseline:T,fill:q,fontSize:le.INTERCARDINAL_FONT_SIZE,fontWeight:600,fontFamily:$e,"aria-hidden":"true",children:h},h)}),e.jsx("circle",{cx:w,cy:A,r:le.LOCAL_DOT_RADIUS,fill:g.chart6,stroke:f?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.2)",strokeWidth:1,role:"img","aria-label":"Local node"}),e.jsx("g",{clipPath:`url(#${ue})`,children:G.map(h=>{const P=L>0?h.distance/L*N:0;if(P>1)return null;const{x:_,y:T}=pe(h.bearing,P),H=h.snr!==null?jt(h.snr,E,I):"#808080",Y=(o==null?void 0:o.hash)===h.hash,Q=m.has(h.hash),ne=le.DOT_RADIUS_HOVERED*1.5;return e.jsxs("g",{role:"img","aria-label":`${h.name}: ${h.distance.toFixed(1)}km ${h.bearing.toFixed(0)}°`,children:[Q&&e.jsx("circle",{cx:_,cy:T,r:ne,fill:"none",stroke:f?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.7)",strokeWidth:2,className:"neighbor-blink-ring"}),Y&&e.jsx("circle",{cx:_,cy:T,r:ne,fill:H,opacity:.3}),e.jsx("circle",{cx:_,cy:T,r:Y?le.DOT_RADIUS_HOVERED:le.DOT_RADIUS,fill:H,stroke:f?"rgba(0,0,0,0.5)":"rgba(0,0,0,0.25)",strokeWidth:1,style:{cursor:"pointer",transition:"r 0.15s"},onMouseEnter:()=>_e(h),onMouseLeave:()=>_e(null)})]},h.hash)})})]})]}),o&&e.jsxs("div",{className:"absolute bg-tooltip-bg border border-edge-subtle rounded-lg px-3 py-2 text-sm pointer-events-none z-10 shadow-xl",style:{left:"50%",bottom:8,transform:"translateX(-50%)"},children:[e.jsx("div",{className:"font-medium text-fg-primary",children:o.name}),e.jsx("div",{className:"type-data-xs text-fg-secondary",children:o.hash}),o.snr!==null?e.jsx("div",{className:"flex gap-3 mt-1 text-xs",children:e.jsxs("span",{children:[e.jsx("span",{className:"text-fg-secondary",children:"SNR:"})," ",e.jsxs("span",{className:"tabular-nums",style:{color:jt(o.snr,E,I)},children:[o.snr.toFixed(1)," dB"]}),e.jsxs("span",{className:"text-fg-secondary ml-1",children:["(",fn(o.snr),")"]})]})}):e.jsx("div",{className:"text-xs text-fg-secondary mt-1",children:"No SNR data"}),e.jsxs("div",{className:"flex gap-3 text-xs",children:[e.jsxs("span",{children:[e.jsx("span",{className:"text-fg-secondary",children:"Distance:"})," ",e.jsxs("span",{className:"tabular-nums text-fg-primary",children:[o.distance.toFixed(2)," km"]})]}),e.jsxs("span",{children:[e.jsx("span",{className:"text-fg-secondary",children:"Bearing:"})," ",e.jsxs("span",{className:"tabular-nums text-fg-primary",children:[o.bearing.toFixed(0),"°"]})]})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-1 px-1.5 pt-4 sm:pt-5 pb-2 flex-shrink-0 depth-raised radius-inset self-stretch",style:{width:"calc(100% / 6)"},children:[r&&e.jsxs("div",{className:"flex flex-col items-start gap-1 pb-2 mb-1",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"icon-md flex items-center justify-center text-icon-card-title",children:e.jsx(We,{className:"w-3.5 h-3.5"})}),l&&e.jsx(Ae,{color:"zinc",children:l})]}),e.jsx("span",{className:"type-micro text-left text-[10px] leading-tight px-1",children:r})]}),e.jsx("div",{className:"flex flex-col gap-1 flex-1",role:"group","aria-label":"Zoom level",children:["1x","2x","4x","8x","16x","36x"].map(h=>e.jsx("button",{onClick:()=>Re(h),"aria-pressed":v===h,className:`flex flex-1 items-center justify-center min-w-[44px] sm:min-w-[32px] text-xs font-medium radius-inner depth-stroke-raised transition-colors ${v===h?"bg-sys-blue/20 text-sys-blue":"bg-subtle-fill/80 text-fg-secondary hover:bg-subtle-fill-strong hover:text-fg-primary"}`,children:h},h))})]})]}):e.jsxs("div",{ref:M,className:"flex flex-col items-center justify-center h-full text-fg-secondary",children:[e.jsx(We,{className:"w-8 h-8 mb-2 opacity-50"}),e.jsx("p",{children:"Local node coordinates not configured"}),e.jsx("p",{className:"text-xs mt-1",children:"Set latitude/longitude in config to enable"})]})}const bn=c.memo(gn),Ze={repeater:"var(--sys-blue)",companion:"var(--sys-cyan)",room_server:"var(--sys-indigo)"};function yn(t){if(t.contact_type){const s=t.contact_type.toLowerCase();if(s==="repeater"||s==="rep")return"repeater";if(s==="room server"||s==="room_server"||s==="room"||s==="server")return"room_server";if(s==="companion"||s==="client"||s==="cli")return"companion"}return t.is_repeater?"repeater":"companion"}function jn({neighbors:t,timeRangeLabel:s}){const n=c.useMemo(()=>{const a={repeater:0,companion:0,room_server:0};for(const l of Object.values(t)){const u=yn(l);a[u]=(a[u]||0)+1}const i=Object.values(a).reduce((l,u)=>l+u,0);return{items:[{label:"Repeaters",count:a.repeater,percent:0,color:Ze.repeater},{label:"Companions",count:a.companion,percent:0,color:Ze.companion},{label:"Room Servers",count:a.room_server,percent:0,color:Ze.room_server}].map(l=>({...l,percent:i>0?l.count/i*100:0})).filter(l=>l.count>0).sort((l,u)=>u.count-l.count),total:i}},[t]);return n.total===0?e.jsx("div",{className:"h-full flex items-center justify-center text-fg-muted type-body-sm",children:"No neighbors discovered yet"}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx("div",{className:"flex-1 flex flex-col justify-evenly",children:n.items.map(a=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"type-data-sm text-fg-secondary",children:a.label}),e.jsxs("span",{className:"type-data-sm text-fg-secondary tabular-nums",children:[a.count," ",e.jsxs("span",{className:"text-fg-secondary/60",children:["(",a.percent.toFixed(0),"%)"]})]})]}),e.jsx("div",{className:"h-2.5 bg-subtle-fill/80 overflow-hidden rounded-full depth-stroke-inset",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-500 ease-out",style:{width:`${a.percent}%`,backgroundColor:a.color,minWidth:a.count>0?"4px":"0"}})})]},a.label))}),e.jsxs("div",{className:"mt-auto pt-2",children:[e.jsxs("div",{className:"data-box-label flex items-center gap-1.5",children:["Total Nodes",s&&e.jsx(Ae,{color:"zinc",children:s})]}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:n.total})]})]})}const Nn=c.memo(jn);function Qe({children:t,minHeight:s="100%",rootMargin:n="200px 0px",keepMounted:a=!0,className:i=""}){const r=c.useRef(null),[l,u]=c.useState(!1),[o,p]=c.useState(!1);c.useEffect(()=>{const x=r.current;if(!x)return;const S=new IntersectionObserver(([y])=>{const v=y.isIntersecting;p(v),v&&u(!0)},{rootMargin:n,threshold:0});return S.observe(x),()=>{S.disconnect()}},[n]);const m=o||a&&l;return e.jsx("div",{ref:r,className:`h-full w-full ${i}`,style:{minHeight:s},children:m?t:e.jsx("div",{className:"h-full w-full flex items-center justify-center text-fg-muted/50",children:e.jsx("div",{className:"animate-pulse text-xs",children:"Loading chart..."})})})}const Ct=[{target:"DisambiguationCard",fn:"disambiguation.collisions",minStage:2}];nt(Ct);const vn=.9,kn=.7,Sn=.5,wn=10,Mn=25,Oe={excellent:"text-signal-excellent",good:"text-signal-good",fair:"text-signal-fair",poor:"text-sys-blue"},Cn={excellent:"bg-signal-excellent/10",good:"bg-signal-good/10",fair:"bg-signal-fair/10",poor:"bg-sys-blue/10"};function An(t){return t>=vn?"excellent":t>=kn?"good":t>=Sn?"fair":"poor"}function _n(t){return t<=wn?"excellent":t<=Mn?"good":"poor"}function Rn(){st(Ct);const t=Wt(),s=Ut(),[n,a]=c.useState(null),i=c.useCallback((m,x)=>{a({prefix:m,candidateHashes:x})},[]),r=c.useCallback(()=>{a(null)},[]);if(!s)return e.jsxs(de,{neomorphic:!0,children:[e.jsx(ve,{icon:e.jsx(lt,{}),title:"Prefix Conflicts"}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-fg-secondary",children:[e.jsx(Gt,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"type-data-xs",children:"No topology data available"}),e.jsx("p",{className:"type-data-xs opacity-70",children:"Run deep analysis to see stats"})]})})]});const l=An(t.avgConfidence),u=_n(t.collisionRate),o=l==="poor"||u==="poor"?"poor":l==="fair"||u==="fair"?"fair":l==="good"||u==="good"?"good":"excellent",p=o==="excellent"||o==="good"?ot:Je;return e.jsxs(de,{neomorphic:!0,className:"flex flex-col overflow-hidden",children:[e.jsx(ve,{icon:e.jsx(lt,{}),title:"Prefix Conflicts",badgeColor:"zinc",actions:o==="poor"?e.jsxs(Ae,{color:"red",children:[e.jsx(Je,{className:"w-3 h-3"}),"Needs Attention"]}):e.jsxs("div",{className:`flex items-center gap-1.5 px-2.5 py-1 rounded-full ${Cn[o]}`,children:[e.jsx(p,{className:`w-3.5 h-3.5 ${Oe[o]}`}),e.jsx("span",{className:`type-data-xs font-medium ${Oe[o]}`,children:o==="excellent"?"Excellent":o==="good"?"Good":"Fair"})]})}),e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[e.jsxs("div",{className:"flex-1 flex flex-col radius-inner depth-stroke-inset px-3 py-2.5 sm:py-3 cursor-help",title:"Total unique 2-character prefixes observed in packet paths.",children:[e.jsx("span",{className:"type-data-xl text-fg-primary",children:e.jsx(Fe,{value:t.totalPrefixes,priority:"low"})}),e.jsx("span",{className:"type-micro text-fg-muted mt-0.5 sm:mt-1",children:"Prefixes"})]}),e.jsxs("div",{className:"flex-1 flex flex-col radius-inner depth-stroke-inset px-3 py-2.5 sm:py-3 cursor-help",title:"Prefixes that map to exactly one known node. No disambiguation needed.",children:[e.jsx("span",{className:"type-data-xl text-fg-primary",children:e.jsx(Fe,{value:t.unambiguousPrefixes,priority:"low"})}),e.jsx("span",{className:"type-micro text-fg-muted mt-0.5 sm:mt-1",children:"Unique"})]}),e.jsxs("div",{className:"flex-1 flex flex-col radius-inner depth-stroke-inset px-3 py-2.5 sm:py-3 cursor-help",title:"Prefixes matching multiple known nodes. Click a prefix below to explore candidates.",children:[e.jsx("span",{className:`type-data-xl ${t.collisionPrefixes>0?"text-sys-blue":"text-fg-primary"}`,children:e.jsx(Fe,{value:t.collisionPrefixes,priority:"low"})}),e.jsx("span",{className:`type-micro mt-0.5 sm:mt-1 ${t.collisionPrefixes>0?"text-sys-blue":"text-fg-muted"}`,children:"Conflicts"})]})]}),t.highCollisionPrefixes.length>0&&e.jsxs("div",{className:"pt-3",children:[e.jsx("div",{className:"data-box-label",children:"Problem Prefixes"}),e.jsx("div",{className:"flex flex-wrap gap-1.5 content-start",children:t.highCollisionPrefixes.map(({prefix:m,candidateCount:x,candidateHashes:S})=>e.jsxs("button",{type:"button",onClick:()=>i(m,S),className:"inline-flex items-center gap-0.5 group",title:`${x} candidates - click to explore`,children:[e.jsx(xs,{children:m}),e.jsxs("span",{className:"text-fg-muted type-data-xs group-hover:text-fg-secondary transition-colors",children:["×",x]})]},m))})]}),t.lowConfidencePrefixes.length===0&&t.collisionPrefixes===0&&e.jsx("div",{className:"flex-1 flex items-center",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ot,{className:"w-3.5 h-3.5 text-signal-excellent"}),e.jsx("span",{className:"type-data-xs text-signal-excellent",children:"All prefixes uniquely identified"})]})}),e.jsxs("div",{className:"flex gap-2 sm:gap-3 mt-auto pt-3",children:[e.jsxs("div",{className:"flex-1 min-w-0 cursor-help",title:"Average confidence score across all disambiguated prefixes. Higher = more certain node identification.",children:[e.jsx("div",{className:"data-box-label",children:"Confidence"}),e.jsxs("div",{className:`data-box data-box-fill data-box-left ${Oe[l]}`,children:[(t.avgConfidence*100).toFixed(1),"%"]})]}),e.jsxs("div",{className:"flex-1 min-w-0 cursor-help",title:"Percentage of 2-character prefixes that match multiple known nodes. Lower is better.",children:[e.jsx("div",{className:"data-box-label",children:"Collisions"}),e.jsxs("div",{className:`data-box data-box-fill data-box-left ${Oe[u]}`,children:[t.collisionRate.toFixed(1),"%"]})]})]})]}),e.jsx(fs,{isOpen:!!n,prefix:(n==null?void 0:n.prefix)||"",candidateHashes:(n==null?void 0:n.candidateHashes)||[],onClose:r})]})}const At=[{target:"PacketHealth",fn:"type",minStage:1},{target:"PacketHealth",fn:"duplicates",minStage:1}];nt(At);const Tn=new Set(["Duplicate","Empty payload","Path too long","Unknown"]),ge=24;function Dn(t,s){const n=Date.now()/1e3,a=s*60,i=n-a,r=a/ge,l=new Array(ge).fill(0),u=new Array(ge).fill(0),o=new Array(ge).fill(0),p=new Array(ge).fill(0);let m=0,x=0,S=0,y=0,v=0,j=0;for(const M of t){if(M.packet_origin==="tx_local")continue;const z=M.timestamp;if(zn)continue;m++;const E=Math.min(ge-1,Math.floor((z-i)/r));u[E]++,M.transmitted||M.packet_origin==="tx_forward"?(x++,l[E]++):(M.is_duplicate||M.drop_reason==="Duplicate")&&S++,M.drop_reason&&Tn.has(M.drop_reason)&&y++,Kt(M.route??M.route_type)&&(v++,o[E]++),M._packetVersion===1&&(j++,p[E]++)}const N=[],R=[],O=[];for(let M=0;M0?Math.round(E/z*100):0,timestamp:g}),R.push({count:z>0?Math.round(o[M]/z*100):0,timestamp:g}),O.push({count:z>0?Math.round(p[M]/z*100):0,timestamp:g})}const B=m-S;return{totalRx:m,uniqueRx:B,forwarded:x,duplicates:S,waste:y,efficiency:m>0?x/m*100:0,duplicateRate:m>0?S/m*100:0,wasteRate:m>0?y/m*100:0,sparkline:N,transport:v,v2:j,transportSparkline:R,v2Sparkline:O}}function En(t){return t>=90?"excellent":t>=75?"good":t>=60?"fair":"poor"}const Ln={excellent:"bg-status-success",good:"bg-sys-blue",fair:"bg-status-warning",poor:"bg-status-danger"};function In({packets:t,rangeMinutes:s,rangeHours:n,timeRangeLabel:a,isLoaded:i=!0}){st(At);const r=c.useMemo(()=>Dn(t,s),[t,s]),[l,u]=c.useState(null),o=c.useCallback(async()=>{try{const x=await Vt(n);x.success&&x.data&&u(x.data.count)}catch{}},[n]);c.useEffect(()=>{o()},[o]);const p=En(r.efficiency),m=r.totalRx>0;return e.jsx(de,{neomorphic:!0,isLoaded:i,skeletonType:"chart",children:i&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{icon:e.jsx(gs,{}),title:"Packet Health",badge:a,badgeColor:"zinc"}),e.jsx(qt,{children:e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("div",{className:"type-data-xl text-fg-primary",children:[m?e.jsx(Fe,{value:Math.round(r.efficiency*10)/10,className:"font-mono tabular-nums",priority:"medium",format:{minimumFractionDigits:1,maximumFractionDigits:1}}):e.jsx("span",{className:"opacity-30",children:"—"}),e.jsx("span",{className:"type-data-sm text-fg-muted ml-0.5",children:"%"})]}),m&&e.jsx("div",{className:`w-2 h-2 rounded-full ${Ln[p]}`})]}),e.jsx("div",{className:"type-micro mb-2 cursor-help",title:"Forwarded packets / total received. CRC failures, garbled packets, and RF collisions that destroy packets before reaching software are not included in this ratio — see CRC Errors for hardware-level failures.",children:"FORWARDING RATE"}),e.jsx("div",{className:"flex-1 min-h-[28px] max-h-[48px] mb-2",children:e.jsx(Ue,{data:r.sparkline,width:9999,height:36,className:"w-full"})}),e.jsxs("div",{className:"flex gap-2 sm:gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0 radius-inner depth-stroke-inset p-2",children:[e.jsx("div",{className:"data-box-label",children:"Transport"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 min-h-[20px] max-h-[28px]",children:e.jsx(Ue,{data:r.transportSparkline,width:9999,height:24,className:"w-full",color:"var(--sys-amber)"})}),e.jsx("div",{className:"data-box data-box-compact shrink-0 text-sys-amber",children:m?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{children:r.transport}),e.jsx("span",{className:"punc-slash",children:"/"}),e.jsx(Pe,{children:r.uniqueRx})]}):"—"})]})]}),e.jsxs("div",{className:"flex-1 min-w-0 radius-inner depth-stroke-inset p-2",children:[e.jsx("div",{className:"data-box-label",children:"V2"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 min-h-[20px] max-h-[28px]",children:e.jsx(Ue,{data:r.v2Sparkline,width:9999,height:24,className:"w-full",color:"var(--sys-teal)"})}),e.jsx("div",{className:"data-box data-box-compact shrink-0 text-sys-teal",children:m?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{children:r.v2}),e.jsx("span",{className:"punc-slash",children:"/"}),e.jsx(Pe,{children:r.uniqueRx})]}):"—"})]})]})]}),e.jsxs("div",{className:"flex gap-2 sm:gap-3 mt-auto",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Dupes"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:m?`${r.duplicateRate.toFixed(1)}%`:"—"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"data-box-label",children:"Waste"}),e.jsx("div",{className:"data-box data-box-fill data-box-left",children:m?`${r.wasteRate.toFixed(1)}%`:"—"})]}),l!==null&&l>0&&e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"data-box-label flex items-center gap-1",children:[e.jsx(Je,{className:"w-3 h-3 text-status-warning"}),"CRC"]}),e.jsx("div",{className:"data-box data-box-fill data-box-left text-status-warning",children:l})]})]})]})})]})})}function ma(){var De,we,Ee,Le,h,P,_,T,H,Y,Q,ne,X,re,ce,me,he;const t=Yt(),s=Xt(),n=Zt(),a=Qt(),i=Jt(),r=es(),l=t!==null&&i,u=c.useRef(!1);l&&!u.current&&(u.current=!0);const o=u.current,p=ts(),m=ss(),x=ns(),[S,y]=c.useState(null),[,v]=c.useState(null),[j]=c.useState(null),[N,R]=c.useState(()=>{const C=localStorage.getItem("statistics-view-mode");return C==="share"||C==="airtime"?C:"airtime"});c.useEffect(()=>{localStorage.setItem("statistics-view-mode",N)},[N]);const[O,B]=c.useState(()=>{const C=localStorage.getItem("statistics-smoothing-mode");return["ema","ultra","mosaic","stats","trend"].includes(C)?C:"stats"});c.useEffect(()=>{localStorage.setItem("statistics-smoothing-mode",O)},[O]);const[M,z]=c.useState(!1),[E,g]=c.useState(!1),[d,f]=c.useState(kt),[k,I]=c.useState(.5),[W,D]=c.useState(bs),[U,q]=c.useState(.5),[ee,J]=c.useState(85),G=c.useMemo(()=>({0:0,1:0,2:1,3:2,4:3,5:4,6:5,7:6,8:7,9:8,10:9})[p]??3,[p]),L=ze[G].hours,K=L*60,te=ze[G],ie=rt(L),ae=r.isBackgroundLoading,se=c.useCallback(C=>{const be={0:1,1:2,2:3,3:4,4:5,5:6,6:7,7:8,8:9,9:10}[C]??4;m(be)},[m]),oe=c.useMemo(()=>{var V;if(!((V=t==null?void 0:t.config)!=null&&V.radio))return null;const C=t.config.radio;return{sf:C.spreading_factor??10,bw:C.bandwidth??25e4,cr:C.coding_rate??5,preamble:C.preamble_length??8}},[(we=(De=t==null?void 0:t.config)==null?void 0:De.radio)==null?void 0:we.spreading_factor,(Le=(Ee=t==null?void 0:t.config)==null?void 0:Ee.radio)==null?void 0:Le.bandwidth,(P=(h=t==null?void 0:t.config)==null?void 0:h.radio)==null?void 0:P.coding_rate,(T=(_=t==null?void 0:t.config)==null?void 0:_.radio)==null?void 0:T.preamble_length]),$=c.useMemo(()=>x.length===0?{timestamps:[],values:[]}:{timestamps:x.map(C=>C.timestamp),values:x.map(C=>C.noise_floor_dbm)},[x]),b=c.useMemo(()=>{if(x.length<10)return{anomalies:[],debug:void 0};const C=Ts(x,d);return{anomalies:C.anomalies,debug:C.debug}},[x,d]),w=b.anomalies,A=c.useMemo(()=>{const C=(t==null?void 0:t.neighbors)??{};return Object.fromEntries(Object.entries(C).filter(([V])=>!s.has(V)))},[t==null?void 0:t.neighbors,s]),F=c.useMemo(()=>{const C=Date.now()/1e3-L*3600;return Object.fromEntries(Object.entries(A).filter(([,V])=>V.last_seen>=C))},[A,L]),Z=c.useMemo(()=>{const C=K*60/ie,V=Math.floor(Date.now()/1e3),be=Math.floor(V/C)*C;return{start:be-K*60,end:be}},[K,ie]),ue=W.timeStart??Z.start,pe=W.timeEnd??Z.end,fe=(pe-ue)/3600,_e=rt(fe),Re=Ns(),Te=c.useMemo(()=>ys(a,W,Re,Z),[a,W,Re,Z]);return e.jsxs(ds,{children:[e.jsx(us,{title:"Statistics",icon:e.jsx(as,{}),subtitle:e.jsx(ms,{}),controls:e.jsx(cs,{ranges:ze,selectedIndex:G,onSelect:se,isPending:ae})}),j&&e.jsx(de,{className:"border border-sys-red/50 bg-sys-red/10",children:e.jsx("p",{className:"text-sys-red",children:j})}),M&&E&&e.jsxs(de,{className:"border border-sys-indigo/30 bg-surface/50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"type-label",children:"Anomaly Detection Tuning"}),e.jsxs("span",{className:"type-data-xs text-fg-muted",children:["(",te.label,")"]})]}),e.jsx("button",{onClick:()=>f(C=>({...C,useAbsoluteThresholds:!C.useAbsoluteThresholds})),className:`type-data-xs px-2 py-1 rounded transition-colors ${d.useAbsoluteThresholds?"bg-sys-indigo/30 text-sys-indigo":"bg-elevated text-fg-muted hover:text-fg-secondary"}`,children:d.useAbsoluteThresholds?"Absolute dBm":"Percentile"})]}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"type-micro",children:"Baseline"}),e.jsxs("span",{className:"ml-2 type-data-sm text-status-warning",children:[((Y=(H=b.debug)==null?void 0:H.baselineCutoff)==null?void 0:Y.toFixed(1))??"—"," dBm"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"type-micro",children:"Spike"}),e.jsxs("span",{className:"ml-2 type-data-sm text-status-warning",children:[((ne=(Q=b.debug)==null?void 0:Q.spikeCutoff)==null?void 0:ne.toFixed(1))??"—"," dBm"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"type-micro",children:"Mid-band"}),e.jsx("span",{className:"ml-2 type-data-sm text-sys-indigo",children:((X=b.debug)==null?void 0:X.midBandSamples)??0})]}),e.jsxs("div",{children:[e.jsx("span",{className:"type-micro",children:"Anomalies"}),e.jsx("span",{className:"ml-2 type-data-sm text-status-danger",children:w.length})]})]}),e.jsxs("div",{className:"mt-4 pt-4 border-t border-edge-subtle space-y-4",children:[d.useAbsoluteThresholds?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Baseline (",d.baselineDbm," dBm)"]}),e.jsx("input",{type:"range",min:"-120",max:"-60",value:d.baselineDbm,onChange:C=>f(V=>({...V,baselineDbm:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Spike (",d.spikeDbm," dBm)"]}),e.jsx("input",{type:"range",min:"-100",max:"-20",value:d.spikeDbm,onChange:C=>f(V=>({...V,spikeDbm:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",d.mergeGapSeconds,"s)"]}),e.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:d.mergeGapSeconds,onChange:C=>f(V=>({...V,mergeGapSeconds:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Min Sequence (",d.minSequenceLength,")"]}),e.jsx("input",{type:"range",min:"2",max:"20",value:d.minSequenceLength,onChange:C=>f(V=>({...V,minSequenceLength:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",d.similarityToleranceDbm," dBm)"]}),e.jsx("input",{type:"range",min:"1",max:"15",value:d.similarityToleranceDbm,onChange:C=>f(V=>({...V,similarityToleranceDbm:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(k*100),"%)"]}),e.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:k,onChange:C=>I(Number(C.target.value)),className:"w-full accent-sys-indigo"})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Baseline (P",d.baselinePercentile,")"]}),e.jsx("input",{type:"range",min:"1",max:"50",value:d.baselinePercentile,onChange:C=>f(V=>({...V,baselinePercentile:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Spike (P",d.spikePercentile,")"]}),e.jsx("input",{type:"range",min:"50",max:"99",value:d.spikePercentile,onChange:C=>f(V=>({...V,spikePercentile:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Merge Gap (",d.mergeGapSeconds,"s)"]}),e.jsx("input",{type:"range",min:"5",max:"120",step:"5",value:d.mergeGapSeconds,onChange:C=>f(V=>({...V,mergeGapSeconds:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Min Sequence (",d.minSequenceLength,")"]}),e.jsx("input",{type:"range",min:"2",max:"20",value:d.minSequenceLength,onChange:C=>f(V=>({...V,minSequenceLength:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Similarity (±",d.similarityToleranceDbm," dBm)"]}),e.jsx("input",{type:"range",min:"1",max:"15",value:d.similarityToleranceDbm,onChange:C=>f(V=>({...V,similarityToleranceDbm:Number(C.target.value)})),className:"w-full accent-sys-indigo"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"type-micro block mb-1",children:["Opacity (",Math.round(k*100),"%)"]}),e.jsx("input",{type:"range",min:"0.1",max:"1",step:"0.05",value:k,onChange:C=>I(Number(C.target.value)),className:"w-full accent-sys-indigo"})]})]})]}),e.jsxs("div",{className:"mt-4 p-3 bg-elevated radius-inner",children:[e.jsx("div",{className:"type-micro mb-1",children:"Config output"}),e.jsxs("div",{className:"type-data-sm text-status-success",children:[d.useAbsoluteThresholds?`useAbsoluteThresholds: true, baselineDbm: ${d.baselineDbm}, spikeDbm: ${d.spikeDbm}`:`useAbsoluteThresholds: false, baselinePercentile: ${d.baselinePercentile}, spikePercentile: ${d.spikePercentile}`,", mergeGapSeconds: ",d.mergeGapSeconds,", minSequenceLength: ",d.minSequenceLength,", similarityToleranceDbm: ",d.similarityToleranceDbm]})]})]})]}),e.jsxs(hs,{ready:o,children:[e.jsx("div",{className:"sm:hidden",children:ae&&e.jsx(ye,{template:"auto",children:e.jsx(de,{className:"border border-sys-blue/30 bg-sys-blue/5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative flex h-3 w-3",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-sys-blue opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-sys-blue"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"type-body-sm text-fg-primary",children:["Loading ",te.label," data..."]}),r.loadProgress&&e.jsxs("p",{className:"type-data-xs text-fg-muted mt-0.5",children:[r.loadProgress.loaded.toLocaleString()," packets (",r.loadProgress.percent,"%)"]})]})]})})})}),e.jsxs(e.Fragment,{children:[e.jsx(ye,{template:"hero-auto",children:e.jsx(de,{neomorphic:!0,skeletonType:"chart",children:o&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{icon:e.jsx(Se,{}),title:"Packet Analyzer",badge:te.label,badgeColor:"zinc",stackActionsOnMobile:!0,actions:e.jsxs("div",{className:"flex flex-wrap items-center gap-2 justify-end",children:[O==="stats"&&e.jsx(Ys,{enabled:M,onChange:z,anomalyCount:w.length,showTuning:E,onTuningChange:g}),e.jsx(Ks,{smoothing:O,onChange:B}),e.jsx(qs,{mode:N,onChange:R})]})}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(mn,{packets:Te,allPackets:a,startTs:ue,endTs:pe,parentStartTs:Z.start,parentEndTs:Z.end,bucketCount:_e,radioConfig:oe??void 0,mode:N,smoothing:O,noiseFloorAnomalies:w,showNoiseFloorOverlay:M,overlayOpacity:k,dotSize:U,dotOpacity:ee/100})})]})})}),e.jsx(ye,{template:"auto",className:"relative z-10",children:e.jsx(de,{neomorphic:!0,noPadding:!0,className:"overflow-visible",children:o&&e.jsx(js,{parentStartTs:Z.start,parentEndTs:Z.end,neighbors:A,filter:W,onChange:D,...O==="stats"?{scatterDotSize:U,onScatterDotSizeChange:q,scatterOpacity:ee,onScatterOpacityChange:J}:{}})})}),e.jsxs(ye,{template:"panel",children:[e.jsx(Me,{span:12,md:6,children:e.jsx(de,{neomorphic:!1,skeletonType:"chart",noPadding:o,className:"!bg-transparent !ring-0 !shadow-none !overflow-visible -mx-4 sm:mx-0 !px-0 !pr-0",children:o&&e.jsx(Qe,{children:e.jsx(bn,{neighbors:F,quickNeighbors:n,localLat:((ce=(re=t==null?void 0:t.config)==null?void 0:re.repeater)==null?void 0:ce.latitude)??0,localLon:((he=(me=t==null?void 0:t.config)==null?void 0:me.repeater)==null?void 0:he.longitude)??0,onStatsChange:v,title:"Link Quality",badge:te.label})})})}),e.jsx(Me,{span:12,md:6,children:e.jsx(de,{neomorphic:!0,skeletonType:"chart",children:o&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{icon:e.jsx(ks,{}),title:"Network Composition",badge:te.label,badgeColor:"zinc"}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Qe,{children:e.jsx(Nn,{neighbors:F,timeRangeLabel:te.label})})})]})})})]}),e.jsxs(ye,{template:"panel",children:[e.jsx(Me,{span:12,md:6,children:e.jsx(Rn,{})}),e.jsx(Me,{span:12,md:6,children:e.jsx(In,{packets:a,rangeMinutes:K,rangeHours:L,timeRangeLabel:te.label})})]}),e.jsx(ye,{template:"panel",children:e.jsx(Me,{span:12,children:e.jsx(de,{neomorphic:!0,skeletonType:"chart",children:o&&e.jsxs(e.Fragment,{children:[e.jsx(ve,{icon:e.jsx(is,{}),title:"NOISE FLOOR dBm",stackActionsOnMobile:!0,actions:S?e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsxs("span",{className:"type-data-xs text-fg-muted whitespace-nowrap",children:["min ",e.jsx("span",{className:"data-box",children:S.min.toFixed(0)})]}),e.jsxs("span",{className:"type-data-xs text-fg-muted whitespace-nowrap",children:["avg ",e.jsx("span",{className:"data-box",children:S.avg.toFixed(0)})]}),e.jsxs("span",{className:"type-data-xs text-fg-muted whitespace-nowrap",children:["max ",e.jsx("span",{className:"data-box",children:S.max.toFixed(0)})]})]}):null}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Qe,{children:e.jsx(rs,{timestamps:$.timestamps,values:$.values,onStatsChange:y})})})]})})})})]})]})]})}export{ma as default}; diff --git a/frontend/dist/assets/System-C-bhrfOq.js b/frontend/dist/assets/System-Cl-yLzd8.js similarity index 97% rename from frontend/dist/assets/System-C-bhrfOq.js rename to frontend/dist/assets/System-Cl-yLzd8.js index cd7a9955..bc7d7c22 100644 --- a/frontend/dist/assets/System-C-bhrfOq.js +++ b/frontend/dist/assets/System-Cl-yLzd8.js @@ -1,4 +1,4 @@ -import{d as q,df as B,d6 as A,r as l,p as J,j as e,q as Y,c as F,N as E,dg as te,dh as se,di as re,dj as ne,c9 as ae,B as oe,dk as le,dl as G}from"./index-CeMilrX4.js";import{C as P,P as ce,a as ie,B as de}from"./PageLayout-Cw_MXmcE.js";import{T as me}from"./triangle-alert-DiFold9L.js";import{a as ue,A as xe}from"./arrow-up-C471XgXc.js";import{N as fe}from"./network-c_XxfhAX.js";import{A as L}from"./activity-BZFnO4kb.js";import{R as pe}from"./refresh-cw-DqhcBXAw.js";import{C as he}from"./cpu-C5-ss1x-.js";import{R as H,C as $}from"./Grid-BuDgMX1I.js";/** +import{d as q,dg as B,d7 as A,r as l,p as J,j as e,q as Y,c as F,N as E,dh as te,di as se,dj as re,dk as ne,c9 as ae,B as oe,dl as le,dm as G}from"./index-BOwCLZTK.js";import{C as P,P as ce,a as ie,B as de}from"./PageLayout-QKntxcnp.js";import{T as me}from"./triangle-alert-SO3tIa8w.js";import{a as ue,A as xe}from"./arrow-up-BqsZCBBC.js";import{N as fe}from"./network-D0Fgg1y-.js";import{A as L}from"./activity-D5uH2SFx.js";import{R as pe}from"./refresh-cw-C9txhqc9.js";import{C as he}from"./cpu-D7sbzQ8o.js";import{R as H,C as $}from"./Grid-eFMUBxsw.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/Terminal-BMACddVm.js b/frontend/dist/assets/Terminal-DH8015j-.js similarity index 99% rename from frontend/dist/assets/Terminal-BMACddVm.js rename to frontend/dist/assets/Terminal-DH8015j-.js index 361a3448..52a8e11e 100644 --- a/frontend/dist/assets/Terminal-BMACddVm.js +++ b/frontend/dist/assets/Terminal-DH8015j-.js @@ -1,4 +1,4 @@ -var Ua=Object.defineProperty;var ja=(e,t,i)=>t in e?Ua(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var D=(e,t,i)=>ja(e,typeof t!="symbol"?t+"":t,i);import{d as ls,Z as si,d6 as pe,dv as Ka,dw as rt,dx as es,dy as qa,c8 as Co,cW as xo,cX as Va,z as ko,dz as Ga,dA as Ya,dB as Xa,e as Eo,cV as Ja,bq as Za,dC as Qa,bF as Ro,dD as ge,bh as el,bg as tl,b_ as xt,dE as il,dF as sl,dG as rl,dH as nl,dl as zr,j as m,ak as Bo,dI as Mo,al as Lo,B as ol,r as U,A as fs,m as $i,dJ as Ur,dK as jr,cu as al,dL as ll,c as ts,dM as hl,dN as cl,K as dl,dO as ul,dP as _l,dQ as fl}from"./index-CeMilrX4.js";import{a as pl}from"./ping-DgsEwYAS.js";import{g as ml,r as gl}from"./system-D5lXsOVm.js";import{g as vi,B as Do,r as To,T as $o}from"./ascii-burst-DN6etEs5.js";import{P as vl,B as Sl,C as yl}from"./PageLayout-Cw_MXmcE.js";import{K as Ao,S as wl}from"./KeycapButton-BFRxj00q.js";import{D as Kr}from"./download-ByVPtD5I.js";import{S as qr}from"./search-Bph9xP9G.js";import{C as bl}from"./chevron-right-D3QL4sfa.js";import"./keycap-sfx-ByZp-njj.js";/** +var Ua=Object.defineProperty;var ja=(e,t,i)=>t in e?Ua(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var D=(e,t,i)=>ja(e,typeof t!="symbol"?t+"":t,i);import{d as ls,Z as si,d7 as pe,dw as Ka,dx as rt,dy as es,dz as qa,c8 as Co,cX as xo,cY as Va,z as ko,dA as Ga,dB as Ya,dC as Xa,e as Eo,cW as Ja,bq as Za,dD as Qa,bF as Ro,dE as ge,bh as el,bg as tl,b_ as xt,dF as il,dG as sl,dH as rl,dI as nl,dm as zr,j as m,ak as Bo,dJ as Mo,al as Lo,B as ol,r as U,A as fs,m as $i,dK as Ur,dL as jr,cv as al,dM as ll,c as ts,dN as hl,dO as cl,K as dl,dP as ul,dQ as _l,dR as fl}from"./index-BOwCLZTK.js";import{a as pl}from"./ping-LiBbR-Oy.js";import{g as ml,r as gl}from"./system-BNWIl4nC.js";import{g as vi,B as Do,r as To,T as $o}from"./ascii-burst-DN6etEs5.js";import{P as vl,B as Sl,C as yl}from"./PageLayout-QKntxcnp.js";import{K as Ao,S as wl}from"./KeycapButton-uJlkDPOC.js";import{D as Kr}from"./download-B9g5-0oH.js";import{S as qr}from"./search-Ba9CRHru.js";import{C as bl}from"./chevron-right-DJVm4pVP.js";import"./keycap-sfx-ByZp-njj.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. @@ -142,7 +142,7 @@ The web user needs polkit permissions to restart the service. See: /etc/polkit-1/localauthority/50-local.d/pymc-repeater.pkla`,"error");return}i.update(r,n.error||"Restart failed","error")}catch(n){const o=n instanceof Error?n.message:"";o.includes("ERR_NETWORK")||o.includes("ECONNRESET")||o.includes("Failed to fetch")||o.includes("Load failed")||o.includes("network connection was lost")||o.includes("abort")||o.includes("timeout")||n instanceof DOMException&&n.name==="TimeoutError"||n instanceof DOMException&&n.name==="AbortError"?(i.update(r,"Service is restarting (connection dropped).","success"),await this.waitForService(i)):i.update(r,`Error: ${o||"Restart failed"}`,"error")}}waitForService(i){return new Promise(s=>{const r=i.write("Waiting for service...","system");let n=0;const o=30;setTimeout(()=>{const a=setInterval(async()=>{n++,i.update(r,`Waiting for service... ${n}s`,"system");try{const h=new AbortController,l=setTimeout(()=>h.abort(),3e3);await fetch(`${nl}/api/stats`,{signal:h.signal}),clearTimeout(l),clearInterval(a),i.update(r,`Service connected. (${n+4}s)`,"success"),s();return}catch{}n>=o&&(clearInterval(a),i.update(r,`Service did not respond within ${o+4}s. Check manually.`,"warning"),s())},1e3)},4e3)})}}const Wt="\x1B[",Ie=`${Wt}0m`,Fa=`${Wt}32m`,Fr=`${Wt}33m`,Hr=`${Wt}31m`,R_=`${Wt}36m`,Mt=`${Wt}90m`,Ha=`${Wt}1m`;function Xt(e){return e>=1073741824?`${(e/1073741824).toFixed(1)}G`:e>=1048576?`${(e/1048576).toFixed(0)}M`:e>=1024?`${(e/1024).toFixed(0)}K`:`${e}B`}function co(e){const t=Math.floor(e/86400),i=Math.floor(e%86400/3600),s=Math.floor(e%3600/60);return t>0?`${t}d ${i}h ${s}m`:i>0?`${i}h ${s}m`:`${s}m`}function B_(e,t){const i=Math.max(0,Math.min(100,e)),s=Math.round(i/100*t),r=t-s,n=i>=90?Hr:i>=70?Fr:Fa,o=`${n}${"█".repeat(s)}${Ie}${Mt}${"░".repeat(r)}${Ie}`,a=`${i.toFixed(1)}%`.padStart(6);return`[${o}] ${n}${a}${Ie}`}function M_(e){return e>=80?`${Hr}${Ha}${e.toFixed(1)}°C${Ie}`:e>=60?`${Fr}${e.toFixed(1)}°C${Ie}`:`${Fa}${e.toFixed(1)}°C${Ie}`}const Ci=2,uo=" ";function Jt(e,t){const i=" ".repeat(Ci),s=t-Ci,r=uo.length,n=[];let o="",a=0;for(const h of e){const l=cu(h);a===0?(o=h,a=l):a+r+l<=s?(o+=uo+h,a+=r+l):(n.push(i+o),o=h,a=l)}return a>0&&n.push(i+o),n}function L_(e,t,i){var d,u;const s=e.node_name||"unknown",r=e.version?`v${e.version}`:"",n=(d=t.system)!=null&&d.uptime?co(t.system.uptime):"?",o=co(e.uptime_seconds||0),a=Math.max(3,i-Ci*2),h=((u=t.cpu.load_avg)==null?void 0:u["1min"].toFixed(2))??"?",l=t.cpu.load_avg?`${h} ${t.cpu.load_avg["5min"].toFixed(2)} ${t.cpu.load_avg["15min"].toFixed(2)}`:"?",c=i>=60?l:h;return[` ${R_}${Ha}${s}${Ie} ${Mt}${r}${Ie}`,` ${Mt}${"─".repeat(a)}${Ie}`,...Jt([b("Sys",y(n)),b("Svc",y(o)),b("Load",y(c))],i)]}function D_(e,t){const s=Ci+4+1+2+6,r=Math.max(6,Math.min(30,t-s)),n=s+r,o=t-n-2,a=[""],h=`${e.cpu.count} core${e.cpu.count>1?"s":""}`,l=`${Xt(e.memory.used)}/${Xt(e.memory.total)}`,c=`${Xt(e.disk.used)}/${Xt(e.disk.total)}`,d=(f,_,p)=>{const g=B_(_,r),x=o>=p.length?` ${Ae(p)}`:"";return` ${w(f.padEnd(4))}${g}${x}`};a.push(d("CPU",e.cpu.usage_percent,h)),a.push(d("Mem",e.memory.usage_percent,l)),a.push(d("Dsk",e.disk.usage_percent,c));const u=Object.entries(e.temperatures||{});if(u.length>0){const f=u.map(([_,p])=>`${Ae(_+":")} ${M_(p)}`);a.push(...Jt(f,t))}return a}function T_(e,t){var l,c;const i=e.neighbors||{},s=Object.keys(i).length,r=Object.values(i).filter(d=>d.zero_hop).length,n=((c=(l=e.config)==null?void 0:l.repeater)==null?void 0:c.mode)||"?",o=e.noise_floor_dbm!=null?`${e.noise_floor_dbm}dBm`:"?",a=e.duty_cycle_percent??0,h=["",` ${Mt}MESH${Ie}`];return h.push(...Jt([b("Mode",y(n)),b("Nbrs",`${y(String(r))}${Ae(`/${s}`)}`),b("Noise",y(o)),b("Air",y(`${a.toFixed(1)}%`))],t)),h.push(...Jt([b("RX",y(String(e.rx_count??0))),b("TX",y(String(e.tx_count??0))),b("FWD",y(String(e.forwarded_count??0))),b("Drop",y(String(e.dropped_count??0)))],t)),h.push(...Jt([b("RX/h",y(String(Math.round(e.rx_per_hour??0)))),b("FWD/h",y(String(Math.round(e.forwarded_per_hour??0))))],t)),h}function $_(e,t){if(!e.network)return[];const i=["",` ${Mt}NET${Ie}`];return i.push(...Jt([b("TX",y(Xt(e.network.bytes_sent))),b("RX",y(Xt(e.network.bytes_recv))),b("Pkt",`${y(String(e.network.packets_sent))}${Ae("/")}${y(String(e.network.packets_recv))}`)],t)),i}function A_(e,t,i){if(e.length===0)return[];const s=t>=50,r=t>=50?6:5,n=t>=50?6:5,o=s?7:0,a=Ci+0,h=Math.max(4,t-a-o-r-n-4),l=3,c=t>=50?8:5,d=i!=null?Math.max(0,Math.min(c,i-l)):c;if(d<=0)return[];const u=["",` ${Mt}PROCS${Ie}`],f=(s?"PID".padEnd(o):"")+"CPU".padStart(r)+"MEM".padStart(n)+" NAME";u.push(` ${Ae(f)}`);for(const _ of e.slice(0,d)){const p=s?Ae(String(_.pid).padEnd(o)):"",g=(t>=50?_.cpu_percent.toFixed(1):_.cpu_percent.toFixed(0)).padStart(r),x=(t>=50?_.memory_percent.toFixed(1):_.memory_percent.toFixed(0)).padStart(n),z=_.name.length>h?_.name.slice(0,h-1)+"…":_.name,O=_.cpu_percent>=50?Hr:_.cpu_percent>=20?Fr:"",M=O?`${O}${g}${Ie}`:g;u.push(` ${p}${M}${Ae(x)} ${z}`)}return u}function P_(){return new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}function _o(e,t,i,s,r){if(!e||!t)return` ${Mt}Waiting for data…${Ie}`;const n=L_(e,t,s),o=D_(t,s),a=T_(e,s),h=$_(t,s),l=["",` ${Mt}${P_()} · Ctrl+C to exit${Ie}`],c=[...n,...o,...a,...h,...l],d=r?wr(c,s):0,u=r?Math.max(0,r-d):void 0,f=A_(i,s,u),_=[...c.slice(0,-l.length),...f,...l];return r&&_.length>r&&(_.length=r),_.join(` `)}const N_=3e3;class I_ extends te{constructor(){super(...arguments);D(this,"name","top");D(this,"description","Live system overview (Ctrl+C to exit)");D(this,"aliases",["htop"])}async execute({output:i,rawInput:s,cols:r,signal:n}){var l,c;if(this.argsAfterName(s).toLowerCase().trim()==="help"){i.write([W("top"),` ${w("Live-updating system overview combining hardware")}`,` ${w("stats, mesh metrics, and running processes.")}`,` ${w("Refreshes every 3s. Press Ctrl+C to exit.")}`,"",E("top","start live display"),"",W("Sections"),` ${w("Header Node name, version, uptime, load average")}`,` ${w("Gauges CPU, memory, disk usage with bar charts")}`,` ${w("Mesh Mode, neighbors, packet counts, airtime")}`,` ${w("Network TCP/IP bytes and packet counters")}`,` ${w("Processes Top 8 processes by CPU usage")}`,"",W("Aliases"),` ${w("htop")}`].join(` `));return}let o=null,a=[],h=xt.getState().stats;try{const[d,u]=await Promise.all([es(),zr()]);d.success&&d.data&&(o=d.data),u.success&&u.data&&(a=u.data.processes.sort((f,_)=>_.cpu_percent-f.cpu_percent))}catch{}if(!n.aborted){(l=i.enterFullscreen)==null||l.call(i);try{const d=i.write(_o(h,o,a,i.cols??r,i.rows));await new Promise(u=>{if(n.aborted){u();return}const f=async()=>{h=xt.getState().stats;try{const[p,g]=await Promise.all([es(),zr()]);p.success&&p.data&&(o=p.data),g.success&&g.data&&(a=g.data.processes.sort((x,z)=>z.cpu_percent-x.cpu_percent))}catch{}n.aborted||i.update(d,_o(h,o,a,i.cols??r,i.rows))},_=setInterval(()=>{if(n.aborted){clearInterval(_),u();return}f()},N_);n.addEventListener("abort",()=>{clearInterval(_),u()},{once:!0})})}finally{(c=i.exitFullscreen)==null||c.call(i)}}}}const fo=["DONT PANIC","C0FFEE","FEED C0DE","LOL","I CANNOT DO THAT"];function Wr(){return fo[Math.floor(Math.random()*fo.length)]}const Cr=new EventTarget,xr="shell-phrase";function Wa(e){Cr.dispatchEvent(new CustomEvent(xr,{detail:e??Wr()}))}function O_(e){const t=i=>e(i.detail);return Cr.addEventListener(xr,t),()=>Cr.removeEventListener(xr,t)}class F_ extends te{constructor(){super(...arguments);D(this,"name","fortune");D(this,"description","Display a fortune on the header");D(this,"aliases",["lol"])}execute({output:i}){const s=Wr();Wa(s),i.write(w(` ${s}`))}}const kr=new EventTarget,Er="party-time";function H_(){kr.dispatchEvent(new Event(Er))}function W_(e){return kr.addEventListener(Er,e),()=>kr.removeEventListener(Er,e)}class z_ extends te{constructor(){super(...arguments);D(this,"name","partytime");D(this,"description","Party on, Garth!");D(this,"aliases",["party","excellent","waynesworld"])}execute({output:i}){H_(),Wa("PARTY 0N GARTH"),i.write(w(" SCHWING!"))}}class U_ extends te{constructor(){super(...arguments);D(this,"name","ver");D(this,"description","Show version info");D(this,"aliases",["version"])}async execute({output:i,rawInput:s}){if(this.argsAfterName(s).toLowerCase().trim()==="help"){i.write([W("ver"),` ${w("Display pyMC_Repeater, core, and console version.")}`,` ${w('Equivalent to firmware serial CLI "ver" command.')}`,"",E("ver","show version"),"",W("Aliases"),` ${w("version")}`].join(` -`));return}const r=i.write("processing...","system");try{const n=await rt();i.update(r,[` ${b("pyMC_Repeater",y(`v${n.version||"?"}`))}`,` ${b("pyMC_Core",y(n.core_version||"?"))}`,` ${b("pyMC_Console",y("v0.9.301"))}`].join(` +`));return}const r=i.write("processing...","system");try{const n=await rt();i.update(r,[` ${b("pyMC_Repeater",y(`v${n.version||"?"}`))}`,` ${b("pyMC_Core",y(n.core_version||"?"))}`,` ${b("pyMC_Console",y("v0.9.302"))}`].join(` `),"value")}catch(n){i.update(r,`Error: ${n instanceof Error?n.message:"Command failed"}`,"error")}}}class j_ extends te{constructor(){super(...arguments);D(this,"name","clock");D(this,"description","Show system UTC time")}execute({output:i,rawInput:s}){if(this.argsAfterName(s).toLowerCase().trim()==="help"){i.write([W("clock"),` ${w("Display the current system UTC time.")}`,` ${w('Equivalent to firmware serial CLI "clock" command.')}`,` ${w("Use to verify NTP sync and correlate packet timestamps.")}`,"",E("clock","show UTC time")].join(` `));return}const r=new Date;i.write([` ${b("UTC",y(r.toUTCString()))}`,` ${b("ISO",y(r.toISOString()))}`,` ${b("Unix",y(String(Math.floor(r.getTime()/1e3))))}`].join(` `),"value")}}class K_ extends te{constructor(){super(...arguments);D(this,"name","stats-packets");D(this,"description","Packet counters")}async execute({output:i,rawInput:s}){if(this.argsAfterName(s).toLowerCase().trim()==="help"){i.write([W("stats-packets"),` ${w("Display packet counters: sent, received, forwarded, dropped.")}`,` ${w('Equivalent to firmware serial CLI "stats-packets" command.')}`,"",E("stats-packets","show packet counters")].join(` diff --git a/frontend/dist/assets/activity-BZFnO4kb.js b/frontend/dist/assets/activity-D5uH2SFx.js similarity index 89% rename from frontend/dist/assets/activity-BZFnO4kb.js rename to frontend/dist/assets/activity-D5uH2SFx.js index 42f5c6cd..6d167be5 100644 --- a/frontend/dist/assets/activity-BZFnO4kb.js +++ b/frontend/dist/assets/activity-D5uH2SFx.js @@ -1,4 +1,4 @@ -import{d as t}from"./index-CeMilrX4.js";/** +import{d as t}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/antenna-DhdWQ_ro.js b/frontend/dist/assets/antenna-rYsqNluv.js similarity index 90% rename from frontend/dist/assets/antenna-DhdWQ_ro.js rename to frontend/dist/assets/antenna-rYsqNluv.js index 46ab01ec..ccf904a4 100644 --- a/frontend/dist/assets/antenna-DhdWQ_ro.js +++ b/frontend/dist/assets/antenna-rYsqNluv.js @@ -1,4 +1,4 @@ -import{d as e}from"./index-CeMilrX4.js";/** +import{d as e}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/arrow-up-C471XgXc.js b/frontend/dist/assets/arrow-up-BqsZCBBC.js similarity index 92% rename from frontend/dist/assets/arrow-up-C471XgXc.js rename to frontend/dist/assets/arrow-up-BqsZCBBC.js index ff9c9138..770289de 100644 --- a/frontend/dist/assets/arrow-up-C471XgXc.js +++ b/frontend/dist/assets/arrow-up-BqsZCBBC.js @@ -1,4 +1,4 @@ -import{d as o}from"./index-CeMilrX4.js";/** +import{d as o}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/badge-colors-DnsnMXHA.js b/frontend/dist/assets/badge-colors-DCbxcv7o.js similarity index 96% rename from frontend/dist/assets/badge-colors-DnsnMXHA.js rename to frontend/dist/assets/badge-colors-DCbxcv7o.js index 63acba02..0bc53ced 100644 --- a/frontend/dist/assets/badge-colors-DnsnMXHA.js +++ b/frontend/dist/assets/badge-colors-DCbxcv7o.js @@ -1,4 +1,4 @@ -import{d as r}from"./index-CeMilrX4.js";/** +import{d as r}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/chat-utils-BJwCtjDV.js b/frontend/dist/assets/chat-utils-D21OFED5.js similarity index 94% rename from frontend/dist/assets/chat-utils-BJwCtjDV.js rename to frontend/dist/assets/chat-utils-D21OFED5.js index 9ccd14f9..95a8fa55 100644 --- a/frontend/dist/assets/chat-utils-BJwCtjDV.js +++ b/frontend/dist/assets/chat-utils-D21OFED5.js @@ -1 +1 @@ -import{d6 as a,r as l}from"./index-CeMilrX4.js";const s=[a.green,a.blue,a.amber,a.pink,a.purple,a.cyan,a.orange,a.teal];function m(e){let n=0;for(let t=0;t0){const t=n[0],o=e.replace(i,"").trim();return{emoji:t,cleanName:o||e}}return{emoji:null,cleanName:e}}function f(e){const{cleanName:n}=u(e),t=n.split(/[\s-_]+/).filter(Boolean);if(t.length>=2){const r=Array.from(t[0])[0]||"",c=Array.from(t[1])[0]||"";return(r+c).toUpperCase()}return Array.from(n).slice(0,2).join("").toUpperCase()}function p(e){return new Date(e*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}function g(e){const n=/@\[([^\]]+)\]/g,t=[];let o=0,r;for(;(r=n.exec(e))!==null;)r.index>o&&t.push(e.slice(o,r.index)),t.push(l.createElement("span",{key:r.index,className:"font-extrabold text-white"},r[1])),o=r.index+r[0].length;return o0?t:e}export{f as a,p as b,u as e,g as f,m as g}; +import{d7 as a,r as l}from"./index-BOwCLZTK.js";const s=[a.green,a.blue,a.amber,a.pink,a.purple,a.cyan,a.orange,a.teal];function m(e){let n=0;for(let t=0;t0){const t=n[0],o=e.replace(i,"").trim();return{emoji:t,cleanName:o||e}}return{emoji:null,cleanName:e}}function f(e){const{cleanName:n}=u(e),t=n.split(/[\s-_]+/).filter(Boolean);if(t.length>=2){const r=Array.from(t[0])[0]||"",c=Array.from(t[1])[0]||"";return(r+c).toUpperCase()}return Array.from(n).slice(0,2).join("").toUpperCase()}function p(e){return new Date(e*1e3).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1})}function g(e){const n=/@\[([^\]]+)\]/g,t=[];let o=0,r;for(;(r=n.exec(e))!==null;)r.index>o&&t.push(e.slice(o,r.index)),t.push(l.createElement("span",{key:r.index,className:"font-extrabold text-white"},r[1])),o=r.index+r[0].length;return o0?t:e}export{f as a,p as b,u as e,g as f,m as g}; diff --git a/frontend/dist/assets/chevron-right-D3QL4sfa.js b/frontend/dist/assets/chevron-right-DJVm4pVP.js similarity index 85% rename from frontend/dist/assets/chevron-right-D3QL4sfa.js rename to frontend/dist/assets/chevron-right-DJVm4pVP.js index 1a8c3ff2..9425f5da 100644 --- a/frontend/dist/assets/chevron-right-D3QL4sfa.js +++ b/frontend/dist/assets/chevron-right-DJVm4pVP.js @@ -1,4 +1,4 @@ -import{d as o}from"./index-CeMilrX4.js";/** +import{d as o}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/circle-check-CY6Nl8LU.js b/frontend/dist/assets/circle-check-CmQaOkab.js similarity index 87% rename from frontend/dist/assets/circle-check-CY6Nl8LU.js rename to frontend/dist/assets/circle-check-CmQaOkab.js index 36e75a12..bd4bc803 100644 --- a/frontend/dist/assets/circle-check-CY6Nl8LU.js +++ b/frontend/dist/assets/circle-check-CmQaOkab.js @@ -1,4 +1,4 @@ -import{d as c}from"./index-CeMilrX4.js";/** +import{d as c}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/circle-question-mark-Bqc_DPUo.js b/frontend/dist/assets/circle-question-mark-XDnZ1ChV.js similarity index 89% rename from frontend/dist/assets/circle-question-mark-Bqc_DPUo.js rename to frontend/dist/assets/circle-question-mark-XDnZ1ChV.js index daf80817..2b11d530 100644 --- a/frontend/dist/assets/circle-question-mark-Bqc_DPUo.js +++ b/frontend/dist/assets/circle-question-mark-XDnZ1ChV.js @@ -1,4 +1,4 @@ -import{d as c}from"./index-CeMilrX4.js";/** +import{d as c}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/circle-stop-BvffqSZg.js b/frontend/dist/assets/circle-stop-Buqz2psb.js similarity index 94% rename from frontend/dist/assets/circle-stop-BvffqSZg.js rename to frontend/dist/assets/circle-stop-Buqz2psb.js index daae1df7..bba7b2ae 100644 --- a/frontend/dist/assets/circle-stop-BvffqSZg.js +++ b/frontend/dist/assets/circle-stop-Buqz2psb.js @@ -1,4 +1,4 @@ -import{d as c}from"./index-CeMilrX4.js";/** +import{d as c}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/circle-x-B6UCLWHM.js b/frontend/dist/assets/circle-x-BJVhIbR2.js similarity index 99% rename from frontend/dist/assets/circle-x-B6UCLWHM.js rename to frontend/dist/assets/circle-x-BJVhIbR2.js index e5807a92..bd059a39 100644 --- a/frontend/dist/assets/circle-x-B6UCLWHM.js +++ b/frontend/dist/assets/circle-x-BJVhIbR2.js @@ -1,4 +1,4 @@ -import{r as y,aK as _,d as A}from"./index-CeMilrX4.js";function S(r,l,e){let s=e.initialDeps??[],t,n=!0;function o(){var i,h,u;let c;e.key&&((i=e.debug)!=null&&i.call(e))&&(c=Date.now());const f=r();if(!(f.length!==s.length||f.some((p,d)=>s[d]!==p)))return t;s=f;let m;if(e.key&&((h=e.debug)!=null&&h.call(e))&&(m=Date.now()),t=l(...f),e.key&&((u=e.debug)!=null&&u.call(e))){const p=Math.round((Date.now()-c)*100)/100,d=Math.round((Date.now()-m)*100)/100,b=d/16,x=(g,E)=>{for(g=String(g);g.lengths[d]!==p)))return t;s=f;let m;if(e.key&&((h=e.debug)!=null&&h.call(e))&&(m=Date.now()),t=l(...f),e.key&&((u=e.debug)!=null&&u.call(e))){const p=Math.round((Date.now()-c)*100)/100,d=Math.round((Date.now()-m)*100)/100,b=d/16,x=(g,E)=>{for(g=String(g);g.length{s=i},o}function M(r,l){if(r===void 0)throw new Error("Unexpected undefined");return r}const R=(r,l)=>Math.abs(r-l)<1.01,k=(r,l,e)=>{let s;return function(...t){r.clearTimeout(s),s=r.setTimeout(()=>l.apply(this,t),e)}},z=r=>{const{offsetWidth:l,offsetHeight:e}=r;return{width:l,height:e}},T=r=>r,W=r=>{const l=Math.max(r.startIndex-r.overscan,0),e=Math.min(r.endIndex+r.overscan,r.count-1),s=[];for(let t=l;t<=e;t++)s.push(t);return s},D=(r,l)=>{const e=r.scrollElement;if(!e)return;const s=r.targetWindow;if(!s)return;const t=o=>{const{width:i,height:h}=o;l({width:Math.round(i),height:Math.round(h)})};if(t(z(e)),!s.ResizeObserver)return()=>{};const n=new s.ResizeObserver(o=>{const i=()=>{const h=o[0];if(h!=null&&h.borderBoxSize){const u=h.borderBoxSize[0];if(u){t({width:u.inlineSize,height:u.blockSize});return}}t(z(e))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()});return n.observe(e,{box:"border-box"}),()=>{n.unobserve(e)}},C={passive:!0},O=typeof window>"u"?!0:"onscrollend"in window,L=(r,l)=>{const e=r.scrollElement;if(!e)return;const s=r.targetWindow;if(!s)return;let t=0;const n=r.options.useScrollendEvent&&O?()=>{}:k(s,()=>{l(t,!1)},r.options.isScrollingResetDelay),o=c=>()=>{const{horizontal:f,isRtl:a}=r.options;t=f?e.scrollLeft*(a&&-1||1):e.scrollTop,n(),l(t,c)},i=o(!0),h=o(!1);e.addEventListener("scroll",i,C);const u=r.options.useScrollendEvent&&O;return u&&e.addEventListener("scrollend",h,C),()=>{e.removeEventListener("scroll",i),u&&e.removeEventListener("scrollend",h)}},j=(r,l,e)=>{if(l!=null&&l.borderBoxSize){const s=l.borderBoxSize[0];if(s)return Math.round(s[e.options.horizontal?"inlineSize":"blockSize"])}return r[e.options.horizontal?"offsetWidth":"offsetHeight"]},P=(r,{adjustments:l=0,behavior:e},s)=>{var t,n;const o=r+l;(n=(t=s.scrollElement)==null?void 0:t.scrollTo)==null||n.call(t,{[s.options.horizontal?"left":"top"]:o,behavior:e})};class N{constructor(l){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.currentScrollToIndex=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let e=null;const s=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(t=>{t.forEach(n=>{const o=()=>{this._measureElement(n.target,n)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var t;(t=s())==null||t.disconnect(),e=null},observe:t=>{var n;return(n=s())==null?void 0:n.observe(t,{box:"border-box"})},unobserve:t=>{var n;return(n=s())==null?void 0:n.unobserve(t)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([s,t])=>{typeof t>"u"&&delete e[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:T,rangeExtractor:W,onChange:()=>{},measureElement:j,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var s,t;(t=(s=this.options).onChange)==null||t.call(s,this,e)},this.maybeNotify=S(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(t=>{this.observer.observe(t)}),this.unsubs.push(this.options.observeElementRect(this,t=>{this.scrollRect=t,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(t,n)=>{this.scrollAdjustments=0,this.scrollDirection=n?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,s)=>{const t=new Map,n=new Map;for(let o=s-1;o>=0;o--){const i=e[o];if(t.has(i.lane))continue;const h=n.get(i.lane);if(h==null||i.end>h.end?n.set(i.lane,i):i.endo.end===i.end?o.index-i.index:o.end-i.end)[0]:void 0},this.getMeasurementOptions=S(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,s,t,n,o,i)=>(this.prevLanes!==void 0&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:s,scrollMargin:t,getItemKey:n,enabled:o,lanes:i}),{key:!1}),this.getMeasurements=S(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:s,scrollMargin:t,getItemKey:n,enabled:o,lanes:i},h)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const a of this.laneAssignments.keys())a>=e&&this.laneAssignments.delete(a);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(a=>{this.itemSizeCache.set(a.key,a.size)}));const u=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const c=this.measurementsCache.slice(0,u),f=new Array(i).fill(void 0);for(let a=0;a1){d=p;const v=f[d],w=v!==void 0?c[v]:void 0;b=w?w.end+this.options.gap:s+t}else{const v=this.options.lanes===1?c[a-1]:this.getFurthestMeasurement(c,a);b=v?v.end+this.options.gap:s+t,d=v?v.lane:a%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(a,d)}const x=h.get(m),g=typeof x=="number"?x:this.options.estimateSize(a),E=b+g;c[a]={index:a,start:b,size:g,end:E,key:m,lane:d},f[d]=a}return this.measurementsCache=c,c},{key:!1,debug:()=>this.options.debug}),this.calculateRange=S(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,s,t,n)=>this.range=e.length>0&&s>0?B({measurements:e,outerSize:s,scrollOffset:t,lanes:n}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=S(()=>{let e=null,s=null;const t=this.calculateRange();return t&&(e=t.startIndex,s=t.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,s]},(e,s,t,n,o)=>n===null||o===null?[]:e({startIndex:n,endIndex:o,overscan:s,count:t}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const s=this.options.indexAttribute,t=e.getAttribute(s);return t?parseInt(t,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(e,s)=>{const t=this.indexFromElement(e),n=this.measurementsCache[t];if(!n)return;const o=n.key,i=this.elementsCache.get(o);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(o,e)),e.isConnected&&this.resizeItem(t,this.options.measureElement(e,s,this))},this.resizeItem=(e,s)=>{const t=this.measurementsCache[e];if(!t)return;const n=this.itemSizeCache.get(t.key)??t.size,o=s-n;o!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(t,o,this):t.start{if(!e){this.elementsCache.forEach((s,t)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(t))});return}this._measureElement(e,void 0)},this.getVirtualItems=S(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,s)=>{const t=[];for(let n=0,o=e.length;nthis.options.debug}),this.getVirtualItemForOffset=e=>{const s=this.getMeasurements();if(s.length!==0)return M(s[F(0,s.length-1,t=>M(s[t]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,s,t=0)=>{if(!this.scrollElement)return 0;const n=this.getSize(),o=this.getScrollOffset();s==="auto"&&(s=e>=o+n?"end":"start"),s==="center"?e+=(t-n)/2:s==="end"&&(e-=n);const i=this.getMaxScrollOffset();return Math.max(Math.min(i,e),0)},this.getOffsetForIndex=(e,s="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const t=this.measurementsCache[e];if(!t)return;const n=this.getSize(),o=this.getScrollOffset();if(s==="auto")if(t.end>=o+n-this.options.scrollPaddingEnd)s="end";else if(t.start<=o+this.options.scrollPaddingStart)s="start";else return[o,s];if(s==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),s];const i=s==="end"?t.end+this.options.scrollPaddingEnd:t.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,s,t.size),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(e,{align:s="start",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(e,s),{adjustments:void 0,behavior:t})},this.scrollToIndex=(e,{align:s="auto",behavior:t}={})=>{t==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),e=Math.max(0,Math.min(e,this.options.count-1)),this.currentScrollToIndex=e;let n=0;const o=10,i=u=>{if(!this.targetWindow)return;const c=this.getOffsetForIndex(e,u);if(!c){console.warn("Failed to get offset for index:",e);return}const[f,a]=c;this._scrollToOffset(f,{adjustments:void 0,behavior:t}),this.targetWindow.requestAnimationFrame(()=>{const m=()=>{if(this.currentScrollToIndex!==e)return;const p=this.getScrollOffset(),d=this.getOffsetForIndex(e,a);if(!d){console.warn("Failed to get offset for index:",e);return}R(d[0],p)||h(a)};this.isDynamicMode()?this.targetWindow.requestAnimationFrame(m):m()})},h=u=>{this.targetWindow&&this.currentScrollToIndex===e&&(n++,ni(u)):console.warn(`Failed to scroll to index ${e} after ${o} attempts.`))};i(s)},this.scrollBy=(e,{behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+e,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var e;const s=this.getMeasurements();let t;if(s.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=((e=s[s.length-1])==null?void 0:e.end)??0;else{const n=Array(this.options.lanes).fill(null);let o=s.length-1;for(;o>=0&&n.some(i=>i===null);){const i=s[o];n[i.lane]===null&&(n[i.lane]=i.end),o--}t=Math.max(...n.filter(i=>i!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:s,behavior:t})=>{this.options.scrollToFn(e,{behavior:t,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(l)}}const F=(r,l,e,s)=>{for(;r<=l;){const t=(r+l)/2|0,n=e(t);if(ns)l=t-1;else return t}return r>0?r-1:0};function B({measurements:r,outerSize:l,scrollOffset:e,lanes:s}){const t=r.length-1,n=h=>r[h].start;if(r.length<=s)return{startIndex:0,endIndex:t};let o=F(0,t,n,e),i=o;if(s===1)for(;i1){const h=Array(s).fill(0);for(;ic=0&&u.some(c=>c>=e);){const c=r[o];u[c.lane]=c.start,o--}o=Math.max(0,o-o%s),i=Math.min(t,i+(s-1-i%s))}return{startIndex:o,endIndex:i}}const I=typeof document<"u"?y.useLayoutEffect:y.useEffect;function H({useFlushSync:r=!0,...l}){const e=y.useReducer(()=>({}),{})[1],s={...l,onChange:(n,o)=>{var i;r&&o?_.flushSync(e):e(),(i=l.onChange)==null||i.call(l,n,o)}},[t]=y.useState(()=>new N(s));return t.setOptions(s),I(()=>t._didMount(),[]),I(()=>t._willUpdate()),t}function U(r){return H({observeElementRect:D,observeElementOffset:L,scrollToFn:P,...r})}/** diff --git a/frontend/dist/assets/consumer-registry-Hkh6Dv_i.js b/frontend/dist/assets/consumer-registry-CTjikLma.js similarity index 92% rename from frontend/dist/assets/consumer-registry-Hkh6Dv_i.js rename to frontend/dist/assets/consumer-registry-CTjikLma.js index aa43ad2d..2921c57b 100644 --- a/frontend/dist/assets/consumer-registry-Hkh6Dv_i.js +++ b/frontend/dist/assets/consumer-registry-CTjikLma.js @@ -1 +1 @@ -import{af as n,r as i}from"./index-CeMilrX4.js";const p=t=>(t.type??t.payload_type)===n.ADVERT,l=t=>(t.type??t.payload_type)===n.TRACE,h=t=>(t.type??t.payload_type)===n.TXT_MSG,_=t=>(t.type??t.payload_type)===n.PATH,d=t=>(t.type??t.payload_type)===n.ACK,g=t=>{const e=t.type??t.payload_type;return e===n.GRP_TXT||e===n.GRP_DATA},m=t=>(t.path_length??(Array.isArray(t.original_path)?t.original_path.length:0))>0,A=t=>!!t.src_hash,T=t=>t.airtime_ms!=null,c=new Set,o=new Map;function a(t,e){return`${t}|${e}`}function u(t,e){const s=a(t,e);o.set(s,(o.get(s)??0)+1)}function y(t,e){const s=a(t,e),r=o.get(s)??0;r>1?o.set(s,r-1):o.delete(s)}function C(t){for(const e of t){const s=a(e.target,e.fn);c.has(s)||c.add(s)}}function P(t){i.useEffect(()=>{for(const e of t)u(e.target,e.fn);return()=>{for(const e of t)y(e.target,e.fn)}},[t])}export{m as a,A as b,h as c,d,p as e,l as f,_ as g,T as h,g as i,C as r,P as u}; +import{af as n,r as i}from"./index-BOwCLZTK.js";const p=t=>(t.type??t.payload_type)===n.ADVERT,l=t=>(t.type??t.payload_type)===n.TRACE,h=t=>(t.type??t.payload_type)===n.TXT_MSG,_=t=>(t.type??t.payload_type)===n.PATH,d=t=>(t.type??t.payload_type)===n.ACK,g=t=>{const e=t.type??t.payload_type;return e===n.GRP_TXT||e===n.GRP_DATA},m=t=>(t.path_length??(Array.isArray(t.original_path)?t.original_path.length:0))>0,A=t=>!!t.src_hash,T=t=>t.airtime_ms!=null,c=new Set,o=new Map;function a(t,e){return`${t}|${e}`}function u(t,e){const s=a(t,e);o.set(s,(o.get(s)??0)+1)}function y(t,e){const s=a(t,e),r=o.get(s)??0;r>1?o.set(s,r-1):o.delete(s)}function C(t){for(const e of t){const s=a(e.target,e.fn);c.has(s)||c.add(s)}}function P(t){i.useEffect(()=>{for(const e of t)u(e.target,e.fn);return()=>{for(const e of t)y(e.target,e.fn)}},[t])}export{m as a,A as b,h as c,d,p as e,l as f,_ as g,T as h,g as i,C as r,P as u}; diff --git a/frontend/dist/assets/cpu-C5-ss1x-.js b/frontend/dist/assets/cpu-D7sbzQ8o.js similarity index 94% rename from frontend/dist/assets/cpu-C5-ss1x-.js rename to frontend/dist/assets/cpu-D7sbzQ8o.js index 10695fc3..02798c6d 100644 --- a/frontend/dist/assets/cpu-C5-ss1x-.js +++ b/frontend/dist/assets/cpu-D7sbzQ8o.js @@ -1,4 +1,4 @@ -import{d as h}from"./index-CeMilrX4.js";/** +import{d as h}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/database-D2sIhibw.js b/frontend/dist/assets/database-C6oOGn9y.js similarity index 89% rename from frontend/dist/assets/database-D2sIhibw.js rename to frontend/dist/assets/database-C6oOGn9y.js index 2570ddca..1d33653c 100644 --- a/frontend/dist/assets/database-D2sIhibw.js +++ b/frontend/dist/assets/database-C6oOGn9y.js @@ -1,4 +1,4 @@ -import{d as e}from"./index-CeMilrX4.js";/** +import{d as e}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/download-ByVPtD5I.js b/frontend/dist/assets/download-B9g5-0oH.js similarity index 89% rename from frontend/dist/assets/download-ByVPtD5I.js rename to frontend/dist/assets/download-B9g5-0oH.js index e210cd54..16ea627b 100644 --- a/frontend/dist/assets/download-ByVPtD5I.js +++ b/frontend/dist/assets/download-B9g5-0oH.js @@ -1,4 +1,4 @@ -import{d as o}from"./index-CeMilrX4.js";/** +import{d as o}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/easing-CFZ7-xae.js b/frontend/dist/assets/easing-CsgXD0uy.js similarity index 53% rename from frontend/dist/assets/easing-CFZ7-xae.js rename to frontend/dist/assets/easing-CsgXD0uy.js index 60b2cccb..c8707e7f 100644 --- a/frontend/dist/assets/easing-CFZ7-xae.js +++ b/frontend/dist/assets/easing-CsgXD0uy.js @@ -1,6 +1,6 @@ -import{d as s,fb as a}from"./index-CeMilrX4.js";/** +import{d as c,fc as a}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const c=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],t=s("compass",c),o=a(.65,0,.35,1),n=a(.33,1,.68,1),u=a(.33,.67,.67,1),i=a(.76,0,.24,1);export{t as C,n as a,o as b,u as c,i as e}; + */const s=[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],t=c("compass",s),o=a(.65,0,.35,1),n=a(.33,1,.68,1),u=a(.33,.67,.67,1),i=a(.76,0,.24,1);export{t as C,n as a,o as b,u as c,i as e}; diff --git a/frontend/dist/assets/element-movement-zLH7y51p.js b/frontend/dist/assets/element-movement-BLnr83nT.js similarity index 74% rename from frontend/dist/assets/element-movement-zLH7y51p.js rename to frontend/dist/assets/element-movement-BLnr83nT.js index eec1d6db..fa550d74 100644 --- a/frontend/dist/assets/element-movement-zLH7y51p.js +++ b/frontend/dist/assets/element-movement-BLnr83nT.js @@ -1 +1 @@ -import{r as o,aq as v,cx as b,eS as h,eT as w,cO as x,b2 as c,b5 as R}from"./index-CeMilrX4.js";function S(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function N(e=S){return o.useCallback((t,r)=>{if(typeof e=="string"){let u=e;return(t==null?void 0:t[u])===(r==null?void 0:r[u])}return e(t,r)},[e])}var $=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))($||{});function j(e){let t=o.useRef(null),r=v(l=>{t.current=l.pointerType,!b(l.currentTarget)&&l.pointerType==="mouse"&&l.button===$.Left&&(l.preventDefault(),e(l))}),u=v(l=>{t.current!=="mouse"&&(b(l.currentTarget)||e(l))});return{onPointerDown:r,onClick:u}}var y=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(y||{});const z={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},I=200,k=5;function F(e,{trigger:t,action:r,close:u,select:l}){let n=o.useRef(null),i=o.useRef(null),a=o.useRef(null);h(e&&t!==null,"pointerdown",s=>{w(s==null?void 0:s.target)&&t!=null&&t.contains(s.target)&&(i.current=s.x,a.current=s.y,n.current=s.timeStamp)}),h(e&&t!==null,"pointerup",s=>{var d,f;let g=n.current;if(g===null||(n.current=null,!x(s.target))||Math.abs(s.x-((d=i.current)!=null?d:s.x))I&&(l(p.target),u());break}case 2:{u();break}}},{capture:!0})}function m(e){return[e.screenX,e.screenY]}function P(){let e=o.useRef([-1,-1]);return{wasMoved(t){let r=m(t);return e.current[0]===r[0]&&e.current[1]===r[1]?!1:(e.current=r,!0)},update(t){e.current=m(t)}}}function L({children:e,freeze:t},r){let u=T(t,e);return o.isValidElement(u)?o.cloneElement(u,{ref:r}):c.createElement(c.Fragment,null,u)}const O=c.forwardRef(L);function T(e,t){let[r,u]=o.useState(t);return!e&&r!==t&&u(t),e?r:t}function E(e){throw new Error("Unexpected object: "+e)}var C=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(C||{});function q(e,t){let r=t.resolveItems();if(r.length<=0)return null;let u=t.resolveActiveIndex(),l=u??-1;switch(e.focus){case 0:{for(let n=0;n=0;--n)if(!t.resolveDisabled(r[n],n,r))return n;return u}case 2:{for(let n=l+1;n=0;--n)if(!t.resolveDisabled(r[n],n,r))return n;return u}case 4:{for(let n=0;n({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function D(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function B(e,t,r){let u=R();if(t.kind==="Tracked"){let l=function(){n!==D(e)&&(u.dispose(),r())},{position:n}=t,i=new ResizeObserver(l);i.observe(e),u.add(()=>i.disconnect()),u.addEventListener(window,"scroll",l,{passive:!0}),u.addEventListener(window,"resize",l)}return()=>u.dispose()}export{F as L,z as S,A as a,D as b,C as c,O as d,P as e,q as f,$ as g,N as h,B as p,j as s,T as u}; +import{r as o,aq as v,cy as b,eT as h,eU as w,cP as x,b2 as c,b5 as y}from"./index-BOwCLZTK.js";function R(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function N(e=R){return o.useCallback((t,r)=>{if(typeof e=="string"){let u=e;return(t==null?void 0:t[u])===(r==null?void 0:r[u])}return e(t,r)},[e])}var $=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))($||{});function P(e){let t=o.useRef(null),r=v(l=>{t.current=l.pointerType,!b(l.currentTarget)&&l.pointerType==="mouse"&&l.button===$.Left&&(l.preventDefault(),e(l))}),u=v(l=>{t.current!=="mouse"&&(b(l.currentTarget)||e(l))});return{onPointerDown:r,onClick:u}}var S=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(S||{});const j={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},I=200,k=5;function z(e,{trigger:t,action:r,close:u,select:l}){let n=o.useRef(null),i=o.useRef(null),a=o.useRef(null);h(e&&t!==null,"pointerdown",s=>{w(s==null?void 0:s.target)&&t!=null&&t.contains(s.target)&&(i.current=s.x,a.current=s.y,n.current=s.timeStamp)}),h(e&&t!==null,"pointerup",s=>{var d,f;let g=n.current;if(g===null||(n.current=null,!x(s.target))||Math.abs(s.x-((d=i.current)!=null?d:s.x))I&&(l(p.target),u());break}case 2:{u();break}}},{capture:!0})}function m(e){return[e.screenX,e.screenY]}function F(){let e=o.useRef([-1,-1]);return{wasMoved(t){let r=m(t);return e.current[0]===r[0]&&e.current[1]===r[1]?!1:(e.current=r,!0)},update(t){e.current=m(t)}}}function L({children:e,freeze:t},r){let u=T(t,e);return o.isValidElement(u)?o.cloneElement(u,{ref:r}):c.createElement(c.Fragment,null,u)}const U=c.forwardRef(L);function T(e,t){let[r,u]=o.useState(t);return!e&&r!==t&&u(t),e?r:t}function E(e){throw new Error("Unexpected object: "+e)}var C=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(C||{});function q(e,t){let r=t.resolveItems();if(r.length<=0)return null;let u=t.resolveActiveIndex(),l=u??-1;switch(e.focus){case 0:{for(let n=0;n=0;--n)if(!t.resolveDisabled(r[n],n,r))return n;return u}case 2:{for(let n=l+1;n=0;--n)if(!t.resolveDisabled(r[n],n,r))return n;return u}case 4:{for(let n=0;n({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function D(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function B(e,t,r){let u=y();if(t.kind==="Tracked"){let l=function(){n!==D(e)&&(u.dispose(),r())},{position:n}=t,i=new ResizeObserver(l);i.observe(e),u.add(()=>i.disconnect()),u.addEventListener(window,"scroll",l,{passive:!0}),u.addEventListener(window,"resize",l)}return()=>u.dispose()}export{z as L,j as S,A as a,D as b,C as c,U as d,F as e,q as f,$ as g,N as h,B as p,P as s,T as u}; diff --git a/frontend/dist/assets/funnel-D2SUJQ8o.js b/frontend/dist/assets/funnel-CWx99rlN.js similarity index 89% rename from frontend/dist/assets/funnel-D2SUJQ8o.js rename to frontend/dist/assets/funnel-CWx99rlN.js index 98a54850..646ad382 100644 --- a/frontend/dist/assets/funnel-D2SUJQ8o.js +++ b/frontend/dist/assets/funnel-CWx99rlN.js @@ -1,4 +1,4 @@ -import{d as e}from"./index-CeMilrX4.js";/** +import{d as e}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/hash-CBEVBQJR.js b/frontend/dist/assets/hash-Dwn2PbMF.js similarity index 90% rename from frontend/dist/assets/hash-CBEVBQJR.js rename to frontend/dist/assets/hash-Dwn2PbMF.js index faabd90b..1a2817f4 100644 --- a/frontend/dist/assets/hash-CBEVBQJR.js +++ b/frontend/dist/assets/hash-Dwn2PbMF.js @@ -1,4 +1,4 @@ -import{d as e}from"./index-CeMilrX4.js";/** +import{d as e}from"./index-BOwCLZTK.js";/** * @license lucide-react v0.559.0 - ISC * * This source code is licensed under the ISC license. diff --git a/frontend/dist/assets/index-BK59_Mkt.js b/frontend/dist/assets/index-2RIoVPos.js similarity index 88% rename from frontend/dist/assets/index-BK59_Mkt.js rename to frontend/dist/assets/index-2RIoVPos.js index ef7e50c5..49ad2c7a 100644 --- a/frontend/dist/assets/index-BK59_Mkt.js +++ b/frontend/dist/assets/index-2RIoVPos.js @@ -1 +1 @@ -import{fc as ve,fd as Ae,fe as we,ff as je,r as l,fg as B,bn as oe,j as S,fh as Ee,fi as Ie,fj as De,fk as Me,fl as le,fm as ke,fn as Ce,fo as Re,fp as $e,fq as Ve,fr as Ne,fs as Te,ft as We,fu as Le,fv as Pe,fw as _,fx as Oe,fy as Be,fz as Fe,m as k,fA as Ge,fB as ue,A as ce,bC as Ke,fC as ze,fD as _e}from"./index-CeMilrX4.js";const He=(t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t};function fe(t,e){return ve(t)?t[He(0,t.length,e)]:t}class Xe{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,n){for(let i=0;ii.attachTimeline(e));return()=>{n.forEach((i,r)=>{i&&i(),this.animations[r].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return ne(this.animations,"duration")}get iterationDuration(){return ne(this.animations,"iterationDuration")}runAll(e){this.animations.forEach(n=>n[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function ne(t,e){let n=0;for(let i=0;in&&(n=r)}return n}class Ye extends Xe{then(e,n){return this.finished.finally(e).then(()=>{})}}function qe(t,e){return t in e}class Je extends Ae{constructor(){super(...arguments),this.type="object"}readValueFromInstance(e,n){if(qe(n,e)){const i=e[n];if(typeof i=="string"||typeof i=="number")return i}}getBaseTargetFromProps(){}removeValueFromRenderState(e,n){delete n.output[e]}measureInstanceViewportBox(){return we()}build(e,n){Object.assign(e.output,n)}renderInstance(e,{output:n}){Object.assign(e,n)}sortInstanceNodePosition(){return 0}}function Ue({children:t,isValidProp:e,...n}){e&&je(e),n={...l.useContext(B),...n},n.isStatic=oe(()=>n.isStatic);const i=l.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return S.jsx(B.Provider,{value:i,children:t})}function Qe(t){const e=oe(()=>Ee(t)),{isStatic:n}=l.useContext(B);if(n){const[,i]=l.useState(t);l.useEffect(()=>e.on("change",i),[])}return e}function q(t){return typeof t=="object"&&!Array.isArray(t)}function de(t,e,n,i){return t==null?[]:typeof t=="string"&&q(e)?Ie(t,n,i):t instanceof NodeList?Array.from(t):Array.isArray(t)?t.filter(r=>r!=null):[t]}function Ze(t,e,n){return t*(e+1)}function ie(t,e,n,i){return typeof e=="number"?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):e==="<"?n:e.startsWith("<")?Math.max(0,n+parseFloat(e.slice(1))):i.get(e)??t}function et(t,e,n){for(let i=0;ie&&r.at{const v=at(A),{delay:$=0,times:j=ke(v),type:W=e.type||"keyframes",repeat:N,repeatType:X,repeatDelay:Rt=0,...be}=E;let{ease:V=e.ease||"easeOut",duration:C}=E;const J=typeof $=="function"?$(M,R):$,U=v.length,Q=$e(W)?W:r==null?void 0:r[W||"keyframes"];if(U<=2&&Q){let L=100;if(U===2&&ut(v)){const P=v[1]-v[0];L=Math.abs(P)}const F={...e,...be};C!==void 0&&(F.duration=Ve(C));const G=Ce(F,L,Q);V=G.ease,C=G.duration}C??(C=y);const Z=p+J;j.length===1&&j[0]===0&&(j[1]=1);const ee=j.length-v.length;if(ee>0&&Re(j,ee),v.length===1&&v.unshift(null),N){C=Ze(C,N);const L=[...v],F=[...j];V=Array.isArray(V)?[...V]:[V];const G=[...V];for(let P=0;P{for(const c in x){const f=x[c];f.sort(it);const s=[],a=[],w=[];for(let M=0;Mtypeof t=="number",ut=t=>t.every(lt);function ct(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=Te(t)&&!We(t)?new Le(e):new Pe(e);n.mount(t),_.set(t,n)}function ft(t){const e={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},n=new Je(e);n.mount(t),_.set(t,n)}function dt(t,e){return le(t)||typeof t=="number"||typeof t=="string"&&!q(e)}function pe(t,e,n,i){const r=[];if(dt(t,e))r.push(Oe(t,q(e)&&e.default||e,n&&(n.default||n)));else{if(t==null)return r;const y=de(t,e,i),u=y.length;for(let g=0;g{i.push(...pe(g,y,u))}),i}function mt(t){return Array.isArray(t)&&t.some(Array.isArray)}function yt(t){function e(n,i,r){let y=[],u;if(mt(n))y=pt(n,i,t);else{const{onComplete:o,...h}=r||{};typeof o=="function"&&(u=o),y=pe(n,i,h,t)}const g=new Ye(y);return u&&g.finished.then(u),g}return e}const me=yt(),I="var(--mask-height, 0.15em)",Y="var(--mask-width, 0.5em)",T=`calc(${Y} / var(--invert-x, 1))`,K="#000 0, transparent 71%",ht=`linear-gradient(to right, transparent 0, #000 ${T}, #000 calc(100% - ${T}), transparent),linear-gradient(to bottom, transparent 0, #000 ${I}, #000 calc(100% - ${I}), transparent 100%),radial-gradient(at bottom right, ${K}),radial-gradient(at bottom left, ${K}), radial-gradient(at top left, ${K}), radial-gradient(at top right, ${K})`,gt=`100% calc(100% - ${I} * 2),calc(100% - ${T} * 2) 100%,${T} ${I},${T} ${I},${T} ${I},${T} ${I}`;Ge({"--invert-x":{correct:(t,{treeScale:e,projectionDelta:n})=>n.x.scale*e.x}});function xt({children:t,layoutDependency:e}){return S.jsx(k.span,{layout:!0,layoutDependency:e,"aria-hidden":!0,style:{display:"inline-flex","--invert-x":1,margin:`0 calc(-1*${Y})`,padding:`calc(${I}/2) ${Y}`,position:"relative",zIndex:-1,overflow:"clip",WebkitMaskImage:ht,WebkitMaskSize:gt,WebkitMaskPosition:"center, center, top left, top right, bottom right, bottom left",WebkitMaskRepeat:"no-repeat"},children:t})}function ye(){const t=l.useRef(!0);return l.useEffect(()=>{t.current=!1},[]),t.current}function H(t){const{width:e,fontSize:n}=getComputedStyle(t);return`${parseFloat(e)/parseFloat(n)}em`}const he=new WeakMap,St=l.forwardRef(function({value:e,initialValue:n=e,...i},r){const{transition:y}=l.useContext(B),u=l.useRef(n).current,g=ye(),o=l.useRef(null),h=l.useRef(null);l.useImperativeHandle(r,()=>h.current,[]);const b=l.useRef(new Array(10)),p=ue(),m=p?e:0;l.useLayoutEffect(()=>{!o.current||!b.current[u]||(o.current.style.width=H(b.current[u]))},[]);const x=l.useRef(n);l.useLayoutEffect(()=>{var A;if(!o.current||m===x.current)return;const s=o.current.getBoundingClientRect(),a=(A=h.current)==null?void 0:A.getBoundingClientRect(),w=s.height*(m-x.current)+(s.top-(a?a.top||0:s.top));return me(o.current,{y:[w,0]},y),()=>{x.current=m}},[m]);const[d,c]=l.useState();l.useEffect(()=>{if(g&&u===m||!b.current[m])return;const s=H(b.current[m]);h.current&&he.set(h.current,s),c(s)},[m]);const f=s=>S.jsx("span",{style:{display:"inline-block",padding:`calc(${I}/2) 0`},ref:a=>void(b.current[s]=a),children:s},s);return S.jsx(k.span,{...i,ref:h,layout:"position","data-state":p?void 0:"exiting",style:{display:"inline-flex",justifyContent:"center",width:d},children:S.jsxs("span",{ref:o,style:{display:"inline-flex",justifyContent:"center",flexDirection:"column",alignItems:"center",position:"relative"},children:[m!==0&&S.jsx("span",{style:{...ae,bottom:"100%",left:0},children:new Array(m).fill(null).map((s,a)=>f(a))}),f(m),m!==9&&S.jsx("span",{style:{...ae,top:"100%",left:0},children:new Array(9-m).fill(null).map((s,a)=>f(m+a+1))})]})})}),ae={display:"flex",flexDirection:"column",alignItems:"center",position:"absolute",width:"100%"},ge=l.createContext({justify:"left"}),bt=l.forwardRef(function({partKey:e,type:n,children:i,layoutDependency:r,...y},u){const g=ue(),{justify:o}=l.useContext(ge);return S.jsx(k.span,{...y,"data-state":g?void 0:"exiting",style:{display:"inline-flex",justifyContent:o,padding:`calc(${I}/2) 0`,position:"relative"},layout:"position",layoutDependency:r,ref:u,children:S.jsx(ce,{mode:"popLayout",anchorX:o,initial:!1,children:S.jsx(k.span,{layout:o==="right"?"position":!1,layoutDependency:r,initial:{opacity:0},animate:{opacity:[null,1]},exit:{opacity:[null,0]},style:{display:"inline-block",whiteSpace:"pre"},children:i},i)})})}),z=l.forwardRef(function({parts:e,justify:n="left",mode:i,style:r,name:y,layoutDependency:u,...g},o){const h=l.useRef(null);l.useImperativeHandle(o,()=>h.current,[]);const b=l.useMemo(()=>({justify:n}),[n]),p=l.useRef(null),m=ye(),[x,d]=l.useState();return l.useEffect(()=>{if(!p.current)return;if(m){h.current&&(h.current.style.width=H(p.current));return}const c=Array.from(p.current.children).map(f=>{if(!(f instanceof HTMLElement))return;if(f.dataset.state==="exiting"){const w=f.nextSibling;return f.remove(),()=>{p.current&&p.current.insertBefore(f,w)}}const s=he.get(f);if(!s)return;const a=f.style.width;return f.style.width=s,()=>{f.style.width=a}});d(H(p.current));for(let f=c.length-1;f>=0;f--){const s=c[f];s&&s()}},[e.map(c=>c.value).join("")]),S.jsx(ge.Provider,{value:b,children:S.jsx(k.span,{layoutDependency:u,...g,ref:h,className:`number-section-${y}`,style:{...r,display:"inline-flex",justifyContent:n,width:x},children:S.jsxs("span",{ref:p,style:{display:"inline-flex",justifyContent:"inherit",position:"relative"},children:["​",S.jsx(ce,{mode:i,anchorX:n,initial:!1,children:e.map(c=>c.type==="integer"||c.type==="fraction"?S.jsx(St,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:c.value,initialValue:m?void 0:0,layoutDependency:u},c.key):S.jsx(bt,{type:c.type,partKey:c.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},layoutDependency:u,children:c.value},c.type==="literal"?`${c.key}:${c.value}`:c.key))})]})})})}),vt=(t,{locales:e,format:n},i,r)=>{const u=new Intl.NumberFormat(e,n).formatToParts(Number(t));i&&u.unshift({type:"prefix",value:i}),r&&u.push({type:"suffix",value:r});const g=[],o=[],h=[],b=[],p={},m=s=>`${s}:${p[s]=(p[s]??-1)+1}`;let x="",d=!1,c=!1;for(const s of u){x+=s.value;const a=s.type==="minusSign"||s.type==="plusSign"?"sign":s.type;switch(a){case"integer":d=!0,o.push(...s.value.split("").map(w=>({type:a,value:parseInt(w)})));break;case"group":o.push({type:a,value:s.value});break;case"decimal":c=!0,h.push({type:a,value:s.value,key:m(a)});break;case"fraction":h.push(...s.value.split("").map(w=>({type:a,value:parseInt(w),key:m(a)})));break;default:(d||c?b:g).push({type:a,value:s.value,key:m(a)})}}const f=[];for(let s=o.length-1;s>=0;s--)f.unshift({...o[s],key:m(o[s].type)});return{pre:g,integer:f,fraction:h,post:b,formatted:x}},At={opacity:{duration:1,ease:ze},layout:{type:"spring",duration:1,bounce:0},y:{type:"spring",duration:1,bounce:0}},Vt=l.forwardRef(function({children:e,locales:n,format:i,transition:r,style:y,suffix:u,prefix:g,...o},h){const b=l.useMemo(()=>vt(e,{locales:n,format:i},g,u),[e,n,i]),{pre:p,integer:m,fraction:x,post:d,formatted:c}=b,f=l.useContext(B).transition;r=r??f??At;const{layoutDependency:s}=o,a=l.useMemo(()=>{if(s!==void 0)return{layoutDependency:s,value:e}},[s,e]);return S.jsx(Ke,{children:S.jsx(Ue,{transition:r,children:S.jsx(k.div,{...o,ref:h,layout:!0,layoutDependency:a,style:{lineHeight:1,...y,display:"inline-flex",isolation:"isolate",whiteSpace:"nowrap"},children:S.jsxs(k.div,{layout:!0,layoutDependency:a,"aria-label":c,style:{display:"inline-flex",direction:"ltr",isolation:"isolate",position:"relative",zIndex:-1},children:[S.jsx(z,{style:{padding:`calc(${I}/2) 0`},layoutDependency:a,"aria-hidden":!0,justify:"right",mode:"popLayout",parts:p,name:"pre"}),S.jsxs(xt,{layoutDependency:a,children:[S.jsx(z,{layoutDependency:a,justify:"right",parts:m,name:"integer"}),S.jsx(z,{layout:"position",layoutDependency:a,parts:x,name:"fraction"})]}),S.jsx(z,{style:{padding:`calc(${I}/2) 0`},"aria-hidden":!0,layout:"position",layoutDependency:a,mode:"popLayout",parts:d,name:"post"})]})})})})});k.create(l.Fragment);function xe(t,e){return t.length>e.length||t.length>0&&!e.startsWith(t)}function Se(t,e,n){return t+(e-t)*n}function wt(t,e,n,i,r){if(xe(e,t))return n*r;if(i==="natural")return jt(t,e,n);if(typeof i=="number"&&i>0){const y=n*(i/100);return n+Se(-y,y,Math.random())}return n}function jt(t,e,n){const i=e.length,r=t[i],y=t[i-1];if(!r)return n;const g=t.slice(0,i).lastIndexOf(" "),o=i-g-1,h=g+1,p=t.slice(i).indexOf(" "),x=(p===-1?t.length:i+p)-h;let d=1;if(y&&/[.!?]/.test(y)&&r===" "&&(d*=3),x<=3?d*=.7:(o===0&&r!==" "&&(d*=1.5),o===x-1&&(d*=1.4)),o>0&&o3){const a=Math.min(o/x,.4);d*=1-a}Et.has(r)&&(d*=1.5),It.has(r)&&(d*=1.5),/\d/.test(r)&&(d*=1.3),x>8&&(d*=1.3),r!==r.toLowerCase()&&(d*=1.25);const c=200;if(i>c){const a=Math.min((i-c)/1e3,.3);d*=1+a}const f=Se(-.25,.25,Math.random());d*=1+f;const s=n*d;return Math.max(n*.2,s)}const Et=new Set([".",",","!","?",":",";","'",'"',"-","(",")"]),It=new Set(["!","@","#","$","%","^","&","*","(",")","_","+","{","}","|",":",'"',"<",">","?"]);function Dt(t,e){let n=e-1;for(;n>=0&&/\s/.test(t[n]);)n--;for(;n>=0&&!/\s/.test(t[n]);)n--;return Math.max(0,n+1)}function Mt(t,e){const n=Math.min(t.length,e.length);let i=0;for(let r=0;r{var j;(j=E.current)==null||j.call(E),E.current=null},$=()=>{D.current=me(M.current,{opacity:[1,1,0,0]},{duration:g,times:[0,.5,.5,1],ease:"linear",repeat:1/0,repeatType:"reverse"})};return l.useEffect(()=>{x==="all"&&e!==w.current&&A.set(""),w.current=e},[e,x]),l.useEffect(()=>{var N;if(!h){$(),v();return}(N=D.current)==null||N.cancel();const j=()=>{const X=kt(A.get(),e,x,d);A.set(X),X!==e?W():($(),o==null||o())},W=()=>{E.current=_e(j,wt(e,A.get(),R,r,c))};return E.current||W(),v},[h,o,e,R,r,c,d]),S.jsxs(a,{ref:s,...f,"aria-label":b||e,children:[S.jsx(k.span,{className:p,style:m,children:A}),S.jsx(k.span,{ref:M,className:y,style:{display:"inline-block",width:"2px",height:"1em",backgroundColor:"currentColor",position:"relative",top:"0.1em",left:"0.2em",...u}})]})});export{Vt as A}; +import{fd as ve,fe as Ae,ff as we,fg as Ee,r as l,fh as B,bn as oe,j as S,fi as je,fj as Ie,fk as De,fl as Me,fm as le,fn as ke,fo as Ce,fp as Re,fq as $e,fr as Ve,fs as Ne,ft as Te,fu as We,fv as Le,fw as Pe,fx as _,fy as Oe,fz as Be,fA as Fe,m as k,fB as Ge,fC as ue,A as ce,bC as Ke,fD as ze,fE as _e}from"./index-BOwCLZTK.js";const He=(t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t};function fe(t,e){return ve(t)?t[He(0,t.length,e)]:t}class Xe{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,n){for(let i=0;ii.attachTimeline(e));return()=>{n.forEach((i,r)=>{i&&i(),this.animations[r].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return ne(this.animations,"duration")}get iterationDuration(){return ne(this.animations,"iterationDuration")}runAll(e){this.animations.forEach(n=>n[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function ne(t,e){let n=0;for(let i=0;in&&(n=r)}return n}class Ye extends Xe{then(e,n){return this.finished.finally(e).then(()=>{})}}function qe(t,e){return t in e}class Je extends Ae{constructor(){super(...arguments),this.type="object"}readValueFromInstance(e,n){if(qe(n,e)){const i=e[n];if(typeof i=="string"||typeof i=="number")return i}}getBaseTargetFromProps(){}removeValueFromRenderState(e,n){delete n.output[e]}measureInstanceViewportBox(){return we()}build(e,n){Object.assign(e.output,n)}renderInstance(e,{output:n}){Object.assign(e,n)}sortInstanceNodePosition(){return 0}}function Ue({children:t,isValidProp:e,...n}){e&&Ee(e),n={...l.useContext(B),...n},n.isStatic=oe(()=>n.isStatic);const i=l.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return S.jsx(B.Provider,{value:i,children:t})}function Qe(t){const e=oe(()=>je(t)),{isStatic:n}=l.useContext(B);if(n){const[,i]=l.useState(t);l.useEffect(()=>e.on("change",i),[])}return e}function q(t){return typeof t=="object"&&!Array.isArray(t)}function de(t,e,n,i){return t==null?[]:typeof t=="string"&&q(e)?Ie(t,n,i):t instanceof NodeList?Array.from(t):Array.isArray(t)?t.filter(r=>r!=null):[t]}function Ze(t,e,n){return t*(e+1)}function ie(t,e,n,i){return typeof e=="number"?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):e==="<"?n:e.startsWith("<")?Math.max(0,n+parseFloat(e.slice(1))):i.get(e)??t}function et(t,e,n){for(let i=0;ie&&r.at{const v=at(A),{delay:$=0,times:E=ke(v),type:W=e.type||"keyframes",repeat:N,repeatType:X,repeatDelay:Rt=0,...be}=j;let{ease:V=e.ease||"easeOut",duration:C}=j;const J=typeof $=="function"?$(M,R):$,U=v.length,Q=$e(W)?W:r==null?void 0:r[W||"keyframes"];if(U<=2&&Q){let L=100;if(U===2&&ut(v)){const P=v[1]-v[0];L=Math.abs(P)}const F={...e,...be};C!==void 0&&(F.duration=Ve(C));const G=Ce(F,L,Q);V=G.ease,C=G.duration}C??(C=y);const Z=p+J;E.length===1&&E[0]===0&&(E[1]=1);const ee=E.length-v.length;if(ee>0&&Re(E,ee),v.length===1&&v.unshift(null),N){C=Ze(C,N);const L=[...v],F=[...E];V=Array.isArray(V)?[...V]:[V];const G=[...V];for(let P=0;P{for(const c in x){const f=x[c];f.sort(it);const s=[],a=[],w=[];for(let M=0;Mtypeof t=="number",ut=t=>t.every(lt);function ct(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=Te(t)&&!We(t)?new Le(e):new Pe(e);n.mount(t),_.set(t,n)}function ft(t){const e={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},n=new Je(e);n.mount(t),_.set(t,n)}function dt(t,e){return le(t)||typeof t=="number"||typeof t=="string"&&!q(e)}function pe(t,e,n,i){const r=[];if(dt(t,e))r.push(Oe(t,q(e)&&e.default||e,n&&(n.default||n)));else{if(t==null)return r;const y=de(t,e,i),u=y.length;for(let g=0;g{i.push(...pe(g,y,u))}),i}function mt(t){return Array.isArray(t)&&t.some(Array.isArray)}function yt(t){function e(n,i,r){let y=[],u;if(mt(n))y=pt(n,i,t);else{const{onComplete:o,...h}=r||{};typeof o=="function"&&(u=o),y=pe(n,i,h,t)}const g=new Ye(y);return u&&g.finished.then(u),g}return e}const me=yt(),I="var(--mask-height, 0.15em)",Y="var(--mask-width, 0.5em)",T=`calc(${Y} / var(--invert-x, 1))`,K="#000 0, transparent 71%",ht=`linear-gradient(to right, transparent 0, #000 ${T}, #000 calc(100% - ${T}), transparent),linear-gradient(to bottom, transparent 0, #000 ${I}, #000 calc(100% - ${I}), transparent 100%),radial-gradient(at bottom right, ${K}),radial-gradient(at bottom left, ${K}), radial-gradient(at top left, ${K}), radial-gradient(at top right, ${K})`,gt=`100% calc(100% - ${I} * 2),calc(100% - ${T} * 2) 100%,${T} ${I},${T} ${I},${T} ${I},${T} ${I}`;Ge({"--invert-x":{correct:(t,{treeScale:e,projectionDelta:n})=>n.x.scale*e.x}});function xt({children:t,layoutDependency:e}){return S.jsx(k.span,{layout:!0,layoutDependency:e,"aria-hidden":!0,style:{display:"inline-flex","--invert-x":1,margin:`0 calc(-1*${Y})`,padding:`calc(${I}/2) ${Y}`,position:"relative",zIndex:-1,overflow:"clip",WebkitMaskImage:ht,WebkitMaskSize:gt,WebkitMaskPosition:"center, center, top left, top right, bottom right, bottom left",WebkitMaskRepeat:"no-repeat"},children:t})}function ye(){const t=l.useRef(!0);return l.useEffect(()=>{t.current=!1},[]),t.current}function H(t){const{width:e,fontSize:n}=getComputedStyle(t);return`${parseFloat(e)/parseFloat(n)}em`}const he=new WeakMap,St=l.forwardRef(function({value:e,initialValue:n=e,...i},r){const{transition:y}=l.useContext(B),u=l.useRef(n).current,g=ye(),o=l.useRef(null),h=l.useRef(null);l.useImperativeHandle(r,()=>h.current,[]);const b=l.useRef(new Array(10)),p=ue(),m=p?e:0;l.useLayoutEffect(()=>{!o.current||!b.current[u]||(o.current.style.width=H(b.current[u]))},[]);const x=l.useRef(n);l.useLayoutEffect(()=>{var A;if(!o.current||m===x.current)return;const s=o.current.getBoundingClientRect(),a=(A=h.current)==null?void 0:A.getBoundingClientRect(),w=s.height*(m-x.current)+(s.top-(a?a.top||0:s.top));return me(o.current,{y:[w,0]},y),()=>{x.current=m}},[m]);const[d,c]=l.useState();l.useEffect(()=>{if(g&&u===m||!b.current[m])return;const s=H(b.current[m]);h.current&&he.set(h.current,s),c(s)},[m]);const f=s=>S.jsx("span",{style:{display:"inline-block",padding:`calc(${I}/2) 0`},ref:a=>void(b.current[s]=a),children:s},s);return S.jsx(k.span,{...i,ref:h,layout:"position","data-state":p?void 0:"exiting",style:{display:"inline-flex",justifyContent:"center",width:d},children:S.jsxs("span",{ref:o,style:{display:"inline-flex",justifyContent:"center",flexDirection:"column",alignItems:"center",position:"relative"},children:[m!==0&&S.jsx("span",{style:{...ae,bottom:"100%",left:0},children:new Array(m).fill(null).map((s,a)=>f(a))}),f(m),m!==9&&S.jsx("span",{style:{...ae,top:"100%",left:0},children:new Array(9-m).fill(null).map((s,a)=>f(m+a+1))})]})})}),ae={display:"flex",flexDirection:"column",alignItems:"center",position:"absolute",width:"100%"},ge=l.createContext({justify:"left"}),bt=l.forwardRef(function({partKey:e,type:n,children:i,layoutDependency:r,...y},u){const g=ue(),{justify:o}=l.useContext(ge);return S.jsx(k.span,{...y,"data-state":g?void 0:"exiting",style:{display:"inline-flex",justifyContent:o,padding:`calc(${I}/2) 0`,position:"relative"},layout:"position",layoutDependency:r,ref:u,children:S.jsx(ce,{mode:"popLayout",anchorX:o,initial:!1,children:S.jsx(k.span,{layout:o==="right"?"position":!1,layoutDependency:r,initial:{opacity:0},animate:{opacity:[null,1]},exit:{opacity:[null,0]},style:{display:"inline-block",whiteSpace:"pre"},children:i},i)})})}),z=l.forwardRef(function({parts:e,justify:n="left",mode:i,style:r,name:y,layoutDependency:u,...g},o){const h=l.useRef(null);l.useImperativeHandle(o,()=>h.current,[]);const b=l.useMemo(()=>({justify:n}),[n]),p=l.useRef(null),m=ye(),[x,d]=l.useState();return l.useEffect(()=>{if(!p.current)return;if(m){h.current&&(h.current.style.width=H(p.current));return}const c=Array.from(p.current.children).map(f=>{if(!(f instanceof HTMLElement))return;if(f.dataset.state==="exiting"){const w=f.nextSibling;return f.remove(),()=>{p.current&&p.current.insertBefore(f,w)}}const s=he.get(f);if(!s)return;const a=f.style.width;return f.style.width=s,()=>{f.style.width=a}});d(H(p.current));for(let f=c.length-1;f>=0;f--){const s=c[f];s&&s()}},[e.map(c=>c.value).join("")]),S.jsx(ge.Provider,{value:b,children:S.jsx(k.span,{layoutDependency:u,...g,ref:h,className:`number-section-${y}`,style:{...r,display:"inline-flex",justifyContent:n,width:x},children:S.jsxs("span",{ref:p,style:{display:"inline-flex",justifyContent:"inherit",position:"relative"},children:["​",S.jsx(ce,{mode:i,anchorX:n,initial:!1,children:e.map(c=>c.type==="integer"||c.type==="fraction"?S.jsx(St,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},value:c.value,initialValue:m?void 0:0,layoutDependency:u},c.key):S.jsx(bt,{type:c.type,partKey:c.key,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},layoutDependency:u,children:c.value},c.type==="literal"?`${c.key}:${c.value}`:c.key))})]})})})}),vt=(t,{locales:e,format:n},i,r)=>{const u=new Intl.NumberFormat(e,n).formatToParts(Number(t));i&&u.unshift({type:"prefix",value:i}),r&&u.push({type:"suffix",value:r});const g=[],o=[],h=[],b=[],p={},m=s=>`${s}:${p[s]=(p[s]??-1)+1}`;let x="",d=!1,c=!1;for(const s of u){x+=s.value;const a=s.type==="minusSign"||s.type==="plusSign"?"sign":s.type;switch(a){case"integer":d=!0,o.push(...s.value.split("").map(w=>({type:a,value:parseInt(w)})));break;case"group":o.push({type:a,value:s.value});break;case"decimal":c=!0,h.push({type:a,value:s.value,key:m(a)});break;case"fraction":h.push(...s.value.split("").map(w=>({type:a,value:parseInt(w),key:m(a)})));break;default:(d||c?b:g).push({type:a,value:s.value,key:m(a)})}}const f=[];for(let s=o.length-1;s>=0;s--)f.unshift({...o[s],key:m(o[s].type)});return{pre:g,integer:f,fraction:h,post:b,formatted:x}},At={opacity:{duration:1,ease:ze},layout:{type:"spring",duration:1,bounce:0},y:{type:"spring",duration:1,bounce:0}},Vt=l.forwardRef(function({children:e,locales:n,format:i,transition:r,style:y,suffix:u,prefix:g,...o},h){const b=l.useMemo(()=>vt(e,{locales:n,format:i},g,u),[e,n,i]),{pre:p,integer:m,fraction:x,post:d,formatted:c}=b,f=l.useContext(B).transition;r=r??f??At;const{layoutDependency:s}=o,a=l.useMemo(()=>{if(s!==void 0)return{layoutDependency:s,value:e}},[s,e]);return S.jsx(Ke,{children:S.jsx(Ue,{transition:r,children:S.jsx(k.div,{...o,ref:h,layout:!0,layoutDependency:a,style:{lineHeight:1,...y,display:"inline-flex",isolation:"isolate",whiteSpace:"nowrap"},children:S.jsxs(k.div,{layout:!0,layoutDependency:a,"aria-label":c,style:{display:"inline-flex",direction:"ltr",isolation:"isolate",position:"relative",zIndex:-1},children:[S.jsx(z,{style:{padding:`calc(${I}/2) 0`},layoutDependency:a,"aria-hidden":!0,justify:"right",mode:"popLayout",parts:p,name:"pre"}),S.jsxs(xt,{layoutDependency:a,children:[S.jsx(z,{layoutDependency:a,justify:"right",parts:m,name:"integer"}),S.jsx(z,{layout:"position",layoutDependency:a,parts:x,name:"fraction"})]}),S.jsx(z,{style:{padding:`calc(${I}/2) 0`},"aria-hidden":!0,layout:"position",layoutDependency:a,mode:"popLayout",parts:d,name:"post"})]})})})})});k.create(l.Fragment);function xe(t,e){return t.length>e.length||t.length>0&&!e.startsWith(t)}function Se(t,e,n){return t+(e-t)*n}function wt(t,e,n,i,r){if(xe(e,t))return n*r;if(i==="natural")return Et(t,e,n);if(typeof i=="number"&&i>0){const y=n*(i/100);return n+Se(-y,y,Math.random())}return n}function Et(t,e,n){const i=e.length,r=t[i],y=t[i-1];if(!r)return n;const g=t.slice(0,i).lastIndexOf(" "),o=i-g-1,h=g+1,p=t.slice(i).indexOf(" "),x=(p===-1?t.length:i+p)-h;let d=1;if(y&&/[.!?]/.test(y)&&r===" "&&(d*=3),x<=3?d*=.7:(o===0&&r!==" "&&(d*=1.5),o===x-1&&(d*=1.4)),o>0&&o3){const a=Math.min(o/x,.4);d*=1-a}jt.has(r)&&(d*=1.5),It.has(r)&&(d*=1.5),/\d/.test(r)&&(d*=1.3),x>8&&(d*=1.3),r!==r.toLowerCase()&&(d*=1.25);const c=200;if(i>c){const a=Math.min((i-c)/1e3,.3);d*=1+a}const f=Se(-.25,.25,Math.random());d*=1+f;const s=n*d;return Math.max(n*.2,s)}const jt=new Set([".",",","!","?",":",";","'",'"',"-","(",")"]),It=new Set(["!","@","#","$","%","^","&","*","(",")","_","+","{","}","|",":",'"',"<",">","?"]);function Dt(t,e){let n=e-1;for(;n>=0&&/\s/.test(t[n]);)n--;for(;n>=0&&!/\s/.test(t[n]);)n--;return Math.max(0,n+1)}function Mt(t,e){const n=Math.min(t.length,e.length);let i=0;for(let r=0;r{var E;(E=j.current)==null||E.call(j),j.current=null},$=()=>{D.current=me(M.current,{opacity:[1,1,0,0]},{duration:g,times:[0,.5,.5,1],ease:"linear",repeat:1/0,repeatType:"reverse"})};return l.useEffect(()=>{x==="all"&&e!==w.current&&A.set(""),w.current=e},[e,x]),l.useEffect(()=>{var N;if(!h){$(),v();return}(N=D.current)==null||N.cancel();const E=()=>{const X=kt(A.get(),e,x,d);A.set(X),X!==e?W():($(),o==null||o())},W=()=>{j.current=_e(E,wt(e,A.get(),R,r,c))};return j.current||W(),v},[h,o,e,R,r,c,d]),S.jsxs(a,{ref:s,...f,"aria-label":b||e,children:[S.jsx(k.span,{className:p,style:m,children:A}),S.jsx(k.span,{ref:M,className:y,style:{display:"inline-block",width:"2px",height:"1em",backgroundColor:"currentColor",position:"relative",top:"0.1em",left:"0.2em",...u}})]})});export{Vt as A}; diff --git a/frontend/dist/assets/index-CeMilrX4.js b/frontend/dist/assets/index-BOwCLZTK.js similarity index 74% rename from frontend/dist/assets/index-CeMilrX4.js rename to frontend/dist/assets/index-BOwCLZTK.js index e965547c..682de2c2 100644 --- a/frontend/dist/assets/index-CeMilrX4.js +++ b/frontend/dist/assets/index-BOwCLZTK.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Login-Dh54gKvu.js","assets/ascii-burst-DN6etEs5.js","assets/Dashboard-D8wufrUF.js","assets/PageLayout-Cw_MXmcE.js","assets/consumer-registry-Hkh6Dv_i.js","assets/DataValue-BDllMDjE.js","assets/index-BK59_Mkt.js","assets/node-types-C09ZlzBQ.js","assets/meshcore-tx-constants-DgpFTAmf.js","assets/PacketList-BviFr-nL.js","assets/circle-x-B6UCLWHM.js","assets/primitives-Dgc86_cp.js","assets/badge-colors-DnsnMXHA.js","assets/chat-utils-BJwCtjDV.js","assets/SignalIndicator-CpBGKD5A.js","assets/arrow-up-C471XgXc.js","assets/chevron-right-D3QL4sfa.js","assets/map-pin-D6_BkIVb.js","assets/circle-question-mark-Bqc_DPUo.js","assets/triangle-alert-DiFold9L.js","assets/DataBox-Da-5DbUW.js","assets/layers-DVUHhJuY.js","assets/hash-CBEVBQJR.js","assets/activity-BZFnO4kb.js","assets/circle-check-CY6Nl8LU.js","assets/database-D2sIhibw.js","assets/useMapViewStore-DgL-E_Uc.js","assets/shield-D-fYOAoy.js","assets/MqttModeBadge-C_MEMmDd.js","assets/zap-09srAnh-.js","assets/usePipelineStore-B80TA53S.js","assets/LightSparkline-D652BQd5.js","assets/link-scoring-FRwcQ0ss.js","assets/NodeInformationCard-DGC6n0fh.js","assets/ChatBubble-D4uyE1Zh.js","assets/message-square-VqJiaYsP.js","assets/Grid-BuDgMX1I.js","assets/Packets-JmlGt-gQ.js","assets/element-movement-zLH7y51p.js","assets/AnalyzerFilterPanel-DoQoJv94.js","assets/monitor-smartphone-DxkmIgui.js","assets/funnel-D2SUJQ8o.js","assets/search-Bph9xP9G.js","assets/Contacts-DVoMEmqg.js","assets/ping-DgsEwYAS.js","assets/listbox-CGIGCOya.js","assets/CollisionExplorerModal-Cvw_f8a6.js","assets/BasemapLayer-CNBmoufo.js","assets/target-q6HPYno6.js","assets/network-c_XxfhAX.js","assets/trash-2-Bu7BoH4P.js","assets/ConfirmModal-BF449Kzb.js","assets/BasemapLayer-B1CfjdFi.css","assets/Statistics-rEwwTJX9.js","assets/easing-CFZ7-xae.js","assets/settings-2-97rHsI_C.js","assets/MeshGraph-BTt0q-k9.js","assets/max-0cG3bA4z.js","assets/download-ByVPtD5I.js","assets/System-C-bhrfOq.js","assets/refresh-cw-DqhcBXAw.js","assets/cpu-C5-ss1x-.js","assets/Logs-CWXxwgV4.js","assets/circle-stop-BvffqSZg.js","assets/Terminal-BMACddVm.js","assets/system-D5lXsOVm.js","assets/KeycapButton-BFRxj00q.js","assets/keycap-sfx-ByZp-njj.js","assets/Terminal-6GBZ9nXN.css","assets/Configuration-DyP_2E9Y.js","assets/antenna-DhdWQ_ro.js","assets/plus-D-z0bUE_.js","assets/key-round-Dkqq4aT0.js","assets/RoomServer-CupA42-s.js","assets/wifi-DjxkOZ88.js","assets/PacketObservatory-DhyxQFYe.js","assets/Sessions-DFCPAfFS.js","assets/Mqtt-D450VFG-.js","assets/wifi-off-Y-Y9dpWj.js"])))=>i.map(i=>d[i]); -var t9=Object.defineProperty;var dx=e=>{throw TypeError(e)};var n9=(e,t,n)=>t in e?t9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ie=(e,t,n)=>n9(e,typeof t!="symbol"?t+"":t,n),Ry=(e,t,n)=>t.has(e)||dx("Cannot "+n);var he=(e,t,n)=>(Ry(e,t,"read from private field"),n?n.call(e):t.get(e)),Gt=(e,t,n)=>t.has(e)?dx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),St=(e,t,n,r)=>(Ry(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pt=(e,t,n)=>(Ry(e,t,"access private method"),n);var xh=(e,t,n,r)=>({set _(o){St(e,t,o,n)},get _(){return he(e,t,r)}});function r9(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function o9(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ly={exports:{}},qu={},Iy={exports:{}},jt={};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Login-CgKEN4-7.js","assets/ascii-burst-DN6etEs5.js","assets/Dashboard-DeWxytuz.js","assets/PageLayout-QKntxcnp.js","assets/consumer-registry-CTjikLma.js","assets/DataValue-x_TMPgMk.js","assets/index-2RIoVPos.js","assets/node-types-C6okL8rE.js","assets/meshcore-tx-constants-DgpFTAmf.js","assets/PacketList-DquMVCqT.js","assets/circle-x-BJVhIbR2.js","assets/primitives-DEqdAn1G.js","assets/badge-colors-DCbxcv7o.js","assets/chat-utils-D21OFED5.js","assets/SignalIndicator-Calk-LyB.js","assets/arrow-up-BqsZCBBC.js","assets/chevron-right-DJVm4pVP.js","assets/map-pin-C2z_C0J3.js","assets/circle-question-mark-XDnZ1ChV.js","assets/triangle-alert-SO3tIa8w.js","assets/DataBox-BVnEv6Au.js","assets/layers-Dg2mpSl7.js","assets/hash-Dwn2PbMF.js","assets/activity-D5uH2SFx.js","assets/circle-check-CmQaOkab.js","assets/database-C6oOGn9y.js","assets/useMapViewStore-DpXuD1iT.js","assets/shield-DYw72pvS.js","assets/MqttModeBadge-CSj5wNzF.js","assets/zap-Bd-kARJ1.js","assets/usePipelineStore-Cw6U5jyB.js","assets/LightSparkline-C68RXWon.js","assets/link-scoring-CgjOR3NF.js","assets/NodeInformationCard-PgTi9luy.js","assets/ChatBubble-CCVYaLOe.js","assets/message-square-BcKhgYbO.js","assets/Grid-eFMUBxsw.js","assets/Packets-BOfGw3jb.js","assets/element-movement-BLnr83nT.js","assets/AnalyzerFilterPanel-BWsROE43.js","assets/monitor-smartphone-Dd11JEL9.js","assets/funnel-CWx99rlN.js","assets/search-Ba9CRHru.js","assets/Contacts-nDnNtpiy.js","assets/ping-LiBbR-Oy.js","assets/listbox-C1tUi7YC.js","assets/CollisionExplorerModal-Cudk5ace.js","assets/BasemapLayer-B-5TmAfZ.js","assets/target-vmW1ltA0.js","assets/network-D0Fgg1y-.js","assets/trash-2-qMD09ppP.js","assets/ConfirmModal-DpSKXZ01.js","assets/BasemapLayer-B1CfjdFi.css","assets/Statistics-DeWhSfD2.js","assets/easing-CsgXD0uy.js","assets/settings-2-CXNfSapN.js","assets/MeshGraph-OIPdLzAA.js","assets/max-vSbldOSt.js","assets/download-B9g5-0oH.js","assets/System-Cl-yLzd8.js","assets/refresh-cw-C9txhqc9.js","assets/cpu-D7sbzQ8o.js","assets/Logs-vtktVQrc.js","assets/circle-stop-Buqz2psb.js","assets/Terminal-DH8015j-.js","assets/system-BNWIl4nC.js","assets/KeycapButton-uJlkDPOC.js","assets/keycap-sfx-ByZp-njj.js","assets/Terminal-6GBZ9nXN.css","assets/Configuration-CdhAM59e.js","assets/antenna-rYsqNluv.js","assets/plus-ClrHVFhr.js","assets/key-round-Cv6ASKpS.js","assets/RoomServer-hAC3CH43.js","assets/wifi-CI57D5A3.js","assets/PacketObservatory-B-NONP_Q.js","assets/Sessions-hz3-5yQ9.js","assets/Mqtt-D1z1DeQb.js","assets/wifi-off-DC4jBRps.js"])))=>i.map(i=>d[i]); +var t9=Object.defineProperty;var dx=e=>{throw TypeError(e)};var n9=(e,t,n)=>t in e?t9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ie=(e,t,n)=>n9(e,typeof t!="symbol"?t+"":t,n),Ry=(e,t,n)=>t.has(e)||dx("Cannot "+n);var he=(e,t,n)=>(Ry(e,t,"read from private field"),n?n.call(e):t.get(e)),Gt=(e,t,n)=>t.has(e)?dx("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),St=(e,t,n,r)=>(Ry(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),pt=(e,t,n)=>(Ry(e,t,"access private method"),n);var xh=(e,t,n,r)=>({set _(o){St(e,t,o,n)},get _(){return he(e,t,r)}});function r9(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function o9(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ly={exports:{}},qu={},Iy={exports:{}},Ot={};/** * @license React * react.production.min.js * @@ -7,7 +7,7 @@ var t9=Object.defineProperty;var dx=e=>{throw TypeError(e)};var n9=(e,t,n)=>t in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var hx;function s9(){if(hx)return jt;hx=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),i=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.iterator;function p(W){return W===null||typeof W!="object"?null:(W=h&&W[h]||W["@@iterator"],typeof W=="function"?W:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,b={};function E(W,$,U){this.props=W,this.context=$,this.refs=b,this.updater=U||g}E.prototype.isReactComponent={},E.prototype.setState=function(W,$){if(typeof W!="object"&&typeof W!="function"&&W!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,W,$,"setState")},E.prototype.forceUpdate=function(W){this.updater.enqueueForceUpdate(this,W,"forceUpdate")};function x(){}x.prototype=E.prototype;function v(W,$,U){this.props=W,this.context=$,this.refs=b,this.updater=U||g}var C=v.prototype=new x;C.constructor=v,y(C,E.prototype),C.isPureReactComponent=!0;var A=Array.isArray,k=Object.prototype.hasOwnProperty,B={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function F(W,$,U){var fe,J={},xe=null,te=null;if($!=null)for(fe in $.ref!==void 0&&(te=$.ref),$.key!==void 0&&(xe=""+$.key),$)k.call($,fe)&&!L.hasOwnProperty(fe)&&(J[fe]=$[fe]);var Z=arguments.length-2;if(Z===1)J.children=U;else if(1{throw TypeError(e)};var n9=(e,t,n)=>t in `+W+a}var U=!1;function fe(a,u){if(!a||U)return"";U=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(u)if(u=function(){throw Error()},Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(Ue){var w=Ue}Reflect.construct(a,[],u)}else{try{u.call()}catch(Ue){w=Ue}a.call(u.prototype)}else{try{throw Error()}catch(Ue){w=Ue}a()}}catch(Ue){if(Ue&&w&&typeof Ue.stack=="string"){for(var _=Ue.stack.split(` `),R=w.stack.split(` `),G=_.length-1,pe=R.length-1;1<=G&&0<=pe&&_[G]!==R[pe];)pe--;for(;1<=G&&0<=pe;G--,pe--)if(_[G]!==R[pe]){if(G!==1||pe!==1)do if(G--,pe--,0>pe||_[G]!==R[pe]){var Ce=` -`+_[G].replace(" at new "," at ");return a.displayName&&Ce.includes("")&&(Ce=Ce.replace("",a.displayName)),Ce}while(1<=G&&0<=pe);break}}}finally{U=!1,Error.prepareStackTrace=m}return(a=a?a.displayName||a.name:"")?$(a):""}function J(a){switch(a.tag){case 5:return $(a.type);case 16:return $("Lazy");case 13:return $("Suspense");case 19:return $("SuspenseList");case 0:case 2:case 15:return a=fe(a.type,!1),a;case 11:return a=fe(a.type.render,!1),a;case 1:return a=fe(a.type,!0),a;default:return""}}function xe(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case L:return"Fragment";case B:return"Portal";case M:return"Profiler";case F:return"StrictMode";case V:return"Suspense";case H:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case O:return(a.displayName||"Context")+".Consumer";case I:return(a._context.displayName||"Context")+".Provider";case j:var u=a.render;return a=a.displayName,a||(a=u.displayName||u.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case q:return u=a.displayName||null,u!==null?u:xe(a.type)||"Memo";case le:u=a._payload,a=a._init;try{return xe(a(u))}catch{}}return null}function te(a){var u=a.type;switch(a.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=u.render,a=a.displayName||a.name||"",u.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xe(u);case 8:return u===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}return null}function Z(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function we(a){var u=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function ne(a){var u=we(a)?"checked":"value",m=Object.getOwnPropertyDescriptor(a.constructor.prototype,u),w=""+a[u];if(!a.hasOwnProperty(u)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var _=m.get,R=m.set;return Object.defineProperty(a,u,{configurable:!0,get:function(){return _.call(this)},set:function(G){w=""+G,R.call(this,G)}}),Object.defineProperty(a,u,{enumerable:m.enumerable}),{getValue:function(){return w},setValue:function(G){w=""+G},stopTracking:function(){a._valueTracker=null,delete a[u]}}}}function ge(a){a._valueTracker||(a._valueTracker=ne(a))}function Ee(a){if(!a)return!1;var u=a._valueTracker;if(!u)return!0;var m=u.getValue(),w="";return a&&(w=we(a)?a.checked?"true":"false":a.value),a=w,a!==m?(u.setValue(a),!0):!1}function Me(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function Fe(a,u){var m=u.checked;return Y({},u,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:m??a._wrapperState.initialChecked})}function ie(a,u){var m=u.defaultValue==null?"":u.defaultValue,w=u.checked!=null?u.checked:u.defaultChecked;m=Z(u.value!=null?u.value:m),a._wrapperState={initialChecked:w,initialValue:m,controlled:u.type==="checkbox"||u.type==="radio"?u.checked!=null:u.value!=null}}function be(a,u){u=u.checked,u!=null&&C(a,"checked",u,!1)}function Se(a,u){be(a,u);var m=Z(u.value),w=u.type;if(m!=null)w==="number"?(m===0&&a.value===""||a.value!=m)&&(a.value=""+m):a.value!==""+m&&(a.value=""+m);else if(w==="submit"||w==="reset"){a.removeAttribute("value");return}u.hasOwnProperty("value")?De(a,u.type,m):u.hasOwnProperty("defaultValue")&&De(a,u.type,Z(u.defaultValue)),u.checked==null&&u.defaultChecked!=null&&(a.defaultChecked=!!u.defaultChecked)}function $e(a,u,m){if(u.hasOwnProperty("value")||u.hasOwnProperty("defaultValue")){var w=u.type;if(!(w!=="submit"&&w!=="reset"||u.value!==void 0&&u.value!==null))return;u=""+a._wrapperState.initialValue,m||u===a.value||(a.value=u),a.defaultValue=u}m=a.name,m!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,m!==""&&(a.name=m)}function De(a,u,m){(u!=="number"||Me(a.ownerDocument)!==a)&&(m==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+m&&(a.defaultValue=""+m))}var Le=Array.isArray;function ye(a,u,m,w){if(a=a.options,u){u={};for(var _=0;_"+u.valueOf().toString()+"",u=N.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;u.firstChild;)a.appendChild(u.firstChild)}});function oe(a,u){if(u){var m=a.firstChild;if(m&&m===a.lastChild&&m.nodeType===3){m.nodeValue=u;return}}a.textContent=u}var me={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ae=["Webkit","ms","Moz","O"];Object.keys(me).forEach(function(a){Ae.forEach(function(u){u=u+a.charAt(0).toUpperCase()+a.substring(1),me[u]=me[a]})});function de(a,u,m){return u==null||typeof u=="boolean"||u===""?"":m||typeof u!="number"||u===0||me.hasOwnProperty(a)&&me[a]?(""+u).trim():u+"px"}function ve(a,u){a=a.style;for(var m in u)if(u.hasOwnProperty(m)){var w=m.indexOf("--")===0,_=de(m,u[m],w);m==="float"&&(m="cssFloat"),w?a.setProperty(m,_):a[m]=_}}var Ze=Y({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function it(a,u){if(u){if(Ze[a]&&(u.children!=null||u.dangerouslySetInnerHTML!=null))throw Error(n(137,a));if(u.dangerouslySetInnerHTML!=null){if(u.children!=null)throw Error(n(60));if(typeof u.dangerouslySetInnerHTML!="object"||!("__html"in u.dangerouslySetInnerHTML))throw Error(n(61))}if(u.style!=null&&typeof u.style!="object")throw Error(n(62))}}function st(a,u){if(a.indexOf("-")===-1)return typeof u.is=="string";switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bt=null;function zt(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var tn=null,Et=null,Lt=null;function Ct(a){if(a=Bu(a)){if(typeof tn!="function")throw Error(n(280));var u=a.stateNode;u&&(u=jd(u),tn(a.stateNode,a.type,u))}}function It(a){Et?Lt?Lt.push(a):Lt=[a]:Et=a}function Ht(){if(Et){var a=Et,u=Lt;if(Lt=Et=null,Ct(a),u)for(a=0;a>>=0,a===0?32:31-(mu(a)/Ar|0)|0}var Ra=64,Mi=4194304;function Ri(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function jl(a,u){var m=a.pendingLanes;if(m===0)return 0;var w=0,_=a.suspendedLanes,R=a.pingedLanes,G=m&268435455;if(G!==0){var pe=G&~_;pe!==0?w=Ri(pe):(R&=G,R!==0&&(w=Ri(R)))}else G=m&~_,G!==0?w=Ri(G):R!==0&&(w=Ri(R));if(w===0)return 0;if(u!==0&&u!==w&&(u&_)===0&&(_=w&-w,R=u&-u,_>=R||_===16&&(R&4194240)!==0))return u;if((w&4)!==0&&(w|=m&16),u=a.entangledLanes,u!==0)for(a=a.entanglements,u&=w;0m;m++)u.push(a);return u}function Li(a,u,m){a.pendingLanes|=u,u!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,u=31-zr(u),a[u]=m}function bu(a,u){var m=a.pendingLanes&~u;a.pendingLanes=u,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=u,a.mutableReadLanes&=u,a.entangledLanes&=u,u=a.entanglements;var w=a.eventTimes;for(a=a.expirationTimes;0=ei),Bd=" ",Kl=!1;function z(a,u){switch(a){case"keyup":return Vn.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Q(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var se=!1;function ue(a,u){switch(a){case"compositionend":return Q(u);case"keypress":return u.which!==32?null:(Kl=!0,Bd);case"textInput":return a=u.data,a===Bd&&Kl?null:a;default:return null}}function ke(a,u){if(se)return a==="compositionend"||!Gl&&z(a,u)?(a=ko(),xo=Cu=Co=null,se=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1=u)return{node:m,offset:u-a};a=w}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=co(m)}}function _r(a,u){return a&&u?a===u?!0:a&&a.nodeType===3?!1:u&&u.nodeType===3?_r(a,u.parentNode):"contains"in a?a.contains(u):a.compareDocumentPosition?!!(a.compareDocumentPosition(u)&16):!1:!1}function qr(){for(var a=window,u=Me();u instanceof a.HTMLIFrameElement;){try{var m=typeof u.contentWindow.location.href=="string"}catch{m=!1}if(m)a=u.contentWindow;else break;u=Me(a.document)}return u}function Gr(a){var u=a&&a.nodeName&&a.nodeName.toLowerCase();return u&&(u==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||u==="textarea"||a.contentEditable==="true")}function zo(a){var u=qr(),m=a.focusedElem,w=a.selectionRange;if(u!==m&&m&&m.ownerDocument&&_r(m.ownerDocument.documentElement,m)){if(w!==null&&Gr(m)){if(u=w.start,a=w.end,a===void 0&&(a=u),"selectionStart"in m)m.selectionStart=u,m.selectionEnd=Math.min(a,m.value.length);else if(a=(u=m.ownerDocument||document)&&u.defaultView||window,a.getSelection){a=a.getSelection();var _=m.textContent.length,R=Math.min(w.start,_);w=w.end===void 0?R:Math.min(w.end,_),!a.extend&&R>w&&(_=w,w=R,R=_),_=So(m,R);var G=So(m,w);_&&G&&(a.rangeCount!==1||a.anchorNode!==_.node||a.anchorOffset!==_.offset||a.focusNode!==G.node||a.focusOffset!==G.offset)&&(u=u.createRange(),u.setStart(_.node,_.offset),a.removeAllRanges(),R>w?(a.addRange(u),a.extend(G.node,G.offset)):(u.setEnd(G.node,G.offset),a.addRange(u)))}}for(u=[],a=m;a=a.parentNode;)a.nodeType===1&&u.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof m.focus=="function"&&m.focus(),m=0;m=document.documentMode,er=null,is=null,Yn=null,Yl=!1;function vE(a,u,m){var w=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;Yl||er==null||er!==Me(w)||(w=er,"selectionStart"in w&&Gr(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),Yn&&hr(Yn,w)||(Yn=w,w=Ld(is,"onSelect"),0")&&(Ce=Ce.replace("",a.displayName)),Ce}while(1<=G&&0<=pe);break}}}finally{U=!1,Error.prepareStackTrace=m}return(a=a?a.displayName||a.name:"")?$(a):""}function J(a){switch(a.tag){case 5:return $(a.type);case 16:return $("Lazy");case 13:return $("Suspense");case 19:return $("SuspenseList");case 0:case 2:case 15:return a=fe(a.type,!1),a;case 11:return a=fe(a.type.render,!1),a;case 1:return a=fe(a.type,!0),a;default:return""}}function xe(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case L:return"Fragment";case B:return"Portal";case M:return"Profiler";case F:return"StrictMode";case V:return"Suspense";case H:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case O:return(a.displayName||"Context")+".Consumer";case I:return(a._context.displayName||"Context")+".Provider";case j:var u=a.render;return a=a.displayName,a||(a=u.displayName||u.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case q:return u=a.displayName||null,u!==null?u:xe(a.type)||"Memo";case le:u=a._payload,a=a._init;try{return xe(a(u))}catch{}}return null}function te(a){var u=a.type;switch(a.tag){case 24:return"Cache";case 9:return(u.displayName||"Context")+".Consumer";case 10:return(u._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=u.render,a=a.displayName||a.name||"",u.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return u;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xe(u);case 8:return u===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u}return null}function Z(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function we(a){var u=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(u==="checkbox"||u==="radio")}function ne(a){var u=we(a)?"checked":"value",m=Object.getOwnPropertyDescriptor(a.constructor.prototype,u),w=""+a[u];if(!a.hasOwnProperty(u)&&typeof m<"u"&&typeof m.get=="function"&&typeof m.set=="function"){var _=m.get,R=m.set;return Object.defineProperty(a,u,{configurable:!0,get:function(){return _.call(this)},set:function(G){w=""+G,R.call(this,G)}}),Object.defineProperty(a,u,{enumerable:m.enumerable}),{getValue:function(){return w},setValue:function(G){w=""+G},stopTracking:function(){a._valueTracker=null,delete a[u]}}}}function ge(a){a._valueTracker||(a._valueTracker=ne(a))}function Ee(a){if(!a)return!1;var u=a._valueTracker;if(!u)return!0;var m=u.getValue(),w="";return a&&(w=we(a)?a.checked?"true":"false":a.value),a=w,a!==m?(u.setValue(a),!0):!1}function Me(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function Fe(a,u){var m=u.checked;return Y({},u,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:m??a._wrapperState.initialChecked})}function ie(a,u){var m=u.defaultValue==null?"":u.defaultValue,w=u.checked!=null?u.checked:u.defaultChecked;m=Z(u.value!=null?u.value:m),a._wrapperState={initialChecked:w,initialValue:m,controlled:u.type==="checkbox"||u.type==="radio"?u.checked!=null:u.value!=null}}function be(a,u){u=u.checked,u!=null&&C(a,"checked",u,!1)}function Se(a,u){be(a,u);var m=Z(u.value),w=u.type;if(m!=null)w==="number"?(m===0&&a.value===""||a.value!=m)&&(a.value=""+m):a.value!==""+m&&(a.value=""+m);else if(w==="submit"||w==="reset"){a.removeAttribute("value");return}u.hasOwnProperty("value")?De(a,u.type,m):u.hasOwnProperty("defaultValue")&&De(a,u.type,Z(u.defaultValue)),u.checked==null&&u.defaultChecked!=null&&(a.defaultChecked=!!u.defaultChecked)}function $e(a,u,m){if(u.hasOwnProperty("value")||u.hasOwnProperty("defaultValue")){var w=u.type;if(!(w!=="submit"&&w!=="reset"||u.value!==void 0&&u.value!==null))return;u=""+a._wrapperState.initialValue,m||u===a.value||(a.value=u),a.defaultValue=u}m=a.name,m!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,m!==""&&(a.name=m)}function De(a,u,m){(u!=="number"||Me(a.ownerDocument)!==a)&&(m==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+m&&(a.defaultValue=""+m))}var Le=Array.isArray;function ye(a,u,m,w){if(a=a.options,u){u={};for(var _=0;_"+u.valueOf().toString()+"",u=N.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;u.firstChild;)a.appendChild(u.firstChild)}});function oe(a,u){if(u){var m=a.firstChild;if(m&&m===a.lastChild&&m.nodeType===3){m.nodeValue=u;return}}a.textContent=u}var me={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ae=["Webkit","ms","Moz","O"];Object.keys(me).forEach(function(a){Ae.forEach(function(u){u=u+a.charAt(0).toUpperCase()+a.substring(1),me[u]=me[a]})});function de(a,u,m){return u==null||typeof u=="boolean"||u===""?"":m||typeof u!="number"||u===0||me.hasOwnProperty(a)&&me[a]?(""+u).trim():u+"px"}function ve(a,u){a=a.style;for(var m in u)if(u.hasOwnProperty(m)){var w=m.indexOf("--")===0,_=de(m,u[m],w);m==="float"&&(m="cssFloat"),w?a.setProperty(m,_):a[m]=_}}var Ze=Y({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function it(a,u){if(u){if(Ze[a]&&(u.children!=null||u.dangerouslySetInnerHTML!=null))throw Error(n(137,a));if(u.dangerouslySetInnerHTML!=null){if(u.children!=null)throw Error(n(60));if(typeof u.dangerouslySetInnerHTML!="object"||!("__html"in u.dangerouslySetInnerHTML))throw Error(n(61))}if(u.style!=null&&typeof u.style!="object")throw Error(n(62))}}function st(a,u){if(a.indexOf("-")===-1)return typeof u.is=="string";switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bt=null;function zt(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var tn=null,Et=null,It=null;function Ct(a){if(a=Bu(a)){if(typeof tn!="function")throw Error(n(280));var u=a.stateNode;u&&(u=jd(u),tn(a.stateNode,a.type,u))}}function Nt(a){Et?It?It.push(a):It=[a]:Et=a}function Ht(){if(Et){var a=Et,u=It;if(It=Et=null,Ct(a),u)for(a=0;a>>=0,a===0?32:31-(mu(a)/Ar|0)|0}var Ra=64,Mi=4194304;function Ri(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function jl(a,u){var m=a.pendingLanes;if(m===0)return 0;var w=0,_=a.suspendedLanes,R=a.pingedLanes,G=m&268435455;if(G!==0){var pe=G&~_;pe!==0?w=Ri(pe):(R&=G,R!==0&&(w=Ri(R)))}else G=m&~_,G!==0?w=Ri(G):R!==0&&(w=Ri(R));if(w===0)return 0;if(u!==0&&u!==w&&(u&_)===0&&(_=w&-w,R=u&-u,_>=R||_===16&&(R&4194240)!==0))return u;if((w&4)!==0&&(w|=m&16),u=a.entangledLanes,u!==0)for(a=a.entanglements,u&=w;0m;m++)u.push(a);return u}function Li(a,u,m){a.pendingLanes|=u,u!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,u=31-zr(u),a[u]=m}function bu(a,u){var m=a.pendingLanes&~u;a.pendingLanes=u,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=u,a.mutableReadLanes&=u,a.entangledLanes&=u,u=a.entanglements;var w=a.eventTimes;for(a=a.expirationTimes;0=ei),Bd=" ",Kl=!1;function z(a,u){switch(a){case"keyup":return Vn.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Q(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var se=!1;function ue(a,u){switch(a){case"compositionend":return Q(u);case"keypress":return u.which!==32?null:(Kl=!0,Bd);case"textInput":return a=u.data,a===Bd&&Kl?null:a;default:return null}}function ke(a,u){if(se)return a==="compositionend"||!Gl&&z(a,u)?(a=ko(),xo=Cu=Co=null,se=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1=u)return{node:m,offset:u-a};a=w}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=co(m)}}function _r(a,u){return a&&u?a===u?!0:a&&a.nodeType===3?!1:u&&u.nodeType===3?_r(a,u.parentNode):"contains"in a?a.contains(u):a.compareDocumentPosition?!!(a.compareDocumentPosition(u)&16):!1:!1}function qr(){for(var a=window,u=Me();u instanceof a.HTMLIFrameElement;){try{var m=typeof u.contentWindow.location.href=="string"}catch{m=!1}if(m)a=u.contentWindow;else break;u=Me(a.document)}return u}function Gr(a){var u=a&&a.nodeName&&a.nodeName.toLowerCase();return u&&(u==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||u==="textarea"||a.contentEditable==="true")}function zo(a){var u=qr(),m=a.focusedElem,w=a.selectionRange;if(u!==m&&m&&m.ownerDocument&&_r(m.ownerDocument.documentElement,m)){if(w!==null&&Gr(m)){if(u=w.start,a=w.end,a===void 0&&(a=u),"selectionStart"in m)m.selectionStart=u,m.selectionEnd=Math.min(a,m.value.length);else if(a=(u=m.ownerDocument||document)&&u.defaultView||window,a.getSelection){a=a.getSelection();var _=m.textContent.length,R=Math.min(w.start,_);w=w.end===void 0?R:Math.min(w.end,_),!a.extend&&R>w&&(_=w,w=R,R=_),_=So(m,R);var G=So(m,w);_&&G&&(a.rangeCount!==1||a.anchorNode!==_.node||a.anchorOffset!==_.offset||a.focusNode!==G.node||a.focusOffset!==G.offset)&&(u=u.createRange(),u.setStart(_.node,_.offset),a.removeAllRanges(),R>w?(a.addRange(u),a.extend(G.node,G.offset)):(u.setEnd(G.node,G.offset),a.addRange(u)))}}for(u=[],a=m;a=a.parentNode;)a.nodeType===1&&u.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof m.focus=="function"&&m.focus(),m=0;m=document.documentMode,er=null,is=null,Yn=null,Yl=!1;function vE(a,u,m){var w=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;Yl||er==null||er!==Me(w)||(w=er,"selectionStart"in w&&Gr(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),Yn&&hr(Yn,w)||(Yn=w,w=Ld(is,"onSelect"),0ec||(a.current=Bg[ec],Bg[ec]=null,ec--)}function vn(a,u){ec++,Bg[ec]=a.current,a.current=u}var Yi={},Dr=Ki(Yi),uo=Ki(!1),Ha=Yi;function tc(a,u){var m=a.type.contextTypes;if(!m)return Yi;var w=a.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===u)return w.__reactInternalMemoizedMaskedChildContext;var _={},R;for(R in m)_[R]=u[R];return w&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=u,a.__reactInternalMemoizedMaskedChildContext=_),_}function fo(a){return a=a.childContextTypes,a!=null}function Od(){Cn(uo),Cn(Dr)}function RE(a,u,m){if(Dr.current!==Yi)throw Error(n(168));vn(Dr,u),vn(uo,m)}function LE(a,u,m){var w=a.stateNode;if(u=u.childContextTypes,typeof w.getChildContext!="function")return m;w=w.getChildContext();for(var _ in w)if(!(_ in u))throw Error(n(108,te(a)||"Unknown",_));return Y({},m,w)}function $d(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Yi,Ha=Dr.current,vn(Dr,a),vn(uo,uo.current),!0}function IE(a,u,m){var w=a.stateNode;if(!w)throw Error(n(169));m?(a=LE(a,u,Ha),w.__reactInternalMemoizedMergedChildContext=a,Cn(uo),Cn(Dr),vn(Dr,a)):Cn(uo),vn(uo,m)}var ni=null,Ud=!1,Pg=!1;function NE(a){ni===null?ni=[a]:ni.push(a)}function wB(a){Ud=!0,NE(a)}function Qi(){if(!Pg&&ni!==null){Pg=!0;var a=0,u=Vt;try{var m=ni;for(Vt=1;a>=G,_-=G,ri=1<<32-zr(u)+_|m<<_|w,oi=R+a}else ri=1<Tt?(gr=At,At=null):gr=At.sibling;var Qt=Qe(Pe,At,je[Tt],rt);if(Qt===null){At===null&&(At=gr);break}a&&At&&Qt.alternate===null&&u(Pe,At),_e=R(Qt,_e,Tt),kt===null?wt=Qt:kt.sibling=Qt,kt=Qt,At=gr}if(Tt===je.length)return m(Pe,At),_n&&Ga(Pe,Tt),wt;if(At===null){for(;TtTt?(gr=At,At=null):gr=At.sibling;var sa=Qe(Pe,At,Qt.value,rt);if(sa===null){At===null&&(At=gr);break}a&&At&&sa.alternate===null&&u(Pe,At),_e=R(sa,_e,Tt),kt===null?wt=sa:kt.sibling=sa,kt=sa,At=gr}if(Qt.done)return m(Pe,At),_n&&Ga(Pe,Tt),wt;if(At===null){for(;!Qt.done;Tt++,Qt=je.next())Qt=et(Pe,Qt.value,rt),Qt!==null&&(_e=R(Qt,_e,Tt),kt===null?wt=Qt:kt.sibling=Qt,kt=Qt);return _n&&Ga(Pe,Tt),wt}for(At=w(Pe,At);!Qt.done;Tt++,Qt=je.next())Qt=ft(At,Pe,Tt,Qt.value,rt),Qt!==null&&(a&&Qt.alternate!==null&&At.delete(Qt.key===null?Tt:Qt.key),_e=R(Qt,_e,Tt),kt===null?wt=Qt:kt.sibling=Qt,kt=Qt);return a&&At.forEach(function(e9){return u(Pe,e9)}),_n&&Ga(Pe,Tt),wt}function Qn(Pe,_e,je,rt){if(typeof je=="object"&&je!==null&&je.type===L&&je.key===null&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case k:e:{for(var wt=je.key,kt=_e;kt!==null;){if(kt.key===wt){if(wt=je.type,wt===L){if(kt.tag===7){m(Pe,kt.sibling),_e=_(kt,je.props.children),_e.return=Pe,Pe=_e;break e}}else if(kt.elementType===wt||typeof wt=="object"&&wt!==null&&wt.$$typeof===le&&VE(wt)===kt.type){m(Pe,kt.sibling),_e=_(kt,je.props),_e.ref=Pu(Pe,kt,je),_e.return=Pe,Pe=_e;break e}m(Pe,kt);break}else u(Pe,kt);kt=kt.sibling}je.type===L?(_e=tl(je.props.children,Pe.mode,rt,je.key),_e.return=Pe,Pe=_e):(rt=mh(je.type,je.key,je.props,null,Pe.mode,rt),rt.ref=Pu(Pe,_e,je),rt.return=Pe,Pe=rt)}return G(Pe);case B:e:{for(kt=je.key;_e!==null;){if(_e.key===kt)if(_e.tag===4&&_e.stateNode.containerInfo===je.containerInfo&&_e.stateNode.implementation===je.implementation){m(Pe,_e.sibling),_e=_(_e,je.children||[]),_e.return=Pe,Pe=_e;break e}else{m(Pe,_e);break}else u(Pe,_e);_e=_e.sibling}_e=Ty(je,Pe.mode,rt),_e.return=Pe,Pe=_e}return G(Pe);case le:return kt=je._init,Qn(Pe,_e,kt(je._payload),rt)}if(Le(je))return mt(Pe,_e,je,rt);if(ce(je))return yt(Pe,_e,je,rt);Hd(Pe,je)}return typeof je=="string"&&je!==""||typeof je=="number"?(je=""+je,_e!==null&&_e.tag===6?(m(Pe,_e.sibling),_e=_(_e,je),_e.return=Pe,Pe=_e):(m(Pe,_e),_e=Dy(je,Pe.mode,rt),_e.return=Pe,Pe=_e),G(Pe)):m(Pe,_e)}return Qn}var sc=WE(!0),HE=WE(!1),qd=Ki(null),Gd=null,ic=null,jg=null;function Og(){jg=ic=Gd=null}function $g(a){var u=qd.current;Cn(qd),a._currentValue=u}function Ug(a,u,m){for(;a!==null;){var w=a.alternate;if((a.childLanes&u)!==u?(a.childLanes|=u,w!==null&&(w.childLanes|=u)):w!==null&&(w.childLanes&u)!==u&&(w.childLanes|=u),a===m)break;a=a.return}}function ac(a,u){Gd=a,jg=ic=null,a=a.dependencies,a!==null&&a.firstContext!==null&&((a.lanes&u)!==0&&(ho=!0),a.firstContext=null)}function Ho(a){var u=a._currentValue;if(jg!==a)if(a={context:a,memoizedValue:u,next:null},ic===null){if(Gd===null)throw Error(n(308));ic=a,Gd.dependencies={lanes:0,firstContext:a}}else ic=ic.next=a;return u}var Ka=null;function zg(a){Ka===null?Ka=[a]:Ka.push(a)}function qE(a,u,m,w){var _=u.interleaved;return _===null?(m.next=m,zg(u)):(m.next=_.next,_.next=m),u.interleaved=m,si(a,w)}function si(a,u){a.lanes|=u;var m=a.alternate;for(m!==null&&(m.lanes|=u),m=a,a=a.return;a!==null;)a.childLanes|=u,m=a.alternate,m!==null&&(m.childLanes|=u),m=a,a=a.return;return m.tag===3?m.stateNode:null}var Xi=!1;function Vg(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function GE(a,u){a=a.updateQueue,u.updateQueue===a&&(u.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function ii(a,u){return{eventTime:a,lane:u,tag:0,payload:null,callback:null,next:null}}function Ji(a,u,m){var w=a.updateQueue;if(w===null)return null;if(w=w.shared,(qt&2)!==0){var _=w.pending;return _===null?u.next=u:(u.next=_.next,_.next=u),w.pending=u,si(a,m)}return _=w.interleaved,_===null?(u.next=u,zg(w)):(u.next=_.next,_.next=u),w.interleaved=u,si(a,m)}function Kd(a,u,m){if(u=u.updateQueue,u!==null&&(u=u.shared,(m&4194240)!==0)){var w=u.lanes;w&=a.pendingLanes,m|=w,u.lanes=m,Ii(a,m)}}function KE(a,u){var m=a.updateQueue,w=a.alternate;if(w!==null&&(w=w.updateQueue,m===w)){var _=null,R=null;if(m=m.firstBaseUpdate,m!==null){do{var G={eventTime:m.eventTime,lane:m.lane,tag:m.tag,payload:m.payload,callback:m.callback,next:null};R===null?_=R=G:R=R.next=G,m=m.next}while(m!==null);R===null?_=R=u:R=R.next=u}else _=R=u;m={baseState:w.baseState,firstBaseUpdate:_,lastBaseUpdate:R,shared:w.shared,effects:w.effects},a.updateQueue=m;return}a=m.lastBaseUpdate,a===null?m.firstBaseUpdate=u:a.next=u,m.lastBaseUpdate=u}function Yd(a,u,m,w){var _=a.updateQueue;Xi=!1;var R=_.firstBaseUpdate,G=_.lastBaseUpdate,pe=_.shared.pending;if(pe!==null){_.shared.pending=null;var Ce=pe,Ue=Ce.next;Ce.next=null,G===null?R=Ue:G.next=Ue,G=Ce;var Je=a.alternate;Je!==null&&(Je=Je.updateQueue,pe=Je.lastBaseUpdate,pe!==G&&(pe===null?Je.firstBaseUpdate=Ue:pe.next=Ue,Je.lastBaseUpdate=Ce))}if(R!==null){var et=_.baseState;G=0,Je=Ue=Ce=null,pe=R;do{var Qe=pe.lane,ft=pe.eventTime;if((w&Qe)===Qe){Je!==null&&(Je=Je.next={eventTime:ft,lane:0,tag:pe.tag,payload:pe.payload,callback:pe.callback,next:null});e:{var mt=a,yt=pe;switch(Qe=u,ft=m,yt.tag){case 1:if(mt=yt.payload,typeof mt=="function"){et=mt.call(ft,et,Qe);break e}et=mt;break e;case 3:mt.flags=mt.flags&-65537|128;case 0:if(mt=yt.payload,Qe=typeof mt=="function"?mt.call(ft,et,Qe):mt,Qe==null)break e;et=Y({},et,Qe);break e;case 2:Xi=!0}}pe.callback!==null&&pe.lane!==0&&(a.flags|=64,Qe=_.effects,Qe===null?_.effects=[pe]:Qe.push(pe))}else ft={eventTime:ft,lane:Qe,tag:pe.tag,payload:pe.payload,callback:pe.callback,next:null},Je===null?(Ue=Je=ft,Ce=et):Je=Je.next=ft,G|=Qe;if(pe=pe.next,pe===null){if(pe=_.shared.pending,pe===null)break;Qe=pe,pe=Qe.next,Qe.next=null,_.lastBaseUpdate=Qe,_.shared.pending=null}}while(!0);if(Je===null&&(Ce=et),_.baseState=Ce,_.firstBaseUpdate=Ue,_.lastBaseUpdate=Je,u=_.shared.interleaved,u!==null){_=u;do G|=_.lane,_=_.next;while(_!==u)}else R===null&&(_.shared.lanes=0);Xa|=G,a.lanes=G,a.memoizedState=et}}function YE(a,u,m){if(a=u.effects,u.effects=null,a!==null)for(u=0;um?m:4,a(!0);var w=Kg.transition;Kg.transition={};try{a(!1),u()}finally{Vt=m,Kg.transition=w}}function pC(){return qo().memoizedState}function kB(a,u,m){var w=na(a);if(m={lane:w,action:m,hasEagerState:!1,eagerState:null,next:null},mC(a))gC(u,m);else if(m=qE(a,u,m,w),m!==null){var _=Yr();fs(m,a,w,_),yC(m,u,w)}}function AB(a,u,m){var w=na(a),_={lane:w,action:m,hasEagerState:!1,eagerState:null,next:null};if(mC(a))gC(u,_);else{var R=a.alternate;if(a.lanes===0&&(R===null||R.lanes===0)&&(R=u.lastRenderedReducer,R!==null))try{var G=u.lastRenderedState,pe=R(G,m);if(_.hasEagerState=!0,_.eagerState=pe,gn(pe,G)){var Ce=u.interleaved;Ce===null?(_.next=_,zg(u)):(_.next=Ce.next,Ce.next=_),u.interleaved=_;return}}catch{}finally{}m=qE(a,u,_,w),m!==null&&(_=Yr(),fs(m,a,w,_),yC(m,u,w))}}function mC(a){var u=a.alternate;return a===In||u!==null&&u===In}function gC(a,u){Iu=Jd=!0;var m=a.pending;m===null?u.next=u:(u.next=m.next,m.next=u),a.pending=u}function yC(a,u,m){if((m&4194240)!==0){var w=u.lanes;w&=a.pendingLanes,m|=w,u.lanes=m,Ii(a,m)}}var th={readContext:Ho,useCallback:Tr,useContext:Tr,useEffect:Tr,useImperativeHandle:Tr,useInsertionEffect:Tr,useLayoutEffect:Tr,useMemo:Tr,useReducer:Tr,useRef:Tr,useState:Tr,useDebugValue:Tr,useDeferredValue:Tr,useTransition:Tr,useMutableSource:Tr,useSyncExternalStore:Tr,useId:Tr,unstable_isNewReconciler:!1},SB={readContext:Ho,useCallback:function(a,u){return Ts().memoizedState=[a,u===void 0?null:u],a},useContext:Ho,useEffect:iC,useImperativeHandle:function(a,u,m){return m=m!=null?m.concat([a]):null,Zd(4194308,4,cC.bind(null,u,a),m)},useLayoutEffect:function(a,u){return Zd(4194308,4,a,u)},useInsertionEffect:function(a,u){return Zd(4,2,a,u)},useMemo:function(a,u){var m=Ts();return u=u===void 0?null:u,a=a(),m.memoizedState=[a,u],a},useReducer:function(a,u,m){var w=Ts();return u=m!==void 0?m(u):u,w.memoizedState=w.baseState=u,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:u},w.queue=a,a=a.dispatch=kB.bind(null,In,a),[w.memoizedState,a]},useRef:function(a){var u=Ts();return a={current:a},u.memoizedState=a},useState:oC,useDebugValue:ty,useDeferredValue:function(a){return Ts().memoizedState=a},useTransition:function(){var a=oC(!1),u=a[0];return a=xB.bind(null,a[1]),Ts().memoizedState=a,[u,a]},useMutableSource:function(){},useSyncExternalStore:function(a,u,m){var w=In,_=Ts();if(_n){if(m===void 0)throw Error(n(407));m=m()}else{if(m=u(),mr===null)throw Error(n(349));(Qa&30)!==0||ZE(w,u,m)}_.memoizedState=m;var R={value:m,getSnapshot:u};return _.queue=R,iC(tC.bind(null,w,R,a),[a]),w.flags|=2048,Ou(9,eC.bind(null,w,R,m,u),void 0,null),m},useId:function(){var a=Ts(),u=mr.identifierPrefix;if(_n){var m=oi,w=ri;m=(w&~(1<<32-zr(w)-1)).toString(32)+m,u=":"+u+"R"+m,m=Nu++,0<\/script>",a=a.removeChild(a.firstChild)):typeof w.is=="string"?a=G.createElement(m,{is:w.is}):(a=G.createElement(m),m==="select"&&(G=a,w.multiple?G.multiple=!0:w.size&&(G.size=w.size))):a=G.createElementNS(a,m),a[_s]=u,a[Fu]=w,NC(a,u,!1,!1),u.stateNode=a;e:{switch(G=st(m,w),m){case"dialog":En("cancel",a),En("close",a),_=w;break;case"iframe":case"object":case"embed":En("load",a),_=w;break;case"video":case"audio":for(_=0;_<_u.length;_++)En(_u[_],a);_=w;break;case"source":En("error",a),_=w;break;case"img":case"image":case"link":En("error",a),En("load",a),_=w;break;case"details":En("toggle",a),_=w;break;case"input":ie(a,w),_=Fe(a,w),En("invalid",a);break;case"option":_=w;break;case"select":a._wrapperState={wasMultiple:!!w.multiple},_=Y({},w,{value:void 0}),En("invalid",a);break;case"textarea":Ke(a,w),_=Oe(a,w),En("invalid",a);break;default:_=w}it(m,_),pe=_;for(R in pe)if(pe.hasOwnProperty(R)){var Ce=pe[R];R==="style"?ve(a,Ce):R==="dangerouslySetInnerHTML"?(Ce=Ce?Ce.__html:void 0,Ce!=null&&K(a,Ce)):R==="children"?typeof Ce=="string"?(m!=="textarea"||Ce!=="")&&oe(a,Ce):typeof Ce=="number"&&oe(a,""+Ce):R!=="suppressContentEditableWarning"&&R!=="suppressHydrationWarning"&&R!=="autoFocus"&&(o.hasOwnProperty(R)?Ce!=null&&R==="onScroll"&&En("scroll",a):Ce!=null&&C(a,R,Ce,G))}switch(m){case"input":ge(a),$e(a,w,!1);break;case"textarea":ge(a),Be(a);break;case"option":w.value!=null&&a.setAttribute("value",""+Z(w.value));break;case"select":a.multiple=!!w.multiple,R=w.value,R!=null?ye(a,!!w.multiple,R,!1):w.defaultValue!=null&&ye(a,!!w.multiple,w.defaultValue,!0);break;default:typeof _.onClick=="function"&&(a.onclick=Nd)}switch(m){case"button":case"input":case"select":case"textarea":w=!!w.autoFocus;break e;case"img":w=!0;break e;default:w=!1}}w&&(u.flags|=4)}u.ref!==null&&(u.flags|=512,u.flags|=2097152)}return Fr(u),null;case 6:if(a&&u.stateNode!=null)OC(a,u,a.memoizedProps,w);else{if(typeof w!="string"&&u.stateNode===null)throw Error(n(166));if(m=Ya(Lu.current),Ya(Ds.current),Wd(u)){if(w=u.stateNode,m=u.memoizedProps,w[_s]=u,(R=w.nodeValue!==m)&&(a=_o,a!==null))switch(a.tag){case 3:Id(w.nodeValue,m,(a.mode&1)!==0);break;case 5:a.memoizedProps.suppressHydrationWarning!==!0&&Id(w.nodeValue,m,(a.mode&1)!==0)}R&&(u.flags|=4)}else w=(m.nodeType===9?m:m.ownerDocument).createTextNode(w),w[_s]=u,u.stateNode=w}return Fr(u),null;case 13:if(Cn(Ln),w=u.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(_n&&Do!==null&&(u.mode&1)!==0&&(u.flags&128)===0)zE(),oc(),u.flags|=98560,R=!1;else if(R=Wd(u),w!==null&&w.dehydrated!==null){if(a===null){if(!R)throw Error(n(318));if(R=u.memoizedState,R=R!==null?R.dehydrated:null,!R)throw Error(n(317));R[_s]=u}else oc(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;Fr(u),R=!1}else as!==null&&(xy(as),as=null),R=!0;if(!R)return u.flags&65536?u:null}return(u.flags&128)!==0?(u.lanes=m,u):(w=w!==null,w!==(a!==null&&a.memoizedState!==null)&&w&&(u.child.flags|=8192,(u.mode&1)!==0&&(a===null||(Ln.current&1)!==0?ir===0&&(ir=3):Sy())),u.updateQueue!==null&&(u.flags|=4),Fr(u),null);case 4:return lc(),dy(a,u),a===null&&Du(u.stateNode.containerInfo),Fr(u),null;case 10:return $g(u.type._context),Fr(u),null;case 17:return fo(u.type)&&Od(),Fr(u),null;case 19:if(Cn(Ln),R=u.memoizedState,R===null)return Fr(u),null;if(w=(u.flags&128)!==0,G=R.rendering,G===null)if(w)$u(R,!1);else{if(ir!==0||a!==null&&(a.flags&128)!==0)for(a=u.child;a!==null;){if(G=Qd(a),G!==null){for(u.flags|=128,$u(R,!1),w=G.updateQueue,w!==null&&(u.updateQueue=w,u.flags|=4),u.subtreeFlags=0,w=m,m=u.child;m!==null;)R=m,a=w,R.flags&=14680066,G=R.alternate,G===null?(R.childLanes=0,R.lanes=a,R.child=null,R.subtreeFlags=0,R.memoizedProps=null,R.memoizedState=null,R.updateQueue=null,R.dependencies=null,R.stateNode=null):(R.childLanes=G.childLanes,R.lanes=G.lanes,R.child=G.child,R.subtreeFlags=0,R.deletions=null,R.memoizedProps=G.memoizedProps,R.memoizedState=G.memoizedState,R.updateQueue=G.updateQueue,R.type=G.type,a=G.dependencies,R.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),m=m.sibling;return vn(Ln,Ln.current&1|2),u.child}a=a.sibling}R.tail!==null&&mn()>dc&&(u.flags|=128,w=!0,$u(R,!1),u.lanes=4194304)}else{if(!w)if(a=Qd(G),a!==null){if(u.flags|=128,w=!0,m=a.updateQueue,m!==null&&(u.updateQueue=m,u.flags|=4),$u(R,!0),R.tail===null&&R.tailMode==="hidden"&&!G.alternate&&!_n)return Fr(u),null}else 2*mn()-R.renderingStartTime>dc&&m!==1073741824&&(u.flags|=128,w=!0,$u(R,!1),u.lanes=4194304);R.isBackwards?(G.sibling=u.child,u.child=G):(m=R.last,m!==null?m.sibling=G:u.child=G,R.last=G)}return R.tail!==null?(u=R.tail,R.rendering=u,R.tail=u.sibling,R.renderingStartTime=mn(),u.sibling=null,m=Ln.current,vn(Ln,w?m&1|2:m&1),u):(Fr(u),null);case 22:case 23:return Ay(),w=u.memoizedState!==null,a!==null&&a.memoizedState!==null!==w&&(u.flags|=8192),w&&(u.mode&1)!==0?(To&1073741824)!==0&&(Fr(u),u.subtreeFlags&6&&(u.flags|=8192)):Fr(u),null;case 24:return null;case 25:return null}throw Error(n(156,u.tag))}function RB(a,u){switch(Rg(u),u.tag){case 1:return fo(u.type)&&Od(),a=u.flags,a&65536?(u.flags=a&-65537|128,u):null;case 3:return lc(),Cn(uo),Cn(Dr),Gg(),a=u.flags,(a&65536)!==0&&(a&128)===0?(u.flags=a&-65537|128,u):null;case 5:return Hg(u),null;case 13:if(Cn(Ln),a=u.memoizedState,a!==null&&a.dehydrated!==null){if(u.alternate===null)throw Error(n(340));oc()}return a=u.flags,a&65536?(u.flags=a&-65537|128,u):null;case 19:return Cn(Ln),null;case 4:return lc(),null;case 10:return $g(u.type._context),null;case 22:case 23:return Ay(),null;case 24:return null;default:return null}}var sh=!1,Br=!1,LB=typeof WeakSet=="function"?WeakSet:Set,ht=null;function uc(a,u){var m=a.ref;if(m!==null)if(typeof m=="function")try{m(null)}catch(w){Wn(a,u,w)}else m.current=null}function hy(a,u,m){try{m()}catch(w){Wn(a,u,w)}}var $C=!1;function IB(a,u){if(Ag=an,a=qr(),Gr(a)){if("selectionStart"in a)var m={start:a.selectionStart,end:a.selectionEnd};else e:{m=(m=a.ownerDocument)&&m.defaultView||window;var w=m.getSelection&&m.getSelection();if(w&&w.rangeCount!==0){m=w.anchorNode;var _=w.anchorOffset,R=w.focusNode;w=w.focusOffset;try{m.nodeType,R.nodeType}catch{m=null;break e}var G=0,pe=-1,Ce=-1,Ue=0,Je=0,et=a,Qe=null;t:for(;;){for(var ft;et!==m||_!==0&&et.nodeType!==3||(pe=G+_),et!==R||w!==0&&et.nodeType!==3||(Ce=G+w),et.nodeType===3&&(G+=et.nodeValue.length),(ft=et.firstChild)!==null;)Qe=et,et=ft;for(;;){if(et===a)break t;if(Qe===m&&++Ue===_&&(pe=G),Qe===R&&++Je===w&&(Ce=G),(ft=et.nextSibling)!==null)break;et=Qe,Qe=et.parentNode}et=ft}m=pe===-1||Ce===-1?null:{start:pe,end:Ce}}else m=null}m=m||{start:0,end:0}}else m=null;for(Sg={focusedElem:a,selectionRange:m},an=!1,ht=u;ht!==null;)if(u=ht,a=u.child,(u.subtreeFlags&1028)!==0&&a!==null)a.return=u,ht=a;else for(;ht!==null;){u=ht;try{var mt=u.alternate;if((u.flags&1024)!==0)switch(u.tag){case 0:case 11:case 15:break;case 1:if(mt!==null){var yt=mt.memoizedProps,Qn=mt.memoizedState,Pe=u.stateNode,_e=Pe.getSnapshotBeforeUpdate(u.elementType===u.type?yt:ls(u.type,yt),Qn);Pe.__reactInternalSnapshotBeforeUpdate=_e}break;case 3:var je=u.stateNode.containerInfo;je.nodeType===1?je.textContent="":je.nodeType===9&&je.documentElement&&je.removeChild(je.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(rt){Wn(u,u.return,rt)}if(a=u.sibling,a!==null){a.return=u.return,ht=a;break}ht=u.return}return mt=$C,$C=!1,mt}function Uu(a,u,m){var w=u.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var _=w=w.next;do{if((_.tag&a)===a){var R=_.destroy;_.destroy=void 0,R!==void 0&&hy(u,m,R)}_=_.next}while(_!==w)}}function ih(a,u){if(u=u.updateQueue,u=u!==null?u.lastEffect:null,u!==null){var m=u=u.next;do{if((m.tag&a)===a){var w=m.create;m.destroy=w()}m=m.next}while(m!==u)}}function py(a){var u=a.ref;if(u!==null){var m=a.stateNode;switch(a.tag){case 5:a=m;break;default:a=m}typeof u=="function"?u(a):u.current=a}}function UC(a){var u=a.alternate;u!==null&&(a.alternate=null,UC(u)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(u=a.stateNode,u!==null&&(delete u[_s],delete u[Fu],delete u[Fg],delete u[bB],delete u[vB])),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function zC(a){return a.tag===5||a.tag===3||a.tag===4}function VC(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||zC(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function my(a,u,m){var w=a.tag;if(w===5||w===6)a=a.stateNode,u?m.nodeType===8?m.parentNode.insertBefore(a,u):m.insertBefore(a,u):(m.nodeType===8?(u=m.parentNode,u.insertBefore(a,m)):(u=m,u.appendChild(a)),m=m._reactRootContainer,m!=null||u.onclick!==null||(u.onclick=Nd));else if(w!==4&&(a=a.child,a!==null))for(my(a,u,m),a=a.sibling;a!==null;)my(a,u,m),a=a.sibling}function gy(a,u,m){var w=a.tag;if(w===5||w===6)a=a.stateNode,u?m.insertBefore(a,u):m.appendChild(a);else if(w!==4&&(a=a.child,a!==null))for(gy(a,u,m),a=a.sibling;a!==null;)gy(a,u,m),a=a.sibling}var Cr=null,cs=!1;function Zi(a,u,m){for(m=m.child;m!==null;)WC(a,u,m),m=m.sibling}function WC(a,u,m){if(io&&typeof io.onCommitFiberUnmount=="function")try{io.onCommitFiberUnmount(Pi,m)}catch{}switch(m.tag){case 5:Br||uc(m,u);case 6:var w=Cr,_=cs;Cr=null,Zi(a,u,m),Cr=w,cs=_,Cr!==null&&(cs?(a=Cr,m=m.stateNode,a.nodeType===8?a.parentNode.removeChild(m):a.removeChild(m)):Cr.removeChild(m.stateNode));break;case 18:Cr!==null&&(cs?(a=Cr,m=m.stateNode,a.nodeType===8?Tg(a.parentNode,m):a.nodeType===1&&Tg(a,m),Vi(a)):Tg(Cr,m.stateNode));break;case 4:w=Cr,_=cs,Cr=m.stateNode.containerInfo,cs=!0,Zi(a,u,m),Cr=w,cs=_;break;case 0:case 11:case 14:case 15:if(!Br&&(w=m.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){_=w=w.next;do{var R=_,G=R.destroy;R=R.tag,G!==void 0&&((R&2)!==0||(R&4)!==0)&&hy(m,u,G),_=_.next}while(_!==w)}Zi(a,u,m);break;case 1:if(!Br&&(uc(m,u),w=m.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=m.memoizedProps,w.state=m.memoizedState,w.componentWillUnmount()}catch(pe){Wn(m,u,pe)}Zi(a,u,m);break;case 21:Zi(a,u,m);break;case 22:m.mode&1?(Br=(w=Br)||m.memoizedState!==null,Zi(a,u,m),Br=w):Zi(a,u,m);break;default:Zi(a,u,m)}}function HC(a){var u=a.updateQueue;if(u!==null){a.updateQueue=null;var m=a.stateNode;m===null&&(m=a.stateNode=new LB),u.forEach(function(w){var _=HB.bind(null,a,w);m.has(w)||(m.add(w),w.then(_,_))})}}function us(a,u){var m=u.deletions;if(m!==null)for(var w=0;w_&&(_=G),w&=~R}if(w=_,w=mn()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*jB(w/1960))-w,10a?16:a,ta===null)var w=!1;else{if(a=ta,ta=null,fh=0,(qt&6)!==0)throw Error(n(331));var _=qt;for(qt|=4,ht=a.current;ht!==null;){var R=ht,G=R.child;if((ht.flags&16)!==0){var pe=R.deletions;if(pe!==null){for(var Ce=0;Cemn()-vy?Za(a,0):by|=m),mo(a,u)}function ox(a,u){u===0&&((a.mode&1)===0?u=1:(u=Mi,Mi<<=1,(Mi&130023424)===0&&(Mi=4194304)));var m=Yr();a=si(a,u),a!==null&&(Li(a,u,m),mo(a,m))}function WB(a){var u=a.memoizedState,m=0;u!==null&&(m=u.retryLane),ox(a,m)}function HB(a,u){var m=0;switch(a.tag){case 13:var w=a.stateNode,_=a.memoizedState;_!==null&&(m=_.retryLane);break;case 19:w=a.stateNode;break;default:throw Error(n(314))}w!==null&&w.delete(u),ox(a,m)}var sx;sx=function(a,u,m){if(a!==null)if(a.memoizedProps!==u.pendingProps||uo.current)ho=!0;else{if((a.lanes&m)===0&&(u.flags&128)===0)return ho=!1,PB(a,u,m);ho=(a.flags&131072)!==0}else ho=!1,_n&&(u.flags&1048576)!==0&&jE(u,Vd,u.index);switch(u.lanes=0,u.tag){case 2:var w=u.type;oh(a,u),a=u.pendingProps;var _=tc(u,Dr.current);ac(u,m),_=Qg(null,u,w,a,_,m);var R=Xg();return u.flags|=1,typeof _=="object"&&_!==null&&typeof _.render=="function"&&_.$$typeof===void 0?(u.tag=1,u.memoizedState=null,u.updateQueue=null,fo(w)?(R=!0,$d(u)):R=!1,u.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,Vg(u),_.updater=nh,u.stateNode=_,_._reactInternals=u,ry(u,w,a,m),u=ay(null,u,w,!0,R,m)):(u.tag=0,_n&&R&&Mg(u),Kr(null,u,_,m),u=u.child),u;case 16:w=u.elementType;e:{switch(oh(a,u),a=u.pendingProps,_=w._init,w=_(w._payload),u.type=w,_=u.tag=GB(w),a=ls(w,a),_){case 0:u=iy(null,u,w,a,m);break e;case 1:u=BC(null,u,w,a,m);break e;case 11:u=SC(null,u,w,a,m);break e;case 14:u=_C(null,u,w,ls(w.type,a),m);break e}throw Error(n(306,w,""))}return u;case 0:return w=u.type,_=u.pendingProps,_=u.elementType===w?_:ls(w,_),iy(a,u,w,_,m);case 1:return w=u.type,_=u.pendingProps,_=u.elementType===w?_:ls(w,_),BC(a,u,w,_,m);case 3:e:{if(PC(u),a===null)throw Error(n(387));w=u.pendingProps,R=u.memoizedState,_=R.element,GE(a,u),Yd(u,w,null,m);var G=u.memoizedState;if(w=G.element,R.isDehydrated)if(R={element:w,isDehydrated:!1,cache:G.cache,pendingSuspenseBoundaries:G.pendingSuspenseBoundaries,transitions:G.transitions},u.updateQueue.baseState=R,u.memoizedState=R,u.flags&256){_=cc(Error(n(423)),u),u=MC(a,u,w,m,_);break e}else if(w!==_){_=cc(Error(n(424)),u),u=MC(a,u,w,m,_);break e}else for(Do=Gi(u.stateNode.containerInfo.firstChild),_o=u,_n=!0,as=null,m=HE(u,null,w,m),u.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling;else{if(oc(),w===_){u=ai(a,u,m);break e}Kr(a,u,w,m)}u=u.child}return u;case 5:return QE(u),a===null&&Ig(u),w=u.type,_=u.pendingProps,R=a!==null?a.memoizedProps:null,G=_.children,_g(w,_)?G=null:R!==null&&_g(w,R)&&(u.flags|=32),FC(a,u),Kr(a,u,G,m),u.child;case 6:return a===null&&Ig(u),null;case 13:return RC(a,u,m);case 4:return Wg(u,u.stateNode.containerInfo),w=u.pendingProps,a===null?u.child=sc(u,null,w,m):Kr(a,u,w,m),u.child;case 11:return w=u.type,_=u.pendingProps,_=u.elementType===w?_:ls(w,_),SC(a,u,w,_,m);case 7:return Kr(a,u,u.pendingProps,m),u.child;case 8:return Kr(a,u,u.pendingProps.children,m),u.child;case 12:return Kr(a,u,u.pendingProps.children,m),u.child;case 10:e:{if(w=u.type._context,_=u.pendingProps,R=u.memoizedProps,G=_.value,vn(qd,w._currentValue),w._currentValue=G,R!==null)if(gn(R.value,G)){if(R.children===_.children&&!uo.current){u=ai(a,u,m);break e}}else for(R=u.child,R!==null&&(R.return=u);R!==null;){var pe=R.dependencies;if(pe!==null){G=R.child;for(var Ce=pe.firstContext;Ce!==null;){if(Ce.context===w){if(R.tag===1){Ce=ii(-1,m&-m),Ce.tag=2;var Ue=R.updateQueue;if(Ue!==null){Ue=Ue.shared;var Je=Ue.pending;Je===null?Ce.next=Ce:(Ce.next=Je.next,Je.next=Ce),Ue.pending=Ce}}R.lanes|=m,Ce=R.alternate,Ce!==null&&(Ce.lanes|=m),Ug(R.return,m,u),pe.lanes|=m;break}Ce=Ce.next}}else if(R.tag===10)G=R.type===u.type?null:R.child;else if(R.tag===18){if(G=R.return,G===null)throw Error(n(341));G.lanes|=m,pe=G.alternate,pe!==null&&(pe.lanes|=m),Ug(G,m,u),G=R.sibling}else G=R.child;if(G!==null)G.return=R;else for(G=R;G!==null;){if(G===u){G=null;break}if(R=G.sibling,R!==null){R.return=G.return,G=R;break}G=G.return}R=G}Kr(a,u,_.children,m),u=u.child}return u;case 9:return _=u.type,w=u.pendingProps.children,ac(u,m),_=Ho(_),w=w(_),u.flags|=1,Kr(a,u,w,m),u.child;case 14:return w=u.type,_=ls(w,u.pendingProps),_=ls(w.type,_),_C(a,u,w,_,m);case 15:return DC(a,u,u.type,u.pendingProps,m);case 17:return w=u.type,_=u.pendingProps,_=u.elementType===w?_:ls(w,_),oh(a,u),u.tag=1,fo(w)?(a=!0,$d(u)):a=!1,ac(u,m),vC(u,w,_),ry(u,w,_,m),ay(null,u,w,!0,a,m);case 19:return IC(a,u,m);case 22:return TC(a,u,m)}throw Error(n(156,u.tag))};function ix(a,u){return Gn(a,u)}function qB(a,u,m,w){this.tag=a,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ko(a,u,m,w){return new qB(a,u,m,w)}function _y(a){return a=a.prototype,!(!a||!a.isReactComponent)}function GB(a){if(typeof a=="function")return _y(a)?1:0;if(a!=null){if(a=a.$$typeof,a===j)return 11;if(a===q)return 14}return 2}function oa(a,u){var m=a.alternate;return m===null?(m=Ko(a.tag,u,a.key,a.mode),m.elementType=a.elementType,m.type=a.type,m.stateNode=a.stateNode,m.alternate=a,a.alternate=m):(m.pendingProps=u,m.type=a.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=a.flags&14680064,m.childLanes=a.childLanes,m.lanes=a.lanes,m.child=a.child,m.memoizedProps=a.memoizedProps,m.memoizedState=a.memoizedState,m.updateQueue=a.updateQueue,u=a.dependencies,m.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},m.sibling=a.sibling,m.index=a.index,m.ref=a.ref,m}function mh(a,u,m,w,_,R){var G=2;if(w=a,typeof a=="function")_y(a)&&(G=1);else if(typeof a=="string")G=5;else e:switch(a){case L:return tl(m.children,_,R,u);case F:G=8,_|=8;break;case M:return a=Ko(12,m,u,_|2),a.elementType=M,a.lanes=R,a;case V:return a=Ko(13,m,u,_),a.elementType=V,a.lanes=R,a;case H:return a=Ko(19,m,u,_),a.elementType=H,a.lanes=R,a;case X:return gh(m,_,R,u);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case I:G=10;break e;case O:G=9;break e;case j:G=11;break e;case q:G=14;break e;case le:G=16,w=null;break e}throw Error(n(130,a==null?a:typeof a,""))}return u=Ko(G,m,u,_),u.elementType=a,u.type=w,u.lanes=R,u}function tl(a,u,m,w){return a=Ko(7,a,w,u),a.lanes=m,a}function gh(a,u,m,w){return a=Ko(22,a,w,u),a.elementType=X,a.lanes=m,a.stateNode={isHidden:!1},a}function Dy(a,u,m){return a=Ko(6,a,null,u),a.lanes=m,a}function Ty(a,u,m){return u=Ko(4,a.children!==null?a.children:[],a.key,u),u.lanes=m,u.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},u}function KB(a,u,m,w,_){this.tag=u,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=yu(0),this.expirationTimes=yu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yu(0),this.identifierPrefix=w,this.onRecoverableError=_,this.mutableSourceEagerHydrationData=null}function Fy(a,u,m,w,_,R,G,pe,Ce){return a=new KB(a,u,m,pe,Ce),u===1?(u=1,R===!0&&(u|=8)):u=0,R=Ko(3,null,null,u),a.current=R,R.stateNode=a,R.memoizedState={element:w,isDehydrated:m,cache:null,transitions:null,pendingSuspenseBoundaries:null},Vg(R),a}function YB(a,u,m){var w=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ny.exports=u9(),Ny.exports}var xx;function f9(){if(xx)return kh;xx=1;var e=F3();return kh.createRoot=e.createRoot,kh.hydrateRoot=e.hydrateRoot,kh}var d9=f9();/** +`+R.stack}return{value:a,source:u,stack:_,digest:null}}function oy(a,u,m){return{value:a,source:null,stack:m??null,digest:u??null}}function sy(a,u){try{console.error(u.value)}catch(m){setTimeout(function(){throw m})}}var TB=typeof WeakMap=="function"?WeakMap:Map;function EC(a,u,m){m=ii(-1,m),m.tag=3,m.payload={element:null};var w=u.value;return m.callback=function(){ch||(ch=!0,wy=w),sy(a,u)},m}function CC(a,u,m){m=ii(-1,m),m.tag=3;var w=a.type.getDerivedStateFromError;if(typeof w=="function"){var _=u.value;m.payload=function(){return w(_)},m.callback=function(){sy(a,u)}}var R=a.stateNode;return R!==null&&typeof R.componentDidCatch=="function"&&(m.callback=function(){sy(a,u),typeof w!="function"&&(ea===null?ea=new Set([this]):ea.add(this));var G=u.stack;this.componentDidCatch(u.value,{componentStack:G!==null?G:""})}),m}function xC(a,u,m){var w=a.pingCache;if(w===null){w=a.pingCache=new TB;var _=new Set;w.set(u,_)}else _=w.get(u),_===void 0&&(_=new Set,w.set(u,_));_.has(m)||(_.add(m),a=VB.bind(null,a,u,m),u.then(a,a))}function kC(a){do{var u;if((u=a.tag===13)&&(u=a.memoizedState,u=u!==null?u.dehydrated!==null:!0),u)return a;a=a.return}while(a!==null);return null}function AC(a,u,m,w,_){return(a.mode&1)===0?(a===u?a.flags|=65536:(a.flags|=128,m.flags|=131072,m.flags&=-52805,m.tag===1&&(m.alternate===null?m.tag=17:(u=ii(-1,1),u.tag=2,Ji(m,u,1))),m.lanes|=1),a):(a.flags|=65536,a.lanes=_,a)}var FB=A.ReactCurrentOwner,ho=!1;function Kr(a,u,m,w){u.child=a===null?HE(u,null,m,w):sc(u,a.child,m,w)}function SC(a,u,m,w,_){m=m.render;var R=u.ref;return ac(u,_),w=Qg(a,u,m,w,R,_),m=Xg(),a!==null&&!ho?(u.updateQueue=a.updateQueue,u.flags&=-2053,a.lanes&=~_,ai(a,u,_)):(_n&&m&&Mg(u),u.flags|=1,Kr(a,u,w,_),u.child)}function _C(a,u,m,w,_){if(a===null){var R=m.type;return typeof R=="function"&&!_y(R)&&R.defaultProps===void 0&&m.compare===null&&m.defaultProps===void 0?(u.tag=15,u.type=R,DC(a,u,R,w,_)):(a=mh(m.type,null,w,u,u.mode,_),a.ref=u.ref,a.return=u,u.child=a)}if(R=a.child,(a.lanes&_)===0){var G=R.memoizedProps;if(m=m.compare,m=m!==null?m:hr,m(G,w)&&a.ref===u.ref)return ai(a,u,_)}return u.flags|=1,a=oa(R,w),a.ref=u.ref,a.return=u,u.child=a}function DC(a,u,m,w,_){if(a!==null){var R=a.memoizedProps;if(hr(R,w)&&a.ref===u.ref)if(ho=!1,u.pendingProps=w=R,(a.lanes&_)!==0)(a.flags&131072)!==0&&(ho=!0);else return u.lanes=a.lanes,ai(a,u,_)}return iy(a,u,m,w,_)}function TC(a,u,m){var w=u.pendingProps,_=w.children,R=a!==null?a.memoizedState:null;if(w.mode==="hidden")if((u.mode&1)===0)u.memoizedState={baseLanes:0,cachePool:null,transitions:null},vn(fc,To),To|=m;else{if((m&1073741824)===0)return a=R!==null?R.baseLanes|m:m,u.lanes=u.childLanes=1073741824,u.memoizedState={baseLanes:a,cachePool:null,transitions:null},u.updateQueue=null,vn(fc,To),To|=a,null;u.memoizedState={baseLanes:0,cachePool:null,transitions:null},w=R!==null?R.baseLanes:m,vn(fc,To),To|=w}else R!==null?(w=R.baseLanes|m,u.memoizedState=null):w=m,vn(fc,To),To|=w;return Kr(a,u,_,m),u.child}function FC(a,u){var m=u.ref;(a===null&&m!==null||a!==null&&a.ref!==m)&&(u.flags|=512,u.flags|=2097152)}function iy(a,u,m,w,_){var R=fo(m)?Ha:Dr.current;return R=tc(u,R),ac(u,_),m=Qg(a,u,m,w,R,_),w=Xg(),a!==null&&!ho?(u.updateQueue=a.updateQueue,u.flags&=-2053,a.lanes&=~_,ai(a,u,_)):(_n&&w&&Mg(u),u.flags|=1,Kr(a,u,m,_),u.child)}function BC(a,u,m,w,_){if(fo(m)){var R=!0;$d(u)}else R=!1;if(ac(u,_),u.stateNode===null)oh(a,u),vC(u,m,w),ry(u,m,w,_),w=!0;else if(a===null){var G=u.stateNode,pe=u.memoizedProps;G.props=pe;var Ce=G.context,Ue=m.contextType;typeof Ue=="object"&&Ue!==null?Ue=Ho(Ue):(Ue=fo(m)?Ha:Dr.current,Ue=tc(u,Ue));var Je=m.getDerivedStateFromProps,et=typeof Je=="function"||typeof G.getSnapshotBeforeUpdate=="function";et||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(pe!==w||Ce!==Ue)&&wC(u,G,w,Ue),Xi=!1;var Qe=u.memoizedState;G.state=Qe,Yd(u,w,G,_),Ce=u.memoizedState,pe!==w||Qe!==Ce||uo.current||Xi?(typeof Je=="function"&&(ny(u,m,Je,w),Ce=u.memoizedState),(pe=Xi||bC(u,m,pe,w,Qe,Ce,Ue))?(et||typeof G.UNSAFE_componentWillMount!="function"&&typeof G.componentWillMount!="function"||(typeof G.componentWillMount=="function"&&G.componentWillMount(),typeof G.UNSAFE_componentWillMount=="function"&&G.UNSAFE_componentWillMount()),typeof G.componentDidMount=="function"&&(u.flags|=4194308)):(typeof G.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=w,u.memoizedState=Ce),G.props=w,G.state=Ce,G.context=Ue,w=pe):(typeof G.componentDidMount=="function"&&(u.flags|=4194308),w=!1)}else{G=u.stateNode,GE(a,u),pe=u.memoizedProps,Ue=u.type===u.elementType?pe:ls(u.type,pe),G.props=Ue,et=u.pendingProps,Qe=G.context,Ce=m.contextType,typeof Ce=="object"&&Ce!==null?Ce=Ho(Ce):(Ce=fo(m)?Ha:Dr.current,Ce=tc(u,Ce));var ft=m.getDerivedStateFromProps;(Je=typeof ft=="function"||typeof G.getSnapshotBeforeUpdate=="function")||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(pe!==et||Qe!==Ce)&&wC(u,G,w,Ce),Xi=!1,Qe=u.memoizedState,G.state=Qe,Yd(u,w,G,_);var mt=u.memoizedState;pe!==et||Qe!==mt||uo.current||Xi?(typeof ft=="function"&&(ny(u,m,ft,w),mt=u.memoizedState),(Ue=Xi||bC(u,m,Ue,w,Qe,mt,Ce)||!1)?(Je||typeof G.UNSAFE_componentWillUpdate!="function"&&typeof G.componentWillUpdate!="function"||(typeof G.componentWillUpdate=="function"&&G.componentWillUpdate(w,mt,Ce),typeof G.UNSAFE_componentWillUpdate=="function"&&G.UNSAFE_componentWillUpdate(w,mt,Ce)),typeof G.componentDidUpdate=="function"&&(u.flags|=4),typeof G.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof G.componentDidUpdate!="function"||pe===a.memoizedProps&&Qe===a.memoizedState||(u.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||pe===a.memoizedProps&&Qe===a.memoizedState||(u.flags|=1024),u.memoizedProps=w,u.memoizedState=mt),G.props=w,G.state=mt,G.context=Ce,w=Ue):(typeof G.componentDidUpdate!="function"||pe===a.memoizedProps&&Qe===a.memoizedState||(u.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||pe===a.memoizedProps&&Qe===a.memoizedState||(u.flags|=1024),w=!1)}return ay(a,u,m,w,R,_)}function ay(a,u,m,w,_,R){FC(a,u);var G=(u.flags&128)!==0;if(!w&&!G)return _&&IE(u,m,!1),ai(a,u,R);w=u.stateNode,FB.current=u;var pe=G&&typeof m.getDerivedStateFromError!="function"?null:w.render();return u.flags|=1,a!==null&&G?(u.child=sc(u,a.child,null,R),u.child=sc(u,null,pe,R)):Kr(a,u,pe,R),u.memoizedState=w.state,_&&IE(u,m,!0),u.child}function PC(a){var u=a.stateNode;u.pendingContext?RE(a,u.pendingContext,u.pendingContext!==u.context):u.context&&RE(a,u.context,!1),Wg(a,u.containerInfo)}function MC(a,u,m,w,_){return oc(),Ng(_),u.flags|=256,Kr(a,u,m,w),u.child}var ly={dehydrated:null,treeContext:null,retryLane:0};function cy(a){return{baseLanes:a,cachePool:null,transitions:null}}function RC(a,u,m){var w=u.pendingProps,_=Ln.current,R=!1,G=(u.flags&128)!==0,pe;if((pe=G)||(pe=a!==null&&a.memoizedState===null?!1:(_&2)!==0),pe?(R=!0,u.flags&=-129):(a===null||a.memoizedState!==null)&&(_|=1),vn(Ln,_&1),a===null)return Ig(u),a=u.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?((u.mode&1)===0?u.lanes=1:a.data==="$!"?u.lanes=8:u.lanes=1073741824,null):(G=w.children,a=w.fallback,R?(w=u.mode,R=u.child,G={mode:"hidden",children:G},(w&1)===0&&R!==null?(R.childLanes=0,R.pendingProps=G):R=gh(G,w,0,null),a=tl(a,w,m,null),R.return=u,a.return=u,R.sibling=a,u.child=R,u.child.memoizedState=cy(m),u.memoizedState=ly,a):uy(u,G));if(_=a.memoizedState,_!==null&&(pe=_.dehydrated,pe!==null))return BB(a,u,G,w,pe,_,m);if(R){R=w.fallback,G=u.mode,_=a.child,pe=_.sibling;var Ce={mode:"hidden",children:w.children};return(G&1)===0&&u.child!==_?(w=u.child,w.childLanes=0,w.pendingProps=Ce,u.deletions=null):(w=oa(_,Ce),w.subtreeFlags=_.subtreeFlags&14680064),pe!==null?R=oa(pe,R):(R=tl(R,G,m,null),R.flags|=2),R.return=u,w.return=u,w.sibling=R,u.child=w,w=R,R=u.child,G=a.child.memoizedState,G=G===null?cy(m):{baseLanes:G.baseLanes|m,cachePool:null,transitions:G.transitions},R.memoizedState=G,R.childLanes=a.childLanes&~m,u.memoizedState=ly,w}return R=a.child,a=R.sibling,w=oa(R,{mode:"visible",children:w.children}),(u.mode&1)===0&&(w.lanes=m),w.return=u,w.sibling=null,a!==null&&(m=u.deletions,m===null?(u.deletions=[a],u.flags|=16):m.push(a)),u.child=w,u.memoizedState=null,w}function uy(a,u){return u=gh({mode:"visible",children:u},a.mode,0,null),u.return=a,a.child=u}function rh(a,u,m,w){return w!==null&&Ng(w),sc(u,a.child,null,m),a=uy(u,u.pendingProps.children),a.flags|=2,u.memoizedState=null,a}function BB(a,u,m,w,_,R,G){if(m)return u.flags&256?(u.flags&=-257,w=oy(Error(n(422))),rh(a,u,G,w)):u.memoizedState!==null?(u.child=a.child,u.flags|=128,null):(R=w.fallback,_=u.mode,w=gh({mode:"visible",children:w.children},_,0,null),R=tl(R,_,G,null),R.flags|=2,w.return=u,R.return=u,w.sibling=R,u.child=w,(u.mode&1)!==0&&sc(u,a.child,null,G),u.child.memoizedState=cy(G),u.memoizedState=ly,R);if((u.mode&1)===0)return rh(a,u,G,null);if(_.data==="$!"){if(w=_.nextSibling&&_.nextSibling.dataset,w)var pe=w.dgst;return w=pe,R=Error(n(419)),w=oy(R,w,void 0),rh(a,u,G,w)}if(pe=(G&a.childLanes)!==0,ho||pe){if(w=mr,w!==null){switch(G&-G){case 4:_=2;break;case 16:_=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:_=32;break;case 536870912:_=268435456;break;default:_=0}_=(_&(w.suspendedLanes|G))!==0?0:_,_!==0&&_!==R.retryLane&&(R.retryLane=_,si(a,_),fs(w,a,_,-1))}return Sy(),w=oy(Error(n(421))),rh(a,u,G,w)}return _.data==="$?"?(u.flags|=128,u.child=a.child,u=WB.bind(null,a),_._reactRetry=u,null):(a=R.treeContext,Do=Gi(_.nextSibling),_o=u,_n=!0,as=null,a!==null&&(Vo[Wo++]=ri,Vo[Wo++]=oi,Vo[Wo++]=qa,ri=a.id,oi=a.overflow,qa=u),u=uy(u,w.children),u.flags|=4096,u)}function LC(a,u,m){a.lanes|=u;var w=a.alternate;w!==null&&(w.lanes|=u),Ug(a.return,u,m)}function fy(a,u,m,w,_){var R=a.memoizedState;R===null?a.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:w,tail:m,tailMode:_}:(R.isBackwards=u,R.rendering=null,R.renderingStartTime=0,R.last=w,R.tail=m,R.tailMode=_)}function IC(a,u,m){var w=u.pendingProps,_=w.revealOrder,R=w.tail;if(Kr(a,u,w.children,m),w=Ln.current,(w&2)!==0)w=w&1|2,u.flags|=128;else{if(a!==null&&(a.flags&128)!==0)e:for(a=u.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&LC(a,m,u);else if(a.tag===19)LC(a,m,u);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===u)break e;for(;a.sibling===null;){if(a.return===null||a.return===u)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}w&=1}if(vn(Ln,w),(u.mode&1)===0)u.memoizedState=null;else switch(_){case"forwards":for(m=u.child,_=null;m!==null;)a=m.alternate,a!==null&&Qd(a)===null&&(_=m),m=m.sibling;m=_,m===null?(_=u.child,u.child=null):(_=m.sibling,m.sibling=null),fy(u,!1,_,m,R);break;case"backwards":for(m=null,_=u.child,u.child=null;_!==null;){if(a=_.alternate,a!==null&&Qd(a)===null){u.child=_;break}a=_.sibling,_.sibling=m,m=_,_=a}fy(u,!0,m,null,R);break;case"together":fy(u,!1,null,null,void 0);break;default:u.memoizedState=null}return u.child}function oh(a,u){(u.mode&1)===0&&a!==null&&(a.alternate=null,u.alternate=null,u.flags|=2)}function ai(a,u,m){if(a!==null&&(u.dependencies=a.dependencies),Xa|=u.lanes,(m&u.childLanes)===0)return null;if(a!==null&&u.child!==a.child)throw Error(n(153));if(u.child!==null){for(a=u.child,m=oa(a,a.pendingProps),u.child=m,m.return=u;a.sibling!==null;)a=a.sibling,m=m.sibling=oa(a,a.pendingProps),m.return=u;m.sibling=null}return u.child}function PB(a,u,m){switch(u.tag){case 3:PC(u),oc();break;case 5:QE(u);break;case 1:fo(u.type)&&$d(u);break;case 4:Wg(u,u.stateNode.containerInfo);break;case 10:var w=u.type._context,_=u.memoizedProps.value;vn(qd,w._currentValue),w._currentValue=_;break;case 13:if(w=u.memoizedState,w!==null)return w.dehydrated!==null?(vn(Ln,Ln.current&1),u.flags|=128,null):(m&u.child.childLanes)!==0?RC(a,u,m):(vn(Ln,Ln.current&1),a=ai(a,u,m),a!==null?a.sibling:null);vn(Ln,Ln.current&1);break;case 19:if(w=(m&u.childLanes)!==0,(a.flags&128)!==0){if(w)return IC(a,u,m);u.flags|=128}if(_=u.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),vn(Ln,Ln.current),w)break;return null;case 22:case 23:return u.lanes=0,TC(a,u,m)}return ai(a,u,m)}var NC,dy,jC,OC;NC=function(a,u){for(var m=u.child;m!==null;){if(m.tag===5||m.tag===6)a.appendChild(m.stateNode);else if(m.tag!==4&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===u)break;for(;m.sibling===null;){if(m.return===null||m.return===u)return;m=m.return}m.sibling.return=m.return,m=m.sibling}},dy=function(){},jC=function(a,u,m,w){var _=a.memoizedProps;if(_!==w){a=u.stateNode,Ya(Ds.current);var R=null;switch(m){case"input":_=Fe(a,_),w=Fe(a,w),R=[];break;case"select":_=Y({},_,{value:void 0}),w=Y({},w,{value:void 0}),R=[];break;case"textarea":_=Oe(a,_),w=Oe(a,w),R=[];break;default:typeof _.onClick!="function"&&typeof w.onClick=="function"&&(a.onclick=Nd)}it(m,w);var G;m=null;for(Ue in _)if(!w.hasOwnProperty(Ue)&&_.hasOwnProperty(Ue)&&_[Ue]!=null)if(Ue==="style"){var pe=_[Ue];for(G in pe)pe.hasOwnProperty(G)&&(m||(m={}),m[G]="")}else Ue!=="dangerouslySetInnerHTML"&&Ue!=="children"&&Ue!=="suppressContentEditableWarning"&&Ue!=="suppressHydrationWarning"&&Ue!=="autoFocus"&&(o.hasOwnProperty(Ue)?R||(R=[]):(R=R||[]).push(Ue,null));for(Ue in w){var Ce=w[Ue];if(pe=_!=null?_[Ue]:void 0,w.hasOwnProperty(Ue)&&Ce!==pe&&(Ce!=null||pe!=null))if(Ue==="style")if(pe){for(G in pe)!pe.hasOwnProperty(G)||Ce&&Ce.hasOwnProperty(G)||(m||(m={}),m[G]="");for(G in Ce)Ce.hasOwnProperty(G)&&pe[G]!==Ce[G]&&(m||(m={}),m[G]=Ce[G])}else m||(R||(R=[]),R.push(Ue,m)),m=Ce;else Ue==="dangerouslySetInnerHTML"?(Ce=Ce?Ce.__html:void 0,pe=pe?pe.__html:void 0,Ce!=null&&pe!==Ce&&(R=R||[]).push(Ue,Ce)):Ue==="children"?typeof Ce!="string"&&typeof Ce!="number"||(R=R||[]).push(Ue,""+Ce):Ue!=="suppressContentEditableWarning"&&Ue!=="suppressHydrationWarning"&&(o.hasOwnProperty(Ue)?(Ce!=null&&Ue==="onScroll"&&En("scroll",a),R||pe===Ce||(R=[])):(R=R||[]).push(Ue,Ce))}m&&(R=R||[]).push("style",m);var Ue=R;(u.updateQueue=Ue)&&(u.flags|=4)}},OC=function(a,u,m,w){m!==w&&(u.flags|=4)};function $u(a,u){if(!_n)switch(a.tailMode){case"hidden":u=a.tail;for(var m=null;u!==null;)u.alternate!==null&&(m=u),u=u.sibling;m===null?a.tail=null:m.sibling=null;break;case"collapsed":m=a.tail;for(var w=null;m!==null;)m.alternate!==null&&(w=m),m=m.sibling;w===null?u||a.tail===null?a.tail=null:a.tail.sibling=null:w.sibling=null}}function Fr(a){var u=a.alternate!==null&&a.alternate.child===a.child,m=0,w=0;if(u)for(var _=a.child;_!==null;)m|=_.lanes|_.childLanes,w|=_.subtreeFlags&14680064,w|=_.flags&14680064,_.return=a,_=_.sibling;else for(_=a.child;_!==null;)m|=_.lanes|_.childLanes,w|=_.subtreeFlags,w|=_.flags,_.return=a,_=_.sibling;return a.subtreeFlags|=w,a.childLanes=m,u}function MB(a,u,m){var w=u.pendingProps;switch(Rg(u),u.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fr(u),null;case 1:return fo(u.type)&&Od(),Fr(u),null;case 3:return w=u.stateNode,lc(),Cn(uo),Cn(Dr),Gg(),w.pendingContext&&(w.context=w.pendingContext,w.pendingContext=null),(a===null||a.child===null)&&(Wd(u)?u.flags|=4:a===null||a.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,as!==null&&(xy(as),as=null))),dy(a,u),Fr(u),null;case 5:Hg(u);var _=Ya(Lu.current);if(m=u.type,a!==null&&u.stateNode!=null)jC(a,u,m,w,_),a.ref!==u.ref&&(u.flags|=512,u.flags|=2097152);else{if(!w){if(u.stateNode===null)throw Error(n(166));return Fr(u),null}if(a=Ya(Ds.current),Wd(u)){w=u.stateNode,m=u.type;var R=u.memoizedProps;switch(w[_s]=u,w[Fu]=R,a=(u.mode&1)!==0,m){case"dialog":En("cancel",w),En("close",w);break;case"iframe":case"object":case"embed":En("load",w);break;case"video":case"audio":for(_=0;_<_u.length;_++)En(_u[_],w);break;case"source":En("error",w);break;case"img":case"image":case"link":En("error",w),En("load",w);break;case"details":En("toggle",w);break;case"input":ie(w,R),En("invalid",w);break;case"select":w._wrapperState={wasMultiple:!!R.multiple},En("invalid",w);break;case"textarea":Ke(w,R),En("invalid",w)}it(m,R),_=null;for(var G in R)if(R.hasOwnProperty(G)){var pe=R[G];G==="children"?typeof pe=="string"?w.textContent!==pe&&(R.suppressHydrationWarning!==!0&&Id(w.textContent,pe,a),_=["children",pe]):typeof pe=="number"&&w.textContent!==""+pe&&(R.suppressHydrationWarning!==!0&&Id(w.textContent,pe,a),_=["children",""+pe]):o.hasOwnProperty(G)&&pe!=null&&G==="onScroll"&&En("scroll",w)}switch(m){case"input":ge(w),$e(w,R,!0);break;case"textarea":ge(w),Be(w);break;case"select":case"option":break;default:typeof R.onClick=="function"&&(w.onclick=Nd)}w=_,u.updateQueue=w,w!==null&&(u.flags|=4)}else{G=_.nodeType===9?_:_.ownerDocument,a==="http://www.w3.org/1999/xhtml"&&(a=S(m)),a==="http://www.w3.org/1999/xhtml"?m==="script"?(a=G.createElement("div"),a.innerHTML=" - + +
diff --git a/frontend/package.json b/frontend/package.json index 62c2c28b..56a312c4 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "pymc_console", - "version": "0.9.301", + "version": "0.9.302", "description": "Vite + React Dashboard for pyMC_Repeater", "private": true, "type": "module",